Skip to content

[css-view-transitions-2] Initial spec for nested view transitions - #10629

Merged
noamr merged 28 commits into
w3c:mainfrom
noamr:vt-nested-initial
Aug 13, 2024
Merged

[css-view-transitions-2] Initial spec for nested view transitions#10629
noamr merged 28 commits into
w3c:mainfrom
noamr:vt-nested-initial

Conversation

@noamr

@noamr noamr commented Jul 26, 2024

Copy link
Copy Markdown
Collaborator

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

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
@noamr
noamr requested review from khushalsagar and vmpstr July 26, 2024 10:34
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
noamr and others added 3 commits July 29, 2024 21:07
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
noamr and others added 11 commits July 30, 2024 09:16
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>
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated

: <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>>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix. If its TBD then leave a link to the issue.

Comment thread css-view-transitions-2/Overview.bs Outdated

## 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'.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix.

Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
noamr and others added 6 commits August 6, 2024 11:27
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>
Comment thread css-view-transitions-2/Overview.bs
Comment thread css-view-transitions-2/Overview.bs Outdated

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs
Comment thread css-view-transitions-2/Overview.bs Outdated

1. Let |containingGroupName| be |transition|'s [=ViewTransition/named elements=][|capturedElement|'s [=containing group=].

1. Let |groupContainerElement| be |transition|'s [=ViewTransition/named elements=][|containingGroupName|].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored these algorithms, where the transform adjustment happens when setting the styles.

Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
noamr and others added 3 commits August 9, 2024 07:03
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Comment thread css-view-transitions-2/Overview.bs Outdated
Comment thread css-view-transitions-2/Overview.bs Outdated
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=].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, not multiplying in the previous phase.

Comment thread css-view-transitions-2/Overview.bs Outdated
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=].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, not changing the old transform in the struct, only multiplying when setting the style.

noamr and others added 2 commits August 9, 2024 17:01
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=].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we get to merge the specs, would be nice to rename this to "transform from snapshot containing block".

@noamr
noamr merged commit 667d3d3 into w3c:main Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[css-view-transitions-2] Proposal for a view-transition-tree property (name tbd)

2 participants