Closed Bug 1742997 Opened 2 months ago Closed 2 months ago

[wpt-sync] Sync PR 31746 - Ignore items generated for line breaks at the beggining of the text

Categories

(Core :: DOM: Editor, task, P4)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

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

Ignore items generated for line breaks at the beggining of the text

In r944940 we've added some new logic to the AppendTextReusing function
in the NGInlineItemsBuilder class to dected some inconsitencies in the
items list related to control items added to force line breaks.

The bugs 1273593 and 1273688 decribe some invalid access to the text
array, since the text's legnth was 0 and we were initializing the index
at length - 1; being this index of type wtf_size_t, this code lead to
an arithmetic overflow, hence an index out of the text array range.

We could have fixed this specific issue by using an integer type and
changing the loop clauses to ensure the index is always positive. But
doing so we are hit by a different DCHECK violation, caused by a
difference in the length of the NGOffsetMapping current and new text,
performed as part of some integrity checks being done in the
NGInlineNode::PrepareLayout function.

The root cause of the integrity checks failure is that we are restoring
control items at the position 0 of the text, which indicates an invalid
state of the item list being processed. This is a similar issue than
the one described in 1263567, already fixed in the mentioned r944940
revision.

The solution to both problems would be to ignore control items generated
to force line breaks when the text_ length is 0.

Bug: 1263567, 1273593, 1273688
Change-Id: Ib743a94e91d331d7344b817194994bc6630ff2c9

Reviewed-on: https://chromium-review.googlesource.com/3302669
WPT-Export-Revision: 6e55a2a83de8986e049ac2e8852ef3842f5bddbe

Component: web-platform-tests → DOM: Editor
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/dba8f25c8fac
[wpt PR 31746] - Ignore items generated for line breaks  at the beggining of the text, a=testonly
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.