Title: [190530] trunk
Revision
190530
Author
[email protected]
Date
2015-10-02 16:32:30 -0700 (Fri, 02 Oct 2015)

Log Message

Inserting a child to a slot assigned node doesn't trigger repaint
https://bugs.webkit.org/show_bug.cgi?id=149739

Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: fast/shadow-dom/insert-child-to-assigned-node.html

* dom/Node.cpp:
(WebCore::Node::derefEventTarget):
(WebCore::traverseStyleParent):
(WebCore::traverseFirstStyleParent):
(WebCore::Node::updateAncestorsForStyleRecalc):

    Traverse in style parent order.

LayoutTests:

* fast/shadow-dom/insert-child-to-assigned-node-expected.html: Added.
* fast/shadow-dom/insert-child-to-assigned-node.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (190529 => 190530)


--- trunk/LayoutTests/ChangeLog	2015-10-02 23:09:33 UTC (rev 190529)
+++ trunk/LayoutTests/ChangeLog	2015-10-02 23:32:30 UTC (rev 190530)
@@ -1,3 +1,13 @@
+2015-10-02  Antti Koivisto  <[email protected]>
+
+        Inserting a child to a slot assigned node doesn't trigger repaint
+        https://bugs.webkit.org/show_bug.cgi?id=149739
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/shadow-dom/insert-child-to-assigned-node-expected.html: Added.
+        * fast/shadow-dom/insert-child-to-assigned-node.html: Added.
+
 2015-10-02  Devin Rousso  <[email protected]>
 
         Web Inspector: Copying inline style text puts "undefined" in the pasteboard

Added: trunk/LayoutTests/fast/shadow-dom/insert-child-to-assigned-node-expected.html (0 => 190530)


--- trunk/LayoutTests/fast/shadow-dom/insert-child-to-assigned-node-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/insert-child-to-assigned-node-expected.html	2015-10-02 23:32:30 UTC (rev 190530)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>You should see PASS below:</p>
+<div><span><b>PASS</b></span></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/shadow-dom/insert-child-to-assigned-node.html (0 => 190530)


--- trunk/LayoutTests/fast/shadow-dom/insert-child-to-assigned-node.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/insert-child-to-assigned-node.html	2015-10-02 23:32:30 UTC (rev 190530)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>You should see PASS below:</p>
+<div><span></span></div>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+var host = document.querySelector('div');
+var root = host.attachShadow({mode: 'open'});
+root.appendChild(document.createElement('slot'));
+
+setTimeout(function () {
+    var b = document.createElement('b');
+    b.innerHTML = 'PASS';
+    document.querySelector('span').appendChild(b);
+    testRunner.notifyDone();
+}, 0);
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (190529 => 190530)


--- trunk/Source/WebCore/ChangeLog	2015-10-02 23:09:33 UTC (rev 190529)
+++ trunk/Source/WebCore/ChangeLog	2015-10-02 23:32:30 UTC (rev 190530)
@@ -1,3 +1,20 @@
+2015-10-02  Antti Koivisto  <[email protected]>
+
+        Inserting a child to a slot assigned node doesn't trigger repaint
+        https://bugs.webkit.org/show_bug.cgi?id=149739
+
+        Reviewed by Ryosuke Niwa.
+
+        Test: fast/shadow-dom/insert-child-to-assigned-node.html
+
+        * dom/Node.cpp:
+        (WebCore::Node::derefEventTarget):
+        (WebCore::traverseStyleParent):
+        (WebCore::traverseFirstStyleParent):
+        (WebCore::Node::updateAncestorsForStyleRecalc):
+
+            Traverse in style parent order.
+
 2015-10-02  Joseph Pecoraro  <[email protected]>
 
         Unreviewed, rolling out r190520, some tests assert / crash.

Modified: trunk/Source/WebCore/dom/Node.cpp (190529 => 190530)


--- trunk/Source/WebCore/dom/Node.cpp	2015-10-02 23:09:33 UTC (rev 190529)
+++ trunk/Source/WebCore/dom/Node.cpp	2015-10-02 23:32:30 UTC (rev 190530)
@@ -741,9 +741,34 @@
     deref();
 }
 
+// FIXME: Factor into iterator.
+static ContainerNode* traverseStyleParent(Node& node)
+{
+    auto* parent = node.parentNode();
+    if (!parent) {
+        if (is<ShadowRoot>(node))
+            return downcast<ShadowRoot>(node).host();
+        return nullptr;
+    }
+#if ENABLE(SHADOW_DOM)
+    if (auto* shadowRoot = parent->shadowRoot()) {
+        if (auto* assignedSlot = shadowRoot->findAssignedSlot(node))
+            return assignedSlot;
+    }
+#endif
+    return parent;
+}
+
+static ContainerNode* traverseFirstStyleParent(Node& node)
+{
+    if (is<PseudoElement>(node))
+        return downcast<PseudoElement>(node).hostElement();
+    return traverseStyleParent(node);
+}
+
 inline void Node::updateAncestorsForStyleRecalc()
 {
-    if (ContainerNode* ancestor = is<PseudoElement>(*this) ? downcast<PseudoElement>(*this).hostElement() : parentOrShadowHostNode()) {
+    if (auto* ancestor = traverseFirstStyleParent(*this)) {
         ancestor->setDirectChildNeedsStyleRecalc();
 
         if (is<Element>(*ancestor) && downcast<Element>(*ancestor).childrenAffectedByPropertyBasedBackwardPositionalRules()) {
@@ -751,8 +776,11 @@
                 ancestor->setStyleChange(FullStyleChange);
         }
 
-        for (; ancestor && !ancestor->childNeedsStyleRecalc(); ancestor = ancestor->parentOrShadowHostNode())
+        for (; ancestor; ancestor = traverseStyleParent(*ancestor)) {
+            if (ancestor->childNeedsStyleRecalc())
+                break;
             ancestor->setChildNeedsStyleRecalc();
+        }
     }
 
     Document& document = this->document();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to