gecko-dev/testing/web-platform/tests/css/css-pseudo/first-line-with-out-of-flow.html
Xianzhu Wang cdf29d93f7 Bug 1564747 [wpt PR 17610] - Reland "Fix first line style caching issues", a=testonly
Automatic update from web-platform-tests
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.
>
> 2. 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}

--

wpt-commits: bc0eab5e5ed10c689f6f08028a2060daddb3e32a
wpt-pr: 17610
2019-07-24 13:32:55 +01:00

20 lines
595 B
HTML

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo">
<link rel="match" href="first-line-with-out-of-flow-ref.html">
<style>
#block::first-line { color: green; }
</style>
<div id="block">
<div style="position: absolute"><br></div>
<div style="float: right"><br></div>
<div>
<div style="position: absolute"><br></div>
<div style="float: right"><br></div>
<div style="color: blue">
<div>
<span><span>This text should be green.</span></span><br>
This text should be blue.
</div>
</div>
</div>
</div>