layout: Remove two arguments from StackingContextTree::new() (#37396)

This is a minor cleanup that simplifies the construct of
`StackingContextTree`. The two arguments removed are derived from the
`FragmentTree` which is already passed as an argument.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-06-11 14:42:54 +02:00 committed by GitHub
parent bda3e23c74
commit c36ef34464
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 12 deletions

View file

@ -121,19 +121,23 @@ impl StackingContextTree {
pub fn new( pub fn new(
fragment_tree: &FragmentTree, fragment_tree: &FragmentTree,
viewport_size: LayoutSize, viewport_size: LayoutSize,
content_size: LayoutSize,
pipeline_id: wr::PipelineId, pipeline_id: wr::PipelineId,
viewport_scroll_sensitivity: AxesScrollSensitivity,
first_reflow: bool, first_reflow: bool,
debug: &DebugOptions, debug: &DebugOptions,
) -> Self { ) -> Self {
let scrollable_overflow = fragment_tree.scrollable_overflow();
let scrollable_overflow = LayoutSize::from_untyped(Size2D::new(
scrollable_overflow.size.width.to_f32_px(),
scrollable_overflow.size.height.to_f32_px(),
));
let compositor_info = CompositorDisplayListInfo::new( let compositor_info = CompositorDisplayListInfo::new(
viewport_size, viewport_size,
content_size, scrollable_overflow,
pipeline_id, pipeline_id,
// This epoch is set when the WebRender display list is built. For now use a dummy value. // This epoch is set when the WebRender display list is built. For now use a dummy value.
wr::Epoch(0), wr::Epoch(0),
viewport_scroll_sensitivity, fragment_tree.viewport_scroll_sensitivity,
first_reflow, first_reflow,
); );

View file

@ -872,21 +872,13 @@ impl LayoutThread {
viewport_size.height.to_f32_px(), viewport_size.height.to_f32_px(),
); );
let scrollable_overflow = fragment_tree.scrollable_overflow();
let scrollable_overflow = LayoutSize::from_untyped(Size2D::new(
scrollable_overflow.size.width.to_f32_px(),
scrollable_overflow.size.height.to_f32_px(),
));
// Build the StackingContextTree. This turns the `FragmentTree` into a // Build the StackingContextTree. This turns the `FragmentTree` into a
// tree of fragments in CSS painting order and also creates all // tree of fragments in CSS painting order and also creates all
// applicable spatial and clip nodes. // applicable spatial and clip nodes.
*self.stacking_context_tree.borrow_mut() = Some(StackingContextTree::new( *self.stacking_context_tree.borrow_mut() = Some(StackingContextTree::new(
fragment_tree, fragment_tree,
viewport_size, viewport_size,
scrollable_overflow,
self.id.into(), self.id.into(),
fragment_tree.viewport_scroll_sensitivity,
self.first_reflow.get(), self.first_reflow.get(),
&self.debug, &self.debug,
)); ));