W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2019

Re: [csswg-drafts] [resize-observer] ResizeObserver should support fragments (#3673)

From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
Date: Mon, 25 Feb 2019 23:07:45 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-467221565-1551136064-sysbot+gh@w3.org>
The CSS Working Group just discussed `adding fragmentation support to resize observer`, and agreed to the following:

* `RESOLVED: Option 1; contentBox is an array of fragment sizes`

<details><summary>The full IRC log of that discussion</summary>
&lt;heycam> TopiC: adding fragmentation support to resize observer<br>
&lt;gregwhitworth> Github: https://github.com/w3c/csswg-drafts/issues/3673<br>
&lt;heycam> gregwhitworth: plinss brought up that we don't support fragments<br>
&lt;heycam> ... which is valid<br>
&lt;heycam> ... I don't want this API to back us into a corner for future support of some new display type<br>
&lt;heycam> florian: or printing<br>
&lt;heycam> gregwhitworth: in the issue we have this similar entry API shape<br>
&lt;heycam> florian: if you observe a multi col you would have two values in the entry?<br>
&lt;heycam> gregwhitworth: if observing a box that is fragmenting ...<br>
&lt;heycam> florian: ok<br>
&lt;heycam> gregwhitworth: ... this is just turning the contentBox property value from a single object to a list<br>
&lt;heycam> ... the one caveat I have with Houdini causing many fragments is that you'll get callbacks during custom layout, and you probably wouldn't use custom layout here.<br>
&lt;heycam> florian: inline fragmentation<br>
&lt;heycam> ... do this cover that?<br>
&lt;heycam> alex: resize observer doesn't support watching inlines<br>
&lt;heycam> florian: ruby doesn't fragment<br>
&lt;heycam> dbaron: some larger pieces can<br>
&lt;heycam> florian: the rb and rt don't<br>
&lt;heycam> florian: anyway, the API shape here works<br>
&lt;heycam> Rossen: the only thing you're trying to express here is paginated scenarios, such as multicol, in which you say are observing a div<br>
&lt;heycam> ... and the div is broken between two columns<br>
&lt;heycam> ... the representation would be a list of all of the fragments for that div<br>
&lt;heycam> ... of the content box of that div<br>
&lt;heycam> ... and the expected behavior is that you would get a callback when any of them change?<br>
&lt;heycam> gregwhitworth: that's the next issue<br>
&lt;heycam> ... technically I don't think you can observe those<br>
&lt;heycam> ... in multicol it's ok, content rect will change, and you'll get the notification<br>
&lt;heycam> ... I don't think you can't observe the other boxes<br>
&lt;heycam> florian: what other boxes?<br>
&lt;heycam> gregwhitworth: when you add a RO to an element, I don't know if you can add a resize observer to the other fragments<br>
&lt;heycam> dbaron: one way you could see this working is that -- an element has multiple boxes, if you're split over three columns, you have three boxes, if you fire an observer right now, you would produce an array with 3 boxes in it<br>
&lt;heycam> ... if that array were at some future point some different result, now it only has 2 things in it, or 4, or anything changes in that array, you fire another observation<br>
&lt;heycam> ... because something has changed<br>
&lt;heycam> florian: e.g. because it moved<br>
&lt;heycam> stefan: the interesting case if the content box didn't change but the fragments did<br>
&lt;heycam> ... I don't like that idea<br>
&lt;heycam> gregwhitworth: not even sure we can observe just the fragments<br>
&lt;heycam> dbaron: so you do'nt want to fire an event if it only moves between columns?<br>
&lt;heycam> gregwhitworth: did the content rect change?  then produce the fragments from that<br>
&lt;heycam> dbaron: but there are 3 content rects<br>
&lt;heycam> [Rossen draws]<br>
&lt;heycam> gregwhitworth: so what the API represents at this point is the fragmentainer ...<br>
&lt;heycam> florian: no fragmentainer is the container around that<br>
&lt;heycam> alex: if I am a web dev, have a concern how they're oging to use the fragmentation feature if at all<br>
&lt;heycam> ... most webdevs will code for a single box<br>
&lt;heycam> ... what happens if I've created a resized observer and suddenly someone puts the target in a multi col<br>
&lt;heycam> ... now the use of resize observer breaks<br>
&lt;heycam> heycam: depends on the exact API shape whether it would break or not<br>
&lt;heycam> alex: not sure what the use cases are exactly, but I can see most authors not thinking about fragmentation<br>
&lt;heycam> Rossen: the few that care about it have it<br>
&lt;heycam> gregwhitworth: I think it's ok to have it in here<br>
&lt;heycam> ... I don't see this scenario happening much based on the main use case for resize observer<br>
&lt;heycam> florian: I think for now we could kind of pretend that if we want to make it easy, we could pretend there's no fragmentation and just expose a single box<br>
&lt;heycam> ... but that's not future proof<br>
&lt;heycam> iank_: we have bugs in our impl with reporting geometry things in fragmented containers<br>
&lt;heycam> gregwhitworth: so the idea was to add an array, then add a single item for now in the array (incorrectly)<br>
&lt;heycam> florian: I think this satisfies plinss and fantasai's concerns<br>
&lt;heycam> rego: now the offsets might be useful...<br>
&lt;heycam> stefan: at some point if you're doing things with multicol and resize observer is not giving you granular enough information, you will use Houdini<br>
&lt;heycam> florian: cases where you might want more detailed info is custom painting, but then you'd use Custom Painting API<br>
&lt;heycam> dbaron: what kind of boxes or elements or whatever can you use resize observer on?<br>
&lt;heycam> Rossen: block elements<br>
&lt;heycam> alex: and SVG<br>
&lt;heycam> florian: grid, multi-col<br>
&lt;heycam> dbaron: tables?<br>
&lt;heycam> ... some things get messier with e.g. column spans in tables<br>
&lt;heycam> alex: watching column span sizes?  or cell sizes?<br>
&lt;heycam> dbaron: watching a div with a column span in the middle of it<br>
&lt;heycam> florian: we need to be mindful about which boxes, and which kinds of elements you can observe<br>
&lt;heycam> Rossen: I hope the current spec is already precise as to which elements you're allowed to observe<br>
&lt;heycam> florian: if not it needs to be<br>
&lt;heycam> iank_: still an open question about how to represent the fragments, a separate side structure<br>
&lt;heycam> alex: an array<br>
&lt;heycam> iank_: an additional array?<br>
&lt;heycam> ... the most common thing is people will use only one box<br>
&lt;heycam> ... weshouldn't make them access through an array<br>
&lt;heycam> Rossen: multiple box objects or a bunch of rects?<br>
&lt;heycam> Rossen: people might come back and say that fragments are not really rects<br>
&lt;heycam> iank_: if there's a single fragment, is that still an array with 1 element?<br>
&lt;heycam> gregwhitworth: yes<br>
&lt;heycam> heycam: what about the order of the entryies in the array?<br>
&lt;heycam> Rossen: document order<br>
&lt;heycam> ... the biggest issue with regions is that people complain about search result order<br>
&lt;heycam> gregwhitworth: the common use case for this is people watching border box and watch that change<br>
&lt;heycam> Rossen: but even that can be fragmented<br>
&lt;heycam> alex: the question what elements can we watch<br>
&lt;heycam> ... all elements, but observations don't fire for non-replaced inline elements<br>
&lt;heycam> ... per spec<br>
&lt;heycam> florian: so we need to be a bit more specific about table cells, ...<br>
&lt;heycam> alex: we can<br>
&lt;heycam> iank_: it would be nice if not needing to use the array<br>
&lt;heycam> ... could also make the contentBox attribute polymorphic<br>
&lt;heycam> alex: it would break things as soon as it becomes fragmented<br>
&lt;heycam> gregwhitworth: that's why I would like to have the summation in the entry too<br>
&lt;heycam> florian: what about when one fragment is narrower than another?<br>
&lt;heycam> iank_: Edge and Firefox take the union of the rects<br>
&lt;heycam> gregwhitworth: that would let you handle the common case<br>
&lt;heycam> ... but you would also have the fragments available in a separate property<br>
&lt;heycam> florian: as long as this isn't an excuse to not implement the array<br>
&lt;heycam> Rossen: if I have a tiny column for one part of a div and a large one for the rest of the div<br>
&lt;heycam> ... would you sum up the inline sizes in these single values?<br>
&lt;heycam> iank_: what you report for clientWidth today, which is the union of those values<br>
&lt;heycam> [whiteboard discussion about how to deal with summing up fragment sizes when they're on different pages]<br>
&lt;heycam> gregwhitworth: valid point about not being able to sum them up<br>
&lt;heycam> ... but I'm going back to the main use case of non fragmented boxes you want to observe<br>
&lt;heycam> Rossen: one way to interpret the proposal here is "we have heard your comment about fragmentation and come up with a future proofing of how this could be done"<br>
&lt;heycam> ... "and this or a version of this will solve this problem in a way to satisfy everyone"<br>
&lt;heycam> ... so we could resolve on having the fragments as a list we can add later<br>
&lt;heycam> florian: doesn't help, it's hard to define the separate values for the summed inlineSize/blockSize now<br>
&lt;heycam> Rossen: we can open a separate issue on fragmentation spec for that<br>
&lt;heycam> florian: if we go with the earlier syntax we don't have that problem<br>
&lt;heycam> iank_: we need this defined anyway for clientWidth/clientHeight<br>
&lt;heycam> ... there is blink/webkit vs edge/firefox<br>
&lt;heycam> Rossen: opening an issue on CSSOM and defining how clientWidth/clientHeight work under fragmentation is needed<br>
&lt;heycam> ... and whatever answer that has, will be reflected to be the two numbers here for inlineSize and blockSize on the entry<br>
&lt;heycam> ... if you don't have fragmentation, you don't have the problem<br>
&lt;heycam> ... being able to add fragments even as a v2, with this defined shape, will resolve the issue that peter, me, etc. who care about fragmentation have<br>
&lt;heycam> florian: in the spec right now we say "it's the same as clientWidth" and defer to CSSOM<br>
&lt;heycam> stefan: Intersection Observer is similar, it defers to getBoundingClientRect<br>
&lt;heycam> florian: the "add that later" ...<br>
&lt;heycam> gregwhitworth: realistically nobody is asking me for it<br>
&lt;heycam> Rossen: it's fine to have a v2 with it there right now<br>
&lt;heycam> gregwhitworth: but in terms of blocking on implementations we can't do that<br>
&lt;heycam> florian: the thing I like better with the first alternative, the fragmentation case is rare, when things become weird -- we tell them "wait til v2"<br>
&lt;heycam> gregwhitworth: this is not a "we don't want this", but it's prioritization<br>
&lt;heycam> [discussion about Chrome implementation of fragments]<br>
&lt;heycam> [discussion of whether web devs will notice the inline/block size being duplicated in the single-fragment case]<br>
&lt;heycam> iank_: I was imagining that for a single fragment that fragments is null<br>
&lt;heycam> florian: different approach to the same question<br>
&lt;heycam> ... an author who hasn't thought about fragments<br>
&lt;heycam> ... the thing they haven't thought about happened to be placed in multicol<br>
&lt;heycam> ... does it break more to get the first fragment size, or the union size?<br>
&lt;heycam> gregwhitworth: I would say equally<br>
&lt;heycam> iank_: if we use the max of the inline sizes and the sum of the block sizes that would be closest to being useful<br>
&lt;heycam> florian: regardless, if they just look at one it'll be wrong<br>
&lt;heycam> heycam: just wonder if using names other than inlineSize/blockSize for the summed values would make it look less unsensible<br>
&lt;heycam> florian: so I'm ok with both options prefer the one without the summed inlineSize/blockSize<br>
&lt;heycam> alex: is there any perf difference between the two?<br>
&lt;heycam> iank_: very small.  don't have to synthesize the array until you access it<br>
&lt;heycam> straw poll:<br>
&lt;heycam> 1. always return a contentBox which is an array of fragment sizes (usually containing one item currently)<br>
&lt;heycam> 2. return contentBox: { inlineSize: &lt;offsetWidth>, blockSize: &lt;offsetHeight>, fragments: [ { inlineSize, blockSize }, ... ] }<br>
&lt;astearns> main room is about to break<br>
&lt;astearns> (go on a break)<br>
&lt;florian> option 1<br>
&lt;smfr> 1<br>
&lt;Rossen> option 1, 2<br>
&lt;iank_> 2<br>
&lt;gregwhitworth> option 2<br>
&lt;heycam> option 1<br>
&lt;rego> option 1<br>
&lt;rachelandrew> option 1<br>
&lt;dbaron> prefer 2, I think, but not sure<br>
&lt;heycam> result: option 1<br>
&lt;heycam> RESOLVED: Option 1; contentBox is an array of fragment sizes<br>
&lt;heycam> trackbot: end telcon<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3673#issuecomment-467221565 using your GitHub account
Received on Monday, 25 February 2019 23:07:47 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:44 UTC