style: Parse ::slotted() if the webcomponents pref is on.

Bug: 1425834
Reviewed-by: heycam
MozReview-Commit-ID: IOFneIgu7Rm
This commit is contained in:
Emilio Cobos Álvarez 2017-12-18 09:20:59 +01:00
parent b73fe2d698
commit d88696023f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -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) ||