merge_pr_45762
[anchor] Delay ::backdrop updates during interleaving
Elements in the top layer appear early in the layout tree,
and so we get the call to UpdateStyleForOutOfFlow for ::backdrop
before the call to UpdateStyleForOutOfFlow for the originating
element. This is problematic, because the second call to UpdateStyleForOutOfFlow (for the originating element) may also
recalc the style of the ::backdrop pseudo-element (which already
had its UpdateStyleForOutOfFlow call). The result is a computed
style for ::backdrop where all anchor*() functions are invalid.
This issue is currently masked by a combination of CL:5447517 and
Issue 330758160: the second call to UpdateStyleForOutOfFlow
recalculates the style, but doesn't invalidate anything.
Since the computed value of an invalid anchor*() is auto (CL:5447517),
getComputedStyle() grabs the value from the box, which is still correct
due to missing invalidation.
However, if we add explicit 0px fallbacks to the anchor() functions
within ::backdrop, getComputedStyle() won't ask the box, and we see
that the computed values are in fact wrong.
This problem is similar to the issues with had with ::backdrop for
Container Queries, so we can solve this the same way: by delaying
the updates to ::backdrop using PostStyleUpdateScope, and do another
round if needed.
Note: The new test (position-try-backdrop.html) also passes without
this CL. The anchor attribute test no longer passes without this CL
however, due to the addition of explicit 0px fallbacks (which aren't
supposed to be taken).
Bug: 335052779
Change-Id: I48f33568e172983be28264a982b5e04c22e16001
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5458187
Commit-Queue: Anders Hartvoll Ruud andruud@chromium.org
Reviewed-by: Rune Lillesveen futhark@chromium.org
Cr-Commit-Position: refs/heads/main@{#1288929}