Title: [108049] trunk/Source/WebCore
Revision
108049
Author
[email protected]
Date
2012-02-17 01:01:54 -0800 (Fri, 17 Feb 2012)

Log Message

Removing the last presentation attribute should result in a null attributeStyle().
<http://webkit.org/b/78812>

Reviewed by Antti Koivisto.

If the collectStyleForAttribute() pass in updateAttributeStyle() doesn't encounter any
respected presentation attributes, set a null attributeStyle() instead of an empty one.

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::collectMatchingRulesForList):
* dom/StyledElement.cpp:
(WebCore::StyledElement::updateAttributeStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108048 => 108049)


--- trunk/Source/WebCore/ChangeLog	2012-02-17 08:44:45 UTC (rev 108048)
+++ trunk/Source/WebCore/ChangeLog	2012-02-17 09:01:54 UTC (rev 108049)
@@ -1,3 +1,18 @@
+2012-02-16  Andreas Kling  <[email protected]>
+
+        Removing the last presentation attribute should result in a null attributeStyle().
+        <http://webkit.org/b/78812>
+
+        Reviewed by Antti Koivisto.
+
+        If the collectStyleForAttribute() pass in updateAttributeStyle() doesn't encounter any
+        respected presentation attributes, set a null attributeStyle() instead of an empty one.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::updateAttributeStyle):
+
 2012-02-16  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: use static counters for estimation of allocated Documents, Nodes and JS EventListeners

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (108048 => 108049)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-02-17 08:44:45 UTC (rev 108048)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-02-17 09:01:54 UTC (rev 108049)
@@ -1026,12 +1026,10 @@
     // Now check author rules, beginning first with presentational attributes mapped from HTML.
     if (m_styledElement) {
         if (StylePropertySet* attributeStyle = m_styledElement->attributeStyle()) {
-            if (!attributeStyle->isEmpty()) {
-                result.ranges.lastAuthorRule = m_matchedRules.size();
-                if (result.ranges.firstAuthorRule == -1)
-                    result.ranges.firstAuthorRule = result.ranges.lastAuthorRule;
-                addMatchedProperties(result, attributeStyle);
-            }
+            result.ranges.lastAuthorRule = m_matchedRules.size();
+            if (result.ranges.firstAuthorRule == -1)
+                result.ranges.firstAuthorRule = result.ranges.lastAuthorRule;
+            addMatchedProperties(result, attributeStyle);
         }
 
         // Now we check additional mapped declarations.

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (108048 => 108049)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2012-02-17 08:44:45 UTC (rev 108048)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2012-02-17 09:01:54 UTC (rev 108049)
@@ -183,7 +183,11 @@
         collectStyleForAttribute(attribute, style.get());
     }
     clearAttributeStyleDirty();
-    ensureAttributeData()->setAttributeStyle(style.release());
+
+    if (style->isEmpty())
+        attributeData()->setAttributeStyle(0);
+    else
+        attributeData()->setAttributeStyle(style.release());
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to