diff --git a/webrender/src/spatial_node.rs b/webrender/src/spatial_node.rs index 529b8b8ad6..bccbf90d41 100644 --- a/webrender/src/spatial_node.rs +++ b/webrender/src/spatial_node.rs @@ -251,10 +251,15 @@ impl SpatialNode { SpatialNodeType::ReferenceFrame(ref mut info) => { // Resolve the transform against any property bindings. let source_transform = scene_properties.resolve_layout_transform(&info.source_transform); + // Do a change-basis operation on the perspective matrix using + // the scroll offset. + let scrolled_perspective = info.source_perspective + .pre_translate(&state.parent_accumulated_scroll_offset) + .post_translate(-state.parent_accumulated_scroll_offset); info.resolved_transform = LayoutFastTransform::with_vector(info.origin_in_parent_reference_frame) .pre_mul(&source_transform.into()) - .pre_mul(&info.source_perspective); + .pre_mul(&scrolled_perspective); // The transformation for this viewport in world coordinates is the transformation for // our parent reference frame, plus any accumulated scrolling offsets from nodes