Title: [189702] trunk
Revision
189702
Author
r...@igalia.com
Date
2015-09-14 02:46:37 -0700 (Mon, 14 Sep 2015)

Log Message

[css-grid] Percentage columns should remove scrollbar's width
https://bugs.webkit.org/show_bug.cgi?id=149116

Reviewed by Sergio Villar Senin.

Source/WebCore:

Currently the calculation of percentage columns was not subtracting the
scrollbar's size.
Fixed RenderGrid::computeUsedBreadthOfSpecifiedLength()
to avoid this problem.

Test: fast/css-grid-layout/grid-percent-track-scrollbar.html

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

LayoutTests:

Added test to check the behavior for both columns and rows.
Note that rows (height) were already working fine.

* fast/css-grid-layout/grid-percent-track-scrollbar-expected.txt: Added.
* fast/css-grid-layout/grid-percent-track-scrollbar.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (189701 => 189702)


--- trunk/LayoutTests/ChangeLog	2015-09-14 09:45:25 UTC (rev 189701)
+++ trunk/LayoutTests/ChangeLog	2015-09-14 09:46:37 UTC (rev 189702)
@@ -1,3 +1,16 @@
+2015-09-14  Manuel Rego Casasnovas  <r...@igalia.com>
+
+        [css-grid] Percentage columns should remove scrollbar's width
+        https://bugs.webkit.org/show_bug.cgi?id=149116
+
+        Reviewed by Sergio Villar Senin.
+
+        Added test to check the behavior for both columns and rows.
+        Note that rows (height) were already working fine.
+
+        * fast/css-grid-layout/grid-percent-track-scrollbar-expected.txt: Added.
+        * fast/css-grid-layout/grid-percent-track-scrollbar.html: Added.
+
 2015-09-14  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [Streams API] pipe-to writable stream tests

Added: trunk/LayoutTests/fast/css-grid-layout/grid-percent-track-scrollbar-expected.txt (0 => 189702)


--- trunk/LayoutTests/fast/css-grid-layout/grid-percent-track-scrollbar-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-percent-track-scrollbar-expected.txt	2015-09-14 09:46:37 UTC (rev 189702)
@@ -0,0 +1,4 @@
+This test checks that percentage tracks reduce the grid's scrollbars if any in order to calculate their breadths.
+
+PASS
+PASS

Added: trunk/LayoutTests/fast/css-grid-layout/grid-percent-track-scrollbar.html (0 => 189702)


--- trunk/LayoutTests/fast/css-grid-layout/grid-percent-track-scrollbar.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-percent-track-scrollbar.html	2015-09-14 09:46:37 UTC (rev 189702)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="" rel="stylesheet">
+<style>
+.grid {
+    width: 100px;
+    height: 100px;
+    -webkit-grid-template-columns: 20% 50% 30%;
+    -webkit-grid-template-rows: 40% 60%;
+}
+
+.scroll {
+    width: 115px;
+    height: 115px;
+    overflow: scroll;
+}
+
+</style>
+<script src=""
+</head>
+<body _onload_="checkLayout('.grid');">
+    <p>This test checks that percentage tracks reduce the grid's scrollbars if any in order to calculate their breadths.</p>
+
+    <div class="grid">
+        <div data-expected-width="20" data-expected-height="40"></div>
+        <div data-expected-width="50" data-expected-height="40"></div>
+        <div data-expected-width="30" data-expected-height="40"></div>
+        <div data-expected-width="20" data-expected-height="60"></div>
+        <div data-expected-width="50" data-expected-height="60"></div>
+        <div data-expected-width="30" data-expected-height="60"></div>
+    </div>
+
+    <div class="grid scroll">
+        <div data-expected-width="20" data-expected-height="40"></div>
+        <div data-expected-width="50" data-expected-height="40"></div>
+        <div data-expected-width="30" data-expected-height="40"></div>
+        <div data-expected-width="20" data-expected-height="60"></div>
+        <div data-expected-width="50" data-expected-height="60"></div>
+        <div data-expected-width="30" data-expected-height="60"></div>
+    </div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (189701 => 189702)


--- trunk/Source/WebCore/ChangeLog	2015-09-14 09:45:25 UTC (rev 189701)
+++ trunk/Source/WebCore/ChangeLog	2015-09-14 09:46:37 UTC (rev 189702)
@@ -1,3 +1,20 @@
+2015-09-14  Manuel Rego Casasnovas  <r...@igalia.com>
+
+        [css-grid] Percentage columns should remove scrollbar's width
+        https://bugs.webkit.org/show_bug.cgi?id=149116
+
+        Reviewed by Sergio Villar Senin.
+
+        Currently the calculation of percentage columns was not subtracting the
+        scrollbar's size.
+        Fixed RenderGrid::computeUsedBreadthOfSpecifiedLength()
+        to avoid this problem.
+
+        Test: fast/css-grid-layout/grid-percent-track-scrollbar.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeUsedBreadthOfSpecifiedLength):
+
 2015-09-13  Chris Dumez  <cdu...@apple.com>
 
         Improve Node pre-insertion validation when the parent is a Document

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (189701 => 189702)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2015-09-14 09:45:25 UTC (rev 189701)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2015-09-14 09:46:37 UTC (rev 189702)
@@ -451,7 +451,7 @@
 {
     ASSERT(trackLength.isSpecified());
     if (direction == ForColumns)
-        return valueForLength(trackLength, logicalWidth() - borderAndPaddingLogicalWidth());
+        return valueForLength(trackLength, contentLogicalWidth());
     return valueForLength(trackLength, computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), Nullopt).valueOr(0));
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to