Summary: | [css-flexbox] WebKit doesn't preserve aspect ratio when computing cross size of flexed images in auto-height flex container | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Daniel Holbert <dholbert> | ||||||
Component: | Layout and Rendering | Assignee: | Sergio Villar Senin <svillar> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | achristensen, bfulgham, changseok, clopez, darin, esprehn+autocc, ews-watchlist, glenn, jensimmons, jfernandez, kondapallykalyan, m.goleb+bugzilla, oliverjash, pdr, rego, simon.fraser, svillar, tonikitoo, webkit-bug-importer, zalan | ||||||
Priority: | P2 | Keywords: | InRadar, WebExposed | ||||||
Version: | Safari 13 | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 219343 | ||||||||
Attachments: |
|
Description
Daniel Holbert
2020-04-03 13:40:34 PDT
On bug 191460 I'm trying to import the WPT css-flexbox tests into WebKit and also de-deplicate the old versions of the flexbox tests we have, in favor of the new versions from WPT. The WebKit layout test css3/flexbox/flexitem-stretch-image.html is moved to WPT as imported/w3c/web-platform-tests/css/css-flexbox/flexitem-stretch-image.html but this new version of the test causes failures due to this bug. Check https://github.com/web-platform-tests/wpt/commit/557efa4d00 (its the diff between what we had as layout test vs the new version of the WPT test) This is a key bug to fix so that Authors can use Flexbox as intended. At the moment, no one can use Flexbox in a DOM structure where images are flex children. Here's a test: https://labs.jensimmons.com/2017/02-008.html All the circles should be round. (In reply to Jen Simmons from comment #4) > Here's a test: https://labs.jensimmons.com/2017/02-008.html > > All the circles should be round. I've a patch for this issue. I'll upload it soon Created attachment 414685 [details]
Patch
Comment on attachment 414685 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=414685&action=review > Source/WebCore/ChangeLog:9 > + Aspect ratio was not preserved in the cross axis because WebKit was stretching the items (as they're auto sized) whitout considering Spelling error here in the word "without". > Source/WebCore/rendering/RenderFlexibleBox.cpp:1555 > + // Aspect ratio is properly handled by RenderReplaced during layout. > + if (child.isRenderReplaced() && child.hasAspectRatio()) > + return false; This is frustratingly specific; I worry about a line of code like this that affects only a single regression test. Are there other things we should be testing? > LayoutTests/ChangeLog:9 > + * css3/flexbox/flexitem.html: Updated expectations. Aspect ratio must be preserved. Do we need to keep this test around? When our tests are duplicates of tests in Web Platform Tests, it would be good for the WebKit project to delete the older WebKit tests, unless they still have separate value. I presume in many cases the WPT test is a descendant of the test that began as a separate WebKit test. It’s better for long term maintainability to cut down the duplication when we can as we notice it. Comment on attachment 414685 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=414685&action=review >> Source/WebCore/rendering/RenderFlexibleBox.cpp:1555 >> + return false; > > This is frustratingly specific; I worry about a line of code like this that affects only a single regression test. Are there other things we should be testing? It's a single regression test indeed, but it's a very common use case for using images as flex items. Anyway I've filled https://github.com/web-platform-tests/wpt/pull/26617 with a new test. I'll import it before landing this patch. >> LayoutTests/ChangeLog:9 >> + * css3/flexbox/flexitem.html: Updated expectations. Aspect ratio must be preserved. > > Do we need to keep this test around? > > When our tests are duplicates of tests in Web Platform Tests, it would be good for the WebKit project to delete the older WebKit tests, unless they still have separate value. I presume in many cases the WPT test is a descendant of the test that began as a separate WebKit test. It’s better for long term maintainability to cut down the duplication when we can as we notice it. We have to keep it indeed because it's testing some code paths that are not tested by any current WPT test. Actually EWS reported some test failures in the first version of this patch that were triggered by this specific test. That said, I think it's worth thinking about moving this test to WPT in a follow up. *** Bug 199583 has been marked as a duplicate of this bug. *** (In reply to Sergio Villar Senin from comment #8) > Comment on attachment 414685 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=414685&action=review > > >> Source/WebCore/rendering/RenderFlexibleBox.cpp:1555 > >> + return false; > > > > This is frustratingly specific; I worry about a line of code like this that affects only a single regression test. Are there other things we should be testing? > > It's a single regression test indeed, but it's a very common use case for > using images as flex items. Anyway I've filled > https://github.com/web-platform-tests/wpt/pull/26617 with a new test. I'll > import it before landing this patch. The patch landed with the new test. I'll proceed to import several aspect ratio tests from the WPT repository once the SVN lockdown is over and then I'll land this patch. Created attachment 415112 [details]
Patch for landing
After importing more tests we're passing 3 more tests plus the WebKit test with incorrect expectations
Committed r270288: <https://trac.webkit.org/changeset/270288> |