Closed Bug 1750885 Opened 4 years ago Closed 3 years ago

[wpt-sync] Sync PR 32444 - Compute the NGLineInfo hang_width even if ignored in text alignment

Categories

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

task

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Javier Fernández García-Boente <jfernandez@igalia.com> wrote:

Compute the NGLineInfo hang_width even if ignored in text alignment

The NGLineInfo class has an attribute hang_width_ to store the width
of the preserved trailing spaces. Theoretically, this value is intended
to be used during text alignment, following the rules discussed and
resolved in the CSS WG issue 3440 [1]. In this issue it's been
discussed how to handle end-of-line pre-wrap spaces, which may hang and
could affect the final result of the text alignment.

However, we also use the NGLineInfo's attribute to compute the line
box's inline size, as part of the NGInlineLayoutAlgorithm::CreateLine
logic. Since we ignore the hanging spaces when using 'center'
alignment, we don't compute it; this leads to an incorrect inline size
of the fist line in the test case described in the bug 782638, which
incorrectly overflows the box's fixed size, causing the scrollbar to be
activated when it shouldn't.

Since we always compute the hang_width now, we need to consider it also
in the case of RTL scenarios, where we were assuming it was ignored
depending on certain values of the text alignment. In order to avoid
regressions, this CL also simplifies the line_box's inline_size
computation performed in the CreateLine function, ignoring for now the
text direction, we always subtract the hang_width

Then, the inclusion or not of the hang_width will be decided where it
should; the function NGInlineLayoutAlgorithm::ApplyTextAlign is the one
responsible of implementing the rules agreed in the CSS WG issue
mentioned before.

https://github.com/w3c/csswg-drafts/issues/3440

Bug: 782638, 1278559
Change-Id: Ib1950533169fb9cabc6b7bb9e6925451eff2a767
Reviewed-on: https://chromium-review.googlesource.com/3360876
WPT-Export-Revision: fce73d02da640c7edfc160ebe51a3d1a3153fba3

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 10 tests

Status Summary

Firefox

PASS: 10

Chrome

PASS: 4
FAIL: 6

Safari

PASS: 8
FAIL: 2

Links

GitHub PR Head
GitHub PR Base

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
You need to log in before you can comment on or make changes to this bug.