Title: [126789] trunk
Revision
126789
Author
[email protected]
Date
2012-08-27 13:39:18 -0700 (Mon, 27 Aug 2012)

Log Message

ShadowRoot insertion point change aborts css transition
https://bugs.webkit.org/show_bug.cgi?id=93755

Patch by Takashi Sakamoto <[email protected]> on 2012-08-27
Reviewed by Hajime Morita.

Source/WebCore:

ElementShadow always detaches shadow hosts when distribution is
changed, i.e. select attribute's value is changed. However it clears
the style of the shadow host. So when distribution is changed,
no css transition can be started at the same time. To avoid this
problem, invalidateDistribution, i.e. a method for invalidating current
distribution, should not make shadow host reattach. Instead, it should
make distribute nodes reattached and set needsRecalcStyle flag of
shadow host.

Test: transitions/transition-on-shadow-host-with-distributed-node.html

* dom/ElementShadow.cpp:
(WebCore::ElementShadow::addShadowRoot):
To support replaced elements, i.e. IMG, and so on, shadow host's
renderer must be updated when author shadow roots are addded.
So invoke shadow host's reattach instead of shadowRoot's attach.
(WebCore::ElementShadow::invalidateDistribution):
Remove shadow host's lazy reattach (detach and lazyAttach). Instead, do
distributed nodes' lazy reattach and set shadow host's needsRecalcStyle
flag.
* dom/Node.h:
(WebCore::Node::lazyReattach):
Newly added. The method works like Node::reattach, but use
lazyAttach instead of attach.
(WebCore):

LayoutTests:

* fast/dom/shadow/transition-on-shadow-host-with-distributed-node-expected.txt: Added.
* fast/dom/shadow/transition-on-shadow-host-with-distributed-node.html: Added.
* platform/chromium-linux/fast/html/details-nested-2-expected.txt: Added, because of changing the code about adding shadow root.
* platform/chromium-linux/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt: Added.
* platform/mac/fast/html/details-nested-2-expected.txt: Rebased, because of changing the code about adding shadow root.
* platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt: Rebased.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126788 => 126789)


--- trunk/LayoutTests/ChangeLog	2012-08-27 20:32:00 UTC (rev 126788)
+++ trunk/LayoutTests/ChangeLog	2012-08-27 20:39:18 UTC (rev 126789)
@@ -1,3 +1,17 @@
+2012-08-27  Takashi Sakamoto  <[email protected]>
+
+        ShadowRoot insertion point change aborts css transition
+        https://bugs.webkit.org/show_bug.cgi?id=93755
+
+        Reviewed by Hajime Morita.
+
+        * fast/dom/shadow/transition-on-shadow-host-with-distributed-node-expected.txt: Added.
+        * fast/dom/shadow/transition-on-shadow-host-with-distributed-node.html: Added.
+        * platform/chromium-linux/fast/html/details-nested-2-expected.txt: Added, because of changing the code about adding shadow root.
+        * platform/chromium-linux/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt: Added.
+        * platform/mac/fast/html/details-nested-2-expected.txt: Rebased, because of changing the code about adding shadow root.
+        * platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt: Rebased.
+
 2012-08-27  Anna Cavender  <[email protected]>
 
         TextTrack modes are strings

Added: trunk/LayoutTests/fast/dom/shadow/transition-on-shadow-host-with-distributed-node-expected.txt (0 => 126789)


--- trunk/LayoutTests/fast/dom/shadow/transition-on-shadow-host-with-distributed-node-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/transition-on-shadow-host-with-distributed-node-expected.txt	2012-08-27 20:39:18 UTC (rev 126789)
@@ -0,0 +1,3 @@
+New Content
+PASS - "opacity" property for "box" element at 0.5s saw something close to: 0.5
+

Added: trunk/LayoutTests/fast/dom/shadow/transition-on-shadow-host-with-distributed-node.html (0 => 126789)


--- trunk/LayoutTests/fast/dom/shadow/transition-on-shadow-host-with-distributed-node.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/transition-on-shadow-host-with-distributed-node.html	2012-08-27 20:39:18 UTC (rev 126789)
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<style>
+.box {
+    height: 100px;
+    width: 100px;
+    margin: 10px;
+    background-color: gray;
+}
+
+#box {
+    opacity: 1;
+    -webkit-transition: opacity 1s linear;
+}
+    
+#box.fade {
+    opacity: 0;
+}
+</style>
+<script src=""
+<script>
+const expectedValues = [
+      // [time, element-id, property, expected-value, tolerance]
+      [0.5, 'box', 'opacity', 0.5, 0.1],
+];
+  
+function setupTest() {
+    var box = document.getElementById('box');
+    var shadowRoot = new WebKitShadowRoot(box);
+    shadowRoot.innerHTML = '<content select="*:first-child"></content>';
+    setTimeout(function() {
+        shadowRoot.querySelector("content").setAttribute("select", "*:last-child");
+        box.className = 'box fade';
+    }, 0);
+}
+
+runTransitionTest(expectedValues, setupTest, usePauseAPI);
+</script>
+</head>
+<body>
+    <!-- Test for [bug 93755] ShadowRoot insertion point change aborts css transition, https://bugs.webkit.org/show_bug.cgi?id=93755 -->
+    <!-- If this test pass, css transition will be started and -->
+    <!-- the css transition will be paused by using pauseTransitionAtTimeOnElementWithId. -->
+    <div id="box" class="box" style="background: green;">
+        <div>Content</div>
+        <div>New Content</div>
+    </div>
+
+    <div id="result"></div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium-linux/fast/html/details-nested-2-expected.txt (0 => 126789)


--- trunk/LayoutTests/platform/chromium-linux/fast/html/details-nested-2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/fast/html/details-nested-2-expected.txt	2012-08-27 20:39:18 UTC (rev 126789)
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DETAILS} at (0,0) size 784x144 [border: (8px solid #555599)]
+        RenderBlock {SUMMARY} at (8,8) size 768x36 [border: (8px solid #9999CC)]
+          RenderDetailsMarker {DIV} at (8,12) size 11x11: down
+          RenderText {#text} at (24,8) size 59x19
+            text run at (24,8) width 5: " "
+            text run at (28,8) width 55: "summary"
+        RenderBlock (anonymous) at (8,44) size 768x0
+        RenderBlock {DETAILS} at (8,44) size 768x72 [border: (8px solid #995555)]
+          RenderBlock {SUMMARY} at (8,8) size 752x36 [border: (8px solid #CC9999)]
+            RenderDetailsMarker {DIV} at (8,12) size 11x11: down
+            RenderText {#text} at (24,8) size 254x19
+              text run at (24,8) width 5: " "
+              text run at (28,8) width 250: "nested summary (details-deails-summary)"
+          RenderBlock (anonymous) at (8,44) size 752x20
+            RenderText {#text} at (0,0) size 173x19
+              text run at (0,0) width 173: "nested details (details-deails)"
+        RenderBlock (anonymous) at (8,116) size 768x20
+          RenderText {#text} at (0,0) size 38x19
+            text run at (0,0) width 38: "details"

Added: trunk/LayoutTests/platform/chromium-linux/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt (0 => 126789)


--- trunk/LayoutTests/platform/chromium-linux/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt	2012-08-27 20:39:18 UTC (rev 126789)
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,16) size 784x568
+layer at (8,16) size 784x175
+  RenderBlock {DIV} at (0,0) size 784x175 [border: (5px solid #800000)]
+    RenderBlock (anonymous) at (5,5) size 379x20
+      RenderInline {LABEL} at (0,0) size 95x19
+        RenderText {#text} at (0,0) size 95x19
+          text run at (0,0) width 95: "Some inline text"
+    RenderBlock (anonymous) at (5,25) size 379x306
+      RenderBlock {SUMMARY} at (0,0) size 379x306
+        RenderBlock (anonymous) at (0,0) size 379x20
+          RenderText {#text} at (0,0) size 99x19
+            text run at (0,0) width 99: "Some block text"
+        RenderBlock {H2} at (0,39) size 379x28 [bgcolor=#EEEEEE]
+          RenderText {#text} at (0,0) size 58x26
+            text run at (0,0) width 58: "PASS"
+        RenderBlock (anonymous) at (0,86) size 379x220
+          RenderText {#text} at (0,0) size 379x217
+            text run at (0,0) width 373: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla"
+            text run at (0,20) width 331: "varius enim ac mi. Curabitur sollicitudin felis quis lectus."
+            text run at (0,58) width 362: "Quisque adipiscing rhoncus sem. Proin nulla purus, vulputate"
+            text run at (0,78) width 358: "vel, varius ut, euismod et, nisi. Sed vitae felis vel orci sagittis"
+            text run at (0,98) width 365: "aliquam. Cras convallis adipiscing sem. Nam nonummy enim."
+            text run at (0,118) width 376: "Nullam bibendum lobortis neque. Vestibulum velit orci, tempus"
+            text run at (0,138) width 379: "euismod, pretium quis, interdum vitae, nulla. Phasellus eget ante"
+            text run at (0,158) width 376: "et tortor condimentum vestibulum. Suspendisse hendrerit quam"
+            text run at (0,178) width 362: "nec felis. Sed varius turpis vitae pede. Lorem ipsum dolor sit"
+            text run at (0,198) width 201: "amet, consectetuer adipiscing elit."
+    RenderBlock (anonymous) at (5,330) size 379x1
+      RenderInline {LABEL} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/fast/html/details-nested-2-expected.txt (126788 => 126789)


--- trunk/LayoutTests/platform/mac/fast/html/details-nested-2-expected.txt	2012-08-27 20:32:00 UTC (rev 126788)
+++ trunk/LayoutTests/platform/mac/fast/html/details-nested-2-expected.txt	2012-08-27 20:39:18 UTC (rev 126789)
@@ -9,6 +9,7 @@
           RenderText {#text} at (24,8) size 62x18
             text run at (24,8) width 4: " "
             text run at (28,8) width 58: "summary"
+        RenderBlock (anonymous) at (8,42) size 768x0
         RenderBlock {DETAILS} at (8,42) size 768x68 [border: (8px solid #995555)]
           RenderBlock {SUMMARY} at (8,8) size 752x34 [border: (8px solid #CC9999)]
             RenderDetailsMarker {DIV} at (8,12) size 10x10: down

Modified: trunk/LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt (126788 => 126789)


--- trunk/LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt	2012-08-27 20:32:00 UTC (rev 126788)
+++ trunk/LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt	2012-08-27 20:39:18 UTC (rev 126789)
@@ -9,7 +9,6 @@
       RenderInline {LABEL} at (0,0) size 102x18
         RenderText {#text} at (0,0) size 102x18
           text run at (0,0) width 102: "Some inline text"
-      RenderInline {LABEL} at (0,0) size 0x0
     RenderBlock (anonymous) at (5,23) size 379x285
       RenderBlock {SUMMARY} at (0,0) size 379x285
         RenderBlock (anonymous) at (0,0) size 379x18

Modified: trunk/Source/WebCore/ChangeLog (126788 => 126789)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 20:32:00 UTC (rev 126788)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 20:39:18 UTC (rev 126789)
@@ -1,3 +1,36 @@
+2012-08-27  Takashi Sakamoto  <[email protected]>
+
+        ShadowRoot insertion point change aborts css transition
+        https://bugs.webkit.org/show_bug.cgi?id=93755
+
+        Reviewed by Hajime Morita.
+
+        ElementShadow always detaches shadow hosts when distribution is
+        changed, i.e. select attribute's value is changed. However it clears
+        the style of the shadow host. So when distribution is changed,
+        no css transition can be started at the same time. To avoid this
+        problem, invalidateDistribution, i.e. a method for invalidating current
+        distribution, should not make shadow host reattach. Instead, it should
+        make distribute nodes reattached and set needsRecalcStyle flag of
+        shadow host.
+
+        Test: transitions/transition-on-shadow-host-with-distributed-node.html
+
+        * dom/ElementShadow.cpp:
+        (WebCore::ElementShadow::addShadowRoot):
+        To support replaced elements, i.e. IMG, and so on, shadow host's
+        renderer must be updated when author shadow roots are addded.
+        So invoke shadow host's reattach instead of shadowRoot's attach.
+        (WebCore::ElementShadow::invalidateDistribution):
+        Remove shadow host's lazy reattach (detach and lazyAttach). Instead, do
+        distributed nodes' lazy reattach and set shadow host's needsRecalcStyle
+        flag.
+        * dom/Node.h:
+        (WebCore::Node::lazyReattach):
+        Newly added. The method works like Node::reattach, but use
+        lazyAttach instead of attach.
+        (WebCore):
+
 2012-08-27  Justin Novosad  <[email protected]>
 
         [Chromium] Fixing infinite recursion in Canvas2DLayerManager

Modified: trunk/Source/WebCore/dom/ElementShadow.cpp (126788 => 126789)


--- trunk/Source/WebCore/dom/ElementShadow.cpp	2012-08-27 20:32:00 UTC (rev 126788)
+++ trunk/Source/WebCore/dom/ElementShadow.cpp	2012-08-27 20:39:18 UTC (rev 126789)
@@ -83,8 +83,11 @@
     invalidateDistribution(shadowHost);
     ChildNodeInsertionNotifier(shadowHost).notify(shadowRoot.get());
 
-    if (shadowHost->attached() && !shadowRoot->attached())
-        shadowRoot->attach();
+    // FIXME(94905): ShadowHost should be reattached during recalcStyle.
+    // Set some flag here and recreate shadow hosts' renderer in
+    // Element::recalcStyle.
+    if (shadowHost->attached())
+        shadowHost->lazyReattach();
 
     InspectorInstrumentation::didPushShadowRoot(shadowHost, shadowRoot.get());
 }
@@ -205,8 +208,9 @@
     bool needsReattach = needsInvalidation ? m_distributor.invalidate(host) : false;
 
     if (needsReattach && host->attached()) {
-        host->detach();
-        host->lazyAttach();
+        for (Node* n = host->firstChild(); n; n = n->nextSibling())
+            n->lazyReattach();
+        host->setNeedsStyleRecalc();
     }
 
     if (needsInvalidation)

Modified: trunk/Source/WebCore/dom/Node.h (126788 => 126789)


--- trunk/Source/WebCore/dom/Node.h	2012-08-27 20:32:00 UTC (rev 126788)
+++ trunk/Source/WebCore/dom/Node.h	2012-08-27 20:39:18 UTC (rev 126789)
@@ -355,6 +355,7 @@
         DoNotSetAttached
     };
     void lazyAttach(ShouldSetAttached = SetAttached);
+    void lazyReattach(ShouldSetAttached = SetAttached);
 
     virtual void setFocus(bool = true);
     virtual void setActive(bool f = true, bool /*pause*/ = false) { setFlag(f, IsActiveFlag); }
@@ -876,6 +877,13 @@
         reattach();
 }
 
+inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached)
+{
+    if (attached())
+        detach();
+    lazyAttach(shouldSetAttached);
+}
+
 } //namespace
 
 #ifndef NDEBUG
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to