Add node-aware selective paint scenes - #698
Open
duz52 wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
@nicoburns Thanks — I reworked the PR around that shape. There is now a I removed the separate hooks object and the two-argument plumbing entirely. The ownership and filtering behavior is unchanged, and the full CI matrix is green. It feels substantially cleaner now. Would appreciate another sanity check when you have a chance: #698 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BlitzPaintScene, a node-aware extension of AnyRender'sPaintScene.paint_sceneAPI through a forwardingPaintSceneAdapterthat ignores node metadata.paint_scene_with_nodesfor node ownership scopes and selective paint traversal.NodeIdplus document ID.Motivation
Page-by-page output needs to retain Blitz's authoritative paint order while omitting DOM branches that cannot contribute to the current page. Painting the whole document first would require untangling a nested command and layer stream afterward.
This is deliberately coarse paint filtering, not fragmentation. Split content is placed and clipped separately. The node-aware scene only exposes DOM ownership around the commands Blitz already emits.
Design
BlitzPaintScenehasPaintSceneas a supertrait and adds three operations:should_paint(PaintNode)selects paint traversal branches and independently painted inline owners.begin_node(PaintNode)starts a contiguous ownership scope.end_node(PaintNode)closes that scope.Only the scene is threaded through the painter. There is no separate hooks argument, trait object, registry, plugin system, or intermediate scene representation.
PaintSceneAdapterforwards the completeRenderContextandPaintScenesurface to an ordinary AnyRender backend and ignores the node-specific methods. The existingpaint_sceneentry point uses this adapter, preserving its current API and paint output.PaintNodecombinesBaseDocument::id()withNodeId, so nodes in subdocuments remain unambiguous. Scopes are nested and balanced, but may repeat because one DOM node's commands are not necessarily contiguous in CSS paint order.Ownership details
Validation
Added integration coverage for:
Commands run:
All passed.
Strict scoped Clippy also passed:
The allowances are limited to pre-existing warnings outside this change:
packages/blitz-paint/src/render/mask.rs:clippy::needless_borrowpackages/blitz-dom/src/mutator.rs:clippy::needless_returnWPT results
No changes in test results compared to
main.Generated by the WPT workflow.