Bug 1540093 - Refactor some enabledness checks. r=mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 29 Mar 2019 11:12:12 +0000
changeset 466743 7077ebbd4677cabc478006b26dbf7cc6ac9bd0dc
parent 466742 9eca658703d92afe37923f313c9f662d16b98627
child 466744 46ad671b9fafbabad163c8e6b7d7bc752d142f1b
push id35780
push useropoprus@mozilla.com
push dateFri, 29 Mar 2019 21:53:01 +0000
treeherdermozilla-central@414f37afbe07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1540093
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1540093 - Refactor some enabledness checks. r=mats There are some common checks that could get some easy-to-use aliases. Differential Revision: https://phabricator.services.mozilla.com/D25117
servo/components/style/media_queries/media_feature_expression.rs
servo/components/style/parser.rs
servo/components/style/stylesheets/supports_rule.rs
servo/components/style/values/specified/box.rs
--- a/servo/components/style/media_queries/media_feature_expression.rs
+++ b/servo/components/style/media_queries/media_feature_expression.rs
@@ -12,17 +12,16 @@ use crate::context::QuirksMode;
 #[cfg(feature = "gecko")]
 use crate::gecko::media_features::MEDIA_FEATURES;
 #[cfg(feature = "gecko")]
 use crate::gecko_bindings::structs;
 use crate::parser::{Parse, ParserContext};
 #[cfg(feature = "servo")]
 use crate::servo::media_queries::MEDIA_FEATURES;
 use crate::str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
-use crate::stylesheets::Origin;
 use crate::values::computed::{self, ToComputedValue};
 use crate::values::specified::{Integer, Length, Number, Resolution};
 use crate::values::{serialize_atom_identifier, CSSFloat};
 use crate::{Atom, Zero};
 use cssparser::{Parser, Token};
 use std::cmp::{Ordering, PartialOrd};
 use std::fmt::{self, Write};
 use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
