Title: [201984] trunk
Revision
201984
Author
[email protected]
Date
2016-06-12 13:45:44 -0700 (Sun, 12 Jun 2016)

Log Message

Remove positioned descendants when RenderBlock is no longer a containing block.
https://bugs.webkit.org/show_bug.cgi?id=158655
<rdar://problem/26510032>

Reviewed by Simon Fraser.

Normally the RenderView is the containing block for fixed positioned renderers.
However when a renderer acquires some transform related properties, it becomes the containing
block for all the fixed positioned renderers in its descendant tree.
When the last transform related property is removed, the renderer is no longer a containing block
and we need to remove all these positioned renderers from the descendant tracker map (gPositionedDescendantsMap).
They will be inserted back into the tracker map during the next layout (either under the RenderView or
under the next transformed renderer in the ancestor chain).

Source/WebCore:

Test: fast/block/fixed-position-reparent-when-transition-is-removed.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removePositionedObjectsIfNeeded):

LayoutTests:

* fast/block/fixed-position-reparent-when-transition-is-removed-expected.txt: Added.
* fast/block/fixed-position-reparent-when-transition-is-removed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201983 => 201984)


--- trunk/LayoutTests/ChangeLog	2016-06-12 13:22:53 UTC (rev 201983)
+++ trunk/LayoutTests/ChangeLog	2016-06-12 20:45:44 UTC (rev 201984)
@@ -1,3 +1,22 @@
+2016-06-12  Zalan Bujtas  <[email protected]>
+
+        Remove positioned descendants when RenderBlock is no longer a containing block.
+        https://bugs.webkit.org/show_bug.cgi?id=158655
+        <rdar://problem/26510032>
+
+        Reviewed by Simon Fraser.
+
+        Normally the RenderView is the containing block for fixed positioned renderers.
+        However when a renderer acquires some transform related properties, it becomes the containing
+        block for all the fixed positioned renderers in its descendant tree.
+        When the last transform related property is removed, the renderer is no longer a containing block
+        and we need to remove all these positioned renderers from the descendant tracker map (gPositionedDescendantsMap).
+        They will be inserted back into the tracker map during the next layout (either under the RenderView or
+        under the next transformed renderer in the ancestor chain).
+
+        * fast/block/fixed-position-reparent-when-transition-is-removed-expected.txt: Added.
+        * fast/block/fixed-position-reparent-when-transition-is-removed.html: Added.
+
 2016-06-11  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems

Added: trunk/LayoutTests/fast/block/fixed-position-reparent-when-transition-is-removed-expected.txt (0 => 201984)


--- trunk/LayoutTests/fast/block/fixed-position-reparent-when-transition-is-removed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/fixed-position-reparent-when-transition-is-removed-expected.txt	2016-06-12 20:45:44 UTC (rev 201984)
@@ -0,0 +1,2 @@
+PASS if no crash or assert.
+

Added: trunk/LayoutTests/fast/block/fixed-position-reparent-when-transition-is-removed.html (0 => 201984)


--- trunk/LayoutTests/fast/block/fixed-position-reparent-when-transition-is-removed.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/fixed-position-reparent-when-transition-is-removed.html	2016-06-12 20:45:44 UTC (rev 201984)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests the case when fixed positioned elements has a new containing block.</title>
+<style>
+div {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+</style>
+</head>
+<body>
+PASS if no crash or assert.
+<div id=container style="position: absolute; transform: rotate(10deg);">
+  <div id=fixedChild style="position: fixed;"></div>
+</div>
+<script>
+if (window.testRunner) {
+  testRunner.waitUntilDone();
+  testRunner.dumpAsText();
+}
+var container = document.getElementById("container"); 
+setTimeout(function() {
+  container.style.transform = "";
+  setTimeout(function() {
+    var removeThis = document.getElementById("fixedChild");
+    removeThis.parentNode.removeChild(removeThis);
+      setTimeout(function() {
+        var newChild = document.createElement("div");
+        newChild.style.positioned = "absolute";
+        container.appendChild(newChild);
+        if (window.testRunner)
+          testRunner.notifyDone();
+    }, 0);
+  }, 0);
+}, 0);
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (201983 => 201984)


--- trunk/Source/WebCore/ChangeLog	2016-06-12 13:22:53 UTC (rev 201983)
+++ trunk/Source/WebCore/ChangeLog	2016-06-12 20:45:44 UTC (rev 201984)
@@ -1,3 +1,24 @@
+2016-06-12  Zalan Bujtas  <[email protected]>
+
+        Remove positioned descendants when RenderBlock is no longer a containing block.
+        https://bugs.webkit.org/show_bug.cgi?id=158655
+        <rdar://problem/26510032>
+
+        Reviewed by Simon Fraser.
+
+        Normally the RenderView is the containing block for fixed positioned renderers.
+        However when a renderer acquires some transform related properties, it becomes the containing
+        block for all the fixed positioned renderers in its descendant tree.
+        When the last transform related property is removed, the renderer is no longer a containing block
+        and we need to remove all these positioned renderers from the descendant tracker map (gPositionedDescendantsMap).
+        They will be inserted back into the tracker map during the next layout (either under the RenderView or
+        under the next transformed renderer in the ancestor chain).
+
+        Test: fast/block/fixed-position-reparent-when-transition-is-removed.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::removePositionedObjectsIfNeeded):
+
 2016-06-11  Myles C. Maxfield  <[email protected]>
 
         Addressing post-review comments after r201978.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (201983 => 201984)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2016-06-12 13:22:53 UTC (rev 201983)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2016-06-12 20:45:44 UTC (rev 201984)
@@ -244,14 +244,20 @@
     if (oldStyle.position() == newStyle.position() && hadTransform == willHaveTransform)
         return;
 
-    // We are no longer a containing block.
+    // We are no longer the containing block for fixed descendants.
+    if (hadTransform && !willHaveTransform) {
+        // Our positioned descendants will be inserted into a new containing block's positioned objects list during the next layout.
+        removePositionedObjects(nullptr, NewContainingBlock);
+        return;
+    }
+
+    // We are no longer the containing block for absolute positioned descendants.
     if (newStyle.position() == StaticPosition && !willHaveTransform) {
-        // Clear our positioned objects list. Our absolutely positioned descendants will be
-        // inserted into our containing block's positioned objects list during layout.
+        // Our positioned descendants will be inserted into a new containing block's positioned objects list during the next layout.
         removePositionedObjects(nullptr, NewContainingBlock);
         return;
     }
-    
+
     // We are a new containing block.
     if (oldStyle.position() == StaticPosition && !hadTransform) {
         // Remove our absolutely positioned descendants from their current containing block.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to