Title: [106746] trunk/Source/WebCore
Revision
106746
Author
kl...@webkit.org
Date
2012-02-04 14:56:28 -0800 (Sat, 04 Feb 2012)

Log Message

Element: Remove unnecessary attributeChanged() argument.
<http://webkit.org/b/77814>

Reviewed by Ryosuke Niwa.

Remove the 'preserveDecls' argument to Element::attributeChanged() as that is no
longer needed after the removal of per-attribute style declarations.
Decorated subclass overrides with OVERRIDE since we're touching the lines.

Also removed an old inaccurate comment in NamedNodeMap::setAttributes() - calling
attributeChanged() is absolutely necessary to initialize element-specific state.

* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/Element.h:
(Element):
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::setAttributes):
* dom/StyledElement.cpp:
(WebCore::StyledElement::attributeChanged):
* dom/StyledElement.h:
(StyledElement):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::attributeChanged):
* html/HTMLMediaElement.h:
(HTMLMediaElement):
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::attributeChanged):
* html/HTMLScriptElement.h:
(HTMLScriptElement):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::attributeChanged):
* html/HTMLTrackElement.h:
(HTMLTrackElement):
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::attributeChanged):
* svg/SVGAnimationElement.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::attributeChanged):
* svg/SVGElement.h:
(SVGElement):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::attributeChanged):
* svg/animation/SVGSMILElement.h:
(SVGSMILElement):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106745 => 106746)


--- trunk/Source/WebCore/ChangeLog	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/ChangeLog	2012-02-04 22:56:28 UTC (rev 106746)
@@ -1,3 +1,53 @@
+2012-02-04  Andreas Kling  <awesomekl...@apple.com>
+
+        Element: Remove unnecessary attributeChanged() argument.
+        <http://webkit.org/b/77814>
+
+        Reviewed by Ryosuke Niwa.
+
+        Remove the 'preserveDecls' argument to Element::attributeChanged() as that is no
+        longer needed after the removal of per-attribute style declarations.
+        Decorated subclass overrides with OVERRIDE since we're touching the lines.
+
+        Also removed an old inaccurate comment in NamedNodeMap::setAttributes() - calling
+        attributeChanged() is absolutely necessary to initialize element-specific state.
+
+        * dom/Element.cpp:
+        (WebCore::Element::attributeChanged):
+        * dom/Element.h:
+        (Element):
+        * dom/NamedNodeMap.cpp:
+        (WebCore::NamedNodeMap::setAttributes):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::attributeChanged):
+        * dom/StyledElement.h:
+        (StyledElement):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateType):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::attributeChanged):
+        * html/HTMLMediaElement.h:
+        (HTMLMediaElement):
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::attributeChanged):
+        * html/HTMLScriptElement.h:
+        (HTMLScriptElement):
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::attributeChanged):
+        * html/HTMLTrackElement.h:
+        (HTMLTrackElement):
+        * svg/SVGAnimationElement.cpp:
+        (WebCore::SVGAnimationElement::attributeChanged):
+        * svg/SVGAnimationElement.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::attributeChanged):
+        * svg/SVGElement.h:
+        (SVGElement):
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::attributeChanged):
+        * svg/animation/SVGSMILElement.h:
+        (SVGSMILElement):
+
 2012-02-04  Ken Buchanan  <ke...@chromium.org>
 
         Crash when reparenting children of flexible boxes

Modified: trunk/Source/WebCore/dom/Element.cpp (106745 => 106746)


--- trunk/Source/WebCore/dom/Element.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/dom/Element.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -655,7 +655,7 @@
     return Attribute::create(name, value);
 }
 
-void Element::attributeChanged(Attribute* attr, bool)
+void Element::attributeChanged(Attribute* attr)
 {
     if (isIdAttributeName(attr->name()))
         idAttributeChanged(attr);

Modified: trunk/Source/WebCore/dom/Element.h (106745 => 106746)


--- trunk/Source/WebCore/dom/Element.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/dom/Element.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -221,8 +221,7 @@
     NamedNodeMap* updatedAttributes() const;
 
     // This method is called whenever an attribute is added, changed or removed.
-    // FIXME: Remove the preserveDecls argument.
-    virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+    virtual void attributeChanged(Attribute*);
 
     // Only called by the parser immediately after element construction.
     void parserSetAttributeMap(PassOwnPtr<NamedNodeMap>, FragmentScriptingPermission);

Modified: trunk/Source/WebCore/dom/NamedNodeMap.cpp (106745 => 106746)


--- trunk/Source/WebCore/dom/NamedNodeMap.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/dom/NamedNodeMap.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -239,15 +239,12 @@
     clearAttributes();
     unsigned newLength = other.length();
     m_attributes.resize(newLength);
+
+    // FIXME: These loops can probably be combined.
     for (unsigned i = 0; i < newLength; i++)
         m_attributes[i] = other.m_attributes[i]->clone();
-
-    // FIXME: This is wasteful.  The class list could be preserved on a copy, and we
-    // wouldn't have to waste time reparsing the attribute.
-    // The derived class, HTMLNamedNodeMap, which manages a parsed class list for the CLASS attribute,
-    // will update its member variable when parse attribute is called.
     for (unsigned i = 0; i < newLength; i++)
-        m_element->attributeChanged(m_attributes[i].get(), true);
+        m_element->attributeChanged(m_attributes[i].get());
 }
 
 void NamedNodeMap::addAttribute(PassRefPtr<Attribute> prpAttribute)

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -64,13 +64,13 @@
     return Attribute::createMapped(name, value);
 }
 
-void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void StyledElement::attributeChanged(Attribute* attr)
 {
     if (attr->name() == HTMLNames::nameAttr)
         setHasName(!attr->isNull());
 
     if (!attr->isMappedAttribute()) {
-        Element::attributeChanged(attr, preserveDecls);
+        Element::attributeChanged(attr);
         return;
     }
 

Modified: trunk/Source/WebCore/dom/StyledElement.h (106745 => 106746)


--- trunk/Source/WebCore/dom/StyledElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/dom/StyledElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -68,7 +68,7 @@
     {
     }
 
-    virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
     virtual void parseMappedAttribute(Attribute*);
     virtual void copyNonAttributeProperties(const Element*);
 

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -548,11 +548,11 @@
         NamedNodeMap* map = attributeMap();
         ASSERT(map);
         if (Attribute* height = map->getAttributeItem(heightAttr))
-            attributeChanged(height, false);
+            attributeChanged(height);
         if (Attribute* width = map->getAttributeItem(widthAttr))
-            attributeChanged(width, false);
+            attributeChanged(width);
         if (Attribute* align = map->getAttributeItem(alignAttr))
-            attributeChanged(align, false);
+            attributeChanged(align);
     }
 
     if (wasAttached) {

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -315,9 +315,9 @@
     return controls() ||  HTMLElement::supportsFocus();
 }
 
-void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void HTMLMediaElement::attributeChanged(Attribute* attr)
 {
-    HTMLElement::attributeChanged(attr, preserveDecls);
+    HTMLElement::attributeChanged(attr);
 
     const QualifiedName& attrName = attr->name();
     if (attrName == srcAttr) {

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -336,7 +336,7 @@
     void createMediaPlayer();
 
     virtual bool supportsFocus() const;
-    virtual void attributeChanged(Attribute*, bool preserveDecls);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
     virtual bool rendererIsNeeded(const NodeRenderingContext&);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual void insertedIntoDocument();

Modified: trunk/Source/WebCore/html/HTMLScriptElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLScriptElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLScriptElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -58,11 +58,11 @@
     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 }
 
-void HTMLScriptElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void HTMLScriptElement::attributeChanged(Attribute* attr)
 {
     if (attr->name() == asyncAttr)
         handleAsyncAttribute();
-    HTMLElement::attributeChanged(attr, preserveDecls);
+    HTMLElement::attributeChanged(attr);
 }
 
 void HTMLScriptElement::parseMappedAttribute(Attribute* attr)

Modified: trunk/Source/WebCore/html/HTMLScriptElement.h (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLScriptElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLScriptElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -47,7 +47,7 @@
     virtual void parseMappedAttribute(Attribute*);
     virtual void insertedIntoDocument();
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
-    virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
 
     virtual bool isURLAttribute(Attribute*) const;
 

Modified: trunk/Source/WebCore/html/HTMLTrackElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLTrackElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLTrackElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -100,9 +100,9 @@
         HTMLElement::parseMappedAttribute(attribute);
 }
 
-void HTMLTrackElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void HTMLTrackElement::attributeChanged(Attribute* attr)
 {
-    HTMLElement::attributeChanged(attr, preserveDecls);
+    HTMLElement::attributeChanged(attr);
 
     if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
         return;

Modified: trunk/Source/WebCore/html/HTMLTrackElement.h (106745 => 106746)


--- trunk/Source/WebCore/html/HTMLTrackElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/html/HTMLTrackElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -76,7 +76,7 @@
     virtual ~HTMLTrackElement();
 
     virtual void parseMappedAttribute(Attribute*);
-    virtual void attributeChanged(Attribute*, bool preserveDecls);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
 
     virtual void insertedIntoDocument() OVERRIDE;
     virtual void removedFromDocument() OVERRIDE;

Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -201,12 +201,12 @@
     ASSERT_NOT_REACHED();
 }
 
-void SVGAnimationElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void SVGAnimationElement::attributeChanged(Attribute* attr)
 {
     // Assumptions may not hold after an attribute change.
     m_animationValid = false;
     setInactive();
-    SVGSMILElement::attributeChanged(attr, preserveDecls);
+    SVGSMILElement::attributeChanged(attr);
 }
 
 float SVGAnimationElement::getStartTime() const

Modified: trunk/Source/WebCore/svg/SVGAnimationElement.h (106745 => 106746)


--- trunk/Source/WebCore/svg/SVGAnimationElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -107,7 +107,7 @@
     virtual void endedActiveInterval();
 
 private:
-    virtual void attributeChanged(Attribute*, bool preserveDecls);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
 
     virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
     virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -359,13 +359,13 @@
     return false;
 }
 
-void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void SVGElement::attributeChanged(Attribute* attr)
 {
     ASSERT(attr);
     if (!attr)
         return;
 
-    StyledElement::attributeChanged(attr, preserveDecls);
+    StyledElement::attributeChanged(attr);
 
     // When an animated SVG property changes through SVG DOM, svgAttributeChanged() is called, not attributeChanged().
     // Next time someone tries to access the XML attributes, the synchronization code starts. During that synchronization

Modified: trunk/Source/WebCore/svg/SVGElement.h (106745 => 106746)


--- trunk/Source/WebCore/svg/SVGElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/svg/SVGElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -111,7 +111,7 @@
     virtual void parseMappedAttribute(Attribute*);
 
     virtual void finishParsingChildren();
-    virtual void attributeChanged(Attribute*, bool preserveDecls = false);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
     virtual bool childShouldCreateRenderer(Node*) const;
     
     virtual void removedFromDocument();

Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (106745 => 106746)


--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp	2012-02-04 22:56:28 UTC (rev 106746)
@@ -406,10 +406,10 @@
         SVGElement::parseMappedAttribute(attr);
 }
 
-void SVGSMILElement::attributeChanged(Attribute* attr, bool preserveDecls)
+void SVGSMILElement::attributeChanged(Attribute* attr)
 {
-    SVGElement::attributeChanged(attr, preserveDecls);
-    
+    SVGElement::attributeChanged(attr);
+
     const QualifiedName& attrName = attr->name();
     if (attrName == SVGNames::durAttr)
         m_cachedDur = invalidCachedTime;

Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.h (106745 => 106746)


--- trunk/Source/WebCore/svg/animation/SVGSMILElement.h	2012-02-04 22:44:40 UTC (rev 106745)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.h	2012-02-04 22:56:28 UTC (rev 106746)
@@ -45,7 +45,7 @@
     static bool isSMILElement(Node*);
 
     virtual void parseMappedAttribute(Attribute*);
-    virtual void attributeChanged(Attribute*, bool preserveDecls);
+    virtual void attributeChanged(Attribute*) OVERRIDE;
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to