auto merge of #3741 : cgaebel/servo/clear-reflow-flags, r=pcwalton

This commit is contained in:
bors-servo 2014-10-22 18:48:31 -06:00
commit a07b80bd56
3 changed files with 43 additions and 18 deletions

View file

@ -1163,6 +1163,16 @@ impl BlockFlow {
self.base.position.size.block = block_size; 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. /// Return the block-start outer edge of the hypothetical box for an absolute flow.
/// ///
/// This is wrt its parent flow box. /// 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. // Our inline-size was set to the inline-size of the containing block by the flow's parent.
// Now compute the real value. // Now compute the real value.
let containing_block_inline_size = self.base.block_container_inline_size; self.propagate_and_compute_used_inline_size(layout_context);
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;
}
// Formatting contexts are never impacted by floats. // Formatting contexts are never impacted by floats.
match self.formatting_context_type() { 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 *inline_start_margin_edge = *inline_start_margin_edge + inline_size
} }
} }

View file

@ -599,6 +599,10 @@ impl Descendants {
self.descendant_links.len() self.descendant_links.len()
} }
pub fn is_empty(&self) -> bool {
self.descendant_links.is_empty()
}
pub fn push(&mut self, given_descendant: FlowRef) { pub fn push(&mut self, given_descendant: FlowRef) {
self.descendant_links.push(given_descendant); self.descendant_links.push(given_descendant);
} }

View file

@ -8,7 +8,8 @@ use css::node_style::StyledNode;
use css::matching::{ApplicableDeclarations, CannotShare, MatchMethods, StyleWasShared}; use css::matching::{ApplicableDeclarations, CannotShare, MatchMethods, StyleWasShared};
use construct::FlowConstructor; use construct::FlowConstructor;
use context::LayoutContext; use context::LayoutContext;
use flow::{Flow, MutableFlowUtils, PreorderFlowTraversal, PostorderFlowTraversal}; use flow::{Flow, ImmutableFlowUtils, MutableFlowUtils};
use flow::{PreorderFlowTraversal, PostorderFlowTraversal};
use flow; use flow;
use incremental::{RestyleDamage, BubbleISizes, Reflow}; use incremental::{RestyleDamage, BubbleISizes, Reflow};
use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode}; use wrapper::{layout_node_to_unsafe_layout_node, LayoutNode};
@ -282,6 +283,7 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
#[inline] #[inline]
fn process(&self, flow: &mut Flow) { fn process(&self, flow: &mut Flow) {
flow.bubble_inline_sizes(); flow.bubble_inline_sizes();
flow::mut_base(flow).restyle_damage.remove(BubbleISizes);
} }
#[inline] #[inline]
@ -298,12 +300,18 @@ pub struct AssignISizes<'a> {
impl<'a> PreorderFlowTraversal for AssignISizes<'a> { impl<'a> PreorderFlowTraversal for AssignISizes<'a> {
#[inline] #[inline]
fn process(&self, flow: &mut Flow) { 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] #[inline]
fn should_process(&self, flow: &mut Flow) -> bool { 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> { impl<'a> PostorderFlowTraversal for AssignBSizesAndStoreOverflow<'a> {
#[inline] #[inline]
fn process(&self, flow: &mut Flow) { fn process(&self, flow: &mut Flow) {
flow.assign_block_size(self.layout_context); if !flow::base(flow).flags.impacted_by_floats() {
// Skip store-overflow for absolutely positioned flows. That will be flow.assign_block_size(self.layout_context);
// done in a separate traversal.
if !flow.is_store_overflow_delayed() { // Skip store-overflow for absolutely positioned flows. That will be
flow.store_overflow(self.layout_context); // 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] #[inline]
fn should_process(&self, flow: &mut Flow) -> bool { fn should_process(&self, flow: &mut Flow) -> bool {
let base = flow::base(flow); // TODO(cgaebel): Incremental block size assignment.
base.restyle_damage.contains(Reflow) && !base.flags.impacted_by_floats() flow::base(flow).restyle_damage.contains(Reflow) || true
} }
} }
@ -340,7 +356,7 @@ pub struct ComputeAbsolutePositions<'a> {
impl<'a> PreorderFlowTraversal for ComputeAbsolutePositions<'a> { impl<'a> PreorderFlowTraversal for ComputeAbsolutePositions<'a> {
#[inline] #[inline]
fn process(&self, flow: &mut Flow) { 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> { impl<'a> PostorderFlowTraversal for BuildDisplayList<'a> {
#[inline] #[inline]
fn process(&self, flow: &mut Flow) { fn process(&self, flow: &mut Flow) {
flow.build_display_list(self.layout_context) flow.build_display_list(self.layout_context);
} }
} }