-
Notifications
You must be signed in to change notification settings - Fork 676
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
[css-view-transitions-2] First pass at layered capture #11045
Conversation
Describe how layered capture works, which CSS properties it targets and how it affects rendering. Based on [this resolution](w3c#10585 (comment)). This is a first pass, and still has open issues (will open separately): 1. Should there be a CSS property to decide on this? What should be the default? 2. How do we capture overflow/box-sizing? 3. (More capture questions if they come up) Closes w3c#10585
11fb9a6
to
ae59e4c
Compare
css-view-transitions-2/Overview.bs
Outdated
- 'overflow-clip-margin' | ||
- 'padding' | ||
|
||
Issue: the behavior of 'overflow' is not entirely clear, especially with ''overflow/scroll'' and ''overflow-auto''. Should the scroll bars be part of the snapshot? |
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.
nit: Also containment. Not clear whether style, layout and size containment should be carried over.
css-view-transitions-2/Overview.bs
Outdated
- 'overflow-clip-margin' | ||
- 'padding' | ||
|
||
Issue: the behavior of 'overflow' needs to be clarified, especially with ''overflow/scroll'' and ''overflow-auto''. Should the scroll bars be part of the snapshot? |
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.
containment is also an open question. We likely only want to consider paint containment and set overflow
to clip
if it's there.
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.
Added to the note, also moved the note
css-view-transitions-2/Overview.bs
Outdated
:: A string. | ||
|
||
: <dfn>transform from snapshot containing block</dfn> | ||
: <dfn>old nested group transform |
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.
why do we need new transforms here...? we dealt with this for nesting, layered capture shouldn't need to track new transforms.
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.
Done
css-view-transitions-2/Overview.bs
Outdated
|
||
### Render the snapshot with layered capture ### {#layered-capture-rendering} | ||
|
||
When capturing an element into a snapshot, apply the following style to the element in addition to the [=capture rendering characteristics=]: |
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.
I don't think this would be the right way to define this since we don't actually want to remove these styles. We could lean on the concept of "contents" defined in the contain spec: https://drafts.csswg.org/css-contain/#skips-its-contents:~:text=the%20flat%20tree%20descendants%20of%20the%20element%2C%20including%20both%20text%20and%20elements%2C%20or%20the%20replaced%20content%20of%20a%20replaced%20element to describe what should be painted when generating this snapshot. @vmpstr might have more input here.
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.
Reworded, PTAL?
css-view-transitions-2/Overview.bs
Outdated
Note: we apply 'outline-color' and 'border-color' instead of 'outline' and 'border' so that layout is not affected by capturing. | ||
|
||
### Compute the nested group transform ### {#vt-compute-nested-group-transform} | ||
To compute the <dfn>nested group transform</dfn> given an {{Element}} |element|, return a [=matrix=] equivalent to a 2D translation of (|element|'s [=computed value|computed=] ''border-left-width'', |element|'s [=computed value|computed=] ''border-top-width''). |
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.
Ah, so this is for the border offset. could we cache a 2D offset instead of a transform, and just name it explicitly like border offset
.
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.
Done
Co-authored-by: Khushal Sagar <[email protected]>
Co-authored-by: Khushal Sagar <[email protected]>
css-view-transitions-2/Overview.bs
Outdated
<div algorithm="adjust image capture size (layered)"> | ||
When [=capturing the image=] given |element|: | ||
1. Let |geometry| be |element|'s [=layered capture geometry=]. | ||
1. If |geometry| is not null and |geometry|'s [=layered box properties/box sizing=] is ''box-sizing/content-box'', |
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 snapshot capture is independent of box-sizing, box-sizing
only impacts the CSS of the pseudos. But the snapshot would always be content box size because there's no reason to capture borders as a part of it. So it wouldn't make sense for the snapshot to be larger than the element's content.
You can fold this into the "layered-capture-rendering" algorithm below.
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.
But this is the spot in L1 where we define the natural dimension of the image and how it's positioned...
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.
Eh ok, my main point was about not making this conditional based on box-sizing
. Does that make sense?
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.
Done
|
||
### Render the snapshot with layered capture ### {#layered-capture-rendering} | ||
|
||
When capturing an element into a snapshot, only the [=element contents=] are painted, without the element's effects and box decorations. |
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.
Would love to get @vmpstr's input on this phrasing too.
Taking inspiration from the wording in L1: https://drafts.csswg.org/css-view-transitions-1/#capture-the-image-algorithm:~:text=containing%20block.-,Otherwise,-%3A.
- We want to say what is painted, which is covered here.
- We want to say what the image size is internally in the UA which I think would be the union of ink overflow rectangles of all the descendants + size of replaced content..?
- And we want to define the web observable size of the image which is covered above as content box.
1. Append the [=string/concatenate|concatentation=] of « `"::view-transition-group("`, |transitionName|, `") {"`, |style| , `"}"` » to the constructed user-agent stylesheet. | ||
1. Let (|oldContentWidth|, |oldContentHeight|) be (|capturedElement|'s [=captured element/old width=], |capturedElement|'s [=captured element/old height=]) if |capturedElement|'s [=old box properties=] is null, otherwise |capturedElement|'s [=old box properties=]'s [=layered box properties/content box=]'s size. | ||
1. Let (|newContentWidth|, |newContentHeight|) be (|width|, |height|) if [=new box properties=] is null, otherwise |capturedElement|'s [=new box properties=]'s [=layered box properties/content box=]'s size. | ||
1. Append the next string (with replaced variables) to the user agent stylesheet: |
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.
https://chromium-review.googlesource.com/c/chromium/src/+/5953705 is appending the extra styles for image-pair only if layered capture is in use. Did you mean to do the same here as well? No need to override the existing styles in image-pair in flat capture mode.
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.
Yea, but we haven't resolved yet on "when are we in capture mode". So currently the capture mode spec changes assume that we're in that mode.
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.
Hmmm ok. Then maybe a link to the issue saying this is tentative is good enough.
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.
It's already there in the overview...
Co-authored-by: Khushal Sagar <[email protected]>
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.
Revised box-sizing
thing to only apply to the width/height rather than to the capture.
1. Append the [=string/concatenate|concatentation=] of « `"::view-transition-group("`, |transitionName|, `") {"`, |style| , `"}"` » to the constructed user-agent stylesheet. | ||
1. Let (|oldContentWidth|, |oldContentHeight|) be (|capturedElement|'s [=captured element/old width=], |capturedElement|'s [=captured element/old height=]) if |capturedElement|'s [=old box properties=] is null, otherwise |capturedElement|'s [=old box properties=]'s [=layered box properties/content box=]'s size. | ||
1. Let (|newContentWidth|, |newContentHeight|) be (|width|, |height|) if [=new box properties=] is null, otherwise |capturedElement|'s [=new box properties=]'s [=layered box properties/content box=]'s size. | ||
1. Append the next string (with replaced variables) to the user agent stylesheet: |
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.
It's already there in the overview...
Describe how layered capture works, which CSS properties it targets and how it affects rendering. Based on this resolution.
This is a first pass, and still has open issues (will open separately):
Closes #10585