Use fastHasAttribute() / fastGetAttribute() when possible
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Sep 2014 16:52:10 +0000 (16:52 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Sep 2014 16:52:10 +0000 (16:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136900

Reviewed by Benjamin Poulain.

Use fastHasAttribute() / fastGetAttribute() when possible, that is when
the attribute is not SVG-animated or the |style| attribute, to avoid
synchronizing attributes unnecessarily.

Also avoid calling hasAttribute(xxxAttr) then getAttribute(xxxAttr) as
it causes 2 linear searches. It is best to call getAttribute(xxxAttr)
directly and check if it returns the nullAtom.

No new tests, no behavior change. Element::fastAttributeLookupAllowed()
is there as a safety set for debug builds.

* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::isEnabled):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::alternativeTextForWebArea):
(WebCore::AccessibilityNodeObject::hierarchicalLevel):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::contentEditableAttributeIsEnabled):
* dom/Document.cpp:
(WebCore::Document::hasManifest):
* dom/DocumentOrderedMap.cpp:
(WebCore::keyMatchesLabelForAttribute):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
* dom/Element.cpp:
(WebCore::Element::imageSourceURL):
(WebCore::Element::pseudo):
(WebCore::Element::spellcheckAttributeState):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
* editing/EditingStyle.cpp:
(WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
(WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
* editing/SplitElementCommand.cpp:
(WebCore::SplitElementCommand::doUnapply):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::draggable):
(WebCore::HTMLAnchorElement::sendPings):
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::updateWidget):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::addSubresourceAttributeURLs):
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::value):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::dir):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::imageSourceURL):
(WebCore::HTMLEmbedElement::addSubresourceAttributeURLs):
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::~HTMLFieldSetElement):
(WebCore::updateFromControlElementsAncestorDisabledStateUnder):
(WebCore::HTMLFieldSetElement::disabledAttributeChanged):
(WebCore::HTMLFieldSetElement::disabledStateChanged):
(WebCore::HTMLFieldSetElement::childrenChanged):
(WebCore::HTMLFieldSetElement::didMoveToNewDocument):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::action):
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::noResize):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::location):
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
* html/HTMLHtmlElement.cpp:
(WebCore::HTMLHtmlElement::insertedByParser):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::altText):
(WebCore::HTMLImageElement::alt):
(WebCore::HTMLImageElement::draggable):
(WebCore::HTMLImageElement::src):
(WebCore::HTMLImageElement::addSubresourceAttributeURLs):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::finishParsingChildren):
(WebCore::HTMLInputElement::altText):
(WebCore::HTMLInputElement::reset):
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::control):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::rel):
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::content):
(WebCore::HTMLMetaElement::httpEquiv):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::imageSourceURL):
(WebCore::HTMLObjectElement::addSubresourceAttributeURLs):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::groupLabelText):
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::max):
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::sourceAttributeValue):
(WebCore::HTMLScriptElement::charsetAttributeValue):
(WebCore::HTMLScriptElement::languageAttributeValue):
(WebCore::HTMLScriptElement::forAttributeValue):
(WebCore::HTMLScriptElement::eventAttributeValue):
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::addSubresourceAttributeURLs):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::rules):
(WebCore::HTMLTableElement::summary):
(WebCore::HTMLTableElement::addSubresourceAttributeURLs):
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::align):
(WebCore::HTMLTableSectionElement::ch):
(WebCore::HTMLTableSectionElement::vAlign):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::maxLength):
* html/SearchInputType.cpp:
(WebCore::SearchInputType::searchEventsShouldBeDispatched):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* page/Frame.cpp:
(WebCore::Frame::matchLabelsAgainstElement):
* page/PageSerializer.cpp:
(WebCore::PageSerializer::serializeFrame):
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeImageToDataObject):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::altDisplayString):
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::autosaveName):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::computePreferredLogicalWidths):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173724 268f45cc-cd09-0410-ab3c-d52691b4dbfc

52 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityListBoxOption.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/DocumentOrderedMap.cpp
Source/WebCore/dom/DocumentStyleSheetCollection.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/SplitElementCommand.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLButtonElement.cpp
Source/WebCore/html/HTMLButtonElement.h
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFrameElement.cpp
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLHRElement.cpp
Source/WebCore/html/HTMLHtmlElement.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLLabelElement.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h
Source/WebCore/html/HTMLMetaElement.cpp
Source/WebCore/html/HTMLMetaElement.h
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLProgressElement.cpp
Source/WebCore/html/HTMLScriptElement.cpp
Source/WebCore/html/HTMLTableCellElement.cpp
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTableSectionElement.cpp
Source/WebCore/html/HTMLTableSectionElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/SearchInputType.cpp
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/platform/win/PasteboardWin.cpp
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/RenderSearchField.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp

index 0de442a..76c5d6e 100644 (file)
@@ -1,5 +1,142 @@
 2014-09-18  Chris Dumez  <cdumez@apple.com>
 
