Repository navigation
A filter takes in what its element draws outside its box, as Chrome filters it - #93
Conversation
…ilters it blitz-paint made a filtered element's layer from its border box grown by the filter's reach, and raea-sys-filters sizes the layer's texture from that clip. So whatever the element's descendants drew outside its box was cut off before the filter ran: a wrapper of no size with `filter: blur(4px)` around absolutely positioned children drew a few px of blur and nothing else, and a 60 px box with `grayscale(1)` showed 60 px of a 200x100 child. The same wrappers with `opacity` drew whole, since an opacity group already reaches over the element's overflow. A filtered element's layer now reaches over the boxes it and its descendants draw (drawn_bounds), and the same of each box its stacking context paints, then grows by the filter's reach as before. drawn_bounds is scrollable_overflow's walk (blitz-dom's resolve_transforms: each child's box through its transform) with two differences. It is cut, on each axis an element clips, to that element's box grown by its overflow-clip-margin (the root element clips nothing, as in should_clip). The overflow itself reaches through every clip, and a texture made from it is as large as content nobody sees: small filtered boxes, each around a clipping box with a child covering the frame, became layers the size of the frame, more than Vello's image atlas holds, and tiles went missing. And a descendant with a filter of its own counts with that filter's reach (its drop shadow). raea-sys-filters still cuts a layer to the page grown by the reach. bench/filter-overflow/check.sh: page.tsx draws the blurred wrapper, a grayscale box around a square with its own drop shadow, and the grayscale box three ways (as it is, clipping its overflow, clipping x alone), probed at twelve pixels for Chrome 157's values, read from a screenshot of the same markup; clipped.tsx is 60 small filtered boxes around clipping boxes with frame-covering content, half of them painted by the stacking context, its tiles counted. The raea before this fails five probes; with it all pass and all 60 tiles are drawn. Not covered: a box-shadow or an outline of a descendant, and a descendant's url() filter, still end at the boxes' bounds; a box the stacking context paints that a clip between the two cuts is counted whole (a larger layer, never a smaller one); and a filtered element inside an element with a perspective transform is still cut to the page's rectangle in that element's own space (raea-sys-filters' region). Co-Authored-By: Claude <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43e8892ce2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let Some(t) = child.transform().as_deref() { | ||
| to_own *= *t; | ||
| } | ||
| effect_layer_clip = effect_layer_clip.union(to_own.transform_rect_bbox(self.drawn_bounds(hoisted.node_id, true))); |
There was a problem hiding this comment.
Clip hoisted bounds before adding them to the filter region
For a small filtered overflow: hidden box containing a frame-covering position: relative; z-index: 1 child, this union adds the entire child back after drawn_bounds(node_id, false) correctly stopped at the owner's clip. draw_children actually paints that child inside the clip, so the new frame-sized texture contains almost entirely invisible content. Sixty such cards arranged like bench/filter-overflow/clipped.tsx require 124,416,000 image texels, exceeding Vello's 8192×8192 atlas; resolve_pending_images in vendor/vello_encoding/src/resolve.rs then omits images whose allocations fail. Intersect ordinary hoisted-child bounds with their applicable clips before unioning them, while preserving the separate treatment of children painted outside those clips.
Useful? React with 👍 / 👎.
| let (clips_x, clips_y, grow) = styles.as_ref().filter(|_| self.root_element_id != Some(node_id)).map_or((false, false, 0.0), |s| { | ||
| let b = s.get_box(); | ||
| (!matches!(b.overflow_x, Overflow::Visible), !matches!(b.overflow_y, Overflow::Visible), s.get_margin().overflow_clip_margin.offset.0.px() as f64 * self.scale.max(1.0)) |
There was a problem hiding this comment.
Stop the bounds walk at paint-containment clips
When a filtered card contains a small contain: paint box with oversized descendants, this predicate treats both axes as unclipped because their overflow remains visible. However, render_element already clips that content through its contain_paint/should_clip condition. The new walk therefore expands the filter texture over content that cannot be painted: replacing the inner overflow: hidden in the added 60-card benchmark with contain: paint produces frame-sized textures and exceeds the image-atlas capacity, even without any hoisted children. Include the same paint-containment eligibility used by should_clip when determining the bounds walk's clipped axes.
Useful? React with 👍 / 👎.
…the boxes its stacking context paints Two more ways the layer grew over content nobody sees, both from the Codex review of the first commit: - the stacking context's boxes were all added whole, where hoisted_content_bbox places them. Only the ones painted past the clip need that (the out-of-flow boxes from containing blocks above, shinyobjectz#39's from_above, which the walk doesn't meet). The others are met by the walk, under the clips they are painted under, so a filtered `overflow: hidden` box with a frame-covering `z-index` child keeps a layer its own size; - drawn_bounds stops at a `contain: paint` box as at an overflow clip (render_element's contain_paint). bench/filter-overflow/clipped.tsx is now 120 boxes cut four ways, 30 each. The first commit drew 60 of its 120 tiles: each of the two new kinds made 30 layers the size of the frame, more than Vello's image atlas holds. Co-Authored-By: Claude <noreply@anthropic.com>
|
Merged, thanks. Stopping at clips was the right call, and the 120-box tile count shows it. I'll run bench/filter-overflow on macOS with the next build and report here if anything differs. |
A
filtercuts off whatever its element's descendants draw outside the element's own box.Chrome draws two blurred squares. raea draws a few px of blur at the wrapper's corner and nothing else. A 60 px box with
grayscale(1)shows 60 px of a 200x100 child. The same wrappers withopacityin place of the filter draw whole.Why
blitz-paint makes a filtered element's layer from its border box grown by the filter's reach (
effect_layer_clip), and raea-sys-filters sizes the layer's texture from that clip. What the descendants draw outside the box never reaches the texture. An opacity group already reaches over the element's overflow, which is why opacity was right.Change
All in
vendor/blitz-paint/src/render.rs. A filtered element's layer now reaches over the boxes it and its descendants draw, and over the out-of-flow boxes its stacking context paints past its clip (#39'sfrom_above), then grows by the filter's reach as before.The bounds come from a new
drawn_bounds, which isscrollable_overflow's walk (blitz-dom'sresolve_transforms) with two differences:contain: paint), the bounds are cut to that element's box grown by itsoverflow-clip-margin. The root element clips nothing, as inshould_clip. Using the overflow itself was the first version of this change, and it was wrong: the overflow reaches through every clip, so small filtered boxes around a clipping box with large content became layers the size of the frame. Sixty of them drew no tiles at all.raea-sys-filters still cuts a layer to the page grown by the reach, so no layer is larger than that.
Two commits. The second answers the two Codex review comments on the first: the stacking context's boxes painted inside the clip are no longer added whole (the walk meets them, under the clips they are painted under), and
contain: paintstops the walk.Testing
bench/filter-overflow/check.sh(new).page.tsxis probed at twelve pixels for Chrome 157's values, read from a screenshot of the same markup.clipped.tsxis 120 small filtered boxes, each showing 60 px of frame-covering content cut one of four ways (a clipping box inside, one the stacking context paints, the filtered box's own clip over az-indexchild, acontain: paintbox inside), and its tiles are counted.page.tsx, 12 probesclipped.tsxbench/opacity-out-of-flow/check.shRun on Windows 11 (Vulkan) with release builds,
mainat bb0a176.tools/size.sh,layers.sh,names.sh,one-version.sh,no-void.shandpublic-guard.shpass on the branch.Limits
url()filter, still end at the boxes' bounds, as they do in an opacity group.region). Not touched here.cargo dupesandcargo sheararen't installed here.The first commit was reviewed over three rounds by GPT-6.1 Sol (high effort), a different model family from the one that wrote it. Stopping at overflow clips, the stacking context's boxes, the root element and a descendant's own filter reach all came from its findings. The last of those, and the second commit, have not been reviewed again.
Created with Claude Fable 5.2 in T3 Code (Claude Code).
🤖 Generated with Claude Code