Title: [286417] trunk
Revision
286417
Author
mrobin...@webkit.org
Date
2021-12-02 00:18:21 -0800 (Thu, 02 Dec 2021)

Log Message

sticky th or td in table does not stops at specified top
https://bugs.webkit.org/show_bug.cgi?id=232431
<rdar://problem/85011818>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

Add new WPT tests that test the behavior of sticky <td> elements in the middle of
tables.

* web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html: Added.
* web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html: Added.

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html
       imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html
       imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html
       imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html

* rendering/RenderBox.h: Make frameRectForStickyPositioning not final.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::frameRectForStickyPositioning const): Added this implementation
that takes into account that RenderTableCell is positioned relatively to the RenderTableSection.
* rendering/RenderTableCell.h: Added method declaration.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286416 => 286417)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-02 08:16:13 UTC (rev 286416)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-02 08:18:21 UTC (rev 286417)
@@ -1,3 +1,23 @@
+2021-12-02  Martin Robinson  <mrobin...@webkit.org>
+
+        sticky th or td in table does not stops at specified top
+        https://bugs.webkit.org/show_bug.cgi?id=232431
+        <rdar://problem/85011818>
+
+        Reviewed by Simon Fraser.
+
+        Add new WPT tests that test the behavior of sticky <td> elements in the middle of
+        tables.
+
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html: Added.
+        * web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html: Added.
+
 2021-12-02  Manuel Rego Casasnovas  <r...@igalia.com>
 
         [selectors] :focus-visible should stop matching after blur

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom-expected.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<title>Reference for position:sticky bottom constraint should behave correctly for &lt;td&gt; elements</title>
+
+<style>
+.group {
+  display: inline-block;
+  position: relative;
+  width: 150px;
+  height: 200px;
+}
+
+.scroller {
+  position: relative;
+  width: 100px;
+  height: 150px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.contents {
+  height: 550px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: green;
+  left: 0;
+  height: 50px;
+  width: 50px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollTop = 0;
+  document.getElementById('scroller2').scrollTop = 75;
+  document.getElementById('scroller3').scrollTop = 150;
+});
+</script>
+
+<div>You should see three green boxes below. No red should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="top: 100px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="top: 150px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="top: 200px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,109 @@
+<!DOCTYPE html>
+<title>position:sticky bottom constraint should behave correctly for &lt;td&gt; elements</title>
+<link rel="match" href="" />
+<link rel="help" href="" />
+<meta name="assert" content="This test checks that the position:sticky bottom constraint behaves correctly for &lt;td&gt; elements" />
+
+<style>
+table {
+  border-collapse:collapse;
+}
+
+td {
+  padding: 0;
+}
+
+td > div {
+  height: 50px;
+  width: 50px;
+}
+
+.group {
+  display: inline-block;
+  position: relative;
+  width: 150px;
+  height: 200px;
+}
+
+.scroller {
+  position: relative;
+  width: 100px;
+  height: 150px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.prepadding {
+  height: 100px;
+}
+
+.postpadding {
+  height: 250px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: red;
+  left: 0;
+  height: 50px;
+  width: 50px;
+}
+
+.sticky {
+  position: sticky;
+  bottom: 25px;
+  background-color: green;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollTop = 0;
+  document.getElementById('scroller2').scrollTop = 75;
+  document.getElementById('scroller3').scrollTop = 150;
+});
+</script>
+
+<div>You should see three green boxes below. No red should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="top: 100px;"></div>
+    <div class="prepadding"></div>
+    <table>
+      <tr><td><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+      <tr><td class="sticky"><div></div></td></td>
+      <tr><td><div></div></td></tr>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="top: 150px;"></div>
+    <div class="prepadding"></div>
+    <table>
+      <tr><td><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+      <tr><td class="sticky"><div></div></td></td>
+      <tr><td><div></div></td></tr>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="top: 200px;"></div>
+    <div class="prepadding"></div>
+    <table>
+      <tr><td><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+      <tr><td class="sticky"><div></div></td></td>
+      <tr><td><div></div></td></tr>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left-expected.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<title>Reference for position:sticky left constraint should behave correctly for &lt;td&gt; elements</title>
+
+<style>
+.group {
+  position: relative;
+  width: 250px;
+  height: 150px;
+}
+
+.scroller {
+  position: relative;
+  width: 200px;
+  height: 100px;
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.contents {
+  height: 10px;
+  width: 500px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: green;
+  top: 0;
+  height: 50px;
+  width: 50px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollLeft = 50;
+  document.getElementById('scroller2').scrollLeft = 175;
+  document.getElementById('scroller3').scrollLeft = 250;
+});
+</script>
+
+<div>You should see three green boxes below. No red or blue should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="left: 150px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="left: 200px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="left: 250px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<title>position:sticky left constraint should behave correctly for &lt;td&gt; elements</title>
+<link rel="match" href="" />
+<link rel="help" href="" />
+<meta name="assert" content="This test checks that the position:sticky left constraint behaves correctly for &lt;td&gt; elements" />
+
+<script src=""
+
+<style>
+table {
+    border-collapse: collapse;
+    margin-left: 100px;
+}
+
+td {
+  padding: 0;
+}
+
+td > div {
+  height: 50px;
+  width: 50px;
+}
+
+.group {
+  position: relative;
+  width: 250px;
+  height: 150px;
+}
+
+.scroller {
+  position: relative;
+  width: 200px;
+  height: 100px;
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.postpadding {
+  height: 10px;
+  width: 500px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: red;
+  top: 0;
+  height: 50px;
+  width: 50px;
+}
+
+.sticky {
+  position: sticky;
+  left: 25px;
+  background-color: green;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollLeft = 50;
+  document.getElementById('scroller2').scrollLeft = 175;
+  document.getElementById('scroller3').scrollLeft = 250;
+  createIndicatorForStickyElements(document.querySelectorAll('.sticky'));
+});
+</script>
+
+<div>You should see three green boxes below. No red or blue should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="left: 150px;"></div>
+    <table>
+      <tbody>
+        <tr>
+          <td><div></div></td>
+          <td class="sticky"><div></div></td>
+          <td><div></div></td>
+          <td><div></div></td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="left: 200px;"></div>
+    <table>
+      <tbody>
+        <tr>
+          <td><div></div></td>
+          <td class="sticky"><div></div></td>
+          <td><div></div></td>
+          <td><div></div></td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="left: 250px;"></div>
+    <table>
+      <tbody>
+        <tr>
+          <td><div></div></td>
+          <td class="sticky"><div></div></td>
+          <td><div></div></td>
+          <td><div></div></td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right-expected.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<title>Reference for position:sticky right constraint should behave correctly for &lt;td&gt; elements</title>
+
+<style>
+.group {
+  position: relative;
+  width: 250px;
+  height: 150px;
+}
+
+.scroller {
+  position: relative;
+  width: 200px;
+  height: 100px;
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.contents {
+  height: 10px;
+  width: 500px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: green;
+  top: 0;
+  height: 50px;
+  width: 50px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollLeft = 0;
+  document.getElementById('scroller2').scrollLeft = 75;
+  document.getElementById('scroller3').scrollLeft = 150;
+});
+</script>
+
+<div>You should see three green boxes below. No red or blue should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="left: 150px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="left: 200px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="left: 250px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<title>position:sticky right constraint should behave correctly for &lt;td&gt; elements</title>
+<link rel="match" href="" />
+<link rel="help" href="" />
+<meta name="assert" content="This test checks that the position:sticky right constraint behaves correctly for &lt;td&gt; elements" />
+
+<script src=""
+
+<style>
+table {
+    border-collapse: collapse;
+    margin-left: 150px;
+}
+
+td {
+  padding: 0;
+}
+
+td > div {
+  height: 50px;
+  width: 50px;
+}
+
+.group {
+  position: relative;
+  width: 250px;
+  height: 150px;
+}
+
+.scroller {
+  position: relative;
+  width: 200px;
+  height: 100px;
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.postpadding {
+  height: 10px;
+  width: 500px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: red;
+  top: 0;
+  height: 50px;
+  width: 50px;
+}
+
+.sticky {
+  position: sticky;
+  right: 25px;
+  background-color: green;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollLeft = 0;
+  document.getElementById('scroller2').scrollLeft = 75;
+  document.getElementById('scroller3').scrollLeft = 150;
+  createIndicatorForStickyElements(document.querySelectorAll('.sticky'));
+});
+</script>
+
+<div>You should see three green boxes below. No red or blue should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="left: 150px;"></div>
+    <table>
+      <tbody>
+        <tr>
+          <td><div></div></td>
+          <td><div></div></td>
+          <td class="sticky"><div></div></td>
+          <td><div></div></td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="left: 200px;"></div>
+    <table>
+      <tbody>
+        <tr>
+          <td><div></div></td>
+          <td><div></div></td>
+          <td class="sticky"><div></div></td>
+          <td><div></div></td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="left: 250px;"></div>
+    <table>
+      <tbody>
+        <tr>
+          <td><div></div></td>
+          <td><div></div></td>
+          <td class="sticky"><div></div></td>
+          <td><div></div></td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top-expected.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<title>Reference for position:sticky top constraint should behave correctly for &lt;td&gt; elements</title>
+
+<style>
+.group {
+  display: inline-block;
+  position: relative;
+  width: 150px;
+  height: 200px;
+}
+
+.scroller {
+  position: relative;
+  width: 100px;
+  height: 150px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.contents {
+  height: 550px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: green;
+  left: 0;
+  height: 50px;
+  width: 50px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollTop = 150;
+  document.getElementById('scroller2').scrollTop = 225;
+  document.getElementById('scroller3').scrollTop = 250;
+});
+</script>
+
+<div>You should see three green boxes below. No red should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="top: 200px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="top: 250px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="top: 250px;"></div>
+    <div class="contents"></div>
+  </div>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html (0 => 286417)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html	2021-12-02 08:18:21 UTC (rev 286417)
@@ -0,0 +1,109 @@
+<!DOCTYPE html>
+<title>position:sticky top constraint should behave correctly for &lt;td&gt; elements</title>
+<link rel="match" href="" />
+<link rel="help" href="" />
+<meta name="assert" content="This test checks that the position:sticky top constraint behaves correctly for &lt;td&gt; elements" />
+
+<style>
+table {
+  border-collapse:collapse;
+}
+
+td {
+  padding: 0;
+}
+
+td > div {
+  height: 50px;
+  width: 50px;
+}
+
+.group {
+  display: inline-block;
+  position: relative;
+  width: 150px;
+  height: 200px;
+}
+
+.scroller {
+  position: relative;
+  width: 100px;
+  height: 150px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.prepadding {
+  height: 100px;
+}
+
+.postpadding {
+  height: 250px;
+}
+
+.indicator {
+  position: absolute;
+  background-color: red;
+  left: 0;
+  height: 50px;
+  width: 50px;
+}
+
+.sticky {
+  position: sticky;
+  top: 25px;
+  background-color: green;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollTop = 150;
+  document.getElementById('scroller2').scrollTop = 225;
+  document.getElementById('scroller3').scrollTop = 250;
+});
+</script>
+
+<div>You should see three green boxes below. No red should be visible.</div>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator" style="top: 200px;"></div>
+    <div class="prepadding"></div>
+    <table>
+      <tr><td><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+      <tr><td class="sticky"><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator" style="top: 250px;"></div>
+    <div class="prepadding"></div>
+    <table>
+        <tr><td><div></div></td></tr>
+        <tr><td><div></div></td></tr>
+        <tr><td class="sticky"><div></div></td></tr>
+        <tr><td><div></div></td></tr>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller3" class="scroller">
+    <div class="indicator" style="top: 250px;"></div>
+    <div class="prepadding"></div>
+    <table>
+      <tr><td><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+      <tr><td class="sticky"><div></div></td></tr>
+      <tr><td><div></div></td></tr>
+    </table>
+    <div class="postpadding"></div>
+  </div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (286416 => 286417)


--- trunk/Source/WebCore/ChangeLog	2021-12-02 08:16:13 UTC (rev 286416)
+++ trunk/Source/WebCore/ChangeLog	2021-12-02 08:18:21 UTC (rev 286417)
@@ -1,3 +1,22 @@
+2021-12-02  Martin Robinson  <mrobin...@webkit.org>
+
+        sticky th or td in table does not stops at specified top
+        https://bugs.webkit.org/show_bug.cgi?id=232431
+        <rdar://problem/85011818>
+
+        Reviewed by Simon Fraser.
+
+        Tests: imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-bottom.html
+               imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-left.html
+               imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-right.html
+               imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-table-td-top.html
+
+        * rendering/RenderBox.h: Make frameRectForStickyPositioning not final.
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::frameRectForStickyPositioning const): Added this implementation
+        that takes into account that RenderTableCell is positioned relatively to the RenderTableSection.
+        * rendering/RenderTableCell.h: Added method declaration.
+
 2021-12-01  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][a11y] Add implementation of table and table cell interfaces when building with ATSPI

Modified: trunk/Source/WebCore/rendering/RenderBox.h (286416 => 286417)


--- trunk/Source/WebCore/rendering/RenderBox.h	2021-12-02 08:16:13 UTC (rev 286416)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2021-12-02 08:18:21 UTC (rev 286417)
@@ -783,7 +783,7 @@
     // These include tables, positioned objects, floats and flexible boxes.
     virtual void computePreferredLogicalWidths();
 
-    LayoutRect frameRectForStickyPositioning() const final { return frameRect(); }
+    LayoutRect frameRectForStickyPositioning() const override { return frameRect(); }
 
     LayoutRect computeVisibleRectUsingPaintOffset(const LayoutRect&) const;
     

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (286416 => 286417)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2021-12-02 08:16:13 UTC (rev 286416)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2021-12-02 08:18:21 UTC (rev 286417)
@@ -203,6 +203,17 @@
     }
 }
 
+LayoutRect RenderTableCell::frameRectForStickyPositioning() const
+{
+    // RenderTableCell has the RenderTableRow as the container, but is positioned relatively
+    // to the RenderTableSection. The sticky positioning algorithm assumes that elements are
+    // positioned relatively to their container, so we correct for that here.
+    ASSERT(parentBox());
+    auto returnValue = frameRect();
+    returnValue.move(-parentBox()->locationOffset());
+    return returnValue;
+}
+
 void RenderTableCell::computeIntrinsicPadding(LayoutUnit rowHeight)
 {
     LayoutUnit oldIntrinsicPaddingBefore = intrinsicPaddingBefore();

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (286416 => 286417)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2021-12-02 08:16:13 UTC (rev 286416)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2021-12-02 08:18:21 UTC (rev 286417)
@@ -138,6 +138,8 @@
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     void computePreferredLogicalWidths() override;
 
+    LayoutRect frameRectForStickyPositioning() const override;
+
     static RenderPtr<RenderTableCell> createTableCellWithStyle(Document&, const RenderStyle&);
 
     const char* renderName() const override { return (isAnonymous() || isPseudoElement()) ? "RenderTableCell (anonymous)" : "RenderTableCell"; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to