Closed Bug 1750585 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 32415 - Reland "The line offset must include the trailing spaces hang_width"

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 32415 into mozilla-central (this bug is closed when the sync is complete).

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

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

Reland "The line offset must include the trailing spaces hang_width"

This is a reland of 327959fa6b34cce33d6ad95820132cbfa7d45c81 but with
some modifications to avoid regression like bug #1286299. Basically, I
don't adjust the line offset if the hang width causes overflow.

In r876293 we solved how we computed trailing spaces' width in text
using RTL direction. It's worth mentioning that we could implement this
change thanks to the first steps toward a full UAX#9 L1 implementation
that we started in https://crrev.com/c/2505486.

On the other hand, in the NGInlineLayoutAlgorithm::CreateLine function
we call to NGInlineLayoutStateStack::ComputeInlinePositions to compute
the line_box's inline_size and left offset of the text.

For some reason, I believe to make easier the implementation of some
alignment and justification related logc, we were ignoring the trailing
space hang_width for the box's inline_size, hence its offset in the
line.

However, in order to correctly place the Caret after a space insertion
it's needed to consider this hang_width, which is now properly computed
thanks to the change in r876293, as mentioned previously.

The bug described in the issue 1278559 is caused by this difference
between the caret position computed after the InsertTextCommand, which
as I said includes the new hang_width value as a result of the new
inserted space, and the current line_box left offset in a RTL text. We
are applying some adjustments in the ComputeLocalCaretRectAtTextOffset
function, to ensure that the caret_location offset was between the
line_box.X() and the right_limit. Since the line_box.X() didn't include
the hang_width, the effect was that the caret never advanced to the new
position after the inserted space.

Bug: 1278559
Change-Id: I2873a80ea74174caf47c3af33c031c4da617cd55
Reviewed-on: https://chromium-review.googlesource.com/3387789
WPT-Export-Revision: f719d3c186db0015e5b5801f1370ea5d2488a1a6

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

CI Results

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

Total 2 tests

Status Summary

Firefox

PASS: 2

Chrome

PASS: 2

Safari

PASS: 2

Links

Gecko CI (Treeherder)
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.