Use Element's hasName/hasID flags to avoid unnecessary work when looking up name...
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Feb 2012 14:50:28 +0000 (14:50 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Feb 2012 14:50:28 +0000 (14:50 +0000)
commitf4d2377a31514d2f3d2445bd565b5cd6d1ead071
treee70bf93732d4d5e4790c51c840d6bce4253fa6de
parent4a48ecd523c2f57bc3162e497a963f0cefa6d0b6
Use Element's hasName/hasID flags to avoid unnecessary work when looking up name/id attributes.
<http://webkit.org/b/77845>

Reviewed by Anders Carlsson.

Have Element::getIdAttribute() check the hasID() flag before looking up the attribute.
Add an Element::getNameAttribute() to do the same thing with hasName().
Update call sites to make use of these helpers whenever possible.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityDescription):
* dom/DocumentOrderedMap.cpp:
(WebCore::keyMatchesId):
* dom/Element.h:
(Element):
(WebCore::Element::getIdAttribute):
(WebCore):
(WebCore::Element::getNameAttribute):
* dom/NameNodeList.cpp:
(WebCore::NameNodeList::nodeMatches):
* dom/StaticHashSetNodeList.cpp:
(WebCore::StaticHashSetNodeList::itemWithName):
* dom/StaticNodeList.cpp:
(WebCore::StaticNodeList::itemWithName):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::name):
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::createRenderer):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::checkForNameMatch):
(WebCore::HTMLCollection::updateNameCache):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLFormCollection.cpp:
(WebCore::HTMLFormCollection::updateNameCache):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::formControlName):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::name):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::setNameAndOpenURL):
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::name):
* html/HTMLNameCollection.cpp:
(WebCore::HTMLNameCollection::itemAfter):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
(WebCore::HTMLObjectElement::updateDocNamedItem):
(WebCore::HTMLObjectElement::containsJavaApplet):
(WebCore::HTMLObjectElement::formControlName):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::buildObjectForFrame):
* page/Frame.cpp:
(WebCore::Frame::matchLabelsAgainstElement):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::getElementById):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107477 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/dom/DocumentOrderedMap.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/NameNodeList.cpp
Source/WebCore/dom/StaticHashSetNodeList.cpp
Source/WebCore/dom/StaticNodeList.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLFormCollection.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLMetaElement.cpp
Source/WebCore/html/HTMLNameCollection.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebCore/svg/SVGSVGElement.cpp