+        Use fastHasAttribute() / fastGetAttribute() when possible
+        https://bugs.webkit.org/show_bug.cgi?id=136900
+
+        Reviewed by Benjamin Poulain.
+
+        Use fastHasAttribute() / fastGetAttribute() when possible, that is when
+        the attribute is not SVG-animated or the |style| attribute, to avoid
+        synchronizing attributes unnecessarily.
+
+        Also avoid calling hasAttribute(xxxAttr) then getAttribute(xxxAttr) as
+        it causes 2 linear searches. It is best to call getAttribute(xxxAttr)
+        directly and check if it returns the nullAtom.
+
+        No new tests, no behavior change. Element::fastAttributeLookupAllowed()
+        is there as a safety set for debug builds.
+
+        * accessibility/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::isEnabled):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::alternativeTextForWebArea):
+        (WebCore::AccessibilityNodeObject::hierarchicalLevel):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::contentEditableAttributeIsEnabled):
+        * dom/Document.cpp:
+        (WebCore::Document::hasManifest):
+        * dom/DocumentOrderedMap.cpp:
+        (WebCore::keyMatchesLabelForAttribute):
+        * dom/DocumentStyleSheetCollection.cpp:
+        (WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
+        * dom/Element.cpp:
+        (WebCore::Element::imageSourceURL):
+        (WebCore::Element::pseudo):
+        (WebCore::Element::spellcheckAttributeState):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
+        * editing/EditingStyle.cpp:
+        (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue):
+        (WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue):
+        * editing/SplitElementCommand.cpp:
+        (WebCore::SplitElementCommand::doUnapply):
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::draggable):
+        (WebCore::HTMLAnchorElement::sendPings):
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::updateWidget):
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::addSubresourceAttributeURLs):
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::value):
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::dir):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::imageSourceURL):
+        (WebCore::HTMLEmbedElement::addSubresourceAttributeURLs):
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::HTMLFieldSetElement::~HTMLFieldSetElement):
+        (WebCore::updateFromControlElementsAncestorDisabledStateUnder):
+        (WebCore::HTMLFieldSetElement::disabledAttributeChanged):
+        (WebCore::HTMLFieldSetElement::disabledStateChanged):
+        (WebCore::HTMLFieldSetElement::childrenChanged):
+        (WebCore::HTMLFieldSetElement::didMoveToNewDocument):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::action):
+        * html/HTMLFrameElement.cpp:
+        (WebCore::HTMLFrameElement::noResize):
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::location):
+        * html/HTMLHRElement.cpp:
+        (WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
+        * html/HTMLHtmlElement.cpp:
+        (WebCore::HTMLHtmlElement::insertedByParser):
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::altText):
+        (WebCore::HTMLImageElement::alt):
+        (WebCore::HTMLImageElement::draggable):
+        (WebCore::HTMLImageElement::src):
+        (WebCore::HTMLImageElement::addSubresourceAttributeURLs):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::finishParsingChildren):
+        (WebCore::HTMLInputElement::altText):
+        (WebCore::HTMLInputElement::reset):
+        * html/HTMLLabelElement.cpp:
+        (WebCore::HTMLLabelElement::control):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::process):
+        (WebCore::HTMLLinkElement::rel):
+        * html/HTMLMetaElement.cpp:
+        (WebCore::HTMLMetaElement::content):
+        (WebCore::HTMLMetaElement::httpEquiv):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::imageSourceURL):
+        (WebCore::HTMLObjectElement::addSubresourceAttributeURLs):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::groupLabelText):
+        * html/HTMLProgressElement.cpp:
+        (WebCore::HTMLProgressElement::max):
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::sourceAttributeValue):
+        (WebCore::HTMLScriptElement::charsetAttributeValue):
+        (WebCore::HTMLScriptElement::languageAttributeValue):
+        (WebCore::HTMLScriptElement::forAttributeValue):
+        (WebCore::HTMLScriptElement::eventAttributeValue):
+        * html/HTMLTableCellElement.cpp:
+        (WebCore::HTMLTableCellElement::addSubresourceAttributeURLs):
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::rules):
+        (WebCore::HTMLTableElement::summary):
+        (WebCore::HTMLTableElement::addSubresourceAttributeURLs):
+        * html/HTMLTableSectionElement.cpp:
+        (WebCore::HTMLTableSectionElement::align):
+        (WebCore::HTMLTableSectionElement::ch):
+        (WebCore::HTMLTableSectionElement::vAlign):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::maxLength):
+        * html/SearchInputType.cpp:
+        (WebCore::SearchInputType::searchEventsShouldBeDispatched):
+        * loader/FormSubmission.cpp:
+        (WebCore::FormSubmission::create):
+        * page/Frame.cpp:
+        (WebCore::Frame::matchLabelsAgainstElement):
+        * page/PageSerializer.cpp:
+        (WebCore::PageSerializer::serializeFrame):
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::Pasteboard::writeImageToDataObject):
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::altDisplayString):
+        * rendering/RenderSearchField.cpp:
+        (WebCore::RenderSearchField::autosaveName):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::computePreferredLogicalWidths):
+        * rendering/svg/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
+
+2014-09-18  Chris Dumez  <cdumez@apple.com>
+
         Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
         https://bugs.webkit.org/show_bug.cgi?id=136902
 
index b7591d4..a9fad8d 100644 (file)
@@ -70,7 +70,7 @@ bool AccessibilityListBoxOption::isEnabled() const
     if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
         return false;
 
-    if (m_optionElement->hasAttribute(disabledAttr))
+    if (m_optionElement->fastHasAttribute(disabledAttr))
         return false;
     
     return true;
index fc4158d..0a8c447 100644 (file)
@@ -1456,7 +1456,7 @@ String AccessibilityNodeObject::alternativeTextForWebArea() const
     
     // Check if the HTML element has an aria-label for the webpage.
     if (Element* documentElement = document->documentElement()) {
-        const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr);
+        const AtomicString& ariaLabel = documentElement->fastGetAttribute(aria_labelAttr);
         if (!ariaLabel.isEmpty())
             return ariaLabel;
     }
@@ -1563,7 +1563,7 @@ unsigned AccessibilityNodeObject::hierarchicalLevel() const
     if (!node || !node->isElementNode())
         return 0;
     Element* element = toElement(node);
-    String ariaLevel = element->getAttribute(aria_levelAttr);
+    const AtomicString& ariaLevel = element->fastGetAttribute(aria_levelAttr);
     if (!ariaLevel.isEmpty())
         return ariaLevel.toInt();
     
index 4999040..349486b 100644 (file)
@@ -1378,10 +1378,10 @@ bool AccessibilityObject::contentEditableAttributeIsEnabled(Element* element)
     if (!element)
         return false;
     
-    if (!element->hasAttribute(contenteditableAttr))
+    const AtomicString& contentEditableValue = element->fastGetAttribute(contenteditableAttr);
+    if (contentEditableValue.isNull())
         return false;
     
-    const AtomicString& contentEditableValue = element->fastGetAttribute(contenteditableAttr);
     // Both "true" (case-insensitive) and the empty string count as true.
     return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableValue, "true");
 }
index ce257ab..f7b1959 100644 (file)
@@ -814,7 +814,7 @@ DOMImplementation* Document::implementation()
 
 bool Document::hasManifest() const
 {
-    return documentElement() && documentElement()->hasTagName(htmlTag) && documentElement()->hasAttribute(manifestAttr);
+    return documentElement() && documentElement()->hasTagName(htmlTag) && documentElement()->fastHasAttribute(manifestAttr);
 }
 
 DocumentType* Document::doctype() const
index 8448f94..08b6c1e 100644 (file)
@@ -69,7 +69,7 @@ inline bool keyMatchesLowercasedUsemap(const AtomicStringImpl& key, const Elemen
 
 inline bool keyMatchesLabelForAttribute(const AtomicStringImpl& key, const Element& element)
 {
-    return isHTMLLabelElement(element) && element.getAttribute(forAttr).impl() == &key;
+    return isHTMLLabelElement(element) && element.fastGetAttribute(forAttr).impl() == &key;
 }
 
 inline bool keyMatchesWindowNamedItem(const AtomicStringImpl& key, const Element& element)
index ed20ed5..db233eb 100644 (file)
@@ -282,7 +282,7 @@ void DocumentStyleSheetCollection::collectActiveStyleSheets(Vector<RefPtr<StyleS
 #endif
         } else if ((node->isHTMLElement() && (toHTMLElement(*node).hasTagName(linkTag) || toHTMLElement(*node).hasTagName(styleTag))) || (node->isSVGElement() && toSVGElement(*node).hasTagName(SVGNames::styleTag))) {
             Element& element = toElement(*node);
-            AtomicString title = element.getAttribute(titleAttr);
+            AtomicString title = element.fastGetAttribute(titleAttr);
             bool enabledViaScript = false;
             if (isHTMLLinkElement(element)) {
                 // <LINK> element
index 83acc93..543db74 100644 (file)
@@ -1305,7 +1305,7 @@ URL Element::baseURI() const
 
 const AtomicString& Element::imageSourceURL() const
 {
-    return getAttribute(srcAttr);
+    return fastGetAttribute(srcAttr);
 }
 
 bool Element::rendererIsNeeded(const RenderStyle& style)
@@ -2045,7 +2045,7 @@ String Element::title() const
 
 const AtomicString& Element::pseudo() const
 {
-    return getAttribute(pseudoAttr);
+    return fastGetAttribute(pseudoAttr);
 }
 
 void Element::setPseudo(const AtomicString& value)
@@ -2455,7 +2455,7 @@ void Element::requestPointerLock()
 
 SpellcheckAttributeState Element::spellcheckAttributeState() const
 {
-    const AtomicString& value = getAttribute(HTMLNames::spellcheckAttr);
+    const AtomicString& value = fastGetAttribute(HTMLNames::spellcheckAttr);
     if (value == nullAtom)
         return SpellcheckAttributeDefault;
     if (equalIgnoringCase(value, "true") || equalIgnoringCase(value, ""))
index a22027e..55377c6 100644 (file)
@@ -517,7 +517,7 @@ void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp
         // and all matching style rules in order to determine how to best set the unicode-bidi property to 'normal'.
         // For now, it assumes that if the 'dir' attribute is present, then removing it will suffice, and
         // otherwise it sets the property in the inline style declaration.
-        if (element->hasAttribute(dirAttr)) {
+        if (element->fastHasAttribute(dirAttr)) {
             // FIXME: If this is a BDO element, we should probably just remove it if it has no
             // other attributes, like we (should) do with B and I elements.
             removeNodeAttribute(element, dirAttr);
index 438a1c0..0458ca3 100644 (file)
@@ -277,12 +277,13 @@ void HTMLAttributeEquivalent::addToStyle(Element* element, EditingStyle* style)
 PassRefPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSValue(Element* element) const
 {
     ASSERT(element);
-    if (!element->hasAttribute(m_attrName))
+    const AtomicString& value = element->getAttribute(m_attrName);
+    if (value.isNull())
         return 0;
     
     RefPtr<MutableStyleProperties> dummyStyle;
     dummyStyle = MutableStyleProperties::create();
-    dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName));
+    dummyStyle->setProperty(m_propertyID, value);
     return dummyStyle->getPropertyCSSValue(m_propertyID);
 }
 
@@ -301,10 +302,11 @@ HTMLFontSizeEquivalent::HTMLFontSizeEquivalent()
 PassRefPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValue(Element* element) const
 {
     ASSERT(element);
-    if (!element->hasAttribute(m_attrName))
+    const AtomicString& value = element->getAttribute(m_attrName);
+    if (value.isNull())
         return 0;
     CSSValueID size;
-    if (!HTMLFontElement::cssValueFromFontSizeNumber(element->getAttribute(m_attrName), size))
+    if (!HTMLFontElement::cssValueFromFontSizeNumber(value, size))
         return 0;
     return CSSPrimitiveValue::createIdentifier(size);
 }
index d3426e7..a03ef88 100644 (file)
@@ -91,8 +91,9 @@ void SplitElementCommand::doUnapply()
         m_element2->insertBefore(children[i].get(), refChild.get(), IGNORE_EXCEPTION);
 
     // Recover the id attribute of the original element.
-    if (m_element1->hasAttribute(HTMLNames::idAttr))
-        m_element2->setAttribute(HTMLNames::idAttr, m_element1->getAttribute(HTMLNames::idAttr));
+    const AtomicString& id = m_element1->fastGetAttribute(HTMLNames::idAttr);
+    if (!id.isNull())
+        m_element2->setAttribute(HTMLNames::idAttr, id);
 
     m_element1->remove(IGNORE_EXCEPTION);
 }
index 338e537..f160a2b 100644 (file)
@@ -286,7 +286,7 @@ bool HTMLAnchorElement::canStartSelection() const
 bool HTMLAnchorElement::draggable() const
 {
     // Should be draggable if we have an href attribute.
-    const AtomicString& value = getAttribute(draggableAttr);
+    const AtomicString& value = fastGetAttribute(draggableAttr);
     if (equalIgnoringCase(value, "true"))
         return true;
     if (equalIgnoringCase(value, "false"))
@@ -512,10 +512,10 @@ bool HTMLAnchorElement::isLiveLink() const
 
 void HTMLAnchorElement::sendPings(const URL& destinationURL)
 {
-    if (!hasAttribute(pingAttr) || !document().settings() || !document().settings()->hyperlinkAuditingEnabled())
+    if (!fastHasAttribute(pingAttr) || !document().settings() || !document().settings()->hyperlinkAuditingEnabled())
         return;
 
-    SpaceSplitString pingURLs(getAttribute(pingAttr), false);
+    SpaceSplitString pingURLs(fastGetAttribute(pingAttr), false);
     for (unsigned i = 0; i < pingURLs.size(); i++)
         PingLoader::sendPing(*document().frame(), document().completeURL(pingURLs[i]), destinationURL);
 }
index c654b53..ee48c40 100644 (file)
@@ -125,11 +125,11 @@ void HTMLAppletElement::updateWidget(PluginCreationOption pluginCreationOption)
     Vector<String> paramValues;
 
     paramNames.append("code");
-    paramValues.append(getAttribute(codeAttr).string());
+    paramValues.append(fastGetAttribute(codeAttr).string());
 
-    const AtomicString& codeBase = getAttribute(codebaseAttr);
+    const AtomicString& codeBase = fastGetAttribute(codebaseAttr);
     if (!codeBase.isNull()) {
-        paramNames.append("codeBase");
+        paramNames.append(ASCIILiteral("codeBase"));
         paramValues.append(codeBase.string());
     }
 
@@ -139,18 +139,18 @@ void HTMLAppletElement::updateWidget(PluginCreationOption pluginCreationOption)
         paramValues.append(name.string());
     }
 
-    const AtomicString& archive = getAttribute(archiveAttr);
+    const AtomicString& archive = fastGetAttribute(archiveAttr);
     if (!archive.isNull()) {
-        paramNames.append("archive");
+        paramNames.append(ASCIILiteral("archive"));
         paramValues.append(archive.string());
     }
 
-    paramNames.append("baseURL");
+    paramNames.append(ASCIILiteral("baseURL"));
     paramValues.append(document().baseURL().string());
 
-    const AtomicString& mayScript = getAttribute(mayscriptAttr);
+    const AtomicString& mayScript = fastGetAttribute(mayscriptAttr);
     if (!mayScript.isNull()) {
-        paramNames.append("mayScript");
+        paramNames.append(ASCIILiteral("mayScript"));
         paramValues.append(mayScript.string());
     }
 
index a87d977..a742f38 100644 (file)
@@ -287,7 +287,7 @@ void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
 {
     HTMLElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)));
+    addSubresourceURL(urls, document().completeURL(fastGetAttribute(backgroundAttr)));
 }
 
 } // namespace WebCore
