aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/construct.rs29
-rw-r--r--components/layout/flow.rs11
2 files changed, 38 insertions, 2 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index ec40dad1199..bf427dfbf99 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -19,7 +19,7 @@ use css::node_style::StyledNode;
use data::{HAS_NEWLY_CONSTRUCTED_FLOW, LayoutDataAccess, LayoutDataWrapper};
use floats::FloatKind;
use flow::{Descendants, AbsDescendants};
-use flow::{Flow, ImmutableFlowUtils, MutableOwnedFlowUtils};
+use flow::{Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils};
use flow::{IS_ABSOLUTELY_POSITIONED};
use flow;
use flow_ref::FlowRef;
@@ -85,6 +85,8 @@ impl ConstructionResult {
return mem::replace(self, ConstructionResult::None)
}
+ // FIXME(pcwalton): Stop doing this with inline fragments. Cloning fragments is very
+ // inefficient!
(*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
// therefore be repaired by simply propagating damage and style to the flow.
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
}
ConstructionResult::ConstructionItem(_) => {
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 976ddbc405b..74d3100f1f2 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -435,6 +435,10 @@ pub trait MutableFlowUtils {
/// So, kids have their flow origin already set. In the case of absolute flow kids, they have
/// their hypothetical box position already set.
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 {
@@ -1309,6 +1313,13 @@ impl<'a> MutableFlowUtils for &'a mut (Flow + 'a) {
}
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 {