pub fn render_node_to_buffer(
node: &RenderNode,
buffer: &mut ScreenBuffer,
clip_rect: &Rect,
parent_bg: Option<Color>,
)Expand description
Renders a node and its children to the screen buffer with clipping and background inheritance.
§Clipping Strategy
This function uses two different clip rectangles:
-
element_clip: Used for rendering the element itself (border, background)
- Always the intersection of node bounds and incoming clip_rect
- Ensures the element doesn’t render outside its parent’s clip area
-
children_clip: Used for clipping child elements
- When overflow:hidden, clips to padding box (CSS behavior)
- When overflow:none, uses parent’s clip_rect unchanged
CSS Box Model & Clipping:
┌─────────────────────────┐ ← node_bounds
│ Border │
│ ┌─────────────────────┐ │ ← padding_box (overflow:hidden clips here)
│ │ Padding │ │
│ │ ┌─────────────────┐ │ │ ← content_box
│ │ │ │ │ │
│ │ │ Content │ │ │
│ │ │ │ │ │
│ │ └─────────────────┘ │ │
│ └─────────────────────┘ │
└─────────────────────────┘
overflow:hidden clips at padding edge (includes padding, excludes border)
overflow:none allows children to render outside all bounds