aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/stylesheetlist.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-08-16 15:46:17 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-08-18 14:31:35 +0200
commitd1725b1f195652bf947d5ce00622807597bc0b9c (patch)
tree5c0416212d033bcbbf19574134ff7fc74531a17a /components/script/dom/stylesheetlist.rs
parentb8159e659e787c1e792d13b0939bb88e978ae84e (diff)
downloadservo-d1725b1f195652bf947d5ce00622807597bc0b9c.tar.gz
servo-d1725b1f195652bf947d5ce00622807597bc0b9c.zip
style: Replicate the list of stylesheets on the layout thread.
This is a patch that unifies a bit how Gecko and Stylo stylesheets work, in order to be able to eventually move the stylesheets into the stylist, and be able to incrementally update the invalidation map.
Diffstat (limited to 'components/script/dom/stylesheetlist.rs')
-rw-r--r--components/script/dom/stylesheetlist.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/components/script/dom/stylesheetlist.rs b/components/script/dom/stylesheetlist.rs
index 25d95ae3986..faeb04c1dda 100644
--- a/components/script/dom/stylesheetlist.rs
+++ b/components/script/dom/stylesheetlist.rs
@@ -36,18 +36,14 @@ impl StyleSheetList {
impl StyleSheetListMethods for StyleSheetList {
// https://drafts.csswg.org/cssom/#dom-stylesheetlist-length
fn Length(&self) -> u32 {
- self.document.with_style_sheets_in_document(|s| s.len() as u32)
+ self.document.stylesheet_count() as u32
}
// https://drafts.csswg.org/cssom/#dom-stylesheetlist-item
fn Item(&self, index: u32) -> Option<Root<StyleSheet>> {
- // XXXManishearth this doesn't handle the origin clean flag
- // and is a cors vulnerability
- self.document.with_style_sheets_in_document(|sheets| {
- sheets.get(index as usize)
- .and_then(|sheet| sheet.node.get_cssom_stylesheet())
- .map(Root::upcast)
- })
+ // XXXManishearth this doesn't handle the origin clean flag and is a
+ // cors vulnerability
+ self.document.stylesheet_at(index as usize).map(Root::upcast)
}
// check-tidy: no specs after this line