[csswg-drafts] [css-view-transitions-2] @view-transition resolution algorithm should cascade (#9601)

bokand has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-2] @view-transition resolution algorithm should cascade ==
The @view-transition resolution algorithm is currently [specifies](https://drafts.csswg.org/css-view-transitions-2/#resolving-the-view-transition-rule):

> To get the resolve @view-transition rule for a [Document](https://dom.spec.whatwg.org/#document) document:
> 1. Let matchingRule be the last [@view-transition](https://drafts.csswg.org/css-view-transitions-2/#at-view-transition-rule) rule in document which has a navigation descriptor whose [computed value](https://drafts.csswg.org/css-cascade-5/#computed-value) is [auto](https://drafts.csswg.org/css-view-transitions-2/#valdef-view-transition-navigation-auto).
> 2. If matchingRule is not found, then return "not found".
> 3. Return a [list](https://infra.spec.whatwg.org/#list) of strings corresponding to that descriptor’s [computed value](https://drafts.csswg.org/css-cascade-5/#computed-value).

But I think it needs to account for the CSS cascade. Take this example:

```html
<style>
  @view-transition {
    navigation: auto;
    type: foo;
  }

  @import url('style.css') layer(A);
</style>
```
```css
  /*style.css*/
  @view-transition {
    navigation: auto;
    type: bar;
  }
```

I would expect the `foo` transition to be resolved, despite the fact that the `bar` transition is "last".

I think the way to do this will be to keep a map of all encountered `@view-transition` rules, keyed by their matcher descriptors (currently just `navigation` but later including `from`, `to`, etc. with succeeding levels of the cascade overriding a entries where the matchers are equal.

---

While we're here:

> Return a [list](https://infra.spec.whatwg.org/#list) of strings corresponding to that descriptor’s [computed value](https://drafts.csswg.org/css-cascade-5/#computed-value).

I'm assuming "that descriptor" is `navigation`? 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9601 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 15 November 2023 20:04:46 UTC