Title: [118688] trunk
Revision
118688
Author
an...@apple.com
Date
2012-05-28 09:22:01 -0700 (Mon, 28 May 2012)

Log Message

REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute
https://bugs.webkit.org/show_bug.cgi?id=87349

Source/WebCore: 

Reviewed by Andreas Kling.
        
Selector fast path does not trigger lazy style attribute generation. Since attribute selectors matching
style attribute are rare, disallow them from the fast path rather than making it more branchy.

Test: fast/css/dynamic-style-attribute-query.html

* css/SelectorChecker.cpp:
(WebCore::isFastCheckableMatch):

LayoutTests: 

Reviewed by Andreas Kling.

* fast/css/dynamic-style-attribute-query-expected.txt: Added.
* fast/css/dynamic-style-attribute-query.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118687 => 118688)


--- trunk/LayoutTests/ChangeLog	2012-05-28 16:05:34 UTC (rev 118687)
+++ trunk/LayoutTests/ChangeLog	2012-05-28 16:22:01 UTC (rev 118688)
@@ -1,3 +1,13 @@
+2012-05-28  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute
+        https://bugs.webkit.org/show_bug.cgi?id=87349
+
+        Reviewed by Andreas Kling.
+
+        * fast/css/dynamic-style-attribute-query-expected.txt: Added.
+        * fast/css/dynamic-style-attribute-query.html: Added.
+
 2012-05-28  Marcus Bulach  <bul...@chromium.org>
 
         [Chromium] [V8] Layout Test fast/js/string-replace-2.html failing following 11594 => 11648 v8 update

Added: trunk/LayoutTests/fast/css/dynamic-style-attribute-query-expected.txt (0 => 118688)


--- trunk/LayoutTests/fast/css/dynamic-style-attribute-query-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/dynamic-style-attribute-query-expected.txt	2012-05-28 16:22:01 UTC (rev 118688)
@@ -0,0 +1,5 @@
+PASS document.querySelector('#testDiv[style]') is not null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/dynamic-style-attribute-query.html (0 => 118688)


--- trunk/LayoutTests/fast/css/dynamic-style-attribute-query.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/dynamic-style-attribute-query.html	2012-05-28 16:22:01 UTC (rev 118688)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="testDiv">
+</div>
+<script>
+document.getElementById('testDiv').style.top = 0;
+shouldNotBe("document.querySelector('#testDiv[style]')", "null");
+</script>
+</body>
+<script src=""
+</html>

Modified: trunk/Source/WebCore/ChangeLog (118687 => 118688)


--- trunk/Source/WebCore/ChangeLog	2012-05-28 16:05:34 UTC (rev 118687)
+++ trunk/Source/WebCore/ChangeLog	2012-05-28 16:22:01 UTC (rev 118688)
@@ -1,3 +1,18 @@
+2012-05-28  Antti Koivisto  <an...@apple.com>
+
+        REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute
+        https://bugs.webkit.org/show_bug.cgi?id=87349
+
+        Reviewed by Andreas Kling.
+        
+        Selector fast path does not trigger lazy style attribute generation. Since attribute selectors matching
+        style attribute are rare, disallow them from the fast path rather than making it more branchy.
+
+        Test: fast/css/dynamic-style-attribute-query.html
+
+        * css/SelectorChecker.cpp:
+        (WebCore::isFastCheckableMatch):
+
 2012-05-28  Peter Rybin  <peter.ry...@gmail.com>
 
         Web Inspector: Expose function (closure) scopes in remote protocol

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (118687 => 118688)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2012-05-28 16:05:34 UTC (rev 118687)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2012-05-28 16:22:01 UTC (rev 118688)
@@ -403,10 +403,13 @@
 
 static inline bool isFastCheckableMatch(const CSSSelector* selector)
 {
-    if (selector->m_match == CSSSelector::Set)
-        return true;
+    if (selector->m_match == CSSSelector::Set) {
+        // Style attribute is generated lazily but the fast path doesn't trigger it.
+        // Disallow them here rather than making the fast path more branchy.
+        return selector->attribute() != styleAttr;
+    }
     if (selector->m_match == CSSSelector::Exact)
-        return !htmlAttributeHasCaseInsensitiveValue(selector->attribute());
+        return selector->attribute() != styleAttr && !htmlAttributeHasCaseInsensitiveValue(selector->attribute());
     return selector->m_match == CSSSelector::None || selector->m_match == CSSSelector::Id || selector->m_match == CSSSelector::Class;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to