Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions css-view-transitions-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -434,32 +434,44 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
### Setting up the view-transition in the old {{Document}} ### {#setup-old-document-vt}

<div algorithm>
To <dfn export>setup cross-document view-transition</dfn> given a {{Document}} |oldDocument|,
a {{Document}} |newDocument|, a {{NavigationType}} |navigationType|, a boolean |isBrowserUINavigation|, and |onReady|, which is an algorithm accepting nothing:
To check if a <dfn export>should navigation trigger a cross-document view-transition?</dfn> given
an [=origin=] |oldOrigin|, an [=origin=] |newOrigin|, a boolean |newDocumentWasCreatedWithCrossOriginRedirects|, a {{NavigationType}} |navigationType|, and a boolean |isBrowserUINavigation|:

1. If the user agent decides to display an [=implementation-defined=] navigation experience, e.g. a gesture-based transition for a back navigation,
the user agent may ignore the author-defined view transition. If that is the case, return.
the user agent may ignore the author-defined view transition. If that is the case, return false.

1. If |navigationType| is {{NavigationType/reload}}, then return false.

1. If |navigationType| is {{NavigationType/reload}}, then return.
1. If ||newDocumentWasCreatedWithCrossOriginRedirects|, then return false.

1. If |isBrowserUINavigation| is true, and |navigationType| is {{NavigationType/push}} or {{NavigationType/replace}}, then return.
1. If |isBrowserUINavigation| is true, and |navigationType| is {{NavigationType/push}} or {{NavigationType/replace}}, then return false.

1. If |oldDocument|'s [=environment settings object/origin=] is not [=same origin=] as
|newDocument|'s [=environment settings object/origin=] then call |onReady| and return.
1. If |oldOrigin| is not [=same origin=] as |newOrigin| then return false.

1. If |newDocument| [=was created via cross-origin redirects=] is true
Copy link
Member

Choose a reason for hiding this comment

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

There is an early return above for the "created with cross-origin redirects" case so we'll never hit this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not exactly, but I'll move this bit to the HTML spec PR. A navigation was created with a cross-origin redirects if:

  • the document was created with cross-origin redirects
  • this is not a BFCache restore

and |newDocument|'s [=latest entry=] is null, then call |onReady| and return.
and |newDocument|'s [=latest entry=] is null, then return false.

Note: A document with a non-null [=latest entry=]
is being [=Document/reactivated=], in which case we don't need to check for cross-origin redirects.

1. Return true.
</div>
<div algorithm>
To <dfn export>setup cross-document view-transition</dfn> given a {{Document}} |oldDocument|,
a {{Document}} |newDocument|, a {{NavigationType}} |navigationType|, a boolean |isBrowserUINavigation|, and |onReady|, which is an algorithm accepting nothing:

1. [=Resolve @view-transition rule=] for |oldDocument| and let |resolvedRule| be the result.

1. If |resolvedRule| is "<code>skip transition</code>", then call |onReady| and return.
1. If |resolvedRule| is "<code>skip transition</code>", then return false.

Note: We don't know yet if |newDocument| has opted in, as it might not be parsed yet.
We check the opt-in for |newDocument| when we fire the {{Window/pagereveal}} event.

1. If the result of calling [=should navigation trigger cross-document view-transition?=]
given |oldDocument|'s [=Document/origin=], |newDocument|'s [=Document/origin=],
|newDocument|'s [=was created via cross-origin redirects=], |navigationType|, and |isBrowserUINavigation| is false,
then return.

1. If |oldDocument|'s [=active view transition=] is not null,
then [=skip the view transition|skip=] |oldDocument|'s [=active view transition=]
with an "{{AbortError}}" {{DOMException}} in |oldDocument|'s [=relevant Realm=].
Expand Down