fix(components): apply the css cascade before painters read style - #264
Closed
LeadcodeDev wants to merge 1 commit into
Closed
LeadcodeDev wants to merge 1 commit into
LeadcodeDev wants to merge 1 commit into
Conversation
53 tasks
LeadcodeDev
force-pushed
the
fix/default-size-font-context
branch
from
September 22, 2026 06:11
4b122f6 to
f08bbe7
Compare
LeadcodeDev
force-pushed
the
fix/cascade-reaches-painters
branch
from
September 22, 2026 06:11
6dc5764 to
dc957fe
Compare
LeadcodeDev
force-pushed
the
fix/default-size-font-context
branch
from
September 22, 2026 08:36
f08bbe7 to
2351a9f
Compare
LeadcodeDev
force-pushed
the
fix/cascade-reaches-painters
branch
from
September 22, 2026 08:36
dc957fe to
42c4881
Compare
LeadcodeDev
force-pushed
the
fix/default-size-font-context
branch
from
September 22, 2026 08:46
2351a9f to
067ad3a
Compare
box_builder.rs:496 calls
rustmotion_core::css::cascade::inherit_from(parent_css, &mut css) and
paint_pass.rs:479 passes &node.css into dispatch. LegacyPaintDispatcher (the
only real PaintDispatcher; the other is NoopDispatcher) binds it to _css and
drops it, and Painter::paint_content (painter.rs:60-66) has no CssStyle
parameter at all — so a painter structurally cannot see the cascaded style.
Every painter resolves typography from its own declared struct field instead
(text.rs:523 self.style.color_str_or("#FFFFFF")). All twelve properties
inherit_from propagates (color, font-family, font-size, font-weight, font-
style, line-height, letter-spacing, text-align, white-space, overflow-wrap,
visibility, text-decoration) are paint-only: taffy_bridge.rs reads none of
them (its own header says "Paint properties (color, background,
transform...)" are excluded), paint_pass.rs contains zero references to
visibility/text_decoration/text_align/font_family/white_space, and
component_intrinsic (box_builder.rs:639) builds measurers from
&child.component, not from the cascaded css. Net effect: {"type":"card",
"style":{"color":"#ff0000"}} wrapping a text with no colour of its own
renders white, not red — the documented CLAUDE.md feature "cascade.rs —
Héritage color/font-* parent → enfant" has no observable effect. The
regression test card_color_cascades_to_text_child_with_no_color_of_its_own
(box_builder.rs:3066) passes because it only asserts on the intermediate
text_box.css.color field, never on painted output.
Fix: Either thread the cascaded style to the painters — pass _css through
PaintCtx (or add a css: &CssStyle parameter to paint_content) and have text-
like painters prefer it over self.style — or apply inherit_from to the
component's own style field before the painter reads it. Then add a pixel-
level test asserting a card's color actually tints a child text, since the
existing box-tree assertion cannot catch this class of regression.
Refs #220
LeadcodeDev
force-pushed
the
fix/cascade-reaches-painters
branch
from
September 22, 2026 08:46
42c4881 to
5fba6d1
Compare
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.
Severity Medium, category correctness. Location:
crates/rustmotion-components/src/legacy_dispatch.rs:68Impact
box_builder.rs:496 calls
rustmotion_core::css::cascade::inherit_from(parent_css, &mut css)and paint_pass.rs:479 passes&node.cssintodispatch.LegacyPaintDispatcher(the only realPaintDispatcher; the other isNoopDispatcher) binds it to_cssand drops it, andPainter::paint_content(painter.rs:60-66) has noCssStyleparameter at all — so a painter structurally cannot see the cascaded style. Every painter resolves typography from its own declared struct field instead (text.rs:523self.style.color_str_or("#FFFFFF")). All twelve propertiesinherit_frompropagates (color, font-family, font-size, font-weight, font-style, line-height, letter-spacing, text-align, white-space, overflow-wrap, visibility, text-decoration) are paint-only: taffy_bridge.rs reads none of them (its own header says "Paint properties (color, background, transform...)" are excluded), paint_pass.rs contains zero references tovisibility/text_decoration/text_align/font_family/white_space, andcomponent_intrinsic(box_builder.rs:639) builds measurers from&child.component, not from the cascadedcss. Net effect:{"type":"card", "style":{"color":"#ff0000"}}wrapping atextwith no colour of its own renders white, not red — the documented CLAUDE.md feature "cascade.rs — Héritage color/font-* parent → enfant" has no observable effect. The regression testcard_color_cascades_to_text_child_with_no_color_of_its_own(box_builder.rs:3066) passes because it only asserts on the intermediatetext_box.css.colorfield, never on painted output.Fix
Either thread the cascaded style to the painters — pass
_cssthroughPaintCtx(or add acss: &CssStyleparameter topaint_content) and have text-like painters prefer it overself.style— or applyinherit_fromto the component's ownstylefield before the painter reads it. Then add a pixel-level test asserting a card'scoloractually tints a childtext, since the existing box-tree assertion cannot catch this class of regression.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-07).