aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-06-28 12:12:14 -0700
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-07-02 15:49:40 +0200
commit12630757762b99c509661ddb524daff0d153c423 (patch)
treeee752c55df7a8918f158486759850926dd31f969 /components/layout_thread/lib.rs
parentfd65ac8924dd75b1f80e2cf048f64e11d3387976 (diff)
downloadservo-12630757762b99c509661ddb524daff0d153c423.tar.gz
servo-12630757762b99c509661ddb524daff0d153c423.zip
stylo: Fix StyleSheetInner/Stylesheet mapping
The key of this patch is the split between Stylesheet and StylesheetContents. Gecko will use StylesheetContents, which maps to a ServoStyleSheetInner.
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r--components/layout_thread/lib.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 4e407e2146e..970896f3864 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -101,6 +101,7 @@ use std::marker::PhantomData;
use std::mem as std_mem;
use std::ops::{Deref, DerefMut};
use std::process;
+use std::slice;
use std::sync::{Arc, Mutex, MutexGuard};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Receiver, Sender, channel};
@@ -117,7 +118,7 @@ use style::selector_parser::SnapshotMap;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, REPOSITION, STORE_OVERFLOW};
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards};
use style::stylearc::Arc as StyleArc;
-use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets};
+use style::stylesheets::{Origin, Stylesheet, StylesheetInDocument, UserAgentStylesheets};
use style::stylist::{ExtraStyleData, Stylist};
use style::thread_state;
use style::timer::Timer;
@@ -417,6 +418,17 @@ fn add_font_face_rules(stylesheet: &Stylesheet,
}
}
+#[derive(Clone)]
+struct StylesheetIterator<'a>(slice::Iter<'a, StyleArc<Stylesheet>>);
+
+impl<'a> Iterator for StylesheetIterator<'a> {
+ type Item = &'a Stylesheet;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.0.next().map(|s| &**s)
+ }
+}
+
impl LayoutThread {
/// Creates a new `LayoutThread` structure.
fn new(id: PipelineId,
@@ -1146,7 +1158,7 @@ impl LayoutThread {
marker: PhantomData,
};
let needs_dirtying = self.stylist.update(
- data.document_stylesheets.iter(),
+ StylesheetIterator(data.document_stylesheets.iter()),
&guards,
Some(ua_stylesheets),
data.stylesheets_changed,