Title: [164176] trunk/Source/WebCore
Revision
164176
Author
[email protected]
Date
2014-02-15 10:16:24 -0800 (Sat, 15 Feb 2014)

Log Message

Remove double hashing from DatasetDOMStringMap::deleteItem
https://bugs.webkit.org/show_bug.cgi?id=128865

Reviewed by Benjamin Poulain.

* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::deleteItem): Removed call to hasAttribute, using the
result from removeAttribute instead.

* dom/Element.cpp:
(WebCore::Element::removeAttribute): Add a return value, false if nothing is removed,
and true if something is removed.
(WebCore::Element::removeAttributeNS): Ditto.
* dom/Element.h: Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164175 => 164176)


--- trunk/Source/WebCore/ChangeLog	2014-02-15 18:15:16 UTC (rev 164175)
+++ trunk/Source/WebCore/ChangeLog	2014-02-15 18:16:24 UTC (rev 164176)
@@ -1,3 +1,20 @@
+2014-02-15  Darin Adler  <[email protected]>
+
+        Remove double hashing from DatasetDOMStringMap::deleteItem
+        https://bugs.webkit.org/show_bug.cgi?id=128865
+
+        Reviewed by Benjamin Poulain.
+
+        * dom/DatasetDOMStringMap.cpp:
+        (WebCore::DatasetDOMStringMap::deleteItem): Removed call to hasAttribute, using the
+        result from removeAttribute instead.
+
+        * dom/Element.cpp:
+        (WebCore::Element::removeAttribute): Add a return value, false if nothing is removed,
+        and true if something is removed.
+        (WebCore::Element::removeAttributeNS): Ditto.
+        * dom/Element.h: Ditto.
+
 2014-02-15  Piotr Grad  <[email protected]>
 
         Setting currentTime on HTMLMediaElement with media controller should throw exception.

Modified: trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp (164175 => 164176)


--- trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp	2014-02-15 18:15:16 UTC (rev 164175)
+++ trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp	2014-02-15 18:16:24 UTC (rev 164176)
@@ -203,12 +203,7 @@
 
 bool DatasetDOMStringMap::deleteItem(const String& name)
 {
-    AtomicString attributeName = convertPropertyNameToAttributeName(name);
-    if (!m_element.hasAttribute(attributeName))
-        return false;
-
-    m_element.removeAttribute(attributeName);
-    return true;
+    return m_element.removeAttribute(convertPropertyNameToAttributeName(name));
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/Element.cpp (164175 => 164176)


--- trunk/Source/WebCore/dom/Element.cpp	2014-02-15 18:15:16 UTC (rev 164175)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-02-15 18:16:24 UTC (rev 164176)
@@ -338,16 +338,17 @@
     return attrNode.release();
 }
 
-void Element::removeAttribute(const QualifiedName& name)
+bool Element::removeAttribute(const QualifiedName& name)
 {
     if (!elementData())
-        return;
+        return false;
 
     unsigned index = elementData()->findAttributeIndexByName(name);
     if (index == ElementData::attributeNotFound)
-        return;
+        return false;
 
     removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
+    return true;
 }
 
 void Element::setBooleanAttribute(const QualifiedName& name, bool value)
@@ -1828,25 +1829,26 @@
         didAddAttribute(name, value);
 }
 
-void Element::removeAttribute(const AtomicString& name)
+bool Element::removeAttribute(const AtomicString& name)
 {
     if (!elementData())
-        return;
+        return false;
 
     AtomicString localName = shouldIgnoreAttributeCase(*this) ? name.lower() : name;
     unsigned index = elementData()->findAttributeIndexByName(localName, false);
     if (index == ElementData::attributeNotFound) {
         if (UNLIKELY(localName == styleAttr) && elementData()->styleAttributeIsDirty() && isStyledElement())
             toStyledElement(this)->removeAllInlineStyleProperties();
-        return;
+        return false;
     }
 
     removeAttributeInternal(index, NotInSynchronizationOfLazyAttribute);
+    return true;
 }
 
-void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName)
+bool Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName)
 {
-    removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
+    return removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
 }
 
 PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& localName)

Modified: trunk/Source/WebCore/dom/Element.h (164175 => 164176)


--- trunk/Source/WebCore/dom/Element.h	2014-02-15 18:15:16 UTC (rev 164175)
+++ trunk/Source/WebCore/dom/Element.h	2014-02-15 18:16:24 UTC (rev 164176)
@@ -145,7 +145,7 @@
     const AtomicString& getAttribute(const QualifiedName&) const;
     void setAttribute(const QualifiedName&, const AtomicString& value);
     void setSynchronizedLazyAttribute(const QualifiedName&, const AtomicString& value);
-    void removeAttribute(const QualifiedName&);
+    bool removeAttribute(const QualifiedName&);
 
     // Typed getters and setters for language bindings.
     int getIntegralAttribute(const QualifiedName& attributeName) const;
@@ -236,8 +236,8 @@
     // Returns the absolute bounding box translated into screen coordinates.
     IntRect screenRect() const;
 
-    void removeAttribute(const AtomicString& name);
-    void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
+    bool removeAttribute(const AtomicString& name);
+    bool removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
 
     PassRefPtr<Attr> detachAttribute(unsigned index);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to