Title: [271053] trunk
Revision
271053
Author
[email protected]
Date
2020-12-22 08:09:03 -0800 (Tue, 22 Dec 2020)

Log Message

Layout overflow is computed incorrectly inside flexbox (breaks sticky positioning)
https://bugs.webkit.org/show_bug.cgi?id=220075
Source/WebCore:

<rdar://problem/70956639>

Reviewed by Zalan Bujtas.

RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction(), which is only called by grid
and flexbox layout, would unconditionally clear layout overflow on boxes with overflow clipping,
which resulted in incorrect sticky positioning because RenderBoxModelObject::computeStickyPositionConstraints()
consults layout overflow.

It was only through happenstance that overflow:scroll worked correctly, relying on the fact
that updateScrollInfoAfterLayout() would trigger caching of scroll dimensions on RenderLayer.

This clearing was added in r151360 but seems incorrect; layout overflow should be preserved
after layout.

Test: fast/flexbox/preserve-layout-overflow.html

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

LayoutTests:

Reviewed by Zalan Bujtas.

* fast/flexbox/preserve-layout-overflow-expected.txt: Added.
* fast/flexbox/preserve-layout-overflow.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271052 => 271053)


--- trunk/LayoutTests/ChangeLog	2020-12-22 14:33:47 UTC (rev 271052)
+++ trunk/LayoutTests/ChangeLog	2020-12-22 16:09:03 UTC (rev 271053)
@@ -1,3 +1,13 @@
+2020-12-22  Simon Fraser  <[email protected]>
+
+        Layout overflow is computed incorrectly inside flexbox (breaks sticky positioning)
+        https://bugs.webkit.org/show_bug.cgi?id=220075
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/flexbox/preserve-layout-overflow-expected.txt: Added.
+        * fast/flexbox/preserve-layout-overflow.html: Added.
+
 2020-12-21  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=220078

Added: trunk/LayoutTests/fast/flexbox/preserve-layout-overflow-expected.txt (0 => 271053)


--- trunk/LayoutTests/fast/flexbox/preserve-layout-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/preserve-layout-overflow-expected.txt	2020-12-22 16:09:03 UTC (rev 271053)
@@ -0,0 +1,8 @@
+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
+    RenderFlexibleBox {BODY} at (8,8) size 622x522 [border: (1px solid #000000)]
+layer at (39,39) size 402x460 clip at (40,40) size 385x443 scrollHeight 2500
+  RenderBlock {DIV} at (31,31) size 402x460 [border: (1px solid #000000)] (layout overflow 1,1 385x2500)
+    RenderBlock {DIV} at (1,1) size 385x2500

Added: trunk/LayoutTests/fast/flexbox/preserve-layout-overflow.html (0 => 271053)


--- trunk/LayoutTests/fast/flexbox/preserve-layout-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/preserve-layout-overflow.html	2020-12-22 16:09:03 UTC (rev 271053)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<head>
+<style>
+html {
+	height: 100%;
+}
+
+body {
+	display: flex;
+	flex-direction: column;
+	width: 600px;
+    height: 500px;
+    padding: 10px;
+    border: 1px solid black;
+}
+
+.container {
+    width: 400px;
+    height: 340px;
+    margin: 20px;
+	flex: 1 1 0;
+	overflow: scroll;
+    border: 1px solid black;
+}
+
+.content {
+	height: 2500px;
+    background-image: repeating-linear-gradient(white, silver 300px);
+}
+</style>
+<script>
+    if (window.testRunner)
+        testRunner.setRenderTreeDumpOptions(testRunner.RENDER_TREE_SHOW_OVERFLOW);
+</script>
+</head>
+<body>
+<div class="container">
+	<div class="content"></div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (271052 => 271053)


--- trunk/Source/WebCore/ChangeLog	2020-12-22 14:33:47 UTC (rev 271052)
+++ trunk/Source/WebCore/ChangeLog	2020-12-22 16:09:03 UTC (rev 271053)
@@ -1,3 +1,27 @@
+2020-12-22  Simon Fraser  <[email protected]>
+
+        Layout overflow is computed incorrectly inside flexbox (breaks sticky positioning)
+        https://bugs.webkit.org/show_bug.cgi?id=220075
+        <rdar://problem/70956639>
+
+        Reviewed by Zalan Bujtas.
+
+        RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction(), which is only called by grid
+        and flexbox layout, would unconditionally clear layout overflow on boxes with overflow clipping,
+        which resulted in incorrect sticky positioning because RenderBoxModelObject::computeStickyPositionConstraints()
+        consults layout overflow.
+
+        It was only through happenstance that overflow:scroll worked correctly, relying on the fact
+        that updateScrollInfoAfterLayout() would trigger caching of scroll dimensions on RenderLayer.
+
+        This clearing was added in r151360 but seems incorrect; layout overflow should be preserved
+        after layout.
+
+        Test: fast/flexbox/preserve-layout-overflow.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction):
+
 2020-12-22  Zalan Bujtas  <[email protected]>
 
         [LFC][Integration] Compute enclosing top and bottom while constructing the inline runs

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (271052 => 271053)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2020-12-22 14:33:47 UTC (rev 271052)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2020-12-22 16:09:03 UTC (rev 271053)
@@ -554,7 +554,6 @@
     for (auto* block : blocksToUpdate) {
         ASSERT(block->hasOverflowClip());
         block->layer()->updateScrollInfoAfterLayout();
-        block->clearLayoutOverflow();
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to