Title: [202856] trunk
Revision
202856
Author
[email protected]
Date
2016-07-06 06:02:43 -0700 (Wed, 06 Jul 2016)

Log Message

[css-grid] Height percentages are not properly resolved for item's children
https://bugs.webkit.org/show_bug.cgi?id=159258

Reviewed by Sergio Villar Senin.

Source/WebCore:

When grid items are vertically stretched (default behavior)
they store their height on RenderBox::overrideLogicalContentHeight().
In order to resolve the percentage height on the grid item's children
we need to use that size.

Test: fast/css-grid-layout/percent-resolution-grid-item-children.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):

LayoutTests:

* fast/css-grid-layout/percent-resolution-grid-item-children-expected.txt: Added.
* fast/css-grid-layout/percent-resolution-grid-item-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202855 => 202856)


--- trunk/LayoutTests/ChangeLog	2016-07-06 11:32:07 UTC (rev 202855)
+++ trunk/LayoutTests/ChangeLog	2016-07-06 13:02:43 UTC (rev 202856)
@@ -1,3 +1,13 @@
+2016-07-06  Manuel Rego Casasnovas  <[email protected]>
+
+        [css-grid] Height percentages are not properly resolved for item's children
+        https://bugs.webkit.org/show_bug.cgi?id=159258
+
+        Reviewed by Sergio Villar Senin.
+
+        * fast/css-grid-layout/percent-resolution-grid-item-children-expected.txt: Added.
+        * fast/css-grid-layout/percent-resolution-grid-item-children.html: Added.
+
 2016-07-05  Youenn Fablet  <[email protected]>
 
         Rebasing tests

Added: trunk/LayoutTests/fast/css-grid-layout/percent-resolution-grid-item-children-expected.txt (0 => 202856)


--- trunk/LayoutTests/fast/css-grid-layout/percent-resolution-grid-item-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/percent-resolution-grid-item-children-expected.txt	2016-07-06 13:02:43 UTC (rev 202856)
@@ -0,0 +1,16 @@
+This test checks that percentages are properly resolved for grid items' children.
+
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS

Added: trunk/LayoutTests/fast/css-grid-layout/percent-resolution-grid-item-children.html (0 => 202856)


--- trunk/LayoutTests/fast/css-grid-layout/percent-resolution-grid-item-children.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/percent-resolution-grid-item-children.html	2016-07-06 13:02:43 UTC (rev 202856)
@@ -0,0 +1,143 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+<link href="" rel="stylesheet">
+<style>
+
+.grid {
+    grid: 100px / 200px;
+    position: relative;
+}
+
+.fixedSize350 {
+    width: 350px;
+    height: 350px;
+}
+
+.percentSize100 {
+    width: 100%;
+    height: 100%;
+}
+
+.percentSize50 {
+    width: 50%;
+    height: 50%;
+}
+
+.positioned {
+    position: absolute;
+    grid-column: 1 / 2;
+    grid-row: 1 / 2;
+}
+
+.offsets {
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+}
+
+</style>
+<script src=""
+<body _onload_="checkLayout('.grid')">
+
+<p>This test checks that percentages are properly resolved for grid items' children.</p>
+
+<div class="grid">
+    <div data-expected-width="200" data-expected-height="100">
+        <div class="percentSize100" data-expected-width="200" data-expected-height="100">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div data-expected-width="200" data-expected-height="100">
+        <div class="percentSize50" data-expected-width="100" data-expected-height="50">
+        </div>
+    </div>
+</div>
+
+<div class="grid itemsStart">
+    <div data-expected-width="0" data-expected-height="0">
+        <div class="percentSize100" data-expected-width="0" data-expected-height="0">
+        </div>
+    </div>
+</div>
+
+<div class="grid itemsStart">
+    <div data-expected-width="0" data-expected-height="0">
+        <div class="percentSize50" data-expected-width="0" data-expected-height="0">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="fixedSize350" data-expected-width="350" data-expected-height="350">
+        <div class="percentSize100" data-expected-width="350" data-expected-height="350">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="fixedSize350" data-expected-width="350" data-expected-height="350">
+        <div class="percentSize50" data-expected-width="175" data-expected-height="175">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="percentSize100" data-expected-width="200" data-expected-height="100">
+        <div class="percentSize100" data-expected-width="200" data-expected-height="100">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="percentSize100" data-expected-width="200" data-expected-height="100">
+        <div class="percentSize50" data-expected-width="100" data-expected-height="50">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="percentSize50" data-expected-width="100" data-expected-height="50">
+        <div class="percentSize100" data-expected-width="100" data-expected-height="50">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="percentSize50" data-expected-width="100" data-expected-height="50">
+        <div class="percentSize50" data-expected-width="50" data-expected-height="25">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="positioned" data-expected-width="0" data-expected-height="0">
+        <div class="percentSize100" data-expected-width="0" data-expected-height="0">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="positioned" data-expected-width="0" data-expected-height="0">
+        <div class="percentSize50" data-expected-width="0" data-expected-height="0">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="positioned offsets" data-expected-width="200" data-expected-height="100">
+        <div class="percentSize100" data-expected-width="200" data-expected-height="100">
+        </div>
+    </div>
+</div>
+
+<div class="grid">
+    <div class="positioned offsets" data-expected-width="200" data-expected-height="100">
+        <div class="percentSize50" data-expected-width="100" data-expected-height="50">
+        </div>
+    </div>
+</div>
+
+</body>

Modified: trunk/Source/WebCore/ChangeLog (202855 => 202856)


--- trunk/Source/WebCore/ChangeLog	2016-07-06 11:32:07 UTC (rev 202855)
+++ trunk/Source/WebCore/ChangeLog	2016-07-06 13:02:43 UTC (rev 202856)
@@ -1,3 +1,20 @@
+2016-07-06  Manuel Rego Casasnovas  <[email protected]>
+
+        [css-grid] Height percentages are not properly resolved for item's children
+        https://bugs.webkit.org/show_bug.cgi?id=159258
+
+        Reviewed by Sergio Villar Senin.
+
+        When grid items are vertically stretched (default behavior)
+        they store their height on RenderBox::overrideLogicalContentHeight().
+        In order to resolve the percentage height on the grid item's children
+        we need to use that size.
+
+        Test: fast/css-grid-layout/percent-resolution-grid-item-children.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+
 2016-07-06  Zan Dobersek  <[email protected]>
 
         [GTK] Better guard TextureMapper header and CMake includes

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (202855 => 202856)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2016-07-06 11:32:07 UTC (rev 202855)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2016-07-06 13:02:43 UTC (rev 202856)
@@ -2989,6 +2989,8 @@
 #if ENABLE(CSS_GRID_LAYOUT)
     else if (hasOverrideContainingBlockLogicalHeight())
         availableHeight = overrideContainingBlockContentLogicalHeight();
+    else if (cb->isGridItem() && cb->hasOverrideLogicalContentHeight())
+        availableHeight = cb->overrideLogicalContentHeight();
 #endif
     else if (is<RenderTableCell>(*cb)) {
         if (!skippedAutoHeightContainingBlock) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to