Closed Bug 1857899 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 42425 - Avoid CustomStyleForAltText during ResolveStyle

Categories

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

task

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Anders Hartvoll Ruud <andruud@chromium.org> wrote:

Avoid CustomStyleForAltText during ResolveStyle

During HTMLImageElement::AdjustStyle, we do something very shady:
we poke into the UA shadow and mutate the inline style of some
of the elements in there. This causes style to be marked dirty
during style recalc, which is not a desirable situation.
The behavior would normally trigger a DCHECK, but it is currently
suppressed with by AllowMarkStyleDirtyFromRecalcScope.

Marking style dirty deeper in the current subtree works (sort of),
because we'll eventually reach those elements during the current
style recalc process anyway, so ultimately the dirtiness is
cleared. However, StyleResolver::ResolveStyle can also be called
outside of style recalc. For example, when producing styles
for kFirstLineInherited, we call ResolveStyle during layout.
In this case, there is no greater style recalc process ongoing,
so the dirtiness isn't cleared, and we trigger DCHECKs
(Issue 1486128).

This CL avoids the issue by reintroducing InputTypeView::
CustomStyleForLayoutObject, and making ImageInputType use that
mechanism instead of AdjustStyle. (Effectively a partial revert
of CL:4110875). This avoids the crash by relying on another bug:
when producing kFirstLineInherited styles, we ignore custom styles,
i.e. CustomStyleForLayoutObject never gets called (but AdjustStyle
does).

Bug: 953707
Change-Id: I4ec71ed2b23fe494d06ee80d71990040a94e9f98
Fixed: 1486128
Reviewed-on: https://chromium-review.googlesource.com/4921811
WPT-Export-Revision: 95f0e2ba6bca1ac68ab78783cf171b703e12dad8

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/4946b42d96dc [wpt PR 42425] - Avoid CustomStyleForAltText during ResolveStyle, a=testonly
Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in before you can comment on or make changes to this bug.