From d88696023f485c44a3e666c3fe6ead7223767817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 18 Dec 2017 09:20:59 +0100 Subject: [PATCH] style: Parse ::slotted() if the webcomponents pref is on. Bug: 1425834 Reviewed-by: heycam MozReview-Commit-ID: IOFneIgu7Rm --- components/style/gecko/selector_parser.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 0dec6ed479a..72da9346a36 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -6,7 +6,7 @@ use cssparser::{BasicParseError, BasicParseErrorKind, Parser, ToCss, Token, CowRcStr, SourceLocation}; use element_state::{DocumentState, ElementState}; -use gecko_bindings::structs::CSSPseudoClassType; +use gecko_bindings::structs::{self, CSSPseudoClassType}; use gecko_bindings::structs::RawServoSelectorList; use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI}; use selector_parser::{Direction, SelectorParser}; @@ -333,6 +333,13 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { type Impl = SelectorImpl; type Error = StyleParseErrorKind<'i>; + fn parse_slotted(&self) -> bool { + // NOTE(emilio): Slot assignment and such works per-document, but + // getting a document around here is not trivial, and it's not worth + // anyway to handle this in a per-doc basis. + unsafe { structs::nsContentUtils_sIsWebComponentsEnabled } + } + fn pseudo_element_allows_single_colon(name: &str) -> bool { // FIXME: -moz-tree check should probably be ascii-case-insensitive. ::selectors::parser::is_css2_pseudo_element(name) ||