fix(geometry): resolve vw/vh against the scenario viewport - #227
Merged
Merged
Conversation
LeadcodeDev
force-pushed
the
fix/geometry-viewport-units
branch
from
September 21, 2026 23:39
b59cf4f to
f94bcad
Compare
53 tasks
LeadcodeDev
force-pushed
the
fix/geometry-viewport-units
branch
2 times, most recently
from
September 22, 2026 08:33
99491fd to
c1f4b85
Compare
ConversionContext::default() carries LengthContext { viewport_width: 1920.0,
viewport_height: 1080.0, .. } (rustmotion-core/src/css/units.rs:66-74), and
taffy_bridge::size_to_dim/lp_to_lp/lp_to_lp_auto resolve every vw/vh/rem/em
against it (taffy_bridge.rs:335-338). The renderer does NOT:
render_with_new_pipeline_iter (engine/render/scene.rs:554-558) and
render_scene_hits (scene.rs:792) both pass viewport_conversion_context(vw,
vh), whose own doc comment calls the 1920×1080 default a 78% error on a
1080×1920 vertical video. So on any non-1920×1080 scenario the mandatory
rustmotion validate gate checks a layout the renderer never produces: width:
"50vw" is measured as 960px by the validator and painted as 540px, 50vh as
540px vs 960px. The file header promises the opposite ("so the geometry it
checks matches what the renderer will actually paint"). The same file builds
a correct LengthContext with the real viewport at line 477 for its
transform-origin math, so the omission is confined to the layout pass. Both
the resting walk (:180) and the --strict-anim walk (:1347) are affected.
Fix: Make viewport_conversion_context public (or move it next to run_layout
in rustmotion-core) and call it from both geometry.rs sites:
run_layout(&built.root, viewport_f,
&viewport_conversion_context(viewport_f.0, viewport_f.1)). Better: stop
exposing ConversionContext at the run_layout signature at all — derive it
from the viewport argument inside run_layout, which makes the wrong context
unrepresentable.
Refs #220
LeadcodeDev
force-pushed
the
fix/geometry-viewport-units
branch
from
September 22, 2026 08:43
c1f4b85 to
fc20b4c
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
ConversionContext::default() carries LengthContext { viewport_width: 1920.0,
viewport_height: 1080.0, .. } (rustmotion-core/src/css/units.rs:66-74), and
taffy_bridge::size_to_dim/lp_to_lp/lp_to_lp_auto resolve every vw/vh/rem/em
against it (taffy_bridge.rs:335-338). The renderer does NOT:
render_with_new_pipeline_iter (engine/render/scene.rs:554-558) and
render_scene_hits (scene.rs:792) both pass viewport_conversion_context(vw,
vh), whose own doc comment calls the 1920×1080 default a 78% error on a
1080×1920 vertical video. So on any non-1920×1080 scenario the mandatory
rustmotion validate gate checks a layout the renderer never produces: width:
"50vw" is measured as 960px by the validator and painted as 540px, 50vh as
540px vs 960px. The file header promises the opposite ("so the geometry it
checks matches what the renderer will actually paint"). The same file builds
a correct LengthContext with the real viewport at line 477 for its
transform-origin math, so the omission is confined to the layout pass. Both
the resting walk (:180) and the --strict-anim walk (:1347) are affected.
Fix: Make viewport_conversion_context public (or move it next to run_layout
in rustmotion-core) and call it from both geometry.rs sites:
run_layout(&built.root, viewport_f,
&viewport_conversion_context(viewport_f.0, viewport_f.1)). Better: stop
exposing ConversionContext at the run_layout signature at all — derive it
from the viewport argument inside run_layout, which makes the wrong context
unrepresentable.
Refs #220
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 coherence. Location:
crates/rustmotion/src/cli/commands/geometry.rs:180Impact
ConversionContext::default()carriesLengthContext { viewport_width: 1920.0, viewport_height: 1080.0, .. }(rustmotion-core/src/css/units.rs:66-74), andtaffy_bridge::size_to_dim/lp_to_lp/lp_to_lp_autoresolve everyvw/vh/rem/emagainst it (taffy_bridge.rs:335-338). The renderer does NOT:render_with_new_pipeline_iter(engine/render/scene.rs:554-558) andrender_scene_hits(scene.rs:792) both passviewport_conversion_context(vw, vh), whose own doc comment calls the 1920×1080 default a 78% error on a 1080×1920 vertical video. So on any non-1920×1080 scenario the mandatoryrustmotion validategate checks a layout the renderer never produces:width: "50vw"is measured as 960px by the validator and painted as 540px,50vhas 540px vs 960px. The file header promises the opposite ("so the geometry it checks matches what the renderer will actually paint"). The same file builds a correctLengthContextwith the real viewport at line 477 for its transform-origin math, so the omission is confined to the layout pass. Both the resting walk (:180) and the--strict-animwalk (:1347) are affected.Fix
Make
viewport_conversion_contextpublic (or move it next torun_layoutin rustmotion-core) and call it from both geometry.rs sites:run_layout(&built.root, viewport_f, &viewport_conversion_context(viewport_f.0, viewport_f.1)). Better: stop exposingConversionContextat therun_layoutsignature at all — derive it from theviewportargument insiderun_layout, which makes the wrong context unrepresentable.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-05).