[css-view-transitions-2] Initial spec for nested view transitions - #10629
Conversation
This specifies the new 'view-transition-group' CSS property and how it used, with some overview and an initial example. Based on [this resolution](w3c#10334 (comment)). There are still a lot of open issues but we will open them separately to avoid inflating the initial issue. Closes w3c#10334
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
|
|
||
| : <dfn><<custom-ident>></dfn> | ||
| :: The '':view-transition-group()'' generated by this element's 'view-transition-name' should be a child of the ''::view-transition-group()'' pseudo-element | ||
| that matches the given <<custom-ident>>. |
There was a problem hiding this comment.
Please fix. If its TBD then leave a link to the issue.
|
|
||
| ## Changes to '':view-transition-group()'' ## {#pseudo-element-hierarchy-nested} | ||
|
|
||
| When the view [=view transition tree=] is generated, every generated ''::view-transition-group()'' becomes a child of an existing ''::view-transition-group()'' with the same name as its generating element's 'view-transition-group'. |
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
|
|
||
| When the [=computed value=] of 'view-transition-name' for an element is ''view-transition-name/none'', its 'view-transition-group' [=used value=] is always resolved to ''view-transition-name/none'' as well. | ||
|
|
||
| The <dfn>nearest containing group name</dfn> for an element is the 'view-transition-name' [=computed value=] of its nearest ancestor which has a 'view-transition-group' [=computed value=] of ''view-transition-group/contain'', or ''view-transition-group/none'' if such element does not exist. |
There was a problem hiding this comment.
We also need to add that this ancestor's view-transition-name should not be none, but it won't be needed if the suggestion above works.
|
|
||
| 1. Let |containingGroupName| be |transition|'s [=ViewTransition/named elements=][|capturedElement|'s [=containing group=]. | ||
|
|
||
| 1. Let |groupContainerElement| be |transition|'s [=ViewTransition/named elements=][|containingGroupName|]. |
There was a problem hiding this comment.
groupContainerElement is the captured element struct while we need the new element. And that can be null (for the exit transition case). So we need to check if groupContainerElement's new element is not null and then do the transform stuff.
There was a problem hiding this comment.
I refactored these algorithms, where the transform adjustment happens when setting the styles.
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
| 1. Let |groupContainerElement| be |transition|'s [=ViewTransition/named elements=][|capturedElement|'s [=containing group name=]]. | ||
|
|
||
| 1. Set |group|'s 'transform' to the transform that would map |capturedElement|’s [=new element=] [=border box=] from |groupContainerElement|'s [=border box=] to its current visual position. | ||
| 1. [=Multiply=] |transform| by the inverse matrix of |groupContainerElement|'s [=transform from snapshot containing block=]. |
There was a problem hiding this comment.
This looks like a bug for the exit transition case. Since |transform| passed to this algorithm would be the "old transform" here: https://drafts.csswg.org/css-view-transitions-1/#style-transition-pseudo-elements-algorithm:~:text=Set%20transform%20to%20capturedElement%E2%80%99s%20old%20transform.
And we already multiplied the "old transform" with an inverse of its ancestor's transform in "setting up the transition pseudo-element" above?
There was a problem hiding this comment.
Fixed, not multiplying in the previous phase.
| with its [=view transition name=] set to |capturedElement|'s [=containing group=]. | ||
| whost [=view transition name=] is set to |containingGroupName|. | ||
|
|
||
| 1. Set |capturedElement|'s [=captured element/old transform=] to the result of [=multiplying=] |capturedElement|'s [=captured element/old transform=] by the inverse matrix of |groupContainerElement|'s [=captured element/old transform=]. |
There was a problem hiding this comment.
IIUC we expect both the captured element's old transform and the groupContainerElement's old transform to be relative to the snapshot containing block here.
Wouldn't there be a bug for the case where we have A nesting B which nests C then? Since we build the pseudo tree top down, when we get to C, B's transform would already be relative to A but C's transform would be relative to the snapshot containing block.
Maybe we want to cache a "old transform from snapshot containing block" which is not mutated after capture?
There was a problem hiding this comment.
Fixed, not changing the old transform in the struct, only multiplying when setting the style.
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
|
|
||
| 1. Append |group| to |parentGroup|. | ||
|
|
||
| 1. When setting the animation keyframes given |transform|, [=multiply=] |transform| by the inverse matrix of |groupContainerElement|'s [=old transform=]. |
There was a problem hiding this comment.
When we get to merge the specs, would be nice to rename this to "transform from snapshot containing block".
This specifies the new 'view-transition-group' CSS property and how it used, with some overview and an initial example.
Based on this resolution.
There are still a lot of open issues but we will open them separately to avoid inflating the initial issue.
Closes #10334