RESOLVED FIXED 209871
[css-flexbox] align-content should apply even when there's just a single line
https://bugs.webkit.org/show_bug.cgi?id=209871
Summary [css-flexbox] align-content should apply even when there's just a single line
Attachments
Patch (10.76 KB, patch)
2020-06-01 07:34 PDT, Sergio Villar Senin
no flags
Patch (43.47 KB, patch)
2020-06-03 07:03 PDT, Sergio Villar Senin
rego: review+
Patch (52.84 KB, patch)
2020-06-08 06:43 PDT, Sergio Villar Senin
rego: review+
Carlos Alberto Lopez Perez
Comment 1 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
Carlos Alberto Lopez Perez
Comment 2 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
Carlos Alberto Lopez Perez
Comment 3 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
Carlos Alberto Lopez Perez
Comment 4 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
Sergio Villar Senin
Comment 5 2020-06-01 07:34:03 PDT
Manuel Rego Casasnovas
Comment 6 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?
Sergio Villar Senin
Comment 7 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()
Sergio Villar Senin
Comment 8 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.
Sergio Villar Senin
Comment 9 2020-06-01 13:54:58 PDT
Adding a required dependency.
Sergio Villar Senin
Comment 10 2020-06-03 07:03:37 PDT
Sergio Villar Senin
Comment 11 2020-06-03 07:04:28 PDT
PTAL as I've significantly changed the original patch.
Manuel Rego Casasnovas
Comment 12 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?
Sergio Villar Senin
Comment 13 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?
Sergio Villar Senin
Comment 14 2020-06-08 06:43:40 PDT
Created attachment 401330 [details] Patch iOS rebaseline
Manuel Rego Casasnovas
Comment 15 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.
Sergio Villar Senin
Comment 16 2020-06-08 08:52:25 PDT
Radar WebKit Bug Importer
Comment 17 2020-06-08 08:53:16 PDT
Note You need to log in before you can comment on or make changes to this bug.