@@ -285,17 +284,17 @@ impl MediaFeatureExpression {
         let feature;
         let range;
         {
             let location = input.current_source_location();
             let ident = input.expect_ident()?;
 
             let mut requirements = ParsingRequirements::empty();
 
-            if context.chrome_rules_enabled() || context.stylesheet_origin == Origin::UserAgent {
+            if context.in_ua_or_chrome_sheet() {
                 requirements.insert(ParsingRequirements::CHROME_AND_UA_ONLY);
             }
 
             let result = {
                 let mut feature_name = &**ident;
 
                 #[cfg(feature = "gecko")]
                 {
--- a/servo/components/style/parser.rs
+++ b/servo/components/style/parser.rs
@@ -141,20 +141,33 @@ impl<'a> ParserContext<'a> {
         let error_reporter = match self.error_reporter {
             Some(r) => r,
             None => return,
         };
 
         error_reporter.report_error(self.url_data, location, error)
     }
 
+    /// Whether we're in a user-agent stylesheet.
+    #[inline]
+    pub fn in_ua_sheet(&self) -> bool {
+        self.stylesheet_origin == Origin::UserAgent
+    }
+
     /// 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
     }
+
+    /// Whether we're in a user-agent stylesheet or chrome rules are enabled.
+    #[inline]
+    pub fn in_ua_or_chrome_sheet(&self) -> bool {
+        self.in_ua_sheet() || self.chrome_rules_enabled()
+    }
 }
 
 /// A trait to abstract parsing of a specified value given a `ParserContext` and
 /// CSS input.
 ///
 /// This can be derived on keywords with `#[derive(Parse)]`.
 ///
 /// The derive code understands the following attributes on each of the variants:
--- a/servo/components/style/stylesheets/supports_rule.rs
+++ b/servo/components/style/stylesheets/supports_rule.rs
@@ -218,18 +218,17 @@ impl SupportsCondition {
             SupportsCondition::FutureSyntax(_) => false,
         }
     }
 }
 
 #[cfg(feature = "gecko")]
 fn eval_moz_bool_pref(name: &CStr, cx: &ParserContext) -> bool {
     use crate::gecko_bindings::bindings;
-    use crate::stylesheets::Origin;
-    if cx.stylesheet_origin != Origin::UserAgent && !cx.chrome_rules_enabled() {
+    if !cx.in_ua_or_chrome_sheet() {
         return false;
     }
     unsafe { bindings::Gecko_GetBoolPrefValue(name.as_ptr()) }
 }
 
 #[cfg(feature = "servo")]
 fn eval_moz_bool_pref(_: &CStr, _: &ParserContext) -> bool {
     false
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -16,32 +16,27 @@ use crate::values::specified::{AllowQuir
 use crate::values::{CustomIdent, KeyframesName};
 use crate::Atom;
 use cssparser::Parser;
 use selectors::parser::SelectorParseErrorKind;
 use std::fmt::{self, Write};
 use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
 use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
 
-fn in_ua_or_chrome_sheet(context: &ParserContext) -> bool {
-    use crate::stylesheets::Origin;
-    context.stylesheet_origin == Origin::UserAgent || context.chrome_rules_enabled()
-}
-
 #[cfg(feature = "gecko")]
 fn moz_display_values_enabled(context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs;
-    in_ua_or_chrome_sheet(context) ||
+    context.in_ua_or_chrome_sheet() ||
         unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled }
 }
 
 #[cfg(feature = "gecko")]
 fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs;
-    in_ua_or_chrome_sheet(context) ||
+    context.in_ua_or_chrome_sheet() ||
         unsafe {
             structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled
         }
 }
 
 /// Defines an element’s display type, which consists of
 /// the two basic qualities of how an element generates boxes
 /// <https://drafts.csswg.org/css-display/#propdef-display>
@@ -983,326 +978,326 @@ pub enum Resize {
 )]
 #[repr(u8)]
 pub enum Appearance {
     /// No appearance at all.
     None,
     /// A typical dialog button.
     Button,
     /// Various arrows that go in buttons
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ButtonArrowDown,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ButtonArrowNext,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ButtonArrowPrevious,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ButtonArrowUp,
     /// A rectangular button that contains complex content
     /// like images (e.g. HTML <button> elements)
     ButtonBevel,
     /// The focus outline box inside of a button.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ButtonFocus,
     /// The caret of a text area
     Caret,
     /// A dual toolbar button (e.g., a Back button with a dropdown)
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Dualbutton,
     /// A groupbox.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Groupbox,
     /// A inner-spin button.
     InnerSpinButton,
     /// List boxes.
     Listbox,
     /// A listbox item.
     Listitem,
     /// Menu Bar background
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menubar,
     /// <menu> and <menuitem> appearances
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menuitem,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Checkmenuitem,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Radiomenuitem,
     /// For text on non-iconic menuitems only
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menuitemtext,
     /// A dropdown list.
     Menulist,
     /// The dropdown button(s) that open up a dropdown list.
     MenulistButton,
     /// The text part of a dropdown list, to left of button.
     MenulistText,
     /// An editable textfield with a dropdown list (a combobox).
     MenulistTextfield,
     /// Menu Popup background.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menupopup,
     /// menu checkbox/radio appearances
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menucheckbox,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menuradio,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menuseparator,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menuarrow,
     /// An image in the menu gutter, like in bookmarks or history.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Menuimage,
     /// A horizontal meter bar.
     #[parse(aliases = "meterbar")]
     Meter,
     /// The meter bar's meter indicator.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Meterchunk,
     /// The "arrowed" part of the dropdown button that open up a dropdown list.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMenulistButton,
     /// For HTML's <input type=number>
     NumberInput,
     /// A horizontal progress bar.
     #[parse(aliases = "progressbar")]
     ProgressBar,
     /// The progress bar's progress indicator
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Progresschunk,
     /// A vertical progress bar.
     ProgressbarVertical,
     /// A checkbox element.
     Checkbox,
     /// A radio element within a radio group.
     Radio,
     /// A generic container that always repaints on state changes. This is a
     /// hack to make XUL checkboxes and radio buttons work.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     CheckboxContainer,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     RadioContainer,
     /// The label part of a checkbox or radio button, used for painting a focus
     /// outline.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     CheckboxLabel,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     RadioLabel,
     /// nsRangeFrame and its subparts
     Range,
     RangeThumb,
     /// The resizer background area in a status bar for the resizer widget in
     /// the corner of a window.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Resizerpanel,
     /// The resizer itself.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Resizer,
     /// A slider.
     ScaleHorizontal,
     ScaleVertical,
     /// A slider's thumb.
     ScalethumbHorizontal,
     ScalethumbVertical,
     /// If the platform supports it, the left/right chunks of the slider thumb.
     Scalethumbstart,
     Scalethumbend,
     /// The ticks for a slider.
     Scalethumbtick,
     /// A scrollbar.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Scrollbar,
     /// A small scrollbar.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarSmall,
     /// The scrollbar slider
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarHorizontal,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarVertical,
     /// A scrollbar button (up/down/left/right).
     /// Keep these in order (some code casts these values to `int` in order to
     /// compare them against each other).
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarbuttonUp,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarbuttonDown,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarbuttonLeft,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ScrollbarbuttonRight,
     /// The scrollbar thumb.
     ScrollbarthumbHorizontal,
     ScrollbarthumbVertical,
     /// The scrollbar track.
     ScrollbartrackHorizontal,
     ScrollbartrackVertical,
     /// The scroll corner
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Scrollcorner,
     /// A searchfield.
     Searchfield,
     /// A separator.  Can be horizontal or vertical.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Separator,
     /// A spin control (up/down control for time/date pickers).
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Spinner,
     /// The up button of a spin control.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     SpinnerUpbutton,
     /// The down button of a spin control.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     SpinnerDownbutton,
     /// The textfield of a spin control
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     SpinnerTextfield,
     /// A splitter.  Can be horizontal or vertical.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Splitter,
     /// A status bar in a main application window.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Statusbar,
     /// A single pane of a status bar.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Statusbarpanel,
     /// A single tab in a tab widget.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Tab,
     /// A single pane (inside the tabpanels container).
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Tabpanel,
     /// The tab panels container.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Tabpanels,
     /// The tabs scroll arrows (left/right).
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     TabScrollArrowBack,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     TabScrollArrowForward,
     /// A multi-line text field, e.g. HTML <textarea>.
     #[parse(aliases = "textfield-multiline")]
     Textarea,
     /// A single-line text field, e.g. HTML <input type=text>.
     Textfield,
     /// A toolbar in an application window.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Toolbar,
     /// A single toolbar button (with no associated dropdown).
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Toolbarbutton,
     /// The dropdown portion of a toolbar button
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     ToolbarbuttonDropdown,
     /// The gripper for a toolbar.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Toolbargripper,
     /// The toolbox that contains the toolbars.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Toolbox,
     /// A tooltip.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Tooltip,
     /// A listbox or tree widget header
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treeheader,
     /// An individual header cell
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treeheadercell,
     /// The sort arrow for a header.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treeheadersortarrow,
     /// A tree item.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treeitem,
     /// A tree widget branch line
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treeline,
     /// A tree widget twisty.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treetwisty,
     /// Open tree widget twisty.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treetwistyopen,
     /// A tree widget.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Treeview,
     /// Window and dialog backgrounds.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Window,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     Dialog,
 
     /// Vista Rebars.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWinCommunicationsToolbox,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWinMediaToolbox,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWinBrowsertabbarToolbox,
     /// Vista glass.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWinGlass,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWinBorderlessGlass,
     /// -moz-apperance style used in setting proper glass margins.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWinExcludeGlass,
 
     /// Titlebar elements on the Mac.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacFullscreenButton,
     /// Mac help button.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacHelpButton,
 
     /// Windows themed window frame elements.
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowButtonBox,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowButtonBoxMaximized,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowButtonClose,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowButtonMaximize,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowButtonMinimize,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowButtonRestore,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowFrameBottom,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowFrameLeft,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowFrameRight,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowTitlebar,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozWindowTitlebarMaximized,
 
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozGtkInfoBar,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacActiveSourceListSelection,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacDisclosureButtonClosed,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacDisclosureButtonOpen,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacSourceList,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacSourceListSelection,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacVibrancyDark,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacVibrancyLight,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacVibrantTitlebarDark,
-    #[parse(condition = "in_ua_or_chrome_sheet")]
+    #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
     MozMacVibrantTitlebarLight,
 
     /// A non-disappearing scrollbar.
     #[css(skip)]
     ScrollbarNonDisappearing,
 
     /// A themed focus outline (for outline:auto).
     ///