[css-sizing] Item borders are missing with 'min-width:-webkit-fill-available' and...
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jun 2016 20:48:45 +0000 (20:48 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jun 2016 20:48:45 +0000 (20:48 +0000)
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.

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

LayoutTests/ChangeLog
LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html [new file with mode: 0644]
LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp

index 6ea2bee..3009524 100644 (file)
@@ -1,3 +1,15 @@
+2016-06-15  Javier Fernandez  <jfernandez@igalia.com>
+
+        [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  <achristensen@webkit.org>
 
         Fix 2d canvas transform after r192900
diff --git a/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html b/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width-expected.html
new file mode 100644 (file)
index 0000000..0c62bc4
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<link href="resources/width-keyword-classes.css" 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>
diff --git a/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width.html b/LayoutTests/fast/css-intrinsic-dimensions/fill-available-with-zero-width.html
new file mode 100644 (file)
index 0000000..a6feb26
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<link href="resources/width-keyword-classes.css" 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>
index 5c8654a..745d557 100644 (file)
@@ -1,3 +1,25 @@
+2016-06-15  Javier Fernandez  <jfernandez@igalia.com>
+
+        [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  <achristensen@webkit.org>
 
         Fix 2d canvas transform after r192900
index c3fdd70..03329e5 100644 (file)
@@ -2472,7 +2472,7 @@ LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, Lay
 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;