Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upClip replaced elements to their content rect #26390
Comments
|
I think what we want to do here is just establish a rounded rectangle clip when building the display list for the |
|
Background painting is another case where we have WebRender clips for rounded corners, but those clips apply only to specific display items. My question was around how to make sure that everything in a sub-tree uses that clip. By the way, per spec replaced elements are clipped even if the corner radius happens to be zero. This is not observable for raster images, but it might be eventually for SVG depending on how we end up integrating Pathfinder to WebRender. |
|
For the subtree case, I think we can keep a stack of item-derived clips in the display list builder and use it to create |
|
We presumably already do something similar for nested elements with the That said dealing with the general case may not worth worrying about yet since we have no plan to implement SVG soon, and so far the |
layout_2020::replaced::ReplacedContent::make_fragmentis called in three places for inline-level, block-level, and absolutely-positioned replaced boxes. It returns an arbitraryVecof fragments for the replaced content which is wrapped into aBoxFragmentfor the box itself. The latter is responsible the box’s borders, backgrounds, etc. Hopefully, this nesting in the fragment tree will also make it easier to implementobject-fitandobject-position.Layout 2020 does not yet implement this bit of spec: https://drafts.csswg.org/css-backgrounds/#corner-clipping
(The content edge curve is the content rect, with corners possibly rounded by
border-radius.) Note that this is different from the clipping/trimming by theoverflowproperty, which uses the padding rect/edge.In the current fragment tree however there is no way to tell whether a
BoxFragmentwas generated for a replaced element. We may want to add a boolean field or equivalent, so that display list construction can know which fragments to clip at their content edge.@mrobinson, I see that clipping for the
overflowproperty is handled byStackingContextrather thanBoxFragment. Should we make replaced elements generate a (pseudo?) stacking context?