mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
gfx: Avoid copying stacking contexts around so much during stacking
context creation.
This commit is contained in:
parent
4233e0f163
commit
983576ebaa
1 changed files with 19 additions and 13 deletions
|
@ -1643,18 +1643,24 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
StackingContextCreationMode::PseudoFloat
|
StackingContextCreationMode::PseudoFloat
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut stacking_context =
|
let stacking_context_index = contexts.len();
|
||||||
self.fragment.create_stacking_context(stacking_context_id,
|
contexts.push(self.fragment.create_stacking_context(stacking_context_id,
|
||||||
&self.base,
|
&self.base,
|
||||||
ScrollPolicy::Scrollable,
|
ScrollPolicy::Scrollable,
|
||||||
creation_mode);
|
creation_mode));
|
||||||
let (mut floating, mut positioned) = child_contexts.into_iter().partition(|context| {
|
|
||||||
context.context_type == StackingContextType::PseudoFloat
|
|
||||||
});
|
|
||||||
|
|
||||||
stacking_context.children.append(&mut floating);
|
let mut floating = vec![];
|
||||||
contexts.push(stacking_context);
|
for child_context in child_contexts.into_iter() {
|
||||||
contexts.append(&mut positioned);
|
if child_context.context_type == StackingContextType::PseudoFloat {
|
||||||
|
// Floating.
|
||||||
|
floating.push(child_context)
|
||||||
|
} else {
|
||||||
|
// Positioned.
|
||||||
|
contexts.push(child_context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contexts[stacking_context_index].children = floating;
|
||||||
return stacking_context_id;
|
return stacking_context_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1670,7 +1676,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
&self.base,
|
&self.base,
|
||||||
scroll_policy,
|
scroll_policy,
|
||||||
StackingContextCreationMode::InnerScrollWrapper);
|
StackingContextCreationMode::InnerScrollWrapper);
|
||||||
inner_stacking_context.children.append(&mut child_contexts);
|
inner_stacking_context.children = child_contexts;
|
||||||
|
|
||||||
let mut outer_stacking_context = self.fragment.create_stacking_context(
|
let mut outer_stacking_context = self.fragment.create_stacking_context(
|
||||||
stacking_context_id,
|
stacking_context_id,
|
||||||
|
@ -1685,7 +1691,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
&self.base,
|
&self.base,
|
||||||
scroll_policy,
|
scroll_policy,
|
||||||
StackingContextCreationMode::Normal);
|
StackingContextCreationMode::Normal);
|
||||||
stacking_context.children.append(&mut child_contexts);
|
stacking_context.children = child_contexts;
|
||||||
stacking_context
|
stacking_context
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue