Re: [csswg-drafts] [css-view-transitions-1] Exposing ink overflow rect bounds to script (#8597)

The CSS Working Group just discussed `[css-view-transitions-1] Exposing ink overflow rect bounds to script`, and agreed to the following:

* `RESOLVED: Snapshot raster is theoretically infinite. Snapshot has a "natural view box" of the snapshot element's border box (giving the natural size). Object-view-box can change this view box.`

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> khush: We touched on defining the bounds of the element you capture at the f2f<br>
&lt;TabAtkins> khush: One aspect is the natural size of the image is the ink overflow rectangle.<br>
&lt;TabAtkins> khush: This can be larger than the border box, so you use object-view-box to size it<br>
&lt;TabAtkins> khush: This means the ink overflow rectangle is exposed to authors<br>
&lt;TabAtkins> khush: But this is currently undefined, what to do?<br>
&lt;TabAtkins> khush: Two options. One questions whether we expose this at all.<br>
&lt;TabAtkins> khush: We can censor it in getComputedStyle() and make it !important in UA styles here.<br>
&lt;TabAtkins> khush: This can be bad if authors want to customize the size<br>
&lt;TabAtkins> khush: I haven't seen good use-cases for customizing it tho.<br>
&lt;TabAtkins> khush: Suggestion from fantasai is to use the scrollable overflow rect instead<br>
&lt;TabAtkins> khush: So the natural size authors see is scrollable overflow, but the browser can actually draw a larger ink overflow<br>
&lt;TabAtkins> khush: I'm fine with either option from impl.<br>
&lt;TabAtkins> khush: If scrollable overflow makes more sense as an author-exposed concept, that's fine<br>
&lt;TabAtkins> khush: But if ink overflow would be useful we shoudln't shy away from using it<br>
&lt;TabAtkins> q+<br>
&lt;Rossen_> ack fantasai<br>
&lt;TabAtkins> fantasai: One, I don't think authors want to control layout of stuff using ink overflow rect. Kinda unpredictable.<br>
&lt;TabAtkins> fantasai: And not what they're actually measuring. It's excess stuff, you don't really notice it's there. Serifs on font, blur on box-shadow, etc<br>
&lt;TabAtkins> fantasai: So I don't think this is something authors will want to use.<br>
&lt;TabAtkins> ack TabAtkins<br>
&lt;florian> q+<br>
&lt;TabAtkins> fantasai: I think we either want the scrollable overflow or the box fragments, and allow image to overflow the rect in some way<br>
&lt;flackr> q+<br>
&lt;TabAtkins> fantasai: Even if we expose ink overflow in IntersectionObserve for security reasons, I don't think it's something people want to measure against<br>
&lt;TabAtkins> +1 to fantasai's points<br>
&lt;Rossen_> ack florian<br>
&lt;TabAtkins> florian: Might be confsued, but thought in the gneeral case the ink overflow was not only underspecified, it wasn't necessarily finite.<br>
&lt;TabAtkins> florian: With blurs it can technically be infinite.<br>
&lt;TabAtkins> fantasai: You're right, tho we'd have a proposal to define the bounds that it clips. Tehcnically what impls do today anyway.<br>
&lt;Rossen_> ack flackr<br>
&lt;fantasai> s/we'd have/there was<br>
&lt;TabAtkins> flackr: I think hiding the ink overflow rect is one of my proposals<br>
&lt;TabAtkins> flackr: But my proposal was more that if authors set an ink overflow, we'd combine it with intrinsic ink overflow from the image, and they'd always work wrt the border box of the item.<br>
&lt;TabAtkins> fantasai: Not sure I'm following, more concrete example?<br>
&lt;TabAtkins> flackr: Say you ahve 100x100 box, there's 50px of shadow around it<br>
&lt;TabAtkins> flackr: The thing presented to the dev is no ink overflow.<br>
&lt;TabAtkins> flackr: But when we calculate the ink overflow, we'd add the 50px to whatever we got from the author's ink overflow rect<br>
&lt;TabAtkins> Rossen_: what do you mean by "presented to the dev"<br>
&lt;TabAtkins> flackr: The value of object-overflow won't expose that shadow size.<br>
&lt;Rossen_> q?<br>
&lt;TabAtkins> khush: I'm also having toruble understanding this - is this similar to what fantasai is suggesting, where you see the scorllable overflow as the exposed size?<br>
&lt;TabAtkins> flackr: Basically the same, probably just an impl detail about how it works.<br>
&lt;Rossen_> ack fantasai<br>
&lt;chrishtr> q+<br>
&lt;khush> q+<br>
&lt;TabAtkins> fantasai: I wasn't sure if the box we shoudl use is scrollable overflow or the border box, just pretty sure it shouldn't be the ink overflow rect<br>
&lt;TabAtkins> fantasai: If we have the property controlling the clipping, we could have an "auto" value that computes to itself and works from the ink overflow<br>
&lt;Rossen_> ack chrishtr<br>
&lt;TabAtkins> chrishtr: I think what elika and rob are saying makes sense<br>
&lt;TabAtkins> chrishtr: But khushal, is there any case you've seen where authors need to know the ink overflow to position correctly?<br>
&lt;TabAtkins> khush: No, it is handled automatically.<br>
&lt;TabAtkins> khush: But if authors can set the object-view-box, they get information about the natural size.<br>
&lt;TabAtkins> khush: Like if you say "none", then measure the box, you'll get the size out.<br>
&lt;TabAtkins> khush: So I'm fine with saying the natural size is the border box or scrollable overflow, and what authors see is based on that size.<br>
&lt;Rossen_> ack khush<br>
&lt;TabAtkins> khush: From what i've heard so far, I think I like the proposal of scrollable overflow. If we decide not to expose it and there's a use-case later, it'll be hard to change.<br>
&lt;TabAtkins> khush: So inclined to exposing it, using the scrollable overflow.<br>
&lt;TabAtkins> +1<br>
&lt;Rossen_> ack fantasai<br>
&lt;TabAtkins> fantasai: So we have a replaced element. It contains an image which is  snapshot.<br>
&lt;flackr> q+<br>
&lt;TabAtkins> fantasai: The size of that replaced element is the size of the snapshot element's border box.<br>
&lt;TabAtkins> fantasai: But like an SVG image, that extends past its viewbox.<br>
&lt;TabAtkins> fantasai: and we're setting a property that cause th estuff outside the stuff to actually paint<br>
&lt;fantasai> s/outside the stuff/outside its declared size/<br>
&lt;fantasai> s/declared/nominal<br>
&lt;TabAtkins> khush: Yes, using object-view-box to make the sizing align, and then anything outside paints as ink overflow, is clipped based on 'overflow'.<br>
&lt;TabAtkins> fantasai: So on an SVG currently, say I draw a bunch of circles then set viewbox to 50x50<br>
&lt;TabAtkins> fantasai: I'll get a 50x50 image, stuff can get drawn outside of that. If I put this in an &lt;img> they'll get clipped by default.<br>
&lt;TabAtkins> fantasai: But they're still there - if I use  object-position we're moving that 50x50 square.<br>
&lt;TabAtkins> fantasai: object-view-box refers to that viewbox declaration - I could change it and it would change what portion of the SVG is "the displayed image"<br>
&lt;TabAtkins> fantasai: So we're creating a snapshot whose viewbox is the border box of the snapshot element<br>
&lt;TabAtkins> fantasai: I think we can conceptually say the top left corner of the border box is the 0 coord for the image, for th epurpose of object-view-box?<br>
&lt;TabAtkins> fantasai: Then I think we ahve an analogous situation<br>
&lt;TabAtkins> [i don't quite understand this]<br>
&lt;flackr> +1 that is how i was thinking object-view-box modifications should work<br>
&lt;TabAtkins> fantasai: I think this gets us a mental model and an API consistent with SVG<br>
&lt;TabAtkins> khush: So you're right about the viewbox descriptions.<br>
&lt;TabAtkins> khush: But the origin is based on the natural size<br>
&lt;TabAtkins> khush: object-view-box says to inset from those natural bounds<br>
&lt;TabAtkins> khush: We have an option to say what amount of overflow is exposed to authors<br>
&lt;Rossen_> ack flackr<br>
&lt;TabAtkins> flackr: I agree with elika's thinking about how this should work, that matches what i'm imagining<br>
&lt;TabAtkins> flackr: the ink overflow isn't dev-exposed, just part of the object we've captured<br>
&lt;TabAtkins> flackr: so 0,0 is at the border box corner<br>
&lt;TabAtkins> flackr: Do we capture scrollable overflow even if the source element clipped it?<br>
&lt;TabAtkins> flackr: Is it only for overflow:visible we capture?<br>
&lt;TabAtkins> fantasai: No, we capture what you actually see.<br>
&lt;khush> q+<br>
&lt;TabAtkins> fantasai: I want to change what I'm proposing from what was in th eissue<br>
&lt;TabAtkins> q=<br>
&lt;TabAtkins> q+<br>
&lt;TabAtkins> fantasai: The natural image should be the full size of stuff we see.<br>
&lt;TabAtkins> fantasai: But the origin of the image should be the border box corner.<br>
&lt;TabAtkins> fantasai: Similar to SVG with its viewport<br>
&lt;TabAtkins> fantasai: In SVG you can draw into negative coords<br>
&lt;TabAtkins> fantasai: So I'm proposing the origin of the image is the border box corner. Anything that overflows that is captured for the snapshot still gets captured.<br>
&lt;flackr> +1<br>
&lt;TabAtkins> fantasai: So we create a raster image whose origin is not the top-left corner of the image<br>
&lt;TabAtkins> fantasai: So that lets us say the natural size is the border box. If they want to change that, they can do that (so long as it's captured)<br>
&lt;TabAtkins> fantasai: and if they extend past what's captured they get transparent pixels<br>
&lt;TabAtkins> fantasai: so we don't need to define the boundary of the raster, just that it captures at least the visible scrollable overflow<br>
&lt;TabAtkins> fantasai: everything outside is on an infinite transparent canvas<br>
&lt;TabAtkins> fantasai: I think that gets us a model where author can do whatever they want to do<br>
&lt;Rossen_> ack fantasai<br>
&lt;TabAtkins> khush: +1 elika's suggestion<br>
&lt;TabAtkins> khush: It's funny we added object-viewbox because what is proposed now is what we thought about implementing internally, so we thought a cSS property is a better way to do it<br>
&lt;TabAtkins> khush: So it sounds now we conceptually do what object-view-box is doing but expose it to the author<br>
&lt;TabAtkins> khush: So +1<br>
&lt;fantasai> TabAtkins: basically what khush said<br>
&lt;Rossen_> ack TabAtkins<br>
&lt;Rossen_> ack khush<br>
&lt;fantasai> TabAtkins: original purpose of ovb was to have natural size image and cutout the border box part<br>
&lt;fantasai> TabAtkins: but if we're dealing withi ink ...<br>
&lt;fantasai> TabAtkins: So default case doesn't need 'object-view-box' at all, its natural viewbox matches border-box, sounds find to me<br>
&lt;fantasai> TabAtkins: requires minor spec edits, but good change overal<br>
&lt;fantasai> TabAtkins: and if you want the image to look larger, then you would use negative coords<br>
&lt;fantasai> TabAtkins: rather than smaller positive coords<br>
&lt;fantasai> TabAtkins: so sounds fine, good overall<br>
&lt;TabAtkins> Rossen_: Can you summarize resolution?<br>
&lt;TabAtkins> fantasai: proposed resolution is snapshot rasterization is theoretically infinite. Origin corresponds to top-left of border box of snapshotted element, natural size is width+height of border box. Author can use object-view-box to shift this "natural view box"<br>
&lt;flackr> +1<br>
&lt;ydaniv> +1<br>
&lt;TabAtkins> Rossen_: comments or objections?<br>
&lt;TabAtkins> RESOLVED: Snapshot raster is theoretically infinite. Snapshot has a "natural view box" of the snapshot element's border box (giving the natural size). Object-view-box can change this view box.<br>
&lt;chrishtr> https://github.com/w3c/csswg-drafts/issues/8637<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8597#issuecomment-1488952275 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 29 March 2023 16:48:47 UTC