本文整理汇总了C++中HTMLDocument类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLDocument类的具体用法?C++ HTMLDocument怎么用?C++ HTMLDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertedIntoDocument
void HTMLImageElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
}
// If we have been inserted from a renderer-less document,
// our loader may have not fetched the image, so do it now.
if (!m_imageLoader.image())
m_imageLoader.updateFromElement();
HTMLElement::insertedIntoDocument();
}
示例2: jhtml_input_blur
/**
* blur - this method removes the focus from this element
*
* params - none
* return - void
*/
JSBool jhtml_input_blur(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
HTMLElement *pElem = (HTMLElement *) jhutil_GetPrivate(cx, obj);
if (!pElem)
{
return JS_TRUE;
}
HTMLDocument *pDoc = (pElem)? pElem->GetDocument() : 0;
if (pDoc && pDoc->Body())
{
pDoc->Body()->Focus();
}
*rval = JSVAL_VOID;
return JS_TRUE;
}
示例3: formWouldHaveSecureSubmission
void HTMLFormElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == actionAttr) {
bool oldURLWasSecure = formWouldHaveSecureSubmission(m_url);
m_url = parseURL(attr->value());
bool newURLIsSecure = formWouldHaveSecureSubmission(m_url);
if (m_attached && (oldURLWasSecure != newURLIsSecure))
if (newURLIsSecure)
document()->secureFormAdded();
else
document()->secureFormRemoved();
}
else if (attr->name() == targetAttr)
m_target = attr->value();
else if (attr->name() == methodAttr) {
if (equalIgnoringCase(attr->value(), "post"))
m_post = true;
else if (equalIgnoringCase(attr->value(), "get"))
m_post = false;
} else if (attr->name() == enctypeAttr)
parseEnctype(attr->value());
else if (attr->name() == accept_charsetAttr)
// space separated list of charsets the server
// accepts - see rfc2045
m_acceptcharset = attr->value();
else if (attr->name() == acceptAttr) {
// ignore this one for the moment...
} else if (attr->name() == autocompleteAttr)
m_autocomplete = !equalIgnoringCase(attr->value(), "off");
else if (attr->name() == onsubmitAttr)
setHTMLEventListener(submitEvent, attr);
else if (attr->name() == onresetAttr)
setHTMLEventListener(resetEvent, attr);
else if (attr->name() == nameAttr) {
String newNameAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->removeNamedItem(oldNameAttr);
doc->addNamedItem(newNameAttr);
}
oldNameAttr = newNameAttr;
} else
HTMLElement::parseMappedAttribute(attr);
}
示例4: addCSSLength
void HTMLIFrameElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == widthAttr)
addCSSLength(attr, CSS_PROP_WIDTH, attr->value());
else if (attr->name() == heightAttr)
addCSSLength(attr, CSS_PROP_HEIGHT, attr->value());
else if (attr->name() == alignAttr)
addHTMLAlignment(attr);
else if (attr->name() == nameAttr) {
String newNameAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->removeDocExtraNamedItem(oldNameAttr);
doc->addDocExtraNamedItem(newNameAttr);
}
oldNameAttr = newNameAttr;
} else
HTMLFrameElement::parseMappedAttribute(attr);
}
示例5: insertedIntoDocument
void HTMLIFrameElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->addDocExtraNamedItem(oldNameAttr);
}
HTMLElement::insertedIntoDocument();
// Load the frame
m_name = getAttribute(nameAttr);
if (m_name.isNull())
m_name = getAttribute(idAttr);
if (Frame* parentFrame = document()->frame()) {
m_name = parentFrame->tree()->uniqueChildName(m_name);
openURL();
}
}
示例6: toHTMLDocument
void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == nameAttr) {
if (inDocument() && document()->isHTMLDocument() && !isInShadowTree()) {
HTMLDocument* document = toHTMLDocument(this->document());
document->removeExtraNamedItem(m_name);
document->addExtraNamedItem(value);
}
m_name = value;
} else if (name == sandboxAttr) {
String invalidTokens;
setSandboxFlags(value.isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(value, invalidTokens));
if (!invalidTokens.isNull())
document()->addConsoleMessage(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidTokens);
} else if (name == seamlessAttr) {
// If we're adding or removing the seamless attribute, we need to force the content document to recalculate its StyleResolver.
if (contentDocument())
contentDocument()->styleResolverChanged(DeferRecalcStyle);
} else
HTMLFrameElementBase::parseAttribute(name, value);
}
示例7: insertedIntoDocument
void HTMLImageElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
}
// If we have been inserted from a renderer-less document,
// our loader may have not fetched the image, so do it now.
if (!m_imageLoader.image())
m_imageLoader.updateFromElement();
HTMLElement::insertedIntoDocument();
Request* req = cache()->loader()->requestForUrl(src().string());
if (!req)
return;
req->setNode(PassRefPtr<Node>(this));
}
示例8: if
void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == altAttr ||
attr->name() == archiveAttr ||
attr->name() == codeAttr ||
attr->name() == codebaseAttr ||
attr->name() == mayscriptAttr ||
attr->name() == objectAttr) {
// Do nothing.
} else if (attr->name() == nameAttr) {
String newNameAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->removeNamedItem(oldNameAttr);
doc->addNamedItem(newNameAttr);
}
oldNameAttr = newNameAttr;
} else if (attr->name() == idAttr) {
String newIdAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->removeDocExtraNamedItem(oldIdAttr);
doc->addDocExtraNamedItem(newIdAttr);
}
oldIdAttr = newIdAttr;
// also call superclass
HTMLPlugInElement::parseMappedAttribute(attr);
} else
HTMLPlugInElement::parseMappedAttribute(attr);
}
示例9: if
void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == altAttr ||
attr->name() == archiveAttr ||
attr->name() == codeAttr ||
attr->name() == codebaseAttr ||
attr->name() == mayscriptAttr ||
attr->name() == objectAttr) {
// Do nothing.
} else if (attr->name() == nameAttr) {
const AtomicString& newName = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->addNamedItem(newName);
}
m_name = newName;
} else if (attr->name() == idAttr) {
const AtomicString& newId = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeExtraNamedItem(m_id);
document->addExtraNamedItem(newId);
}
m_id = newId;
// also call superclass
HTMLPlugInElement::parseMappedAttribute(attr);
} else
HTMLPlugInElement::parseMappedAttribute(attr);
}
示例10: if
void HTMLEmbedElement::parseMappedAttribute(MappedAttribute* attr)
{
const AtomicString& value = attr->value();
if (attr->name() == typeAttr) {
m_serviceType = value.string().lower();
int pos = m_serviceType.find(";");
if (pos != -1)
m_serviceType = m_serviceType.left(pos);
if (!isImageType() && m_imageLoader)
m_imageLoader.clear();
} else if (attr->name() == codeAttr)
m_url = parseURL(value.string());
else if (attr->name() == srcAttr) {
m_url = parseURL(value.string());
if (renderer() && isImageType()) {
if (!m_imageLoader)
m_imageLoader.set(new HTMLImageLoader(this));
m_imageLoader->updateFromElement();
}
} else if (attr->name() == pluginpageAttr || attr->name() == pluginspageAttr)
m_pluginPage = value;
else if (attr->name() == hiddenAttr) {
if (equalIgnoringCase(value.string(), "yes") || equalIgnoringCase(value.string(), "true")) {
// FIXME: Not dynamic, since we add this but don't remove it, but it may be OK for now
// that this rarely-used attribute won't work properly if you remove it.
addCSSLength(attr, CSSPropertyWidth, "0");
addCSSLength(attr, CSSPropertyHeight, "0");
}
} else if (attr->name() == nameAttr) {
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->addNamedItem(value);
}
m_name = value;
} else
HTMLPlugInElement::parseMappedAttribute(attr);
}
示例11: exceptionState
void V8HTMLDocument::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
HTMLDocument* htmlDocument = V8HTMLDocument::toNative(info.Holder());
if (info.Length() > 2) {
if (RefPtr<LocalFrame> frame = htmlDocument->frame()) {
// Fetch the global object for the frame.
v8::Local<v8::Context> context = toV8Context(info.GetIsolate(), frame.get(), DOMWrapperWorld::current(info.GetIsolate()));
// Bail out if we cannot get the context.
if (context.IsEmpty())
return;
v8::Local<v8::Object> global = context->Global();
// Get the open property of the global object.
v8::Local<v8::Value> function = global->Get(v8AtomicString(info.GetIsolate(), "open"));
// Failed; return without throwing (new) exception.
if (function.IsEmpty())
return;
// If the open property is not a function throw a type error.
if (!function->IsFunction()) {
throwTypeError("open is not a function", info.GetIsolate());
return;
}
// Wrap up the arguments and call the function.
OwnPtr<v8::Local<v8::Value>[]> params = adoptArrayPtr(new v8::Local<v8::Value>[info.Length()]);
for (int i = 0; i < info.Length(); i++)
params[i] = info[i];
v8SetReturnValue(info, frame->script().callFunction(v8::Local<v8::Function>::Cast(function), global, info.Length(), params.get()));
return;
}
}
ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Document", info.Holder(), info.GetIsolate());
htmlDocument->open(callingDOMWindow(info.GetIsolate())->document(), exceptionState);
if (exceptionState.throwIfNeeded())
return;
v8SetReturnValue(info, info.Holder());
}
示例12: insertedIntoDocument
void HTMLEmbedElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->addNamedItem(oldNameAttr);
}
String width = getAttribute(widthAttr);
String height = getAttribute(heightAttr);
if (!width.isEmpty() || !height.isEmpty()) {
Node* n = parent();
while (n && !n->hasTagName(objectTag))
n = n->parent();
if (n) {
if (!width.isEmpty())
static_cast<HTMLObjectElement*>(n)->setAttribute(widthAttr, width);
if (!height.isEmpty())
static_cast<HTMLObjectElement*>(n)->setAttribute(heightAttr, height);
}
}
HTMLPlugInElement::insertedIntoDocument();
}
示例13: jhtml_anchor_blur
/**
* blur - This method removes the focus from this element
*
* params - none;
* return - void;
*/
JSBool jhtml_anchor_blur(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
LOG_HTMLDOM("jhtml_anchor_blur\n");
if (JS_GetClass(obj) == &JSHtmlAnchorElement)
{
HTMLElement *pElem = (HTMLElement *) jhutil_GetPrivate(cx, obj);
if (!pElem)
{
return JS_TRUE;
}
HTMLDocument *pDoc = (pElem)? pElem->GetDocument() : 0;
if (pDoc && pDoc->Body())
{
pDoc->Body()->Focus();
}
}
*rval = JSVAL_VOID;
return JS_TRUE;
}
示例14: toHTMLDocument
JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(asObject(slotBase));
HTMLDocument* document = toHTMLDocument(thisObj->impl());
AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
if (!atomicPropertyName || !document->documentNamedItemMap().contains(atomicPropertyName))
return jsUndefined();
if (UNLIKELY(!document->documentNamedItemMap().containsSingle(atomicPropertyName))) {
RefPtr<HTMLCollection> collection = document->documentNamedItems(atomicPropertyName);
ASSERT(!collection->isEmpty());
ASSERT(!collection->hasExactlyOneItem());
return toJS(exec, thisObj->globalObject(), WTF::getPtr(collection));
}
Node* node = document->documentNamedItemMap().getElementByDocumentNamedItem(atomicPropertyName, document);
Frame* frame;
if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
return toJS(exec, frame);
return toJS(exec, thisObj->globalObject(), node);
}
示例15: toRenderImage
void HTMLImageElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == altAttr) {
if (renderer() && renderer()->isImage())
toRenderImage(renderer())->updateAltText();
} else if (attrName == srcAttr)
m_imageLoader.updateFromElementIgnoringPreviousError();
else if (attrName == widthAttr)
addCSSLength(attr, CSSPropertyWidth, attr->value());
else if (attrName == heightAttr)
addCSSLength(attr, CSSPropertyHeight, attr->value());
else if (attrName == borderAttr) {
// border="noborder" -> border="0"
applyBorderAttribute(attr);
} else if (attrName == vspaceAttr) {
addCSSLength(attr, CSSPropertyMarginTop, attr->value());
addCSSLength(attr, CSSPropertyMarginBottom, attr->value());
} else if (attrName == hspaceAttr) {
addCSSLength(attr, CSSPropertyMarginLeft, attr->value());
addCSSLength(attr, CSSPropertyMarginRight, attr->value());
} else if (attrName == alignAttr)
addHTMLAlignment(attr);
else if (attrName == valignAttr)
addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value());
else if (attrName == usemapAttr)
setIsLink(!attr->isNull());
else if (attrName == onabortAttr)
setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
else if (attrName == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
else if (attrName == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
else if (attrName == compositeAttr) {
if (!parseCompositeOperator(attr->value(), m_compositeOperator))
m_compositeOperator = CompositeSourceOver;
} else if (attrName == nameAttr) {
const AtomicString& newName = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->addNamedItem(newName);
}
m_name = newName;
} else if (isIdAttributeName(attr->name())) {
const AtomicString& newId = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeExtraNamedItem(m_id);
document->addExtraNamedItem(newId);
}
m_id = newId;
// also call superclass
HTMLElement::parseMappedAttribute(attr);
} else
HTMLElement::parseMappedAttribute(attr);
}