-
Notifications
You must be signed in to change notification settings - Fork 707
[css-view-transitions-1] Display live image when element is outside the snapshot containing block in old state #10587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1172,7 +1172,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |
|
||
<dl dfn-for="captured element"> | ||
: <dfn>old image</dfn> | ||
:: an 2D bitmap or null. Initially null. | ||
:: a 2D bitmap, "`live`" or null. Initially null. | ||
|
||
: <dfn>old width</dfn> | ||
: <dfn>old height</dfn> | ||
|
@@ -1368,11 +1368,13 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |
|
||
1. Let |capture| be a new [=captured element=] struct. | ||
|
||
1. Set |capture|'s [=old image=] to the result of [=capturing the image=] of |element|. | ||
|
||
1. Let |originalRect| be [=snapshot containing block=] if |element| is the [=document element=], | ||
otherwise, the element|'s [=border box=]. | ||
|
||
1. If |originalRect| does not intersect with [=snapshot containing block=], then set |capture|'s [=old image=] to "`live`". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to use the ink overflow rect here, instead of border box. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this in the resolution? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We didn't explicitly state that in the resolution. It's in the notes here:
The last comment was from the discussion here where the conclusion was that ink overflow is sufficiently spec'd to be used by VT or IntersectionObserver. |
||
|
||
1. Otherwise, set |capture|'s [=old image=] to the result of [=capturing the image=] of |element|. | ||
|
||
1. Set |capture|'s [=captured element/old width=] to |originalRect|'s {{DOMRect/width}}. | ||
|
||
1. Set |capture|'s [=captured element/old height=] to |originalRect|'s {{DOMRect/height}}. | ||
|
@@ -1469,9 +1471,11 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |
1. If |capturedElement|'s [=captured element/old image=] is not null, then: | ||
|
||
1. Let |old| be a new ''::view-transition-old()'', | ||
with its [=view transition name=] set to |transitionName|, | ||
displaying |capturedElement|'s [=captured element/old image=] | ||
as its [=replaced element|replaced=] content. | ||
with its [=view transition name=] set to |transitionName|. | ||
|
||
1. If |capturedElement|'s [=captured element/old image=] is not "`live`", then | ||
set |old|'s [=replaced element|replaced=] content to |capturedElement|'s | ||
[=captured element/old image=]. | ||
|
||
1. Append |old| to |imagePair|. | ||
|
||
|
@@ -1903,11 +1907,19 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |
|
||
Note: The above code example contains variables to be replaced. | ||
|
||
1. Let |liveSnapshot| be the result of [=capturing the image=] of |capturedElement|'s [=new element=]. | ||
noamr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. If |capturedElement|'s [=new element=] is not null, then: | ||
|
||
1. Let |new| be the ''::view-transition-new()'' with the [=view transition name=] |transitionName|. | ||
|
||
1. Set |new|'s [=replaced element=] content to the result of [=capturing the image=] of |capturedElement|'s [=new element=]. | ||
1. Set |new|'s [=replaced element=] content to |liveSnapshot|. | ||
|
||
1. If |capturedElement|'s [=old image=] is "`live`", then: | ||
|
||
1. Let |old| be the ''::view-transition-old()'' with the [=view transition name=] |transitionName|. | ||
|
||
1. Set |old|'s [=replaced element=] content to |liveSnapshot|. | ||
|
||
This algorithm must be executed to update styles in [=user-agent origin=] if its effects can be observed by a web API. | ||
|
||
|
@@ -1979,6 +1991,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230 | |
* Fix algorithm for dispatching updateDOMCallback promise. | ||
* Scope view transition names to matching tree context. See <a href="https://github.com/w3c/csswg-drafts/issues/10145">issue 10145</a>. | ||
* Fix scoping to match name instead of element. See <a href="https://github.com/w3c/csswg-drafts/issues/10145">issue 10145</a>. | ||
* Show live contents if the old element is captured when outside the viewport. See <a href="https://github.com/w3c/csswg-drafts/issues/8282">issue 8282</a>. | ||
|
||
<h3 id="changes-since-2022-05-25"> | ||
Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230525/">2022-05-25 Working Draft</a> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since old image is supposed to be a 2D bitmap data type, making it also "live" is odd. Can we track this state using a separate bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would
old image
hold in the live case then? I actually think this is a good way to represent it and it's common in other standards (e.g.fetch
callbacks passfailure
, a network error, or a response).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old image can stay null, since we didn't capture anything. And a bool on captured element like, "should display new live image for old pseudo".
I find the pattern of strongly typed data types in the spec makes it more readable, could be my C++ brain. 😅 So would prefer it unless you feel strongly otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Actually I need to do this anyway because once we update from the actual live snapshot that
live
enum is replaced with an image anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm actually trying to refactor this makes it so that I have to check for this boolean in multiple places (where we check for
old image is null
). I think the variant approach is a lot cleaner...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the bool can be "should generate old pseudo"? That's what old image != null implies which we want to change right. Then we'd only use old image when we need the pixels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, done.