Title: [133769] trunk
Revision
133769
Author
shin...@chromium.org
Date
2012-11-07 09:35:22 -0800 (Wed, 07 Nov 2012)

Log Message

[Shadow] Style should update when 'pseudo' attribute is dynamically updated
https://bugs.webkit.org/show_bug.cgi?id=100918

Reviewed by Dimitri Glazkov.

Source/WebCore:

When 'pseudo' attribute is changed and its element is in ShadowTree, we enable the styleShouldRecalc flag.

It would be fast if we have a set of pseudo attribute style value in RuleFeatureSet,
but it might consume a lot of memory.

Test: fast/dom/shadow/pseudo-attribute-dynamic.html

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

LayoutTests:

* fast/dom/shadow/pseudo-attribute-dynamic-expected.html: Added.
* fast/dom/shadow/pseudo-attribute-dynamic.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (133768 => 133769)


--- trunk/LayoutTests/ChangeLog	2012-11-07 17:33:11 UTC (rev 133768)
+++ trunk/LayoutTests/ChangeLog	2012-11-07 17:35:22 UTC (rev 133769)
@@ -1,3 +1,13 @@
+2012-11-07  Shinya Kawanaka  <shin...@chromium.org>
+
+        [Shadow] Style should update when 'pseudo' attribute is dynamically updated
+        https://bugs.webkit.org/show_bug.cgi?id=100918
+
+        Reviewed by Dimitri Glazkov.
+
+        * fast/dom/shadow/pseudo-attribute-dynamic-expected.html: Added.
+        * fast/dom/shadow/pseudo-attribute-dynamic.html: Added.
+
 2012-11-07  Vsevolod Vlasov  <vse...@chromium.org>
 
         Unreviewed test expectations update.

Added: trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-dynamic-expected.html (0 => 133769)


--- trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-dynamic-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-dynamic-expected.html	2012-11-07 17:35:22 UTC (rev 133769)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<p>This test checks dynamic 'pseudo' attribute should reflect style.</p>
+
+<div><div style="color: blue;">This should be blue.</div></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-dynamic.html (0 => 133769)


--- trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-dynamic.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/pseudo-attribute-dynamic.html	2012-11-07 17:35:22 UTC (rev 133769)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+#host::x-foo {
+    color: red;
+}
+
+#host::x-bar {
+    color: blue;
+}
+</style>
+</head>
+<body>
+
+<p>This test checks dynamic 'pseudo' attribute should reflect style.</p>
+
+<div id="host"></div>
+
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+var shadowRoot = new WebKitShadowRoot(host);
+var div = document.createElement('div');
+div.pseudo = 'x-foo';
+div.innerHTML = "This should be blue.";
+shadowRoot.appendChild(div);
+
+setTimeout(function() {
+    div.pseudo = 'x-bar';
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, 0);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (133768 => 133769)


--- trunk/Source/WebCore/ChangeLog	2012-11-07 17:33:11 UTC (rev 133768)
+++ trunk/Source/WebCore/ChangeLog	2012-11-07 17:35:22 UTC (rev 133769)
@@ -1,3 +1,20 @@
+2012-11-07  Shinya Kawanaka  <shin...@chromium.org>
+
+        [Shadow] Style should update when 'pseudo' attribute is dynamically updated
+        https://bugs.webkit.org/show_bug.cgi?id=100918
+
+        Reviewed by Dimitri Glazkov.
+
+        When 'pseudo' attribute is changed and its element is in ShadowTree, we enable the styleShouldRecalc flag.
+
+        It would be fast if we have a set of pseudo attribute style value in RuleFeatureSet,
+        but it might consume a lot of memory.
+
+        Test: fast/dom/shadow/pseudo-attribute-dynamic.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::attributeChanged):
+
 2012-11-07  Ulan Degenbaev  <u...@chromium.org>
 
         [V8] WebKit sends unnecessary low memory notification when running memory benchmarks

Modified: trunk/Source/WebCore/dom/Element.cpp (133768 => 133769)


--- trunk/Source/WebCore/dom/Element.cpp	2012-11-07 17:33:11 UTC (rev 133768)
+++ trunk/Source/WebCore/dom/Element.cpp	2012-11-07 17:35:22 UTC (rev 133769)
@@ -776,6 +776,8 @@
         }
     } else if (name == HTMLNames::nameAttr)
         setHasName(!newValue.isNull());
+    else if (name == HTMLNames::pseudoAttr)
+        shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree();
 
     shouldInvalidateStyle |= testShouldInvalidateStyle && styleResolver->hasSelectorForAttribute(name.localName());
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to