Title: [202103] trunk
Revision
202103
Author
[email protected]
Date
2016-06-15 13:48:45 -0700 (Wed, 15 Jun 2016)

Log Message

[css-sizing] Item borders are missing with 'min-width:-webkit-fill-available' and zero available width
https://bugs.webkit.org/show_bug.cgi?id=158258

Source/WebCore:

Reviewed by Darin Adler.

The "fill-available" size is defined as the containing block's size less
the box's border and padding size. However, when used for min-width we
should ensure we don't get negative values as result of logical width
computation.

http://www.w3.org/TR/css-sizing-3/#fill-available-sizing

This patch ensure fill-available value computed value will be always
greater than box's boder and padding width.

Test: fast/css-intrinsic-dimensions/fill-available-with-zero-width.html

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

LayoutTests:

Tests to verify that fill-available size works as expected when contaner's width is zero.

Reviewed by Darin Adler.

* fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html: Added.
* fast/css-intrinsic-dimensions/fill-available-with-zero-width.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202102 => 202103)


--- trunk/LayoutTests/ChangeLog	2016-06-15 19:41:52 UTC (rev 202102)
+++ trunk/LayoutTests/ChangeLog	2016-06-15 20:48:45 UTC (rev 202103)
@@ -1,3 +1,15 @@
+2016-06-15  Javier Fernandez  <[email protected]>
+
+        [css-sizing] Item borders are missing with 'min-width:-webkit-fill-available' and zero available width
+        https://bugs.webkit.org/show_bug.cgi?id=158258
+
+        Tests to verify that fill-available size works as expected when contaner's width is zero.
+
+        Reviewed by Darin Adler.
+
+        * fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html: Added.
+        * fast/css-intrinsic-dimensions/fill-available-with-zero-width.html: Added.
+
 2016-06-15  Alex Christensen  <[email protected]>
 
         Fix 2d canvas transform after r192900

Added: trunk/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html (0 => 202103)


--- trunk/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html	2016-06-15 20:48:45 UTC (rev 202103)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+<style>
+.block {
+  width: 0px;
+  font: 10px/1 Ahem;
+}
+
+.item {
+  border: 5px solid magenta;
+  background: cyan;
+}
+</style>
+
+<p>Checking out that 'min-width' as 'fill-available' respects border and padding sizes when container size is 0px, behaving like min-width: auto.</p>
+
+<h2>block</h2>
+
+<div class="block">
+  <div class="item">item</div>
+</div>
+
+<hr>
+
+<h2>flex</h2>
+
+<div class="block">
+  <div class="item">item</div>
+</div>
+
+<hr>
+
+<h2>grid</h2>
+
+<div class="block">
+  <div class="item">item</div>
+</div>

Added: trunk/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width.html (0 => 202103)


--- trunk/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width.html	2016-06-15 20:48:45 UTC (rev 202103)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+<style>
+.block {
+  width: 0px;
+  font: 10px/1 Ahem;
+}
+
+.flex {
+  display: flex;
+}
+
+.grid {
+  display: grid;
+  grid-template-columns: 0px;
+}
+
+.item {
+  border: 5px solid magenta;
+  background: cyan;
+}
+</style>
+
+<p>Checking out that 'min-width' as 'fill-available' respects border and padding sizes when container size is 0px, behaving like min-width: auto.</p>
+
+<h2>block</h2>
+
+<div class="block">
+  <div class="item min-width-fill-available">item</div>
+</div>
+
+<hr>
+
+<h2>flex</h2>
+
+<div class="block flex">
+  <div class="item min-width-fill-available">item</div>
+</div>
+
+<hr>
+
+<h2>grid</h2>
+
+<div class="block grid">
+  <div class="item min-width-fill-available">item</div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (202102 => 202103)


--- trunk/Source/WebCore/ChangeLog	2016-06-15 19:41:52 UTC (rev 202102)
+++ trunk/Source/WebCore/ChangeLog	2016-06-15 20:48:45 UTC (rev 202103)
@@ -1,3 +1,25 @@
+2016-06-15  Javier Fernandez  <[email protected]>
+
+        [css-sizing] Item borders are missing with 'min-width:-webkit-fill-available' and zero available width
+        https://bugs.webkit.org/show_bug.cgi?id=158258
+
+        Reviewed by Darin Adler.
+
+        The "fill-available" size is defined as the containing block's size less
+        the box's border and padding size. However, when used for min-width we
+        should ensure we don't get negative values as result of logical width
+        computation.
+
+        http://www.w3.org/TR/css-sizing-3/#fill-available-sizing
+
+        This patch ensure fill-available value computed value will be always
+        greater than box's boder and padding width.
+
+        Test: fast/css-intrinsic-dimensions/fill-available-with-zero-width.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeIntrinsicLogicalWidthUsing):
+
 2016-06-15  Alex Christensen  <[email protected]>
 
         Fix 2d canvas transform after r192900

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (202102 => 202103)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2016-06-15 19:41:52 UTC (rev 202102)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2016-06-15 20:48:45 UTC (rev 202103)
@@ -2472,7 +2472,7 @@
 LayoutUnit RenderBox::computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const
 {
     if (logicalWidthLength.type() == FillAvailable)
-        return fillAvailableMeasure(availableLogicalWidth);
+        return std::max(borderAndPadding, fillAvailableMeasure(availableLogicalWidth));
 
     LayoutUnit minLogicalWidth = 0;
     LayoutUnit maxLogicalWidth = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to