Title: [234953] trunk
Revision
234953
Author
[email protected]
Date
2018-08-16 13:50:01 -0700 (Thu, 16 Aug 2018)

Log Message

Custom element doesn't invalidate its style when :defined rule starts to apply
https://bugs.webkit.org/show_bug.cgi?id=188637

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Rebaselined the test now that all relevant test cases pass. The only remaining test failures
are for customized builtins which we do not and shall not implement.

* web-platform-tests/custom-elements/pseudo-class-defined-expected.txt:

Source/WebCore:

Fixed the bug by invalidating the subtree when a custom element gets defined.

Test: fast/custom-elements/defined-update-style.html

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

LayoutTests:

Added a regression test.

* fast/custom-elements/defined-update-style-expected.html: Added.
* fast/custom-elements/defined-update-style.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (234952 => 234953)


--- trunk/LayoutTests/ChangeLog	2018-08-16 20:41:39 UTC (rev 234952)
+++ trunk/LayoutTests/ChangeLog	2018-08-16 20:50:01 UTC (rev 234953)
@@ -1,3 +1,15 @@
+2018-08-16  Ryosuke Niwa  <[email protected]>
+
+        Custom element doesn't invalidate its style when :defined rule starts to apply
+        https://bugs.webkit.org/show_bug.cgi?id=188637
+
+        Reviewed by Antti Koivisto.
+
+        Added a regression test.
+
+        * fast/custom-elements/defined-update-style-expected.html: Added.
+        * fast/custom-elements/defined-update-style.html: Added.
+
 2018-08-16  Basuke Suzuki  <[email protected]>
 
         [Curl] Test gardening

Added: trunk/LayoutTests/fast/custom-elements/defined-update-style-expected.html (0 => 234953)


--- trunk/LayoutTests/fast/custom-elements/defined-update-style-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/custom-elements/defined-update-style-expected.html	2018-08-16 20:50:01 UTC (rev 234953)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+    <p>Test passes if you see a single 100px by 100px green box below.</p>
+    <div style="width: 100px; height: 100px; background: green;"></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/custom-elements/defined-update-style.html (0 => 234953)


--- trunk/LayoutTests/fast/custom-elements/defined-update-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/custom-elements/defined-update-style.html	2018-08-16 20:50:01 UTC (rev 234953)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<body>
+<style>
+.box {
+    display: block;
+    width: 100px;
+    height: 25px;
+}
+defined-element { background: red; color: green; }
+defined-element:defined { background: green; }
+defined-element:not(:defined) { color: red; }
+
+defined-element div { background: red; color: green; }
+defined-element:defined div { background: green; }
+defined-element:not(:defined) div { color: red; }
+
+defined-element + .sibling { background: red; color: green; }
+defined-element:defined + .sibling { background: green; }
+defined-element:not(:defined) + .sibling { color: red; }
+
+defined-element#foo { background: red; color: green; }
+defined-element#foo:defined { background: green; }
+defined-element#foo:not(:defined) { color: red; }
+
+</style>
+<p>Test passes if you see a single 100px by 100px green box below.</p>
+<defined-element class="box">FAIL</defined-element>
+<defined-element class="box"><div>FAIL</div></defined-element>
+<div class="sibling box">FAIL</div>
+<defined-element id="foo" class="box">FAIL</defined-element>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+setTimeout(() => {
+    customElements.define('defined-element', class extends HTMLElement {});
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, 0);
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (234952 => 234953)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-08-16 20:41:39 UTC (rev 234952)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-08-16 20:50:01 UTC (rev 234953)
@@ -1,3 +1,15 @@
+2018-08-16  Ryosuke Niwa  <[email protected]>
+
+        Custom element doesn't invalidate its style when :defined rule starts to apply
+        https://bugs.webkit.org/show_bug.cgi?id=188637
+
+        Reviewed by Antti Koivisto.
+
+        Rebaselined the test now that all relevant test cases pass. The only remaining test failures
+        are for customized builtins which we do not and shall not implement.
+
+        * web-platform-tests/custom-elements/pseudo-class-defined-expected.txt:
+
 2018-08-15  Jer Noble  <[email protected]>
 
         Add Experimental Feature support for SourceBuffer.changeType()

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined-expected.txt (234952 => 234953)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined-expected.txt	2018-08-16 20:41:39 UTC (rev 234952)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined-expected.txt	2018-08-16 20:50:01 UTC (rev 234953)
@@ -11,8 +11,8 @@
 PASS createElement("a-a") should not be :defined 
 PASS createElementNS("http://www.w3.org/1999/xhtml", "a-a") should not be :defined 
 PASS createElementNS("http://www.w3.org/2000/svg", "a-a") should be :defined 
-FAIL Upgraded createElement("a-a") should be :defined assert_equals: getComputedStyle expected "rgb(255, 165, 0)" but got "rgb(0, 0, 255)"
-FAIL Upgraded createElementNS("http://www.w3.org/1999/xhtml", "a-a") should be :defined assert_equals: getComputedStyle expected "rgb(255, 165, 0)" but got "rgb(0, 0, 255)"
+PASS Upgraded createElement("a-a") should be :defined 
+PASS Upgraded createElementNS("http://www.w3.org/1999/xhtml", "a-a") should be :defined 
 PASS Without browsing context: createElement("a-a") should not be :defined 
 PASS Without browsing context: createElementNS("http://www.w3.org/1999/xhtml", "a-a") should not be :defined 
 PASS Without browsing context: createElementNS("http://www.w3.org/2000/svg", "a-a") should be :defined 

Modified: trunk/Source/WebCore/ChangeLog (234952 => 234953)


--- trunk/Source/WebCore/ChangeLog	2018-08-16 20:41:39 UTC (rev 234952)
+++ trunk/Source/WebCore/ChangeLog	2018-08-16 20:50:01 UTC (rev 234953)
@@ -1,3 +1,17 @@
+2018-08-16  Ryosuke Niwa  <[email protected]>
+
+        Custom element doesn't invalidate its style when :defined rule starts to apply
+        https://bugs.webkit.org/show_bug.cgi?id=188637
+
+        Reviewed by Antti Koivisto.
+
+        Fixed the bug by invalidating the subtree when a custom element gets defined.
+
+        Test: fast/custom-elements/defined-update-style.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::setIsDefinedCustomElement):
+
 2018-08-16  Youenn Fablet  <[email protected]>
 
         Change the input camera in the sources & outputs example on Safari (11) with M.Way camera

Modified: trunk/Source/WebCore/dom/Element.cpp (234952 => 234953)


--- trunk/Source/WebCore/dom/Element.cpp	2018-08-16 20:41:39 UTC (rev 234952)
+++ trunk/Source/WebCore/dom/Element.cpp	2018-08-16 20:50:01 UTC (rev 234953)
@@ -1978,6 +1978,7 @@
     auto& data = ""
     if (!data.customElementReactionQueue())
         data.setCustomElementReactionQueue(std::make_unique<CustomElementReactionQueue>(elementInterface));
+    invalidateStyleForSubtree();
     InspectorInstrumentation::didChangeCustomElementState(*this);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to