diff options
author | bors-servo <release+servo@mozilla.com> | 2014-01-08 09:58:29 -0800 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-01-08 09:58:29 -0800 |
commit | 728fb9a7dedf67445e7f12eafb314117efede70d (patch) | |
tree | 4cc09cd77970d42b7172ca80736cec79307244f3 /src/components/main/layout/layout_task.rs | |
parent | 99157c64128ad9317e4296b9e28fe4e10bc306f6 (diff) | |
parent | 8d8a8ad6e7cc20389eebbf25069ccfa629617c0c (diff) | |
download | servo-728fb9a7dedf67445e7f12eafb314117efede70d.tar.gz servo-728fb9a7dedf67445e7f12eafb314117efede70d.zip |
auto merge of #1470 : SimonSapin/servo/before-after, r=metajack
No behavior change (hopefully).
a16087d is the core of what I wanted to do, following up on #1464 (cc: @parkjaeman)
Diffstat (limited to 'src/components/main/layout/layout_task.rs')
-rw-r--r-- | src/components/main/layout/layout_task.rs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 9ce50a0bf4c..2224401188a 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -51,7 +51,6 @@ use std::comm::Port; use std::task; use std::util; use style::{AuthorOrigin, Stylesheet, Stylist}; -use style::{Before, After}; /// Information needed by the layout task. struct LayoutTask { @@ -82,7 +81,7 @@ struct LayoutTask { /// A cached display list. display_list: Option<Arc<DisplayList<OpaqueNode>>>, - stylists: ~[RWArc<Stylist>], + stylist: RWArc<Stylist>, /// The channel on which messages can be sent to the profiler. profiler_chan: ProfilerChan, @@ -237,14 +236,6 @@ impl LayoutTask { profiler_chan: ProfilerChan) -> LayoutTask { - let mut stylists = ~[]; - // We implemented parsing/selector-matching only for Before and After. - // FirstLine and FirstLetter have to be added later. - let stylist_owners = ~[Some(Before), Some(After), None]; - for pseudo_element in stylist_owners.iter() { - stylists.push(RWArc::new(new_stylist(*pseudo_element))); - } - LayoutTask { id: id, port: port, @@ -257,7 +248,7 @@ impl LayoutTask { display_list: None, - stylists: stylists, + stylist: RWArc::new(new_stylist()), profiler_chan: profiler_chan, opts: opts.clone() } @@ -356,12 +347,8 @@ impl LayoutTask { fn handle_add_stylesheet(&mut self, sheet: Stylesheet) { let sheet = Cell::new(sheet); - for stylist in self.stylists.iter() { - do stylist.write |stylist| { - sheet.with_ref(|sheet|{ - stylist.add_stylesheet(sheet, AuthorOrigin); - }); - } + do self.stylist.write |stylist| { + stylist.add_stylesheet(sheet.take(), AuthorOrigin); } } @@ -458,7 +445,7 @@ impl LayoutTask { ReflowDocumentDamage => {} _ => { do profile(time::LayoutSelectorMatchCategory, self.profiler_chan.clone()) { - node.match_subtree(self.stylists.clone()); + node.match_subtree(self.stylist.clone()); node.cascade_subtree(None); } } |