Re: [csswg-drafts] [css-highlight-api][css-contain] static ranges and css-contain (#4598)

After spending more time thinking about this I'd like to revisit the assumption that any restrictions on painting across contain boundaries is needed.

As far as I can tell, painting of ranges (both normal `Range` and `StaticRange`) happens basically without regard for paint contain boundaries. If I have a live Range inside an element with `contain:paint`, and I call `setStart` to move the range's boundary point outside of the element, then I've caused a paint change across a contain boundary.  When painting this range, paint containment can't really be taken into account.

The story is similar when painting highlight StaticRanges. In the Chromium implementation we have various conditions that can trigger repaints for them, but these don't take `contain` into account because ranges don't cleanly fit into the tree structure of the DOM, and their boundary points can be moved independently of DOM tree changes.

So is there anything specifically that would break if we allow StaticRange highlights to be painted across `contain:paint` boundaries, or any contain-related UA optimizations that would no longer be possible?

I know that we were concerned about cases like this, where changes inside an element with contain would lead to paint changes outside that element due to a range becoming invalid: https://codepen.io/daniec/pen/qBXMEaG. But another way to look at this case is that it's roughly equivalent to calling `setStart` to move the range's boundary point, which would trigger a contain-boundary-crossing paint update even for a live Range.

So I'm no longer convinced that allowing StaticRanges to paint across `contain:paint` boundaries is really a problem, if UAs and specs consider the painting of ranges to be something that needs to be computed without considering `contain:paint`, which I hypothesize is the case.

-- 
GitHub Notification of comment by dandclark
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4598#issuecomment-966564740 using your GitHub account


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

Received on Thursday, 11 November 2021 19:25:22 UTC