Closed Bug 1902156 Opened 3 months ago Closed 3 months ago

Anonymous flex item gets left behind with just whitespace inside of it, when linewrapped text gets removed from flex container

Categories

(Core :: Layout: Flexbox, defect)

defect

Tracking

()

VERIFIED FIXED
129 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox127 --- unaffected
firefox128 --- verified
firefox129 --- verified

People

(Reporter: dholbert, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

Spinning this off from bug 1901233, for the unusual situation that we ran into there.

Adding and then removing a text node in a flex container will cause us to add and then remove an anonymous flex item wrapper-box -- that's what's supposed to happen, at least. BUT: if the text is linewrapped, we fail to remove the anonymous flex item, for some reason.

The straggling anon box can cause trouble because (a) it violates invariants (which caused a crash in bug 1901233) and (b) it influences how packing space is distributed, e.g. if the flex container uses justify-content:space-around or gap to distribute packing space around flex items.

See Also: → 1901233

Seems this could be a regression from bug 1850834? I'm afk for the day, but if you can check and ni? me if so, I can look.

Flags: needinfo?(dholbert)
Attached file testcase 1

It is indeed! Thanks.

Testing Nightlies from the day before vs. the day after that bug's patch merged to central:

  • Nightly 2024-06-03 gives "good" results on the attached testcase (lime square)
  • Nightly 2024-06-05 gives "bad" results on the attached testcase (mostly-red square)
Flags: needinfo?(dholbert) → needinfo?(emilio)
Keywords: regression
Regressed by: 1850834

Also, warning, the attached testcase might cause a crash in devtools code, in nightlies from around 2024-06-05 to 2024-06-11 or so, if you try to inspect the <div id="flex"> node with the "Layout" devtools pane open. (That crash is bug 1901233, which we've made into a more graceful silent failure via the patch that landed over there.)

Set release status flags based on info from the regressing bug 1850834

Flags: needinfo?(emilio)

Since RemoveFrame also removes them and would leave the wrapping box
empty.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0018551e3c86
Account for continuations to remove anonymous wrappers. r=dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/46746 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
Upstream PR merged by moz-wptsync-bot

ni as reminder to request uplift in a few days

Flags: needinfo?(emilio)

Comment on attachment 9407181 [details]
Bug 1902156 - Account for continuations to remove anonymous wrappers. r=dholbert,TYLin

Beta/Release Uplift Approval Request

  • User impact if declined: Incorrect layout in some cases
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Trivialish fix.
  • String changes made/needed: none
  • Is Android affected?: Yes
Flags: needinfo?(emilio)
Attachment #9407181 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9407181 [details]
Bug 1902156 - Account for continuations to remove anonymous wrappers. r=dholbert,TYLin

Approved for 128.0b4.

Attachment #9407181 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: in-testsuite+
QA Whiteboard: [qa-triaged]

Verified fixed using Nightly 129.0a1 (20240616215431) and Beta 128.0b4 (20240615190628) on Windows 10, MacOS 14 and Ubuntu 24.04.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: