RESOLVED FIXED 234361
[REGRESSION][[css-flexbox] child elements are shrunk to fit into container after r286206
https://bugs.webkit.org/show_bug.cgi?id=234361
Summary [REGRESSION][[css-flexbox] child elements are shrunk to fit into container af...
Yury Semikhatsky
Reported 2021-12-15 12:29:13 PST
Created attachment 447272 [details] example page After https://github.com/WebKit/WebKit/commit/bdb68ddedc91dba21084068424ed93bf58f54f0c flex box children are shrunk to fit into the container where they previously would keep their size. Steps to reproduce: open attached example.html in a window 500x500 Previously: both frames would have width 300px After the change: each has width 242
Attachments
example page (299 bytes, text/html)
2021-12-15 12:29 PST, Yury Semikhatsky
no flags
Before (5.56 KB, image/png)
2021-12-15 12:29 PST, Yury Semikhatsky
no flags
After (4.74 KB, image/png)
2021-12-15 12:29 PST, Yury Semikhatsky
no flags
Patch (4.48 KB, patch)
2021-12-20 08:40 PST, Sergio Villar Senin
no flags
Patch (8.67 KB, patch)
2021-12-21 02:03 PST, Sergio Villar Senin
rego: review+
Yury Semikhatsky
Comment 1 2021-12-15 12:29:41 PST
Yury Semikhatsky
Comment 2 2021-12-15 12:29:59 PST
Sergio Villar Senin
Comment 3 2021-12-16 06:53:22 PST
I guess you mean r286206 then in the title...
Sergio Villar Senin
Comment 4 2021-12-16 06:57:10 PST
Does it happen if you use <div>s instead of iframes with embedded documents?
Sergio Villar Senin
Comment 5 2021-12-16 07:32:13 PST
BTW I've just tried with ToT and I cannot reproduce the issue you mention. I resize the window and both boxes end up occupying the same space...
Sergio Villar Senin
Comment 6 2021-12-16 07:36:59 PST
(In reply to Sergio Villar Senin from comment #5) > BTW I've just tried with ToT and I cannot reproduce the issue you mention. I > resize the window and both boxes end up occupying the same space... Ah OK I see it now, the layout seems inconsistent, sometimes they're equally sized but then you resize and one of the becomes larger.
Yury Semikhatsky
Comment 7 2021-12-16 08:53:42 PST
(In reply to Sergio Villar Senin from comment #4) > Does it happen if you use <div>s instead of iframes with embedded documents? No, I can only reproduce it with iframes. Apparently there was some intrinsic min-width (don't see it in the inspector though).
Yury Semikhatsky
Comment 8 2021-12-16 09:49:15 PST
According to [1] iframe has default width=300. Before the change when two iframes having 'flex-shrink:1' were put into a flex container with width=500 they would keep width 300 (iframe's default width was treated as min-width essentially) which was consistent with Chromium behavior. After the change they are both shrunk to respect 'flex-shrink:1'. I don't know whether this new behavior is correct by the spec but it definitely breaks some web pages. [1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-width
Sergio Villar Senin
Comment 9 2021-12-17 02:13:00 PST
(In reply to Yury Semikhatsky from comment #8) > According to [1] iframe has default width=300. Before the change when two > iframes having 'flex-shrink:1' were put into a flex container with width=500 > they would keep width 300 (iframe's default width was treated as min-width > essentially) which was consistent with Chromium behavior. After the change > they are both shrunk to respect 'flex-shrink:1'. I don't know whether this > new behavior is correct by the spec but it definitely breaks some web pages. Thanks for the info. I have a patch for this issue, I'd love to hear more about those sites that are broken, just to double check that the fix works in the wild.
Sergio Villar Senin
Comment 10 2021-12-20 08:40:10 PST
Sergio Villar Senin
Comment 11 2021-12-20 08:44:01 PST
Note that I haven't included any test because I'm importing https://github.com/web-platform-tests/wpt/pull/32141 as soon as it lands in the WPT repo (I mean as part of this patch).
Manuel Rego Casasnovas
Comment 12 2021-12-20 09:24:53 PST
(In reply to Sergio Villar Senin from comment #11) > Note that I haven't included any test because I'm importing > https://github.com/web-platform-tests/wpt/pull/32141 as soon as it lands in > the WPT repo (I mean as part of this patch). You could include the tests in this patch, and they get reviewed here, and once you get them approved here, the WPT upstream PR gets approved automatically.
Manuel Rego Casasnovas
Comment 13 2021-12-20 09:30:04 PST
Comment on attachment 447606 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=447606&action=review > Source/WebCore/ChangeLog:12 > + regression. Is there no other cases of replaced elements that need SVG images like behavior?
Sergio Villar Senin
Comment 14 2021-12-21 00:57:51 PST
(In reply to Manuel Rego Casasnovas from comment #12) > (In reply to Sergio Villar Senin from comment #11) > > Note that I haven't included any test because I'm importing > > https://github.com/web-platform-tests/wpt/pull/32141 as soon as it lands in > > the WPT repo (I mean as part of this patch). > > You could include the tests in this patch, and they get reviewed here, and > once you get them approved here, the WPT upstream PR gets approved > automatically. The last time I tried the exporter it failed due to naming. In webkit the reference has -expected suffix while WPT expects -ref suffix. That's why I preferred to upload it to WPT and once landed I'll include it in this patch.
Sergio Villar Senin
Comment 15 2021-12-21 01:00:50 PST
(In reply to Manuel Rego Casasnovas from comment #13) > Comment on attachment 447606 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=447606&action=review > > > Source/WebCore/ChangeLog:12 > > + regression. > > Is there no other cases of replaced elements that need SVG images like > behavior? No that I know of. The original patch had initially the code that I'm changing now. At the very last minute I decided to generalize it a bit thinking that replaced elements were basically just images without realizing that things like iframes were also replaced elements. For the rest of the images (raster images) they have intrinsic dimensions (1024x768, etc...). The thing with vector graphics (like SVG) is that they're scale independent, so it does not make much sense to assign them an intrinsic size. But it does make a lot of sense to have an intrinsic ratio, so resizing the image respects the proportions.
Sergio Villar Senin
Comment 16 2021-12-21 02:03:48 PST
Manuel Rego Casasnovas
Comment 17 2021-12-21 07:08:46 PST
Comment on attachment 447700 [details] Patch r=me
Sergio Villar Senin
Comment 18 2021-12-22 07:28:12 PST
Radar WebKit Bug Importer
Comment 19 2021-12-22 07:29:17 PST
Note You need to log in before you can comment on or make changes to this bug.