index 947e71e..92e26a7 100644 (file)
@@ -194,9 +194,9 @@ bool HTMLButtonElement::isURLAttribute(const Attribute& attribute) const
     return attribute.name() == formactionAttr || HTMLFormControlElement::isURLAttribute(attribute);
 }
 
-String HTMLButtonElement::value() const
+const AtomicString& HTMLButtonElement::value() const
 {
-    return getAttribute(valueAttr);
+    return fastGetAttribute(valueAttr);
 }
 
 bool HTMLButtonElement::recalcWillValidate() const
index df6cbcc..e7e9e1d 100644 (file)
@@ -34,7 +34,7 @@ public:
 
     void setType(const AtomicString&);
     
-    String value() const;
+    const AtomicString& value() const;
 
     virtual bool willRespondToMouseClickEvents() override;
 
index 28c8474..0ce2b06 100644 (file)
@@ -107,10 +107,9 @@ int HTMLDocument::height()
 
 String HTMLDocument::dir()
 {
-    HTMLElement* b = body();
-    if (!b)
-        return String();
-    return b->getAttribute(dirAttr);
+    if (auto* body = this->body())
+        return body->fastGetAttribute(dirAttr);
+    return String();
 }
 
 void HTMLDocument::setDir(const String& value)
index 881a642..ca2564a 100644 (file)
@@ -214,14 +214,14 @@ bool HTMLEmbedElement::isURLAttribute(const Attribute& attribute) const
 
 const AtomicString& HTMLEmbedElement::imageSourceURL() const
 {
-    return getAttribute(srcAttr);
+    return fastGetAttribute(srcAttr);
 }
 
 void HTMLEmbedElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
 {
     HTMLPlugInImageElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document().completeURL(getAttribute(srcAttr)));
+    addSubresourceURL(urls, document().completeURL(fastGetAttribute(srcAttr)));
 }
 
 }
index 681e553..db50b27 100644 (file)
@@ -46,7 +46,7 @@ inline HTMLFieldSetElement::HTMLFieldSetElement(const QualifiedName& tagName, Do
 
 HTMLFieldSetElement::~HTMLFieldSetElement()
 {
-    if (hasAttribute(disabledAttr))
+    if (fastHasAttribute(disabledAttr))
         document().removeDisabledFieldsetElement();
 }
 
@@ -65,7 +65,7 @@ static void updateFromControlElementsAncestorDisabledStateUnder(HTMLElement& sta
     while (control) {
         control->setAncestorDisabled(isDisabled);
         // Don't call setAncestorDisabled(false) on form contorls inside disabled fieldsets.
-        if (isHTMLFieldSetElement(control) && control->hasAttribute(disabledAttr))
+        if (isHTMLFieldSetElement(control) && control->fastHasAttribute(disabledAttr))
             control = Traversal<HTMLFormControlElement>::nextSkippingChildren(control, &startNode);
         else
             control = Traversal<HTMLFormControlElement>::next(control, &startNode);
@@ -74,7 +74,7 @@ static void updateFromControlElementsAncestorDisabledStateUnder(HTMLElement& sta
 
 void HTMLFieldSetElement::disabledAttributeChanged()
 {
-    if (hasAttribute(disabledAttr))
+    if (fastHasAttribute(disabledAttr))
         document().addDisabledFieldsetElement();
     else
         document().removeDisabledFieldsetElement();
@@ -90,7 +90,7 @@ void HTMLFieldSetElement::disabledStateChanged()
     if (disabledByAncestorFieldset())
         return;
 
-    bool thisFieldsetIsDisabled = hasAttribute(disabledAttr);
+    bool thisFieldsetIsDisabled = fastHasAttribute(disabledAttr);
     bool hasSeenFirstLegendElement = false;
     for (HTMLElement* control = Traversal<HTMLElement>::firstChild(this); control; control = Traversal<HTMLElement>::nextSibling(control)) {
         if (!hasSeenFirstLegendElement && isHTMLLegendElement(control)) {
@@ -105,7 +105,7 @@ void HTMLFieldSetElement::disabledStateChanged()
 void HTMLFieldSetElement::childrenChanged(const ChildChange& change)
 {
     HTMLFormControlElement::childrenChanged(change);
-    if (!hasAttribute(disabledAttr))
+    if (!fastHasAttribute(disabledAttr))
         return;
 
     HTMLLegendElement* legend = Traversal<HTMLLegendElement>::firstChild(this);
@@ -121,7 +121,7 @@ void HTMLFieldSetElement::childrenChanged(const ChildChange& change)
 void HTMLFieldSetElement::didMoveToNewDocument(Document* oldDocument)
 {
     HTMLFormControlElement::didMoveToNewDocument(oldDocument);
-    if (hasAttribute(disabledAttr)) {
+    if (fastHasAttribute(disabledAttr)) {
         if (oldDocument)
             oldDocument->removeDisabledFieldsetElement();
         document().addDisabledFieldsetElement();
index f1915ea..a31f926 100644 (file)
@@ -103,7 +103,7 @@ bool HTMLFormControlElement::computeIsDisabledByFieldsetAncestor() const
 {
     Element* previousAncestor = nullptr;
     for (Element* ancestor = parentElement(); ancestor; ancestor = ancestor->parentElement()) {
-        if (isHTMLFieldSetElement(ancestor) && ancestor->hasAttribute(disabledAttr)) {
+        if (isHTMLFieldSetElement(ancestor) && ancestor->fastHasAttribute(disabledAttr)) {
             HTMLFieldSetElement& fieldSetAncestor = toHTMLFieldSetElement(*ancestor);
             bool isInFirstLegend = previousAncestor && isHTMLLegendElement(previousAncestor) && previousAncestor == fieldSetAncestor.legend();
             return !isInFirstLegend;
index 21a4cd9..c88eac9 100644 (file)
@@ -660,7 +660,7 @@ bool HTMLFormElement::noValidate() const
 // (Darin Adler) removed this, someone added it back, so I am leaving it in for now.
 String HTMLFormElement::action() const
 {
-    return getAttribute(actionAttr);
+    return fastGetAttribute(actionAttr);
 }
 
 void HTMLFormElement::setAction(const String &value)
index 97babfb..57cf820 100644 (file)
@@ -61,7 +61,7 @@ RenderPtr<RenderElement> HTMLFrameElement::createElementRenderer(PassRef<RenderS
 
 bool HTMLFrameElement::noResize() const
 {
-    return hasAttribute(noresizeAttr);
+    return fastHasAttribute(noresizeAttr);
 }
 
 void HTMLFrameElement::didAttachRenderers()
index 5b151d2..08598e3 100644 (file)
@@ -169,7 +169,7 @@ URL HTMLFrameElementBase::location() const
 {
     if (fastHasAttribute(srcdocAttr))
         return URL(ParsedURLString, "about:srcdoc");
-    return document().completeURL(getAttribute(srcAttr));
+    return document().completeURL(fastGetAttribute(srcAttr));
 }
 
 void HTMLFrameElementBase::setLocation(const String& str)
index bc92e96..1b7be7c 100644 (file)
@@ -82,7 +82,7 @@ void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& na
         addHTMLColorToStyle(style, CSSPropertyBorderColor, value);
         addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value);
     } else if (name == noshadeAttr) {
-        if (!hasAttribute(colorAttr)) {
+        if (!fastHasAttribute(colorAttr)) {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
 
             RefPtr<CSSPrimitiveValue> darkGrayValue = cssValuePool().createColorValue(Color::darkGray);
index 131672e..9e41d31 100644 (file)
@@ -70,7 +70,7 @@ void HTMLHtmlElement::insertedByParser()
     if (!documentLoader)
         return;
 
-    const AtomicString& manifest = getAttribute(manifestAttr);
+    const AtomicString& manifest = fastGetAttribute(manifestAttr);
     if (manifest.isEmpty())
         documentLoader->applicationCacheHost()->selectCacheWithoutManifest();
     else
index c0f9ecc..c011ff7 100644 (file)
@@ -197,16 +197,16 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
     }
 }
 
-String HTMLImageElement::altText() const
+const AtomicString& HTMLImageElement::altText() const
 {
     // lets figure out the alt text.. magic stuff
     // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen
     // also heavily discussed by Hixie on bugzilla
-    String alt = getAttribute(altAttr);
+    const AtomicString& alt = fastGetAttribute(altAttr);
+    if (!alt.isNull())
+        return alt;
     // fall back to title attribute
-    if (alt.isNull())
-        alt = getAttribute(titleAttr);
-    return alt;
+    return fastGetAttribute(titleAttr);
 }
 
 RenderPtr<RenderElement> HTMLImageElement::createElementRenderer(PassRef<RenderStyle> style)
@@ -393,13 +393,13 @@ bool HTMLImageElement::matchesLowercasedUsemap(const AtomicStringImpl& name) con
 
 const AtomicString& HTMLImageElement::alt() const
 {
-    return getAttribute(altAttr);
+    return fastGetAttribute(altAttr);
 }
 
 bool HTMLImageElement::draggable() const
 {
     // Image elements are draggable by default.
-    return !equalIgnoringCase(getAttribute(draggableAttr), "false");
+    return !equalIgnoringCase(fastGetAttribute(draggableAttr), "false");
 }
 
 void HTMLImageElement::setHeight(int value)
@@ -409,7 +409,7 @@ void HTMLImageElement::setHeight(int value)
 
 URL HTMLImageElement::src() const
 {
-    return document().completeURL(getAttribute(srcAttr));
+    return document().completeURL(fastGetAttribute(srcAttr));
 }
 
 void HTMLImageElement::setSrc(const String& value)
@@ -455,7 +455,7 @@ void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
 
     addSubresourceURL(urls, src());
     // FIXME: What about when the usemap attribute begins with "#"?
-    addSubresourceURL(urls, document().completeURL(getAttribute(usemapAttr)));
+    addSubresourceURL(urls, document().completeURL(fastGetAttribute(usemapAttr)));
 }
 
 void HTMLImageElement::didMoveToNewDocument(Document* oldDocument)
index 324948b..fd44018 100644 (file)
@@ -54,7 +54,7 @@ public:
 
     bool isServerMap() const;
 
-    String altText() const;
+    const AtomicString& altText() const;
 
     CompositeOperator compositeOperator() const { return m_compositeOperator; }
 
index 15d0340..a8ebaa9 100644 (file)
@@ -718,7 +718,7 @@ void HTMLInputElement::finishParsingChildren()
     m_parsingInProgress = false;
     HTMLTextFormControlElement::finishParsingChildren();
     if (!m_stateRestored) {
-        bool checked = hasAttribute(checkedAttr);
+        bool checked = fastHasAttribute(checkedAttr);
         if (checked)
             setChecked(checked);
         m_reflectsCheckedAttribute = true;
@@ -767,7 +767,7 @@ String HTMLInputElement::altText() const
     if (alt.isNull())
         alt = getAttribute(titleAttr);
     if (alt.isNull())
-        alt = getAttribute(valueAttr);
+        alt = fastGetAttribute(valueAttr);
     if (alt.isEmpty())
         alt = inputElementAltText();
     return alt;
@@ -801,7 +801,7 @@ void HTMLInputElement::reset()
         setValue(String());
 
     setAutofilled(false);
-    setChecked(hasAttribute(checkedAttr));
+    setChecked(fastHasAttribute(checkedAttr));
     m_reflectsCheckedAttribute = true;
 }
 
index 1cbed01..4118985 100644 (file)
@@ -62,7 +62,7 @@ bool HTMLLabelElement::isFocusable() const
 
 LabelableElement* HTMLLabelElement::control()
 {
-    const AtomicString& controlId = getAttribute(forAttr);
+    const AtomicString& controlId = fastGetAttribute(forAttr);
     if (controlId.isNull()) {
         // Search the children and descendants of the label element for a form element.
         // per http://dev.w3.org/html5/spec/Overview.html#the-label-element
index 8c9ebae..dd6f987 100644 (file)
@@ -189,7 +189,7 @@ void HTMLLinkElement::process()
     if (m_disabledState != Disabled && (m_relAttribute.m_isStyleSheet || (acceptIfTypeContainsTextCSS && type.contains("text/css")))
         && document().frame() && url.isValid()) {
         
-        String charset = getAttribute(charsetAttr);
+        AtomicString charset = fastGetAttribute(charsetAttr);
         if (charset.isEmpty() && document().frame())
             charset = document().charset();
         
@@ -401,9 +401,9 @@ URL HTMLLinkElement::href() const
     return document().completeURL(getAttribute(hrefAttr));
 }
 
-String HTMLLinkElement::rel() const
+const AtomicString& HTMLLinkElement::rel() const
 {
-    return getAttribute(relAttr);
+    return fastGetAttribute(relAttr);
 }
 
 String HTMLLinkElement::target() const
@@ -411,7 +411,7 @@ String HTMLLinkElement::target() const
     return getAttribute(targetAttr);
 }
 
-String HTMLLinkElement::type() const
+const AtomicString& HTMLLinkElement::type() const
 {
     return getAttribute(typeAttr);
 }
index 65b3241..49701f8 100644 (file)
@@ -48,11 +48,11 @@ public:
     virtual ~HTMLLinkElement();
 
     URL href() const;
-    String rel() const;
+    const AtomicString& rel() const;
 
     virtual String target() const override;
 
-    String type() const;
+    const AtomicString& type() const;
 
     IconType iconType() const;
 
index 0a2ee7b..ab10967 100644 (file)
@@ -89,17 +89,17 @@ void HTMLMetaElement::process()
         document().processHttpEquiv(httpEquivValue, contentValue);
 }
 
-String HTMLMetaElement::content() const
+const AtomicString& HTMLMetaElement::content() const
 {
-    return getAttribute(contentAttr);
+    return fastGetAttribute(contentAttr);
 }
 
-String HTMLMetaElement::httpEquiv() const
+const AtomicString& HTMLMetaElement::httpEquiv() const
 {
-    return getAttribute(http_equivAttr);
+    return fastGetAttribute(http_equivAttr);
 }
 
-String HTMLMetaElement::name() const
+const AtomicString& HTMLMetaElement::name() const
 {
     return getNameAttribute();
 }
index 159c3aa..25d1a77 100644 (file)
@@ -31,9 +31,9 @@ class HTMLMetaElement final : public HTMLElement {
 public:
     static PassRefPtr<HTMLMetaElement> create(const QualifiedName&, Document&);
 
-    String content() const;
-    String httpEquiv() const;
-    String name() const;
+    const AtomicString& content() const;
+    const AtomicString& httpEquiv() const;
+    const AtomicString& name() const;
 
 private:
     HTMLMetaElement(const QualifiedName&, Document&);
index 8b69890..9177eaa 100644 (file)
@@ -356,7 +356,7 @@ bool HTMLObjectElement::isURLAttribute(const Attribute& attribute) const
 
 const AtomicString& HTMLObjectElement::imageSourceURL() const
 {
-    return getAttribute(dataAttr);
+    return fastGetAttribute(dataAttr);
 }
 
 void HTMLObjectElement::renderFallbackContent()
@@ -479,11 +479,11 @@ void HTMLObjectElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) cons
 {
     HTMLPlugInImageElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document().completeURL(getAttribute(dataAttr)));
+    addSubresourceURL(urls, document().completeURL(fastGetAttribute(dataAttr)));
 
     // FIXME: Passing a string that starts with "#" to the completeURL function does
     // not seem like it would work. The image element has similar but not identical code.
-    const AtomicString& useMap = getAttribute(usemapAttr);
+    const AtomicString& useMap = fastGetAttribute(usemapAttr);
     if (useMap.startsWith('#'))
         addSubresourceURL(urls, document().completeURL(useMap));
 }
index fcebaec..c0ab70d 100644 (file)
@@ -94,7 +94,7 @@ void HTMLOptGroupElement::recalcSelectOptions()
 
 String HTMLOptGroupElement::groupLabelText() const
 {
-    String itemText = document().displayStringModifiedByEncoding(getAttribute(labelAttr));
+    String itemText = document().displayStringModifiedByEncoding(fastGetAttribute(labelAttr));
     
     // In WinIE, leading and trailing whitespace is ignored in options and optgroups. We match this behavior.
     itemText = itemText.stripWhiteSpace();
index b547579..9837124 100644 (file)
@@ -110,7 +110,7 @@ void HTMLProgressElement::setValue(double value, ExceptionCode& ec)
 
 double HTMLProgressElement::max() const
 {
-    double max = parseToDoubleForNumberType(getAttribute(maxAttr));
+    double max = parseToDoubleForNumberType(fastGetAttribute(maxAttr));
     return !std::isfinite(max) || max <= 0 ? 1 : max;
 }
 
index 30e3d46..578cd39 100644 (file)
@@ -117,12 +117,12 @@ void HTMLScriptElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) cons
 
 String HTMLScriptElement::sourceAttributeValue() const
 {
-    return getAttribute(srcAttr).string();
+    return fastGetAttribute(srcAttr).string();
 }
 
 String HTMLScriptElement::charsetAttributeValue() const
 {
-    return getAttribute(charsetAttr).string();
+    return fastGetAttribute(charsetAttr).string();
 }
 
 String HTMLScriptElement::typeAttributeValue() const
@@ -132,17 +132,17 @@ String HTMLScriptElement::typeAttributeValue() const
 
 String HTMLScriptElement::languageAttributeValue() const
 {
-    return getAttribute(languageAttr).string();
+    return fastGetAttribute(languageAttr).string();
 }
 
 String HTMLScriptElement::forAttributeValue() const
 {
-    return getAttribute(forAttr).string();
+    return fastGetAttribute(forAttr).string();
 }
 
 String HTMLScriptElement::eventAttributeValue() const
 {
-    return getAttribute(eventAttr).string();
+    return fastGetAttribute(eventAttr).string();
 }
 
 bool HTMLScriptElement::asyncAttributeValue() const
index ccfbf27..ccb74ca 100644 (file)
@@ -160,7 +160,7 @@ void HTMLTableCellElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) c
 {
     HTMLTablePartElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)));
+    addSubresourceURL(urls, document().completeURL(fastGetAttribute(backgroundAttr)));
 }
 
 HTMLTableCellElement* HTMLTableCellElement::cellAbove() const
index bf22d00..59feebe 100644 (file)
@@ -560,21 +560,21 @@ PassRefPtr<HTMLCollection> HTMLTableElement::tBodies()
     return ensureCachedHTMLCollection(TableTBodies);
 }
 
-String HTMLTableElement::rules() const
+const AtomicString& HTMLTableElement::rules() const
 {
-    return getAttribute(rulesAttr);
+    return fastGetAttribute(rulesAttr);
 }
 
-String HTMLTableElement::summary() const
+const AtomicString& HTMLTableElement::summary() const
 {
-    return getAttribute(summaryAttr);
+    return fastGetAttribute(summaryAttr);
 }
 
 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
 {
     HTMLElement::addSubresourceAttributeURLs(urls);
 
-    addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)));
+    addSubresourceURL(urls, document().completeURL(fastGetAttribute(backgroundAttr)));
 }
 
 }
index c9768eb..e596ab4 100644 (file)
@@ -63,8 +63,8 @@ public:
     PassRefPtr<HTMLCollection> rows();
     PassRefPtr<HTMLCollection> tBodies();
 
-    String rules() const;
-    String summary() const;
+    const AtomicString& rules() const;
+    const AtomicString& summary() const;
 
     const StyleProperties* additionalCellStyle();
     const StyleProperties* additionalGroupStyle(bool rows);
index 32b8396..4913f12 100644 (file)
@@ -105,42 +105,42 @@ int HTMLTableSectionElement::numRows() const
     return rows;
 }
 
-String HTMLTableSectionElement::align() const
+const AtomicString& HTMLTableSectionElement::align() const
 {
-    return getAttribute(alignAttr);
+    return fastGetAttribute(alignAttr);
 }
 
-void HTMLTableSectionElement::setAlign(const String &value)
+void HTMLTableSectionElement::setAlign(const AtomicString& value)
 {
     setAttribute(alignAttr, value);
 }
 
-String HTMLTableSectionElement::ch() const
+const AtomicString& HTMLTableSectionElement::ch() const
 {
-    return getAttribute(charAttr);
+    return fastGetAttribute(charAttr);
 }
 
-void HTMLTableSectionElement::setCh(const String &value)
+void HTMLTableSectionElement::setCh(const AtomicString& value)
 {
     setAttribute(charAttr, value);
 }
 
-String HTMLTableSectionElement::chOff() const
+const AtomicString& HTMLTableSectionElement::chOff() const
 {
     return getAttribute(charoffAttr);
 }
 
-void HTMLTableSectionElement::setChOff(const String &value)
+void HTMLTableSectionElement::setChOff(const AtomicString& value)
 {
     setAttribute(charoffAttr, value);
 }
 
-String HTMLTableSectionElement::vAlign() const
+const AtomicString& HTMLTableSectionElement::vAlign() const
 {
-    return getAttribute(valignAttr);
+    return fastGetAttribute(valignAttr);
 }
 
-void HTMLTableSectionElement::setVAlign(const String &value)
+void HTMLTableSectionElement::setVAlign(const AtomicString& value)
 {
     setAttribute(valignAttr, value);
 }
index e97e290..70eb17f 100644 (file)
@@ -41,17 +41,17 @@ public:
 
     int numRows() const;
 
-    String align() const;
-    void setAlign(const String&);
+    const AtomicString& align() const;
+    void setAlign(const AtomicString&);
 
-    String ch() const;
-    void setCh(const String&);
+    const AtomicString& ch() const;
+    void setCh(const AtomicString&);
 
-    String chOff() const;
-    void setChOff(const String&);
+    const AtomicString& chOff() const;
+    void setChOff(const AtomicString&);
 
-    String vAlign() const;
-    void setVAlign(const String&);
+    const AtomicString& vAlign() const;
+    void setVAlign(const AtomicString&);
 
     PassRefPtr<HTMLCollection> rows();
 
index 304594d..ce3d8a9 100644 (file)
@@ -430,7 +430,7 @@ void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
 int HTMLTextAreaElement::maxLength() const
 {
     bool ok;
-    int value = getAttribute(maxlengthAttr).string().toInt(&ok);
+    int value = fastGetAttribute(maxlengthAttr).string().toInt(&ok);
     return ok && value >= 0 ? value : -1;
 }
 
index 791dc74..418dd0b 100644 (file)
@@ -180,7 +180,7 @@ void SearchInputType::searchEventTimerFired(Timer<SearchInputType>*)
 
 bool SearchInputType::searchEventsShouldBeDispatched() const
 {
-    return element().hasAttribute(incrementalAttr);
+    return element().fastHasAttribute(incrementalAttr);
 }
 
 void SearchInputType::didSetValueByUserEdit(ValueChangeState state)
index 9318836..5278f4a 100644 (file)
@@ -154,14 +154,14 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
     FormSubmission::Attributes copiedAttributes;
     copiedAttributes.copyFrom(attributes);
     if (submitButton) {
-        String attributeValue;
-        if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNull())
+        AtomicString attributeValue;
+        if (!(attributeValue = submitButton->fastGetAttribute(formactionAttr)).isNull())
             copiedAttributes.parseAction(attributeValue);
-        if (!(attributeValue = submitButton->getAttribute(formenctypeAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formenctypeAttr)).isNull())
             copiedAttributes.updateEncodingType(attributeValue);
-        if (!(attributeValue = submitButton->getAttribute(formmethodAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formmethodAttr)).isNull())
             copiedAttributes.updateMethodType(attributeValue);
-        if (!(attributeValue = submitButton->getAttribute(formtargetAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formtargetAttr)).isNull())
             copiedAttributes.setTarget(attributeValue);
     }
     
index fe26dd1..2960ed2 100644 (file)
@@ -476,7 +476,7 @@ String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* e
     if (!resultFromNameAttribute.isEmpty())
         return resultFromNameAttribute;
     
-    return matchLabelsAgainstString(labels, element->getAttribute(idAttr));
+    return matchLabelsAgainstString(labels, element->fastGetAttribute(idAttr));
 }
 
 #if PLATFORM(IOS)
index 7622f11..43c4e7e 100644 (file)
@@ -232,7 +232,7 @@ void PageSerializer::serializeFrame(Frame* frame)
 
         if (isHTMLImageElement(element)) {
             HTMLImageElement* imageElement = toHTMLImageElement(element);
-            URL url = document->completeURL(imageElement->getAttribute(HTMLNames::srcAttr));
+            URL url = document->completeURL(imageElement->fastGetAttribute(HTMLNames::srcAttr));
             CachedImage* cachedImage = imageElement->cachedImage();
             addImageToResources(cachedImage, imageElement->renderer(), url);
         } else if (element->hasTagName(HTMLNames::linkTag)) {
index 4491d53..ce5a7e2 100644 (file)
@@ -1034,7 +1034,7 @@ void Pasteboard::writeImageToDataObject(Element& element, const URL& url)
     if (!imageBuffer || !imageBuffer->size())
         return;
 
-    HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element.getAttribute(HTMLNames::altAttr), cachedImage);
+    HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element.fastGetAttribute(HTMLNames::altAttr), cachedImage);
     if (!imageFileDescriptor)
         return;
 
