diff options
-rw-r--r-- | components/script/dom/htmlmetaelement.rs | 2 | ||||
-rw-r--r-- | components/script/stylesheet_loader.rs | 2 | ||||
-rw-r--r-- | components/style/stylesheets/stylesheet.rs | 14 |
3 files changed, 14 insertions, 4 deletions
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index a6be8e1747b..74a6400fdca 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -114,7 +114,7 @@ impl HTMLMetaElement { let shared_lock = document.style_shared_lock(); let rule = CssRule::Viewport(Arc::new(shared_lock.wrap(translated_rule))); let sheet = Arc::new(Stylesheet { - contents: StylesheetContents::from_shared_data( + contents: StylesheetContents::from_data( CssRules::new(vec![rule], shared_lock), Origin::Author, window_from_node(self).get_url(), diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 9657227f91a..b7f47b1fcfd 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -361,7 +361,7 @@ impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> { layer: Option<ImportLayer>, ) -> Arc<Locked<ImportRule>> { let sheet = Arc::new(Stylesheet { - contents: StylesheetContents::from_shared_data( + contents: StylesheetContents::from_data( CssRules::new(Vec::new(), lock), context.stylesheet_origin, context.url_data.clone(), diff --git a/components/style/stylesheets/stylesheet.rs b/components/style/stylesheets/stylesheet.rs index 9d3aaedeff5..aaf350b684d 100644 --- a/components/style/stylesheets/stylesheet.rs +++ b/components/style/stylesheets/stylesheet.rs @@ -125,13 +125,12 @@ impl StylesheetContents { /// An empty namespace map should be fine, as it is only used for parsing, /// not serialization of existing selectors. Since UA sheets are read only, /// we should never need the namespace map. - pub fn from_shared_data( + pub fn from_data( rules: Arc<Locked<CssRules>>, origin: Origin, url_data: UrlExtraData, quirks_mode: QuirksMode, ) -> Arc<Self> { - debug_assert!(rules.is_static()); Arc::new(Self { rules, origin, @@ -144,6 +143,17 @@ impl StylesheetContents { }) } + /// Same as above, but ensuring that the rules are static. + pub fn from_shared_data( + rules: Arc<Locked<CssRules>>, + origin: Origin, + url_data: UrlExtraData, + quirks_mode: QuirksMode, + ) -> Arc<Self> { + debug_assert!(rules.is_static()); + Self::from_data(rules, origin, url_data, quirks_mode) + } + /// Returns a reference to the list of rules. #[inline] pub fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] { |