Closed Bug 1564747 Opened 7 years ago Closed 7 years ago

[wpt-sync] Sync PR 17610 - Reland "Fix first line style caching issues"

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Xianzhu Wang <wangxianzhu@chromium.org> wrote:

Reland "Fix first line style caching issues"

This is a reland of 228ee33446fc20cef8fcc94503a91c16bbcfc6fb

Compared to the original CL, this relanded (again) CL has the
following changes:

  • Remove the lazy update of first line image observers which was not
    needed and didn't work (causing reentrancy of
    UpdateFirstLineImageObservers),
  • In LayoutObject::UpdateFirstLineImageObservers(), hold the first
    line style's reference locally because UpdateImageObservers may
    call LayoutBlockFlow::ImageChanged() which invalidates the cached
    first line style.

Original change's description:

Fix first line style caching issues

  1. Cache conflict issue:

Previously calls to Element:: Element::CachedStyleForPseudoElement()
with different second parameters caused cache conflict. The second
call to it might get unwanted result that was cached with a different
second parameter.

Now remove the second parameter, and the function gets and caches the
pseudo style only based on its own computed style. If a caller wants
a pseudo style based on another style, the caller should call
Element::UncachedStyleForPseudoElement() and manage cache by itself.

  1. Under-invalidation on change

Cached first line style needs invalidation in two cases:
a) when the ::first-line style changes, we should invalidate all
cached first line styles affected.
b) when style of an inline element (which inherits ::first-line
style) changes, as the inline element's style has higher priority
than the inherited ::first-line style, even if the style doesn't
change, we need to invalidate the cached
kPseudoIdFirstLineInherited style if the new style is different
from the inherited ::first-line style.

Bug: 979054

Change-Id: Icffe68d5136349d12cce6e92d1d3bf153c28903a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1678878
Reviewed-by: Rune Lillesveen \<futhark@chromium.org>
Commit-Queue: Xianzhu Wang \<wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#673574}

Bug: 979054
Change-Id: If7211c585df77964789140277839a8f1c3822a15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1685672
Commit-Queue: Xianzhu Wang \<wangxianzhu@chromium.org>
Reviewed-by: Fredrik Söderquist \<fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#674509}

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Type: -- → task
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Failed to get results from try push
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/mozilla-inbound/rev/9a057a0ac00f [wpt PR 17610] - Reland "Fix first line style caching issues", a=testonly
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.