Closed Bug 1671140 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 26101 - Avoid DCHECK failure when reusing space and newline with white-space:pre

Categories

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

task

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

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

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

b'Oriol Brufau <obrufau@igalia.com>' wrote:

Avoid DCHECK failure when reusing space and newline with white-space:pre

Consider this code:
\<style>i { white-space: pre-line }\</style>
X\<i> \</i>\<i> \</i>

The first time that NGInlineNode::CollectInlines runs, the text data
will be "X", then "X ", and then AppendForcedBreakCollapseWhitespace
will remove the trailing whitespace before inserting the forced break,
so we get "X\n".

But if some text is appended dynamically, CollectInlines will run again,
and this time it will try to reuse existing items in AppendTextReusing.
Before this patch, this would produce "X \n", which would trigger a
DCHECK failure in ComputeOffsetMapping because it's a different string.

Therefore, this patch prevents AppendTextReusing from reusing existing
items if the last item to collapse with ends with collapsible spaces and
the first item to reuse has 'white-space:pre' and begins with a newline.

Bug: 1136688

TEST=external/wpt/css/css-text/white-space/pre-line-with-space-and-newline.html

Change-Id: I0ff71b125b66256ec3b5c263605c3c116f9ac55f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466279
Reviewed-by: Koji Ishii \<kojii@chromium.org>
Commit-Queue: Oriol Brufau \<obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#816641}

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

CI Results

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

Total 1 tests

Status Summary

Firefox

FAIL: 1

Chrome

PASS: 1

Safari

FAIL: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/css/css-text/white-space/pre-line-with-space-and-newline.html: FAIL (Chrome: PASS, Safari: FAIL)

CI Results

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

Total 1 tests

Status Summary

Firefox

FAIL: 1

Chrome

PASS: 1

Safari

FAIL: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/css/css-text/white-space/pre-line-with-space-and-newline.html: FAIL (Chrome: PASS, Safari: FAIL)

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c38df7d89326 [wpt PR 26101] - Avoid DCHECK failure when reusing space and newline with white-space:pre, a=testonly https://hg.mozilla.org/integration/autoland/rev/8cfcc196f948 [wpt PR 26101] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.