void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { // FIXME: This logic seems wrong for XML documents. // Either the id or name will be used depending on the order the attributes are parsed. if (isIdAttributeName(name) || name == nameAttr) { if (isIdAttributeName(name)) { // Call base class so that hasID bit gets set. HTMLElement::parseAttribute(name, value); if (document().isHTMLDocument()) return; } if (inDocument()) treeScope().removeImageMap(this); String mapName = value; if (mapName[0] == '#') mapName = mapName.substring(1); m_name = AtomicString(document().isHTMLDocument() ? mapName.lower() : mapName); if (inDocument()) treeScope().addImageMap(this); return; } HTMLElement::parseAttribute(name, value); }
void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (isIdAttributeName(name) || name == classAttr || name == styleAttr) return Element::parseAttribute(name, value); if (name == dirAttr) dirAttributeChanged(value); else if (name == tabindexAttr) { int tabindex = 0; if (value.isEmpty()) { clearTabIndexExplicitlyIfNeeded(); if (treeScope().adjustedFocusedElement() == this) { // We might want to call blur(), but it's dangerous to dispatch // events here. document().setNeedsFocusedElementCheck(); } } else if (parseHTMLInteger(value, tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } } else { const AtomicString& eventName = eventNameForAttributeName(name); if (!eventName.isNull()) setAttributeEventListener(eventName, createAttributeEventListener(this, name, value)); } }
void HTMLElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (isIdAttributeName(name) || name == classAttr || name == styleAttr) return StyledElement::parseAttribute(name, value); if (name == dirAttr) dirAttributeChanged(value); else if (name == tabindexAttr) { int tabindex = 0; if (value.isEmpty()) clearTabIndexExplicitlyIfNeeded(); else if (parseHTMLInteger(value, tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } #if ENABLE(MICRODATA) } else if (name == itempropAttr) { setItemProp(value); } else if (name == itemrefAttr) { setItemRef(value); } else if (name == itemtypeAttr) { setItemType(value); #endif } else { AtomicString eventName = eventNameForAttributeName(name); if (!eventName.isNull()) setAttributeEventListener(eventName, createAttributeEventListener(this, name, value)); } }
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); }
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 = deprecatedParseURL(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, 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 HTMLPlugInImageElement::parseMappedAttribute(attr); } else HTMLPlugInImageElement::parseMappedAttribute(attr); }