[css-grid] Horizontal scroll must account for grid container's height
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jun 2016 12:11:22 +0000 (12:11 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Jun 2016 12:11:22 +0000 (12:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157971

Reviewed by Darin Adler.

Source/WebCore:

We don't consider the scrollbar when computing the grid container's
logical height at the beginning of the 'layoutBlock' logic. We must
do it because otherwise, contentLogicalHeight may return a negative
value.

Test: fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):

LayoutTests:

Test to verify we account horizontal scrollbar's size for grid container's
height computation.

* fast/css-grid-layout/grid-container-scroll-accounts-for-sizing-expected.html: Added.
* fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201709 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-container-scroll-accounts-for-sizing-expected.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp

index cfa5944..b70b09c 100644 (file)
@@ -1,3 +1,16 @@
+2016-06-06  Javier Fernandez  <jfernandez@igalia.com>
+
+        [css-grid] Horizontal scroll must account for grid container's height
+        https://bugs.webkit.org/show_bug.cgi?id=157971
+
+        Reviewed by Darin Adler.
+
+        Test to verify we account horizontal scrollbar's size for grid container's
+        height computation.
+
+        * fast/css-grid-layout/grid-container-scroll-accounts-for-sizing-expected.html: Added.
+        * fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html: Added.
+
 2016-06-05  Sam Weinig  <sam@webkit.org>
 
         Add experimental support for spring based CSS animations
diff --git a/LayoutTests/fast/css-grid-layout/grid-container-scroll-accounts-for-sizing-expected.html b/LayoutTests/fast/css-grid-layout/grid-container-scroll-accounts-for-sizing-expected.html
new file mode 100644 (file)
index 0000000..e357cf3
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<link href="../css-intrinsic-dimensions/resources/width-keyword-classes.css" rel="stylesheet">
+<style>
+html {
+   overflow-x: scroll;
+}
+.container {
+   overflow-y: scroll;
+   overflow-x: scroll;
+}
+.item {
+    background: lime;
+    width: 100px;
+    height: 100px;
+}
+</style>
+<p>This test passes if you see a 100x100px green box and scrollbars are disabled.</p>
+<div class="container fit-content">
+    <div class="item">item</div>
+</div>
diff --git a/LayoutTests/fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html b/LayoutTests/fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html
new file mode 100644 (file)
index 0000000..0a8182b
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<link href="../css-intrinsic-dimensions/resources/width-keyword-classes.css" rel="stylesheet">
+<style>
+html {
+   overflow-x: scroll;
+}
+.container {
+   display: grid;
+   overflow-y: scroll;
+   overflow-x: scroll;
+}
+.item {
+    background: lime;
+    width: 100px;
+    height: 100px;
+}
+</style>
+<p>This test passes if you see a 100x100px green box and scrollbars are disabled.</p>
+<div class="container fit-content">
+    <div class="item">item</div>
+</div>
index cef64ee..14c0c01 100644 (file)
@@ -1,3 +1,20 @@
+2016-06-06  Javier Fernandez  <jfernandez@igalia.com>
+
+        [css-grid] Horizontal scroll must account for grid container's height
+        https://bugs.webkit.org/show_bug.cgi?id=157971
+
+        Reviewed by Darin Adler.
+
+        We don't consider the scrollbar when computing the grid container's
+        logical height at the beginning of the 'layoutBlock' logic. We must
+        do it because otherwise, contentLogicalHeight may return a negative
+        value.
+
+        Test: fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::layoutBlock):
+
 2016-06-06  Alex Christensen  <achristensen@webkit.org>
 
         Reduce ResourceRequest copying in loading code
index 6155a28..ceb924f 100644 (file)
@@ -399,7 +399,7 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit)
         computeIntrinsicLogicalHeight(sizingData);
     else
         computeTrackSizesForDirection(ForRows, sizingData, availableLogicalHeight(ExcludeMarginBorderPadding));
-    setLogicalHeight(computeTrackBasedLogicalHeight(sizingData) + borderAndPaddingLogicalHeight());
+    setLogicalHeight(computeTrackBasedLogicalHeight(sizingData) + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight());
 
     LayoutUnit oldClientAfterEdge = clientLogicalBottom();
     updateLogicalHeight();