| Summary: | REGRESSION(r270578): Incorrect layout for the SVG image inside a flex container | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Dima Tisnek <dimaqq> | ||||||||||
| Component: | Images | Assignee: | Sergio Villar Senin <svillar> | ||||||||||
| Status: | RESOLVED FIXED | ||||||||||||
| Severity: | Normal | CC: | jonlee, sabouhallawa, smoley, svillar, webkit-bug-importer | ||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||
| Version: | Safari Technology Preview | ||||||||||||
| Hardware: | Unspecified | ||||||||||||
| OS: | macOS 11 | ||||||||||||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=221234 https://bugs.webkit.org/show_bug.cgi?id=221450 |
||||||||||||
| Bug Depends on: | 221484 | ||||||||||||
| Bug Blocks: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Dima Tisnek
2021-01-28 16:38:25 PST
I tried to dig a bit further and here's a smaller reproducer, with a regular, external image: https://codepen.io/dimaqq/pen/XWNWmym Thanks for filing, this does not reproduce for me on macOS Big Sur 11.2 RC 3 (20D64) using stock Safari 14.0.3, but it does reproduce on STP119 and TOT. Created attachment 419210 [details]
test case
Attaching a more simplified and more readable test case. The green rectangle to should be 10x10. But with the trunk webkit it is always 100x100 regardless how big the size of the <svg> image is.
The behavior of RenderFlexibleBox::childCrossSizeIsDefinite() has changed when the child is a RenderImage and the length is auto. Instead of returning false we are now returning true. This make RenderFlexibleBox::useChildAspectRatio() returns true also which makes RenderFlexibleBox::computeInnerFlexBaseSizeForChild() call adjustChildSizeForAspectRatioCrossAxisMinAndMax(). This function returns the size of the RenderFlexibleBox and ignores the childIntrinsicSize which is the size of the image. Created attachment 419215 [details]
test case
The same bug happens with binary images.
Created attachment 419229 [details]
test case
Checking... I've a patch that fixes this issue. The original patch was not totally correct but it helped to unveil some other already present issues. This means that in order to fix it properly I'll do the following: 1. Import the most recent versions of WPT flexbox tests (we have in tree some of them that are invalid and that will begin to fail as soon as my patches land) 2. Fix content size suggestion computation for aspect ratio items which is not correct (will fill another bug) 3. Fix the original patch Test import ready for review in bug 221484 Submitted a couple of new tests to WPT based on the 3 test cases mentioned in this bug report https://github.com/web-platform-tests/wpt/pull/27596 Given the slow progress in fixing this bug and to have the enough time to fix it properly, I have reverted r270578. Committed r272755: <https://commits.webkit.org/r272755> (In reply to Said Abou-Hallawa from comment #13) > Given the slow progress in fixing this bug and to have the enough time to > fix it properly, I have reverted r270578. > > Committed r272755: <https://commits.webkit.org/r272755> That's unfortunate. IMO the progress was not slow. The patch is ready, I had to wait for the review of bug 221484 and now I'm waiting for https://github.com/web-platform-tests/wpt/pull/27596. Once that last one lands I could upload the patch. |