Title: [101687] trunk/Source/WebCore
Revision
101687
Author
kl...@webkit.org
Date
2011-12-01 10:49:21 -0800 (Thu, 01 Dec 2011)

Log Message

JSC/CSSOM: root(CSSElementStyleDeclaration) should never need to follow the element.
<http://webkit.org/b/73561>

Reviewed by Antti Koivisto.

A CSSElementStyleDeclaration should always either have a null element pointer,
or return a valid parentStyleSheet(), since having an element pointer implies
having an associated element sheet.

In light of this, replace the opaque-root-from-element path for style declarations
by an assertion.

* bindings/js/JSDOMBinding.h:
(WebCore::root):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101686 => 101687)


--- trunk/Source/WebCore/ChangeLog	2011-12-01 18:49:20 UTC (rev 101686)
+++ trunk/Source/WebCore/ChangeLog	2011-12-01 18:49:21 UTC (rev 101687)
@@ -1,3 +1,20 @@
+2011-12-01  Andreas Kling  <kl...@webkit.org>
+
+        JSC/CSSOM: root(CSSElementStyleDeclaration) should never need to follow the element.
+        <http://webkit.org/b/73561>
+
+        Reviewed by Antti Koivisto.
+
+        A CSSElementStyleDeclaration should always either have a null element pointer,
+        or return a valid parentStyleSheet(), since having an element pointer implies
+        having an associated element sheet.
+
+        In light of this, replace the opaque-root-from-element path for style declarations
+        by an assertion.
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::root):
+
 2011-12-01  Patrick Gansterer  <par...@webkit.org>
 
         [CMake] Make the feature defines for DOM names explicit

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (101686 => 101687)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-12-01 18:49:20 UTC (rev 101686)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-12-01 18:49:21 UTC (rev 101687)
@@ -207,10 +207,8 @@
             return root(parentRule);
         if (CSSStyleSheet* styleSheet = style->parentStyleSheet())
             return root(styleSheet);
-        if (style->isElementStyleDeclaration()) {
-            if (StyledElement* element = static_cast<CSSElementStyleDeclaration*>(style)->element())
-                return root(element);
-        }
+        // A style declaration with an associated element should've returned a style sheet above.
+        ASSERT(!style->isElementStyleDeclaration() || !static_cast<CSSElementStyleDeclaration*>(style)->element());
         return style;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to