Closed Bug 2063909 Opened 2 months ago Closed 2 months ago

[text-box-trim] Wrong line is trimmed when inline on last line is fragmented

Categories

(Core :: Layout: Block and Inline, defect)

defect

Tracking

()

RESOLVED FIXED
156 Branch
Tracking Status
firefox154 --- wontfix
firefox155 --- wontfix
firefox156 --- fixed

People

(Reporter: sajidanwar, Assigned: sajidanwar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 external file)

For text-box-trim, the last formatted line detection doesn't properly handle when there's an inline-level box in the last line (call it L1) that is fragmented (due to wrapping or a forced line break) and needs to continue onto another line. This split causes a new last line (call it L2) to be created for this continuation. But this new actual last line, L2, is initially empty because the continuation is still in the overflow list of the original box. L2 is only populated when it's reflowed for the first time. This is problematic for L1, because when it tries to determine if it's the last formatted line by scanning forward, it sees L2 but notes that it's empty and ignores it. L1 is then marked as the last formatted line and gets trimmed (incorrectly).

This scenario occurs when there's a fragmented inline as the block's last child (like <span>...<br>...</span>). But it also occurs for any block with a ::first-line declaration and any line break, because Gecko's implementation of ::first-line creates inline wrapper frames and continuations for the entire block.

Shows four cases of the "fragmented inline box on last line":

  • ::first-line on the block with a <br> inside
  • ::first-line on the block with natural wrapping
  • <span> as the last child with a <br> inside
  • <span> as the last child with natural wrapping

Blink and WebKit have no issues with these. Gecko with this bug shows a) the middle line is closer to the first line because the first line was selected for trim-end, and b) the actual last line is not flush with the bottom of the block because it wasn't selected for trim-end.

Pushed by sajidanwar94@gmail.com: https://github.com/mozilla-firefox/firefox/commit/910768ab0d8c https://hg.mozilla.org/integration/autoland/rev/6d85bef9801c Fix text-box-trim last line detection for lines with pending overflow frames. r=layout-reviewers,emilio

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61986 for changes under testing/web-platform/tests

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

The patch landed in nightly and beta is affected.
:sajidanwar, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(sajidanwar94)
Flags: needinfo?(sajidanwar94)

Upstream PR merged by moz-wptsync-bot

Blocks: 2067858
QA Whiteboard: [qa-triage-done-c157/b156]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: