Element: Inline style selector and AX invalidation in attributeChanged().
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 22:34:16 +0000 (22:34 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 22:34:16 +0000 (22:34 +0000)
<http://webkit.org/b/78888>

Reviewed by Antti Koivisto.

Inline the updateAfterAttributeChanged() and recalcStyleIfNeededAfterAttributeChanged()
methods into Element::attributeChanged(). They were separated when we needed them in
StyledElement::attributeChanged(), but that's no longer the case.

* dom/Element.cpp:
(WebCore::Element::attributeChanged):
* dom/Element.h:

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

Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h

index f174a17..c216212 100644 (file)
@@ -1,3 +1,18 @@
+2012-02-17  Andreas Kling  <awesomekling@apple.com>
+
+        Element: Inline style selector and AX invalidation in attributeChanged().
+        <http://webkit.org/b/78888>
+
+        Reviewed by Antti Koivisto.
+
+        Inline the updateAfterAttributeChanged() and recalcStyleIfNeededAfterAttributeChanged()
+        methods into Element::attributeChanged(). They were separated when we needed them in
+        StyledElement::attributeChanged(), but that's no longer the case.
+
+        * dom/Element.cpp:
+        (WebCore::Element::attributeChanged):
+        * dom/Element.h:
+
 2012-02-17  David Reveman  <reveman@chromium.org>
 
         [Chromium] Texture eviction doesn't show up in traces.
index 4da4a9d..3860540 100644 (file)
@@ -664,12 +664,12 @@ void Element::attributeChanged(Attribute* attr)
     else if (attr->name() == HTMLNames::nameAttr)
         setHasName(!attr->isNull());
 
-    recalcStyleIfNeededAfterAttributeChanged(attr);
-    updateAfterAttributeChanged(attr);
-}
+    if (!needsStyleRecalc() && document()->attached()) {
+        CSSStyleSelector* styleSelector = document()->styleSelectorIfExists();
+        if (!styleSelector || styleSelector->hasSelectorForAttribute(attr->name().localName()))
+            setNeedsStyleRecalc();
+    }
 
-void Element::updateAfterAttributeChanged(Attribute* attr)
-{
     invalidateNodeListsCacheAfterAttributeChanged(attr->name());
 
     if (!AXObjectCache::accessibilityEnabled())
@@ -699,18 +699,6 @@ void Element::updateAfterAttributeChanged(Attribute* attr)
     else if (attrName == aria_invalidAttr)
         document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXInvalidStatusChanged, true);
 }
-    
-void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr)
-{
-    if (needsStyleRecalc())
-        return;
-    if (!document()->attached())
-        return;
-    CSSStyleSelector* styleSelector = document()->styleSelectorIfExists();
-    if (styleSelector && !styleSelector->hasSelectorForAttribute(attr->name().localName()))
-        return;
-    setNeedsStyleRecalc();
-}
 
 void Element::idAttributeChanged(Attribute* attr)
 {
index 328d266..81c878e 100644 (file)
@@ -416,11 +416,6 @@ protected:
     virtual bool shouldRegisterAsNamedItem() const { return false; }
     virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
 
-    // The implementation of Element::attributeChanged() calls the following two functions.
-    // They are separated to allow a different flow of control in StyledElement::attributeChanged().
-    void recalcStyleIfNeededAfterAttributeChanged(Attribute*);
-    void updateAfterAttributeChanged(Attribute*);
-    
     void idAttributeChanged(Attribute*);
 
     HTMLCollection* ensureCachedHTMLCollection(CollectionType);