aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
authorClark Gaebel <cgaebel@mozilla.com>2014-10-20 12:49:39 -0700
committerClark Gaebel <cgaebel@mozilla.com>2014-10-22 17:46:28 -0700
commit5cd47c76700c10b7ee7b1454d941190f70ec1aab (patch)
tree9144c3c347e2530ffccd8dafd11517131168aa8c /components/layout
parenta6f0159cb85e3b84a826c41ae5ad1b6aea09d7cc (diff)
downloadservo-5cd47c76700c10b7ee7b1454d941190f70ec1aab.tar.gz
servo-5cd47c76700c10b7ee7b1454d941190f70ec1aab.zip
Clear reflow flags after reflow.
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/block.rs17
-rw-r--r--components/layout/flow.rs4
-rw-r--r--components/layout/traversal.rs40
3 files changed, 43 insertions, 18 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs
index 1f32e685b2a..54d2bf08b7f 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -1163,6 +1163,16 @@ impl BlockFlow {
self.base.position.size.block = block_size;
}
+ // Our inline-size was set to the inline-size of the containing block by the flow's parent.
+ // This computes the real value, and is run in the `AssignISizes` traversal.
+ pub fn propagate_and_compute_used_inline_size(&mut self, layout_context: &LayoutContext) {
+ let containing_block_inline_size = self.base.block_container_inline_size;
+ self.compute_used_inline_size(layout_context, containing_block_inline_size);
+ if self.is_float() {
+ self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size;
+ }
+ }
+
/// Return the block-start outer edge of the hypothetical box for an absolute flow.
///
/// This is wrt its parent flow box.
@@ -1501,11 +1511,7 @@ impl Flow for BlockFlow {
// Our inline-size was set to the inline-size of the containing block by the flow's parent.
// Now compute the real value.
- let containing_block_inline_size = self.base.block_container_inline_size;
- self.compute_used_inline_size(layout_context, containing_block_inline_size);
- if self.is_float() {
- self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size;
- }
+ self.propagate_and_compute_used_inline_size(layout_context);
// Formatting contexts are never impacted by floats.
match self.formatting_context_type() {
@@ -2472,4 +2478,3 @@ fn propagate_column_inline_sizes_to_child(kid: &mut Flow,
*inline_start_margin_edge = *inline_start_margin_edge + inline_size
}
}
-
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 38ee01b3c96..81f06de9094 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -599,6 +599,10 @@ impl Descendants {
self.descendant_links.len()
}
+ pub fn is_empty(&self) -> bool {
+ self.descendant_links.is_empty()
+ }
+
pub fn push(&mut self, given_descendant: FlowRef) {
self.descendant_links.push(given_descendant);
}
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 5e071651c63..e1b02266134 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -8,7 +8,8 @@ use css::node_style::StyledNode;
use css::matching::{ApplicableDeclarations, CannotShare, MatchMethods, StyleWasShared};
use construct::FlowConstructor;
use context::LayoutContext;
-use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal};
+use flow::{Flow, ImmutableFlowUtils, MutableFlowUtils};
+use flow::{PreorderFlowTraversal, PostorderFlowTraversal};
use flow;
use incremental::{RestyleDamage, BubbleISizes, Reflow};
use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode};
@@ -282,6 +283,7 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
flow.bubble_inline_sizes();
+ flow::mut_base(flow).restyle_damage.remove(BubbleISizes);
}
#[inline]
@@ -298,12 +300,18 @@ pub struct AssignISizes<'a> {
impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
- flow.assign_inline_sizes(self.layout_context);
+ if flow::base(flow).restyle_damage.contains(Reflow) {
+ flow.assign_inline_sizes(self.layout_context);
+ } else if flow.is_block_like() {
+ let block = flow.as_block();
+ block.propagate_and_compute_used_inline_size(self.layout_context);
+ }
}
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- flow::base(flow).restyle_damage.contains(Reflow)
+ // TODO(cgaebel): Incremental inline size assignment.
+ flow::base(flow).restyle_damage.contains(Reflow) || true
}
}
@@ -318,18 +326,26 @@ pub struct AssignBSizesAndStoreOverflow<'a> {
impl<'a> PostorderFlowTraversal for AssignBSizesAndStoreOverflow<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
- flow.assign_block_size(self.layout_context);
- // Skip store-overflow for absolutely positioned flows. That will be
- // done in a separate traversal.
- if !flow.is_store_overflow_delayed() {
- flow.store_overflow(self.layout_context);
+ if !flow::base(flow).flags.impacted_by_floats() {
+ flow.assign_block_size(self.layout_context);
+
+ // Skip store-overflow for absolutely positioned flows. That will be
+ // done in a separate traversal.
+
+ if flow::base(flow).restyle_damage.contains(Reflow) {
+ if !flow.is_store_overflow_delayed() {
+ flow.store_overflow(self.layout_context);
+ }
+ }
}
+
+ flow::mut_base(flow).restyle_damage.remove(Reflow);
}
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
- let base = flow::base(flow);
- base.restyle_damage.contains(Reflow) && !base.flags.impacted_by_floats()
+ // TODO(cgaebel): Incremental block size assignment.
+ flow::base(flow).restyle_damage.contains(Reflow) || true
}
}
@@ -340,7 +356,7 @@ pub struct ComputeAbsolutePositions<'a> {
impl<'a> PreorderFlowTraversal for ComputeAbsolutePositions<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
- flow.compute_absolute_position()
+ flow.compute_absolute_position();
}
}
@@ -351,6 +367,6 @@ pub struct BuildDisplayList<'a> {
impl<'a> PostorderFlowTraversal for BuildDisplayList<'a> {
#[inline]
fn process(&self, flow: &mut Flow) {
- flow.build_display_list(self.layout_context)
+ flow.build_display_list(self.layout_context);
}
}