Title: [243687] trunk
Revision
243687
Author
[email protected]
Date
2019-03-31 23:42:31 -0700 (Sun, 31 Mar 2019)

Log Message

Scroll position gets reset when overflow:scroll is inside grid
https://bugs.webkit.org/show_bug.cgi?id=196337
<rdar://problem/49385784>

Reviewed by Simon Fraser.

Fix scroll position when there are changes inside a grid item with "overflow: scroll".

Source/WebCore:

Test: fast/css-grid-layout/grid-item-content-scroll-position.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock): Use beginUpdateScrollInfoAfterLayoutTransaction()
and endAndCommitUpdateScrollInfoAfterLayoutTransaction().

LayoutTests:

* fast/css-grid-layout/grid-item-content-scroll-position-expected.txt: Added.
* fast/css-grid-layout/grid-item-content-scroll-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243686 => 243687)


--- trunk/LayoutTests/ChangeLog	2019-04-01 02:03:14 UTC (rev 243686)
+++ trunk/LayoutTests/ChangeLog	2019-04-01 06:42:31 UTC (rev 243687)
@@ -1,3 +1,16 @@
+2019-03-31  Manuel Rego Casasnovas  <[email protected]>
+
+        Scroll position gets reset when overflow:scroll is inside grid
+        https://bugs.webkit.org/show_bug.cgi?id=196337
+        <rdar://problem/49385784>
+
+        Reviewed by Simon Fraser.
+
+        Fix scroll position when there are changes inside a grid item with "overflow: scroll".
+
+        * fast/css-grid-layout/grid-item-content-scroll-position-expected.txt: Added.
+        * fast/css-grid-layout/grid-item-content-scroll-position.html: Added.
+
 2019-03-31  Wenson Hsieh  <[email protected]>
 
         [iOS] Crash when changing inputmode for certain types of focusable elements

Added: trunk/LayoutTests/fast/css-grid-layout/grid-item-content-scroll-position-expected.txt (0 => 243687)


--- trunk/LayoutTests/fast/css-grid-layout/grid-item-content-scroll-position-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-content-scroll-position-expected.txt	2019-04-01 06:42:31 UTC (rev 243687)
@@ -0,0 +1,4 @@
+
+PASS Checks that scroll position is kept when an element inside a grid item is showed. 
+foo
+bar

Added: trunk/LayoutTests/fast/css-grid-layout/grid-item-content-scroll-position.html (0 => 243687)


--- trunk/LayoutTests/fast/css-grid-layout/grid-item-content-scroll-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-content-scroll-position.html	2019-04-01 06:42:31 UTC (rev 243687)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<style>
+#grid {
+  display: grid;
+  height: 200px;
+}
+#item {
+  overflow: scroll;
+}
+#content {
+  height: 800px;
+}
+
+#bar {
+  display: none;
+  margin-top: 200px;
+}
+</style>
+<script src=""
+<script src=""
+
+<div id="log"></div>
+
+<div id="grid">
+  <div id="item">
+    <div id="content">
+      <div>foo</div>
+      <div id="bar">bar</div>
+    </div>
+  </div>
+</div>
+
+<script>
+_onload_ = () => {
+  var item = document.getElementById("item");
+  item.scrollTo(0, 200);
+  document.getElementById("bar").style.display = "block";
+  test(() => {
+    assert_equals(item.scrollTop, 200);
+  }, "Checks that scroll position is kept when an element inside a grid item is showed.");
+};
+</script>

Modified: trunk/Source/WebCore/ChangeLog (243686 => 243687)


--- trunk/Source/WebCore/ChangeLog	2019-04-01 02:03:14 UTC (rev 243686)
+++ trunk/Source/WebCore/ChangeLog	2019-04-01 06:42:31 UTC (rev 243687)
@@ -1,3 +1,19 @@
+2019-03-31  Manuel Rego Casasnovas  <[email protected]>
+
+        Scroll position gets reset when overflow:scroll is inside grid
+        https://bugs.webkit.org/show_bug.cgi?id=196337
+        <rdar://problem/49385784>
+
+        Reviewed by Simon Fraser.
+
+        Fix scroll position when there are changes inside a grid item with "overflow: scroll".
+
+        Test: fast/css-grid-layout/grid-item-content-scroll-position.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::layoutBlock): Use beginUpdateScrollInfoAfterLayoutTransaction()
+        and endAndCommitUpdateScrollInfoAfterLayoutTransaction().
+
 2019-03-31  Ryosuke Niwa  <[email protected]>
 
         Reduce the size of Node::deref by eliminating an explicit parentNode check

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (243686 => 243687)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2019-04-01 02:03:14 UTC (rev 243686)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2019-04-01 06:42:31 UTC (rev 243687)
@@ -188,6 +188,7 @@
         LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
 
         preparePaginationBeforeBlockLayout(relayoutChildren);
+        beginUpdateScrollInfoAfterLayoutTransaction();
 
         LayoutSize previousSize = size();
         // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff.
@@ -279,6 +280,8 @@
         layoutGridItems();
         m_trackSizingAlgorithm.reset();
 
+        endAndCommitUpdateScrollInfoAfterLayoutTransaction();
+
         if (size() != previousSize)
             relayoutChildren = true;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to