Skip to content

[css-anchor-position] Computed value of position-area #11828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fantasai opened this issue Mar 5, 2025 · 2 comments
Closed

[css-anchor-position] Computed value of position-area #11828

fantasai opened this issue Mar 5, 2025 · 2 comments

Comments

@fantasai
Copy link
Collaborator

fantasai commented Mar 5, 2025

The position-area syntax has multiple syntaxes in order to accommodate different relationships to the writing mode, but it also has two syntaxes which are exactly equivalent: the start start syntax and the block-start inline-start syntax.

Should these two compute to each other? I think it would make sense to do so.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-anchor-position] Computed value of `position-area` , and agreed to the following:

  • RESOLVED: block/inline-start-end (and the self-* variants) compute to start/end or self-start/end
The full IRC log of that discussion <bkardell> TabAtkins: the position-area property has a number of syntaxes - it has two that are exactly equivalent
<TabAtkins> start start and `block-start inline-start`
<bkardell> elika said they should be equivalent, tab doesn'thavean opinion
<bkardell> TabAtkins: which of the pair it should go to elika? opinion?
<fantasai> astearns: Should it be the shortest serialization or the most explicit one?
<bkardell> kiet: I opened this - It comes up because I am implementing and some of the tests are mismatched because webkit serializes one way, chrome another - if we have one way it's easier to write tests
<bkardell> florian: make it short if we can
<bkardell> TabAtkins: if it is already the case that multiple browsers do this, but just disagreeonwhich I would agree and say lets just use start start
<bkardell> Proposed resolution: block-start and inline-start will serialize to start start and they will compute to start start
<bkardell> kiet: this also applies to self block start...?
<bkardell> TabAtkins: yes
<TabAtkins> proposed: block/inline-start-end (and the self-* variants) compute to start/end or self-start/end
<bkardell> resolved
<bkardell> resolved: block/inline-start-end (and the self-* variants) compute to start/end or self-start/end
<bkardell> RESOLVED: block/inline-start-end (and the self-* variants) compute to start/end or self-start/end
<bkardell> !!!!

webkit-commit-queue pushed a commit to tuankiet65/WebKit that referenced this issue Apr 4, 2025
…sition-area

rdar://146814606
https://bugs.webkit.org/show_bug.cgi?id=289589

Reviewed by Antti Koivisto.

This commit implements swapping due to a try-tactic [1] for position-area.
This is done at style building time; BuilderConverter::convertPositionArea
will flip position-area as specified by the position-try fallback. This is
needed instead of flipping position-area at layout time, because
position-area should compute to the flipped value.

There are some remaining test failures in try-tactic-position-area.html;
these has to do with how position-area should be computed. The test expects
the computed value of position-area to use axis-ambiguous keywords, when the
specified value also uses those keywords (e.g: 'start end' computes to
'start end'). However, WebKit currently computes to their axis-unambiguous
equivalent (e.g: 'start end' computes to 'block-start block-end').
This issue is tracked in [2].

[1]: https://drafts.csswg.org/css-anchor-position-1/#swap-due-to-a-try-tactic
[2]: w3c/csswg-drafts#11828

* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-013-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-014-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/last-successful-basic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/last-successful-change-fallbacks-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/last-successful-iframe-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/last-successful-intermediate-ignored-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/position-area-in-position-try-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/try-tactic-position-area-expected.txt:
* Source/WebCore/rendering/style/PositionArea.cpp:
(WebCore::operator<<):
    - Implemented operator<<(TextStream ts, PositionArea{Axis,Track,Self})
      operator<<(TextStream ts, PositionAreaSpan) will use these functions instead.
    - operator<< that takes references were changed to take values.

* Source/WebCore/rendering/style/PositionArea.h:
(WebCore::oppositePositionAreaAxis):
    - See below.

* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::flipPositionAreaByLogicalAxis):
    - Added function to flip position-area by a logical axis (block/inline).

(WebCore::Style::mirrorPositionAreaAcrossDiagonal):
    - Added function to flip position-area according to flip-start.

(WebCore::Style::BuilderConverter::convertPositionArea):
    - Added code to flip position-area according to the fallback try tactic,
      if specified.

(WebCore::Style::BuilderConverter::convertPositionTryFallbacks):
    - Tightened parsing a bit by rejecting the CSS value if duplicate
      tactics are found.

(WebCore::Style::positionAreaOppositeAxis): Deleted.
    - Renamed to oppositePositionAreaAxis, and moved to PositionArea.h

Canonical link: https://commits.webkit.org/293219@main
@w3c w3c deleted a comment from Shuvohasn May 9, 2025
@fantasai fantasai closed this as completed May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Thursday Afternoon
Development

No branches or pull requests

2 participants