diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-03 10:42:52 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-03 10:42:52 -0700 |
commit | 5cd6316addc1acf145ed3220719387ef6ef08d2f (patch) | |
tree | 7d8daec9db46a555ef567e356f5ab08488f9c71c /components/layout/inline.rs | |
parent | 6fcc02e92f4c519239a834dc37a2965a4993322a (diff) | |
parent | 4c8bde5736853ae68332d1f97cc6f0b02499e35f (diff) | |
download | servo-5cd6316addc1acf145ed3220719387ef6ef08d2f.tar.gz servo-5cd6316addc1acf145ed3220719387ef6ef08d2f.zip |
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.
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r-- | components/layout/inline.rs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 0a4b575c3c4..5c25d5ab00f 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -11,10 +11,10 @@ use floats::{FloatKind, Floats, PlacementInfo}; use flow::{BaseFlow, FlowClass, Flow, MutableFlowUtils, ForceNonfloatedFlag}; use flow::{IS_ABSOLUTELY_POSITIONED}; use flow; -use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, ScannedTextFragmentInfo}; -use fragment::{SpecificFragmentInfo}; +use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, FragmentMutator}; +use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo}; use fragment::SplitInfo; -use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; +use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT}; use layout_debug; use model::IntrinsicISizesContribution; use text; @@ -789,14 +789,22 @@ pub struct InlineFlow { impl InlineFlow { pub fn from_fragments(fragments: InlineFragments, writing_mode: WritingMode) -> InlineFlow { - InlineFlow { + let mut flow = InlineFlow { base: BaseFlow::new(None, writing_mode, ForceNonfloatedFlag::ForceNonfloated), fragments: fragments, lines: Vec::new(), minimum_block_size_above_baseline: Au(0), minimum_depth_below_baseline: Au(0), first_line_indentation: Au(0), + }; + + for fragment in flow.fragments.fragments.iter() { + if fragment.is_generated_content() { + flow.base.restyle_damage.insert(RESOLVE_GENERATED_CONTENT) + } } + + flow } /// Returns the distance from the baseline for the logical block-start inline-start corner of @@ -1391,6 +1399,12 @@ impl Flow for InlineFlow { .translate(stacking_context_position)) } } + + fn mutate_fragments(&mut self, mutator: &mut FragmentMutator) { + for fragment in self.fragments.fragments.iter_mut() { + mutator.process(fragment) + } + } } impl fmt::Debug for InlineFlow { |