Title: [282201] trunk
Revision
282201
Author
[email protected]
Date
2021-09-09 01:16:24 -0700 (Thu, 09 Sep 2021)

Log Message

Position sticky does not work within table cells
https://bugs.webkit.org/show_bug.cgi?id=155496

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-ref.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html: Added.

Source/WebCore:

When computing the content box rect of a sticky container, do not include
intrinsic padding. Instead, use the values computed from CSS. The instrinsic
padding should not limit the movement area of a position:sticky item.

* web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-ref.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html: Added.

Test: imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): Use CSS computed
values which do not include intrinsic padding.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282200 => 282201)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-09 08:10:20 UTC (rev 282200)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-09 08:16:24 UTC (rev 282201)
@@ -1,3 +1,13 @@
+2021-09-09  Martin Robinson  <[email protected]>
+
+        Position sticky does not work within table cells
+        https://bugs.webkit.org/show_bug.cgi?id=155496
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-ref.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html: Added.
+
 2021-09-09  Youenn Fablet  <[email protected]>
 
         Add support for RTCError and RTCErrorEvent

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-expected.html (0 => 282201)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-expected.html	2021-09-09 08:16:24 UTC (rev 282201)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<title>position:sticky should work for elements with display: table* containing blocks</title>
+<link rel="help" href="" />
+<meta name="assert" content="This test checks that position:sticky works for elements with containing blocks that have display: table*" />
+
+<style>
+.group {
+  display: inline-block;
+}
+
+.container {
+  height: 1000px;
+  width: 50px;
+  margin-right: 10px;
+}
+
+.scroll-container {
+  height: 300px;
+  width: 500px;
+  overflow: hidden;
+}
+
+.sticky {
+  height: 50px;
+  width: 50px;
+  background: green;
+}
+</style>
+
+<div class="scroll-container">
+    <div class="group">
+        <div class="container" style="display: table-cell;">
+          <div class="sticky"></div>
+        </div>
+    </div>
+
+    <div class="group">
+        <div class="container" style="display: table-row;">
+          <div class="sticky"></div>
+        </div>
+    </div>
+
+    <div class="group">
+        <div class="container" style="display: table;">
+          <div class="sticky"></div>
+        </div>
+    </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html (0 => 282201)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html	2021-09-09 08:16:24 UTC (rev 282201)
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<title>position:sticky should work for elements with display: table* containing blocks</title>
+<link rel="match" href="" />
+<link rel="help" href="" />
+<meta name="assert" content="This test checks that position:sticky works for elements with containing blocks that have display: table*" />
+
+<style>
+.group {
+  display: inline-block;
+}
+
+.container {
+  height: 1000px;
+  width: 50px;
+  margin-right: 10px;
+}
+
+#scroll-container {
+  height: 300px;
+  width: 500px;
+  overflow: hidden;
+  position: relative;
+}
+
+.sticky {
+  position: sticky;
+  height: 50px;
+  width: 50px;
+  background: green;
+  top: 0;
+}
+
+#scroll-indicator {
+    display: inline-block;
+    position: absolute;
+    top: 0px;
+    width: 300px;
+    height: 50px;
+    background: red;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroll-container').scrollTop = 300;
+});
+</script>
+
+
+<div id="scroll-container">
+    <div class="group">
+        <div class="container" style="display: table-cell;">
+          <div class="sticky"></div>
+        </div>
+    </div>
+
+    <div class="group">
+        <div class="container" style="display: table-row;">
+          <div class="sticky"></div>
+        </div>
+    </div>
+
+    <div class="group">
+        <div class="container" style="display: table;">
+          <div class="sticky"></div>
+        </div>
+    </div>
+
+    <!-- This is here to validate that the container does scroll. -->
+    <div id="scroll-indicator" style=""></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (282200 => 282201)


--- trunk/Source/WebCore/ChangeLog	2021-09-09 08:10:20 UTC (rev 282200)
+++ trunk/Source/WebCore/ChangeLog	2021-09-09 08:16:24 UTC (rev 282201)
@@ -1,3 +1,23 @@
+2021-09-09  Martin Robinson  <[email protected]>
+
+        Position sticky does not work within table cells
+        https://bugs.webkit.org/show_bug.cgi?id=155496
+
+        Reviewed by Simon Fraser.
+
+        When computing the content box rect of a sticky container, do not include
+        intrinsic padding. Instead, use the values computed from CSS. The instrinsic
+        padding should not limit the movement area of a position:sticky item.
+
+        * web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table-ref.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html: Added.
+
+        Test: imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-contained-by-display-table.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): Use CSS computed
+        values which do not include intrinsic padding.
+
 2021-09-09  Youenn Fablet  <[email protected]>
 
         Add support for RTCError and RTCErrorEvent

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (282200 => 282201)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-09-09 08:10:20 UTC (rev 282200)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-09-09 08:16:24 UTC (rev 282201)
@@ -466,7 +466,7 @@
         // the hierarchy between this stickily positioned item and its scrolling ancestor. In both cases,
         // we use the content box rectangle of the containing block, which is what should constrain the
         // movement.
-        containerContentRect = containingBlock->contentBoxRect();
+        containerContentRect = containingBlock->computedCSSContentBoxRect();
     } else {
         containerContentRect = containingBlock->layoutOverflowRect();
         containerContentRect.contract(LayoutBoxExtent {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to