Skip to content

Conversation

@jakearchibald
Copy link
Owner

@jakearchibald jakearchibald commented Jan 20, 2023

I moved some algorithms around, as such the diff is trash, sorry. I'll try and make it easier to read in the comments.

Don't merge this. I'll move it to the CSSWG when #2 lands.

Issue: Define the algorithm used to clip the snapshot when it exceeds max size.
</div>

## [=Handle transition frame=] ## {#update-transition-dom-algorithm}
Copy link
Owner Author

Choose a reason for hiding this comment

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

Renamed this. It used to be "update transition DOM", but it's doing more than that.

Choose a reason for hiding this comment

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

Sounds good.


Note: This algorithm captures the current state of the document,
calls the transition's {{UpdateCallback}},
then captures the new state of the document.
Copy link
Owner Author

Choose a reason for hiding this comment

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

This note is new.

Comment on lines +1100 to +1103
1. [=Capture the old state=] for |transition|.

If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=],
and return.
Copy link
Owner Author

Choose a reason for hiding this comment

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

This used to be inline, but the algorithm was getting a bit large. This felt like a unit that could be moved to its own sub-algorithm.

Comment on lines +1151 to +1154
1. [=Capture the new state=] for |transition|.

If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=],
and return.
Copy link
Owner Author

Choose a reason for hiding this comment

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

Another bit that used to be inline, but now moved into its own algorithm.

1. [=Resolve=] |transition|'s [=ViewTransition/ready promise=].
</div>

### [=Capture the old state=] ### {#capture-old-state-algorithm}
Copy link
Owner Author

Choose a reason for hiding this comment

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

I've groups some algorithms with a parent algorithm, if they're only ever called by the parent. This gives us a more hierarchical heading structure.

</div>

1. Set |document|'s [=document/transition suppressing rendering=] to true.
### [=Capture the new state=] ### {#capture-new-state-algorithm}
Copy link
Owner Author

Choose a reason for hiding this comment

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

This is just extracted from the "Setup view transition" algorithm. No changes other than returning failure, rather than throwing an error.

Issue: The link for "paint order" doesn't seem right.
Is there a more canonical definition?
<div algorithm>
To <dfn>setup transition pseudo-elements</dfn> for a {{ViewTransition}} |transition|:
Copy link
Owner Author

@jakearchibald jakearchibald Jan 20, 2023

Choose a reason for hiding this comment

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

This is just moved. No changes, aside from those noted.

Would it be simpler to always add it and try to optimize in the implementation?
</div>

## [=Call the update callback=] ## {#call-dom-update-callback-algorithm}
Copy link
Owner Author

Choose a reason for hiding this comment

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

Not changed, just moved.


Note: The |interestRectangle| is the subset of |element|'s [=ink overflow rectangle=] that should be captured.
This is required for cases where an element's ink overflow rectangle needs to be clipped because of hardware constraints.
For example, if it exceeds the maximum texture size.
Copy link
Owner Author

Choose a reason for hiding this comment

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

Moved this note to the "computing the interest rectangle" algorithm

Comment on lines +1292 to +1294
Note: This algorithm constructs the pseudo-element tree for the transition,
and generates initial styles.
The structure of the pseudo-tree is covered at a higher level in [[#view-transition-pseudos]].
Copy link
Owner Author

Choose a reason for hiding this comment

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

This is new

Comment on lines +1421 to +1423
Note: This is guaranteed to happen for every {{ViewTransition}},
even if the transition is [=Skip the view transition|skipped=].
The reasons for this are discussed in [[#transitions-as-enhancements]].
Copy link
Owner Author

Choose a reason for hiding this comment

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

This is new

@jakearchibald jakearchibald changed the base branch from dom-intro-sections to main January 27, 2023 15:47
@jakearchibald jakearchibald marked this pull request as ready for review January 27, 2023 15:48
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
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.

3 participants