aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/inline.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-01-02 17:40:54 -0500
committerSimon Sapin <simon.sapin@exyr.org>2015-03-03 17:31:19 +0100
commit30fd28d1077fbb3f47140f6ab1252c0d24f44d23 (patch)
tree6f1e57cc6f9571ae26623676d783284306d7926d /components/layout/inline.rs
parent417a932e306438b5cda7a7071412a34d3e503f94 (diff)
downloadservo-30fd28d1077fbb3f47140f6ab1252c0d24f44d23.tar.gz
servo-30fd28d1077fbb3f47140f6ab1252c0d24f44d23.zip
layout: Implement ordered lists, CSS counters, and `quotes` per CSS 2.1
§ 12.3-12.5. 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.
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r--components/layout/inline.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index a5ca5038c30..7a089095484 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 {