auto merge of #5067 : servo/servo/counters, r=SimonSapin

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.

Moved from #4544, because Critic.

Fixes #4544.
This commit is contained in:
bors-servo 2015-03-03 10:42:52 -07:00
commit 5cd6316add
38 changed files with 1662 additions and 511 deletions

View file

@ -27,7 +27,6 @@
#![deny(unsafe_blocks)]
use construct::FlowConstructor;
use context::LayoutContext;
use css::node_style::StyledNode;
use display_list_builder::{BlockFlowDisplayListBuilding, FragmentDisplayListBuilding};
@ -40,7 +39,8 @@ use flow::{IMPACTED_BY_LEFT_FLOATS, IMPACTED_BY_RIGHT_FLOATS};
use flow::{LAYERS_NEEDED_FOR_DESCENDANTS, NEEDS_LAYER};
use flow::{IS_ABSOLUTELY_POSITIONED};
use flow::{CLEARS_LEFT, CLEARS_RIGHT};
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentMutator};
use fragment::{SpecificFragmentInfo};
use incremental::{REFLOW, REFLOW_OUT_OF_FLOW};
use layout_debug;
use model::{IntrinsicISizes, MarginCollapseInfo};
@ -569,20 +569,6 @@ impl Encodable for BlockFlowFlags {
}
impl BlockFlow {
pub fn from_node(constructor: &mut FlowConstructor, node: &ThreadSafeLayoutNode) -> BlockFlow {
let writing_mode = node.style().writing_mode;
BlockFlow {
base: BaseFlow::new(Some((*node).clone()), writing_mode, ForceNonfloatedFlag::ForceNonfloated),
fragment: Fragment::new(constructor, node),
static_b_offset: Au::new(0),
inline_size_of_preceding_left_floats: Au(0),
inline_size_of_preceding_right_floats: Au(0),
hypothetical_position: LogicalPoint::new(writing_mode, Au(0), Au(0)),
float: None,
flags: BlockFlowFlags::empty(),
}
}
pub fn from_node_and_fragment(node: &ThreadSafeLayoutNode, fragment: Fragment) -> BlockFlow {
let writing_mode = node.style().writing_mode;
BlockFlow {
@ -597,23 +583,6 @@ impl BlockFlow {
}
}
pub fn float_from_node(constructor: &mut FlowConstructor,
node: &ThreadSafeLayoutNode,
float_kind: FloatKind)
-> BlockFlow {
let writing_mode = node.style().writing_mode;
BlockFlow {
base: BaseFlow::new(Some((*node).clone()), writing_mode, ForceNonfloatedFlag::FloatIfNecessary),
fragment: Fragment::new(constructor, node),
static_b_offset: Au::new(0),
inline_size_of_preceding_left_floats: Au(0),
inline_size_of_preceding_right_floats: Au(0),
hypothetical_position: LogicalPoint::new(writing_mode, Au(0), Au(0)),
float: Some(box FloatedBlockInfo::new(float_kind)),
flags: BlockFlowFlags::empty(),
}
}
pub fn float_from_node_and_fragment(node: &ThreadSafeLayoutNode,
fragment: Fragment,
float_kind: FloatKind)
@ -1919,6 +1888,10 @@ impl Flow for BlockFlow {
CoordinateSystem::Parent)
.translate(stacking_context_position));
}
fn mutate_fragments(&mut self, mutator: &mut FragmentMutator) {
mutator.process(&mut self.fragment)
}
}
impl fmt::Debug for BlockFlow {