Closed Bug 1784053 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 35417 - HighlightOverlayPainting: fix ‘text-decoration-skip-ink’

Categories

(Core :: Layout: Generated Content, Lists, and Counters, task, P4)

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Depends on 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

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

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

Delan Azabani <dazabani@igalia.com> wrote:

HighlightOverlayPainting: fix ‘text-decoration-skip-ink’

Underlines skip descenders when ‘text-decoration-skip-ink’ is ‘auto’,
but this relies on NGTextPainter having the correct range to compute
the text intercepts over. NGTextPainter is stateful, with a mutable
NGTextFragmentPaintInfo that affects things like the calculation of
text intercepts for skip ink.

This is generally not a problem, but for highlight painting we break
the text fragment into parts, often painting text for one range then
decorations for another. This means we might compute text intercepts
for the wrong range.

This patch fixes that bug by eliminating the NGTextFragmentPaintInfo
field, making functions that need one take it as an argument.

To make it easier to safely slice NGTextFragmentPaintInfo, we add
methods to do that while checking that the new range is a subrange of
the old range. That way, any guarantees the caller wants to make about
the StringView and/or ShapeResultView in the old instance remain true
for the new instance (for example, some callers don’t care if there’s
a valid ShapeResultView, and sometimes it’s nullptr).

To avoid messy template member functions, we duplicate a small method
(PaintDecorationUnderOrOverLine) for legacy, and move two others from
TextPainterBase into a new NGTextPainterBase, which contains LayoutNG-
specific code shared between NGTextPainter and NGTextCombinePainter.

Fixed: 1350469
Change-Id: Ic51ff58da4e2a80bae2527f7ea90b57b9e361000

Reviewed-on: https://chromium-review.googlesource.com/3820621
WPT-Export-Revision: b75a2fa06b12c21c222f231e9ba39049209a8fea

Component: web-platform-tests → Layout: Generated Content, Lists, and Counters
Product: Testing → Core
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7029885c1b97 [wpt PR 35417] - HighlightOverlayPainting: fix ‘text-decoration-skip-ink’, a=testonly
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.