本文整理汇总了C++中HTMLDocument::addNamedItem方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLDocument::addNamedItem方法的具体用法?C++ HTMLDocument::addNamedItem怎么用?C++ HTMLDocument::addNamedItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLDocument
的用法示例。
在下文中一共展示了HTMLDocument::addNamedItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseMappedAttribute
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);
}
示例2: updateDocNamedItem
void HTMLObjectElement::updateDocNamedItem()
{
// The rule is "<object> elements with no children other than
// <param> elements, unknown elements and whitespace can be
// found by name in a document, and other <object> elements cannot."
bool wasNamedItem = m_docNamedItem;
bool isNamedItem = true;
Node* child = firstChild();
while (child && isNamedItem) {
if (child->isElementNode()) {
Element* element = static_cast<Element*>(child);
if (HTMLElement::isRecognizedTagName(element->tagQName()) && !element->hasTagName(paramTag))
isNamedItem = false;
} else if (child->isTextNode()) {
if (!static_cast<Text*>(child)->containsOnlyWhitespace())
isNamedItem = false;
} else
isNamedItem = false;
child = child->nextSibling();
}
if (isNamedItem != wasNamedItem && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
if (isNamedItem) {
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
} else {
document->removeNamedItem(m_name);
document->removeExtraNamedItem(m_id);
}
}
m_docNamedItem = isNamedItem;
}
示例3: parseMappedAttribute
void HTMLEmbedElement::parseMappedAttribute(MappedAttribute* attr)
{
String val = attr->value();
if (attr->name() == typeAttr) {
m_serviceType = val.lower();
int pos = m_serviceType.find(";");
if (pos != -1)
m_serviceType = m_serviceType.left(pos);
} else if (attr->name() == codeAttr || attr->name() == srcAttr)
url = parseURL(val).deprecatedString();
else if (attr->name() == pluginpageAttr || attr->name() == pluginspageAttr)
m_pluginPage = val;
else if (attr->name() == hiddenAttr) {
if (val.lower() == "yes" || val.lower() == "true") {
// FIXME: Not dynamic, but it's not really important that such a rarely-used
// feature work dynamically.
addCSSLength(attr, CSS_PROP_WIDTH, "0");
addCSSLength(attr, CSS_PROP_HEIGHT, "0");
}
} else if (attr->name() == nameAttr) {
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeNamedItem(oldNameAttr);
doc->addNamedItem(val);
}
oldNameAttr = val;
} else
HTMLPlugInElement::parseMappedAttribute(attr);
}
示例4: parseMappedAttribute
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);
}
示例5: parseMappedAttribute
void HTMLFormElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == actionAttr)
m_attributes.parseAction(attr->value());
else if (attr->name() == targetAttr)
m_attributes.setTarget(attr->value());
else if (attr->name() == methodAttr)
m_attributes.parseMethodType(attr->value());
else if (attr->name() == enctypeAttr)
m_attributes.parseEncodingType(attr->value());
else if (attr->name() == accept_charsetAttr)
m_attributes.setAcceptCharset(attr->value());
else if (attr->name() == autocompleteAttr) {
if (!autoComplete())
document()->registerForDocumentActivationCallbacks(this);
else
document()->unregisterForDocumentActivationCallbacks(this);
} else if (attr->name() == onsubmitAttr)
setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attr));
else if (attr->name() == onresetAttr)
setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attr));
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
HTMLElement::parseMappedAttribute(attr);
}
示例6: parseMappedAttribute
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);
} else if (attr->name() == codeAttr || attr->name() == srcAttr)
m_url = parseURL(value.string());
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);
}
示例7: updateDocNamedItem
void HTMLObjectElement::updateDocNamedItem()
{
// The rule is "<object> elements with no children other than
// <param> elements and whitespace can be found by name in a
// document, and other <object> elements cannot."
bool wasNamedItem = m_docNamedItem;
bool isNamedItem = true;
Node* child = firstChild();
while (child && isNamedItem) {
if (child->isElementNode()) {
if (!static_cast<Element*>(child)->hasTagName(paramTag))
isNamedItem = false;
} else if (child->isTextNode()) {
if (!static_cast<Text*>(child)->containsOnlyWhitespace())
isNamedItem = false;
} else
isNamedItem = false;
child = child->nextSibling();
}
if (isNamedItem != wasNamedItem && document()->isHTMLDocument()) {
HTMLDocument* doc = static_cast<HTMLDocument*>(document());
if (isNamedItem) {
doc->addNamedItem(oldNameAttr);
doc->addDocExtraNamedItem(oldIdAttr);
} else {
doc->removeNamedItem(oldNameAttr);
doc->removeDocExtraNamedItem(oldIdAttr);
}
}
m_docNamedItem = isNamedItem;
}
示例8: insertedIntoDocument
void HTMLFormElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->addNamedItem(oldNameAttr);
}
HTMLElement::insertedIntoDocument();
}
示例9: parseMappedAttribute
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);
}
示例10: parseMappedAttribute
void HTMLObjectElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == typeAttr) {
m_serviceType = attr->value().lower();
size_t pos = m_serviceType.find(";");
if (pos != notFound)
m_serviceType = m_serviceType.left(pos);
if (renderer())
setNeedsWidgetUpdate(true);
if (!isImageType() && m_imageLoader)
m_imageLoader.clear();
} else if (attr->name() == dataAttr) {
m_url = stripLeadingAndTrailingHTMLSpaces(attr->value());
if (renderer()) {
setNeedsWidgetUpdate(true);
if (isImageType()) {
if (!m_imageLoader)
m_imageLoader = adoptPtr(new HTMLImageLoader(this));
m_imageLoader->updateFromElementIgnoringPreviousError();
}
}
} else if (attr->name() == classidAttr) {
m_classId = attr->value();
if (renderer())
setNeedsWidgetUpdate(true);
} else if (attr->name() == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, NULL_METHOD_RESULT(this, attr));
else if (attr->name() == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, NULL_METHOD_RESULT(this, attr));
else if (attr->name() == nameAttr) {
const AtomicString& newName = attr->value();
if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->addNamedItem(newName);
}
m_name = newName;
} else if (attr->name() == borderAttr) {
addCSSLength(attr, CSSPropertyBorderWidth, attr->value().toInt() ? attr->value() : "0");
addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid);
} else if (isIdAttributeName(attr->name())) {
const AtomicString& newId = attr->value();
if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeExtraNamedItem(m_id);
document->addExtraNamedItem(newId);
}
m_id = newId;
// also call superclass
HTMLPlugInImageElement::parseMappedAttribute(attr);
} else
HTMLPlugInImageElement::parseMappedAttribute(attr);
}
示例11: insertedIntoDocument
void HTMLImageElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
}
HTMLElement::insertedIntoDocument();
}
示例12: insertedIntoDocument
void HTMLAppletElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument *doc = static_cast<HTMLDocument *>(document());
doc->addNamedItem(oldNameAttr);
doc->addDocExtraNamedItem(oldIdAttr);
}
HTMLPlugInElement::insertedIntoDocument();
}
示例13: insertedIntoDocument
void HTMLObjectElement::insertedIntoDocument()
{
if (isDocNamedItem() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
}
HTMLPlugInElement::insertedIntoDocument();
}
示例14: parseMappedAttribute
void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
{
String val = attr->value();
int pos;
if (attr->name() == typeAttr) {
m_serviceType = val.lower();
pos = m_serviceType.find(";");
if (pos != -1)
m_serviceType = m_serviceType.left(pos);
if (renderer())
m_needWidgetUpdate = true;
if (!isImageType() && m_imageLoader) {
delete m_imageLoader;
m_imageLoader = 0;
}
} else if (attr->name() == dataAttr) {
m_url = parseURL(val);
if (renderer())
m_needWidgetUpdate = true;
if (renderer() && isImageType()) {
if (!m_imageLoader)
m_imageLoader = new HTMLImageLoader(this);
m_imageLoader->updateFromElement();
}
} else if (attr->name() == classidAttr) {
m_classId = val;
if (renderer())
m_needWidgetUpdate = true;
} else if (attr->name() == onloadAttr) {
setHTMLEventListener(loadEvent, attr);
} else if (attr->name() == onunloadAttr) {
setHTMLEventListener(unloadEvent, attr);
} else if (attr->name() == nameAttr) {
String newNameAttr = attr->value();
if (isDocNamedItem() && 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 (isDocNamedItem() && 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);
}
示例15: parseMappedAttribute
void HTMLObjectElement::parseMappedAttribute(Attribute* attr)
{
String val = attr->value();
int pos;
if (attr->name() == typeAttr) {
m_serviceType = val.lower();
pos = m_serviceType.find(";");
if (pos != -1)
m_serviceType = m_serviceType.left(pos);
if (renderer())
m_needWidgetUpdate = true;
if (!isImageType() && m_imageLoader)
m_imageLoader.clear();
} else if (attr->name() == dataAttr) {
m_url = deprecatedParseURL(val);
if (renderer())
m_needWidgetUpdate = true;
if (renderer() && isImageType()) {
if (!m_imageLoader)
m_imageLoader.set(new HTMLImageLoader(this));
m_imageLoader->updateFromElementIgnoringPreviousError();
}
} else if (attr->name() == classidAttr) {
m_classId = val;
if (renderer())
m_needWidgetUpdate = true;
} else if (attr->name() == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
else if (attr->name() == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
else if (attr->name() == nameAttr) {
const AtomicString& newName = attr->value();
if (isDocNamedItem() && 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 (isDocNamedItem() && 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);
}