mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
layout: Stop rebuilding all inline-block flows unconditionally, and
bubble intrinsic inline sizes as necessary when doing incremental reflow.
This commit is contained in:
parent
ba0d28e002
commit
4011291bf2
2 changed files with 38 additions and 2 deletions
|
@ -19,7 +19,7 @@ use css::node_style::StyledNode;
|
||||||
use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataAccess, LayoutDataWrapper};
|
use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataAccess, LayoutDataWrapper};
|
||||||
use floats::FloatKind;
|
use floats::FloatKind;
|
||||||
use flow::{Descendants, AbsDescendants};
|
use flow::{Descendants, AbsDescendants};
|
||||||
use flow::{Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
|
use flow::{Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
|
||||||
use flow::{IS_ABSOLUTELY_POSITIONED};
|
use flow::{IS_ABSOLUTELY_POSITIONED};
|
||||||
use flow;
|
use flow;
|
||||||
use flow_ref::FlowRef;
|
use flow_ref::FlowRef;
|
||||||
|
@ -85,6 +85,8 @@ impl ConstructionResult {
|
||||||
return mem::replace(self, ConstructionResult::None)
|
return mem::replace(self, ConstructionResult::None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME(pcwalton): Stop doing this with inline fragments. Cloning fragments is very
|
||||||
|
// inefficient!
|
||||||
(*self).clone()
|
(*self).clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,7 +1166,30 @@ impl<'a> FlowConstructor<'a> {
|
||||||
// The node's flow is of the same type and has the same set of children and can
|
// The node's flow is of the same type and has the same set of children and can
|
||||||
// therefore be repaired by simply propagating damage and style to the flow.
|
// therefore be repaired by simply propagating damage and style to the flow.
|
||||||
flow::mut_base(&mut *flow).restyle_damage.insert(node.restyle_damage());
|
flow::mut_base(&mut *flow).restyle_damage.insert(node.restyle_damage());
|
||||||
flow.repair_style(node.style());
|
flow.repair_style_and_bubble_inline_sizes(node.style());
|
||||||
|
true
|
||||||
|
}
|
||||||
|
ConstructionResult::ConstructionItem(ConstructionItem::InlineFragments(
|
||||||
|
mut inline_fragments_construction_result)) => {
|
||||||
|
if !inline_fragments_construction_result.splits.is_empty() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
let damage = node.restyle_damage();
|
||||||
|
for fragment in inline_fragments_construction_result.fragments.iter_mut() {
|
||||||
|
match fragment.specific {
|
||||||
|
SpecificFragmentInfo::InlineBlock(ref mut inline_block_fragment) => {
|
||||||
|
flow::mut_base(&mut *inline_block_fragment.flow_ref).restyle_damage
|
||||||
|
.insert(damage);
|
||||||
|
// FIXME(pcwalton): Fragment restyle damage too?
|
||||||
|
inline_block_fragment.flow_ref.repair_style_and_bubble_inline_sizes(
|
||||||
|
node.style());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
ConstructionResult::ConstructionItem(_) => {
|
ConstructionResult::ConstructionItem(_) => {
|
||||||
|
|
|
@ -435,6 +435,10 @@ pub trait MutableFlowUtils {
|
||||||
/// So, kids have their flow origin already set. In the case of absolute flow kids, they have
|
/// So, kids have their flow origin already set. In the case of absolute flow kids, they have
|
||||||
/// their hypothetical box position already set.
|
/// their hypothetical box position already set.
|
||||||
fn collect_static_block_offsets_from_children(self);
|
fn collect_static_block_offsets_from_children(self);
|
||||||
|
|
||||||
|
/// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of
|
||||||
|
/// calling them individually, since there is no reason not to perform both operations.
|
||||||
|
fn repair_style_and_bubble_inline_sizes(self, style: &Arc<ComputedValues>);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MutableOwnedFlowUtils {
|
pub trait MutableOwnedFlowUtils {
|
||||||
|
@ -1309,6 +1313,13 @@ impl<'a> MutableFlowUtils for &'a mut (Flow + 'a) {
|
||||||
}
|
}
|
||||||
mut_base(self).abs_descendants.static_block_offsets = absolute_descendant_block_offsets
|
mut_base(self).abs_descendants.static_block_offsets = absolute_descendant_block_offsets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Calls `repair_style` and `bubble_inline_sizes`. You should use this method instead of
|
||||||
|
/// calling them individually, since there is no reason not to perform both operations.
|
||||||
|
fn repair_style_and_bubble_inline_sizes(self, style: &Arc<ComputedValues>) {
|
||||||
|
self.repair_style(style);
|
||||||
|
self.bubble_inline_sizes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MutableOwnedFlowUtils for FlowRef {
|
impl MutableOwnedFlowUtils for FlowRef {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue