Skip to content
Permalink
Browse files
[css-flex] Allow indefinite size flex items to be definite wrt resolv…
…ing percentages inside them

https://bugs.webkit.org/show_bug.cgi?id=212264

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-flexbox/percentage-heights-003-expected.txt: There were 3 subtests
marked as failures. All of them work fine now.

Source/WebCore:

Implement w3c/csswg-drafts@5b5db39 which modified
the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that
they're really definite.

This allows us to mark 3 tests which were testing percentages in flex items as correct.

Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org>

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size
definiteness when computing the main size for percentage resolution, no need to check flex basis at all.

LayoutTests:

* css3/flexbox/definite-main-size-expected.txt: Updated expectation.
* css3/flexbox/definite-main-size.html: Updated comment.

Canonical link: https://commits.webkit.org/225187@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
svillar committed May 25, 2020
1 parent a0178ab commit 487fc5a73b8622380f6d5b4379d3097c1363a56c
Showing 7 changed files with 50 additions and 41 deletions.
@@ -1,3 +1,13 @@
2020-05-22 Sergio Villar Senin <svillar@igalia.com>

[css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
https://bugs.webkit.org/show_bug.cgi?id=212264

Reviewed by Manuel Rego Casasnovas.

* css3/flexbox/definite-main-size-expected.txt: Updated expectation.
* css3/flexbox/definite-main-size.html: Updated comment.

2020-05-25 Diego Pino Garcia <dpino@igalia.com>

[GTK] Gardening, update test expectations after r262060
@@ -9,6 +9,6 @@ auto flex-basis. However, as this is a width, we follow regular width rules and

Simple case of percentage resolution, columns:

auto flex-basis, we should ignore the percentage height here:
auto flex-basis. This is still definite.


@@ -61,10 +61,10 @@
<div class="rect flex-none"></div>
</div>

<p>auto flex-basis, we should ignore the percentage height here:</p>
<p>auto flex-basis. This is still definite.</p>
<div class="flexbox column" style="height: 300px;">
<div data-expected-height="50">
<div style="height: 50%;" data-expected-height="50">
<div style="height: 50%;" data-expected-height="25">
<div class="rect"></div>
</div>
</div>
@@ -1,3 +1,13 @@
2020-05-22 Sergio Villar Senin <svillar@igalia.com>

[css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
https://bugs.webkit.org/show_bug.cgi?id=212264

Reviewed by Manuel Rego Casasnovas.

* web-platform-tests/css/css-flexbox/percentage-heights-003-expected.txt: There were 3 subtests
marked as failures. All of them work fine now.

2020-05-22 Carlos Alberto Lopez Perez <clopez@igalia.com>

[css-grid] Update WPT imported tests and deduplicate common tests
@@ -1,30 +1,9 @@

FAIL .flexbox 1 assert_equals:
<div class="flexbox column" style="height: 0">
<div>
<span data-expected-height="100"></span>
</div>
</div>
height expected 100 but got 0
FAIL .flexbox 2 assert_equals:
<div class="flexbox column-wrap" style="height: 0">
<div>
<span data-expected-height="50"></span>
</div>
<div>
<span data-expected-height="50"></span>
</div>
</div>
height expected 50 but got 0
PASS .flexbox 1
PASS .flexbox 2
PASS .flexbox 3
PASS .flexbox 4
PASS .flexbox 5
PASS .flexbox 6
FAIL .flexbox 7 assert_equals:
<div class="flexbox vert-wm">
<div class="horiz-wm">
<span data-expected-height="100"></span>
</div>
</div>
height expected 100 but got 0
PASS .flexbox 7

@@ -1,3 +1,22 @@
2020-05-22 Sergio Villar Senin <svillar@igalia.com>

[css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
https://bugs.webkit.org/show_bug.cgi?id=212264

Reviewed by Manuel Rego Casasnovas.

Implement https://github.com/w3c/csswg-drafts/commit/5b5db39d21f3658ae2f4d7992daaf822aca178d8 which modified
the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that
they're really definite.

This allows us to mark 3 tests which were testing percentages in flex items as correct.

Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org>

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size
definiteness when computing the main size for percentage resolution, no need to check flex basis at all.

2020-05-25 Youenn Fablet <youenn@apple.com>

AVVideoCaptureSource should notify of video samples in a background thread
@@ -1143,21 +1143,12 @@ Optional<LayoutUnit> RenderFlexibleBox::crossSizeForPercentageResolution(const R

Optional<LayoutUnit> RenderFlexibleBox::mainSizeForPercentageResolution(const RenderBox& child)
{
// This function implements section 9.8. Definite and Indefinite Sizes, case
// 2) of the flexbox spec.
// We need to check for the flexbox to have a definite main size, and for the
// flex item to have a definite flex basis.
const Length& flexBasis = flexBasisForChild(child);
if (!mainAxisLengthIsDefinite(child, flexBasis))
// This function implements section 9.8. Definite and Indefinite Sizes, case 2) of the flexbox spec.
// If the flex container has a definite main size the flex item post-flexing main size is also treated
// as definite. We make up a percentage to check whether we have a definite size.
if (!mainAxisLengthIsDefinite(child, Length(0, Percent)))
return WTF::nullopt;
if (!flexBasis.isPercentOrCalculated()) {
// If flex basis had a percentage, our size is guaranteed to be definite or
// the flex item's size could not be definite. Otherwise, we make up a
// percentage to check whether we have a definite size.
if (!mainAxisLengthIsDefinite(child, Length(0, Percent)))
return WTF::nullopt;
}


if (hasOrthogonalFlow(child))
return child.hasOverrideContentLogicalHeight() ? Optional<LayoutUnit>(child.overrideContentLogicalHeight()) : WTF::nullopt;
return child.hasOverrideContentLogicalWidth() ? Optional<LayoutUnit>(child.overrideContentLogicalWidth()) : WTF::nullopt;

0 comments on commit 487fc5a

Please sign in to comment.