Exercise 1: A Transparent Background Produces No Command at All — Possible Solution ==================================================================== THE TEST ------------------------------ transparent_box = block({'background-color': 'transparent', 'width': '50px', 'height': '50px'}) container = block({}, children=[transparent_box]) layout_block(container, root_cb) build_display_list(container) RESULT ------------------------------ [] An empty list -- not a rect command with color 'transparent', not a placeholder of any kind. Genuinely zero commands. THE EXACT LINE RESPONSIBLE ------------------------------ def paint_background(layout_box, display_list): style = box_style(layout_box) bg = style.get('background-color', 'transparent') if bg != 'transparent' and layout_box.dimensions is not None: rect = layout_box.dimensions.border_box() display_list.append(PaintCommand('rect', rect=rect, color=bg)) The line `if bg != 'transparent' and layout_box.dimensions is not None:` is the guard responsible. Both boxes here -- the transparent child AND the container itself, since block()'s own default style also leaves background-color at INITIAL_VALUES' own 'transparent' -- have bg == 'transparent'. The condition's first half, `bg != 'transparent'`, evaluates to False for both, so `display_list.append(...)` is never reached for either box. build_display_list() still walks the full tree (container, then its child) via its own unconditional recursion, but paint_background() itself contributes nothing at either level. WHY THIS WORKS AS AN ANSWER ------------------------------ This confirms 'transparent' is treated as a genuine, meaningful sentinel value -- "there is nothing to paint here" -- rather than just another color string that happens to render as see-through. A real rasterizer benefits directly from this: a display list with fewer commands is strictly less work to execute, and skipping transparent backgrounds at LIST-BUILDING time (rather than emitting a command and having the rasterizer itself decide to skip transparent pixels) means the optimization happens once, up front, rather than being re-checked for every pixel a transparent rect would have covered.