Source/WebCore/ChangeLog

112012-06-28 Kentaro Hara <haraken@chromium.org>
22
 3 Change argument types of Element::getAttribute*() from String to AtomicString
 4 https://bugs.webkit.org/show_bug.cgi?id=90246
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 This is a follow-up patch for r121439. r121439 changed an argument type of
 9 Element::getAttribute() from String to AtomicString, which optimized
 10 performance of Dromaeo/dom-attr.html. This patch changes other argument types
 11 of Element::getAttribute*() from String to AtomicString. See the ChangeLog in
 12 http://trac.webkit.org/changeset/121439 for more details about why this change
 13 optimizes performance.
 14
 15 No tests. No change in behavior.
 16
 17 * dom/DatasetDOMStringMap.cpp:
 18 (WebCore::convertPropertyNameToAttributeName):
 19 * dom/Element.cpp:
 20 (WebCore::Element::getAttributeNS):
 21 (WebCore::Element::removeAttribute):
 22 (WebCore::Element::removeAttributeNS):
 23 (WebCore::Element::getAttributeNode):
 24 (WebCore::Element::getAttributeNodeNS):
 25 (WebCore::Element::hasAttribute):
 26 (WebCore::Element::hasAttributeNS):
 27 * dom/Element.h:
 28 (Element):
 29 * dom/ElementAttributeData.cpp:
 30 (WebCore::ElementAttributeData::getAttributeNode):
 31 * dom/ElementAttributeData.h:
 32 (ElementAttributeData):
 33
 342012-06-28 Kentaro Hara <haraken@chromium.org>
 35
336 [V8] Replace v8::Integer::New() with v8Integer() in custom bindings
437 https://bugs.webkit.org/show_bug.cgi?id=90242
538

Source/WebCore/dom/DatasetDOMStringMap.cpp

@@static bool isValidPropertyName(const String& name)
110110 return true;
111111}
112112
113 static String convertPropertyNameToAttributeName(const String& name)
 113static const String convertPropertyNameToAttributeName(const String& name)
114114{
115115 StringBuilder builder;
116116 builder.append("data-");

Source/WebCore/dom/Element.cpp

@@const AtomicString& Element::getAttribute(const AtomicString& name) const
630630 return nullAtom;
631631}
632632
633 const AtomicString& Element::getAttributeNS(const String& namespaceURI, const String& localName) const
 633const AtomicString& Element::getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const
634634{
635635 return getAttribute(QualifiedName(nullAtom, localName, namespaceURI));
636636}

@@void Element::removeAttribute(size_t index)
14591459 attributeData()->removeAttribute(index, this);
14601460}
14611461
1462 void Element::removeAttribute(const String& name)
 1462void Element::removeAttribute(const AtomicString& name)
14631463{
14641464 ElementAttributeData* attributeData = this->attributeData();
14651465 if (!attributeData)

@@void Element::removeAttribute(const String& name)
14731473 attributeData->removeAttribute(index, this);
14741474}
14751475
1476 void Element::removeAttributeNS(const String& namespaceURI, const String& localName)
 1476void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName)
14771477{
14781478 removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
14791479}
14801480
1481 PassRefPtr<Attr> Element::getAttributeNode(const String& name)
 1481PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& name)
14821482{
14831483 ElementAttributeData* attributeData = updatedAttributeData();
14841484 if (!attributeData)

@@PassRefPtr<Attr> Element::getAttributeNode(const String& name)
14861486 return attributeData->getAttributeNode(name, shouldIgnoreAttributeCase(this), this);
14871487}
14881488
1489 PassRefPtr<Attr> Element::getAttributeNodeNS(const String& namespaceURI, const String& localName)
 1489PassRefPtr<Attr> Element::getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName)
14901490{
14911491 ElementAttributeData* attributeData = updatedAttributeData();
14921492 if (!attributeData)

@@PassRefPtr<Attr> Element::getAttributeNodeNS(const String& namespaceURI, const S
14941494 return attributeData->getAttributeNode(QualifiedName(nullAtom, localName, namespaceURI), this);
14951495}
14961496
1497 bool Element::hasAttribute(const String& name) const
 1497bool Element::hasAttribute(const AtomicString& name) const
14981498{
14991499 ElementAttributeData* attributeData = updatedAttributeData();
15001500 if (!attributeData)

@@bool Element::hasAttribute(const String& name) const
15061506 return attributeData->getAttributeItem(localName, false);
15071507}
15081508
1509 bool Element::hasAttributeNS(const String& namespaceURI, const String& localName) const
 1509bool Element::hasAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const
15101510{
15111511 ElementAttributeData* attributeData = updatedAttributeData();
15121512 if (!attributeData)

Source/WebCore/dom/Element.h

@@public:
139139 // in style attribute or one of the SVG animation attributes.
140140 bool hasAttributesWithoutUpdate() const;
141141
142  bool hasAttribute(const String& name) const;
143  bool hasAttributeNS(const String& namespaceURI, const String& localName) const;
 142 bool hasAttribute(const AtomicString& name) const;
 143 bool hasAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
144144
145145 const AtomicString& getAttribute(const AtomicString& name) const;
146  const AtomicString& getAttributeNS(const String& namespaceURI, const String& localName) const;
 146 const AtomicString& getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
147147
148148 void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);
149149 void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&, FragmentScriptingPermission = AllowScriptingContent);

@@public:
197197 // Returns the absolute bounding box translated into screen coordinates:
198198 IntRect screenRect() const;
199199
200  void removeAttribute(const String& name);
201  void removeAttributeNS(const String& namespaceURI, const String& localName);
 200 void removeAttribute(const AtomicString& name);
 201 void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
202202
203203 PassRefPtr<Attr> detachAttribute(size_t index);
204204
205  PassRefPtr<Attr> getAttributeNode(const String& name);
206  PassRefPtr<Attr> getAttributeNodeNS(const String& namespaceURI, const String& localName);
 205 PassRefPtr<Attr> getAttributeNode(const AtomicString& name);
 206 PassRefPtr<Attr> getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName);
207207 PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionCode&);
208208 PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionCode&);
209209 PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionCode&);

Source/WebCore/dom/ElementAttributeData.cpp

@@void ElementAttributeData::replaceAttribute(size_t index, const Attribute& attri
299299 element->didModifyAttribute(attribute);
300300}
301301
302 PassRefPtr<Attr> ElementAttributeData::getAttributeNode(const String& name, bool shouldIgnoreAttributeCase, Element* element) const
 302PassRefPtr<Attr> ElementAttributeData::getAttributeNode(const AtomicString& name, bool shouldIgnoreAttributeCase, Element* element) const
303303{
304304 ASSERT(element);
305305 Attribute* attribute = getAttributeItem(name, shouldIgnoreAttributeCase);

Source/WebCore/dom/ElementAttributeData.h

@@public:
7575 size_t length() const { return m_attributes.size(); }
7676 bool isEmpty() const { return m_attributes.isEmpty(); }
7777
78  PassRefPtr<Attr> getAttributeNode(const String&, bool shouldIgnoreAttributeCase, Element*) const;
 78 PassRefPtr<Attr> getAttributeNode(const AtomicString&, bool shouldIgnoreAttributeCase, Element*) const;
7979 PassRefPtr<Attr> getAttributeNode(const QualifiedName&, Element*) const;
8080
8181 // Internal interface.