index d4db359..9593b76 100644 (file)
@@ -274,7 +274,7 @@ String HitTestResult::altDisplayString() const
     
     if (isHTMLImageElement(m_innerNonSharedNode.get())) {
         HTMLImageElement* image = toHTMLImageElement(m_innerNonSharedNode.get());
-        return displayString(image->getAttribute(altAttr), m_innerNonSharedNode.get());
+        return displayString(image->fastGetAttribute(altAttr), m_innerNonSharedNode.get());
     }
     
     if (isHTMLInputElement(m_innerNonSharedNode.get())) {
index dfff75c..d824865 100644 (file)
@@ -191,7 +191,7 @@ EVisibility RenderSearchField::visibilityForCancelButton() const
 
 const AtomicString& RenderSearchField::autosaveName() const
 {
-    return inputElement().getAttribute(autosaveAttr);
+    return inputElement().fastGetAttribute(autosaveAttr);
 }
 
 // PopupMenuClient methods
index 0f2b74b..6896234 100644 (file)
@@ -178,7 +178,7 @@ void RenderTableCell::computePreferredLogicalWidths()
     if (element() && style().autoWrap()) {
         // See if nowrap was set.
         Length w = styleOrColLogicalWidth();
-        String nowrap = element()->getAttribute(nowrapAttr);
+        const AtomicString& nowrap = element()->fastGetAttribute(nowrapAttr);
         if (!nowrap.isNull() && w.isFixed())
             // Nowrap is set, but we didn't actually use it because of the
             // fixed width set on the cell.  Even so, it is a WinIE/Moz trait
index 01d558d..f2cdc52 100644 (file)
@@ -226,7 +226,7 @@ bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData
             renderer = useElement.rendererClipChild();
             if (!renderer)
                 continue;
-            if (!useElement.hasAttribute(SVGNames::clip_ruleAttr))
+            if (!useElement.fastHasAttribute(SVGNames::clip_ruleAttr))
                 newClipRule = renderer->style().svgStyle().clipRule();
         }