From df7ea837d8bbed29df400374e0c862c5d80bf573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 17 Jan 2021 15:07:49 +0000 Subject: [PATCH] style: Allow resource:// stylesheets to use chrome-only rules. We'll use it to use @-moz-document from plaintext.css. Differential Revision: https://phabricator.services.mozilla.com/D101516 --- components/style/parser.rs | 2 +- components/style/selector_parser.rs | 2 +- components/style/stylesheets/mod.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/style/parser.rs b/components/style/parser.rs index e38602144ef..f306e2f3838 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -140,7 +140,7 @@ impl<'a> ParserContext<'a> { /// Returns whether chrome-only rules should be parsed. #[inline] pub fn chrome_rules_enabled(&self) -> bool { - self.url_data.is_chrome() || self.stylesheet_origin == Origin::User + self.url_data.chrome_rules_enabled() || self.stylesheet_origin == Origin::User } /// Whether we're in a user-agent stylesheet or chrome rules are enabled. diff --git a/components/style/selector_parser.rs b/components/style/selector_parser.rs index a8b5c3bc33e..52675abf45a 100644 --- a/components/style/selector_parser.rs +++ b/components/style/selector_parser.rs @@ -75,7 +75,7 @@ impl<'a> SelectorParser<'a> { /// Whether we're parsing selectors in a stylesheet that has chrome /// privilege. pub fn chrome_rules_enabled(&self) -> bool { - self.url_data.map_or(false, |d| d.is_chrome()) || self.stylesheet_origin == Origin::User + self.url_data.map_or(false, |d| d.chrome_rules_enabled()) || self.stylesheet_origin == Origin::User } } diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 4c1e996fd5d..724a54ff127 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -154,8 +154,8 @@ impl UrlExtraData { /// True if this URL scheme is chrome. #[inline] - pub fn is_chrome(&self) -> bool { - self.as_ref().mIsChrome + pub fn chrome_rules_enabled(&self) -> bool { + self.as_ref().mChromeRulesEnabled } /// Create a reference to this `UrlExtraData` from a reference to pointer. @@ -213,7 +213,7 @@ impl fmt::Debug for UrlExtraData { formatter .debug_struct("URLExtraData") - .field("is_chrome", &self.is_chrome()) + .field("chrome_rules_enabled", &self.chrome_rules_enabled()) .field( "base", &DebugURI(self.as_ref().mBaseURI.raw::()),