Closed Bug 1880135 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 44564 - Fix min-content related crash in `LineBreaker::SplitTrailingBidiPreservedSpace`

Categories

(Core :: Layout: Text and Fonts, task, P4)

task

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 44564 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/44564
Details from upstream follow.

Andreu Botella <abotella@igalia.com> wrote:

Fix min-content related crash in LineBreaker::SplitTrailingBidiPreservedSpace

In crrev.com/c/5199988, the SplitTrailingBidiPreservedSpace method
was added to the LineBreaker class, which is called right at the end
of line breaking. This method fixes a bidi bug where trailing spaces
were not being reset to the paragraph's bidi direction, and it does so
by splitting some item results (and their shape results) into two
after their construction.

This method assumes that non-empty item results always have a non-null
shape result. This is usually the case, but when computing the minimum
and maximum sizes of an inline node (e.g. for {min,max}-content), a
fast path is used (LineBreak::HandleTextForFastMinContent) which
creates inline item results with a null shape result. This caused a
crash when trying to create a ShapeResultView without a source shape
result.

This patch fixes this by adding an early return from
LineBreaker::SplitTrailingBidiPreservedSpace if the line breaker
mode is kMinContent. This is incorrect, but it can only affect the
hanging behavior of trailing other space separators, which is already
incorrect with {min,max}-content even in non-bidi text. We are
already working on fixing this behavior, and we don't expect any
breakage resulting from this early return.

Bug: 324684931
Change-Id: I6a5a7aae06a0aafdb34b5836030921041d50dfb3
Reviewed-on: https://chromium-review.googlesource.com/5291239
WPT-Export-Revision: 81a9e2b3e4b14995c912d47dab46661825605fbb

Component: web-platform-tests → Layout: Text and Fonts
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests

Status Summary

Firefox

PASS: 1

Chrome

PASS: 1

Safari

PASS: 1

Links

GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7271a2ecf047 [wpt PR 44564] - Fix min-content related crash in `LineBreaker::SplitTrailingBidiPreservedSpace`, a=testonly
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
You need to log in before you can comment on or make changes to this bug.