Bug 283295
Summary: | [css-anchor-position-1] Trigger evaluation of default anchor when it's used for anchor-center | ||
---|---|---|---|
Product: | WebKit | Reporter: | Pawel Lampe <plampe> |
Component: | CSS | Assignee: | Antti Koivisto <koivisto> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | bfulgham, kiet.ho, koivisto, simon.fraser, webkit-bug-importer, zalan |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Pawel Lampe
While working on anchor-center I've discovered that in some cases the resolution of anchoring is not done and therefore the anchored elements are not being linked to anchors. In other words, in some cases it's impossible to fetch default anchor element (https://drafts.csswg.org/css-anchor-position-1/#default-anchor-element) of given element.
Example 1:
In case of https://github.com/web-platform-tests/wpt/blob/master/css/css-anchor-position/anchor-center-offset-change.html the position-anchor is set to --anchor (that is a valid anchor) and the left is set to anchor(--unknown right, 0px) - in this case the anchor resolution should succeed and the internal anchoring-related data structures should store the relation between anchor and the anchor target.
Example 2:
In case of https://github.com/web-platform-tests/wpt/blob/master/css/css-anchor-position/anchor-center-scroll.html the position-anchor is set to --anchor (that is a valid anchor) and yet no inset properties are using anchor() function. In this case the anchor resolution should still succeed and the internal anchoring-related data structures should store the relation between anchor and the anchor target.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/140124449>
Kiet Ho
I haven't dived into this, so some speculation:
We gather:
* all anchor references - anchor name used in anchor() or anchor-size(), or elements with anchor-center
* all anchors - elements with anchor-name specified.
Then we attempt to resolve the anchor references, using the gathered list of anchors.
I think the code right now only looks for anchor references in anchor() and anchor-size(). If an element uses anchor-center and not anchor()/anchor-size(), then the reference isn't caught, even though anchor-center refers to the default anchor.
Pawel Lampe
That's correct.
IMO we should store all the anchor-references used (along with position-anchor) or at least the default one.
Kiet Ho
Pull request: https://github.com/WebKit/WebKit/pull/39599
Antti Koivisto
Pull request: https://github.com/WebKit/WebKit/pull/40758
EWS
Committed 290534@main (aa6b7858fefa): <https://commits.webkit.org/290534@main>
Reviewed commits have been landed. Closing PR #40758 and removing active labels.