Bug 209871 - [css-flexbox] align-content should apply even when there's just a single line
Summary: [css-flexbox] align-content should apply even when there's just a single line
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sergio Villar Senin
URL:
Keywords: InRadar
Depends on: 210465
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-01 12:06 PDT by Carlos Alberto Lopez Perez
Modified: 2020-06-08 08:53 PDT (History)
12 users (show)

See Also:


Attachments
Patch (10.76 KB, patch)
2020-06-01 07:34 PDT, Sergio Villar Senin
no flags Details | Formatted Diff | Diff
Patch (43.47 KB, patch)
2020-06-03 07:03 PDT, Sergio Villar Senin
rego: review+
Details | Formatted Diff | Diff
Patch (52.84 KB, patch)
2020-06-08 06:43 PDT, Sergio Villar Senin
rego: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Carlos Alberto Lopez Perez 2020-04-13 16:51:49 PDT
This bug also affects (indirectly) the test https://wpt.live/css/css-flexbox/flex-wrap-005.html since this test sets align-content on a flexbox with wrappability
Comment 2 Carlos Alberto Lopez Perez 2020-05-13 16:47:39 PDT
Note:

We have the test css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html which is just an old version (testing the old spec) of the WPT test css/css-flexbox/align-content-wrap-001.html (which now tests the new spec)

once this bug its fixed, the test css3/flexbox/alignContent-applies-with-flexWrap-wrap-with-single-line.html can be removed
Comment 3 Carlos Alberto Lopez Perez 2020-05-13 19:02:19 PDT
And layout test css3/flexbox/flexbox-wordwrap.html can be removed in favor of imported/w3c/web-platform-tests/css/css-flexbox/align-content-wrap-002.html
Comment 4 Carlos Alberto Lopez Perez 2020-05-13 19:04:02 PDT
And layout test css3/flexbox/multiline-align-content.html can be removed in favor of  imported/w3c/web-platform-tests/css/css-flexbox/align-content-wrap-003.html
Comment 5 Sergio Villar Senin 2020-06-01 07:34:03 PDT
Created attachment 400732 [details]
Patch
Comment 6 Manuel Rego Casasnovas 2020-06-01 07:51:50 PDT
Comment on attachment 400732 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400732&action=review

Nice catch, thanks for the fix.

> Source/WebCore/rendering/RenderFlexibleBox.cpp:1732
>      // flex line, the line height is all the available space. For

The comment was already accurate...

> Source/WebCore/rendering/RenderFlexibleBox.cpp:1735
> +    if (!isMultiline()) {

Nit: Could we add an ASSERT(lineContexts.size() == 1) here?
Comment 7 Sergio Villar Senin 2020-06-01 08:37:58 PDT
Comment on attachment 400732 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400732&action=review

Thanks for the review

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:1732
>>      // flex line, the line height is all the available space. For
> 
> The comment was already accurate...

Right the comment was accurate but the code was not.

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:1735
>> +    if (!isMultiline()) {
> 
> Nit: Could we add an ASSERT(lineContexts.size() == 1) here?

I am not sure. The invariant you mention should be true in any method not only here, and we know that the array access bellow is correct because !lineContexts.isEmpty()
Comment 8 Sergio Villar Senin 2020-06-01 08:48:50 PDT
I'm checking the test failures. 3 of them come from tests that can be simply removed as described in comments #2, #3 and #4.

However it looks like there are 3 valid regressions. I'll double check.
Comment 9 Sergio Villar Senin 2020-06-01 13:54:58 PDT
Adding a required dependency.
Comment 10 Sergio Villar Senin 2020-06-03 07:03:37 PDT
Created attachment 400916 [details]
Patch
Comment 11 Sergio Villar Senin 2020-06-03 07:04:28 PDT
PTAL as I've significantly changed the original patch.
Comment 12 Manuel Rego Casasnovas 2020-06-08 01:41:50 PDT
Comment on attachment 400916 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400916&action=review

What's going on with iOS EWS?

> Source/WebCore/rendering/RenderFlexibleBox.cpp:365
> +    if (!isMultiline() && !lineContexts.isEmpty())

We might want to move this condition to a separated method with a descriptive name to be called here and later.

> Source/WebCore/rendering/RenderFlexibleBox.cpp:486
> +    auto resetOverride = makeScopeExit([&] {
> +        if (childHasOverrideWidth)
> +            const_cast<RenderBox*>(&child)->setOverrideContentLogicalWidth(overrideWidth);
> +    });

What does these lines do? Wouldn't be the same if we just this this two lines before the return?
Comment 13 Sergio Villar Senin 2020-06-08 06:10:49 PDT
Comment on attachment 400916 [details]
Patch

Regarding iOS it looks like 1 failure is unrelated and the other test needs a rebaseline

View in context: https://bugs.webkit.org/attachment.cgi?id=400916&action=review

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:365
>> +    if (!isMultiline() && !lineContexts.isEmpty())
> 
> We might want to move this condition to a separated method with a descriptive name to be called here and later.

Hmm the condition here and the other one are not the same.

 (lineContexts.isEmpty() || !isMultiline())

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:486
>> +    });
> 
> What does these lines do? Wouldn't be the same if we just this this two lines before the return?

Yes, it's another way to do it. Do you prefer the other way?
Comment 14 Sergio Villar Senin 2020-06-08 06:43:40 PDT
Created attachment 401330 [details]
Patch

iOS rebaseline
Comment 15 Manuel Rego Casasnovas 2020-06-08 07:53:53 PDT
Comment on attachment 400916 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400916&action=review

r=me

>>> Source/WebCore/rendering/RenderFlexibleBox.cpp:365
>>> +    if (!isMultiline() && !lineContexts.isEmpty())
>> 
>> We might want to move this condition to a separated method with a descriptive name to be called here and later.
> 
> Hmm the condition here and the other one are not the same.
> 
>  (lineContexts.isEmpty() || !isMultiline())

Ok, true, I didn't realize sorry.

>>> Source/WebCore/rendering/RenderFlexibleBox.cpp:486
>>> +    });
>> 
>> What does these lines do? Wouldn't be the same if we just this this two lines before the return?
> 
> Yes, it's another way to do it. Do you prefer the other way?

makeScopeExit() is not used at all in WebCore/rendering/, and it's not like this is a lot of code and you lose the context, so I'd prefer the other way around.
Comment 16 Sergio Villar Senin 2020-06-08 08:52:25 PDT
Committed r262716: <https://trac.webkit.org/changeset/262716>
Comment 17 Radar WebKit Bug Importer 2020-06-08 08:53:16 PDT
<rdar://problem/64120424>