Bug 233956 - WebKit thinks that a formatting context root stops fitting in a tiny space, when you give it a negative margin
Summary: WebKit thinks that a formatting context root stops fitting in a tiny space, w...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-07 16:14 PST by Daniel Holbert
Modified: 2022-05-02 12:55 PDT (History)
4 users (show)

See Also:


Attachments
testcase 1 (893 bytes, text/html)
2021-12-07 16:14 PST, Daniel Holbert
no flags Details
testcase 2 (using display:flow-root instead of flex) (918 bytes, text/html)
2021-12-07 16:17 PST, Daniel Holbert
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Holbert 2021-12-07 16:14:51 PST
Created attachment 446248 [details]
testcase 1

STR:
1. Load attached testcase. (also available on jsfiddle: https://jsfiddle.net/dholbert/ujphfkqz/ )

EXPECTED RESULTS:
Case 1 and Case 2 inside of the testcase should look the same.

ACTUAL RESULTS:
In "Case 2", the "A B" text is pushed down, for no clear reason.

The only difference between Case 1 and Case 2 is: in Case 2, the "A B" element has a *negative margin*. So if anything, it should fit even better; there should be even less reason to push it down.


Chrome has the same bug, tracked in https://bugs.chromium.org/p/chromium/issues/detail?id=1141209 .

Firefox gives EXPECTED RESULTS.
Comment 1 Daniel Holbert 2021-12-07 16:17:16 PST
Created attachment 446249 [details]
testcase 2 (using display:flow-root instead of flex)

Note: testcase 1 used flexbox, but as discussed on the chromium bug report, this isn't specific to flexbox; you can reproduce it with 'display:flow-root' as well, for example.

Here's a version using 'display: flow-root'.
Comment 2 Radar WebKit Bug Importer 2021-12-07 20:29:23 PST
<rdar://problem/86189973>
Comment 3 Daniel Holbert 2021-12-09 16:31:35 PST
For reference, I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1745310 on the Firefox side, as a place to aggregate webcompat issues that we've run into as a result of this interop issue.
Comment 4 Daniel Holbert 2022-05-02 12:55:21 PDT
I've done some more investigation and I actually think the WebKit/Blink behavior makes some sense here, per https://bugzilla.mozilla.org/show_bug.cgi?id=1745310#c9 .  And the web apparently depends on it (per the various WebCompat dupes over there).

So, we can close this one as INVALID. But while investigating that, I found a WebKit-specific version of this behavior that makes less sense and that I suspect the web does *not* depend on, and I filed that as:
https://bugs.webkit.org/show_bug.cgi?id=239976