style: Make tree pseudo-element prefix not case-sensitive.

Differential Revision: https://phabricator.services.mozilla.com/D4185
This commit is contained in:
Xidorn Quan 2018-08-24 09:23:05 +00:00 committed by Emilio Cobos Álvarez
parent dceb58664e
commit c587fa3586
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 4 additions and 5 deletions

View file

@ -14,6 +14,7 @@ use properties::{ComputedValues, PropertyFlags};
use properties::longhands::display::computed_value::T as Display; use properties::longhands::display::computed_value::T as Display;
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl}; use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
use std::fmt; use std::fmt;
use str::starts_with_ignore_ascii_case;
use string_cache::Atom; use string_cache::Atom;
use thin_slice::ThinBoxedSlice; use thin_slice::ThinBoxedSlice;
use values::serialize_atom_identifier; use values::serialize_atom_identifier;

View file

@ -242,9 +242,7 @@ impl PseudoElement {
return Some(PseudoElement::Placeholder); return Some(PseudoElement::Placeholder);
} }
_ => { _ => {
// FIXME: -moz-tree check should probably be if starts_with_ignore_ascii_case(name, "-moz-tree-") {
// ascii-case-insensitive.
if name.starts_with("-moz-tree-") {
return PseudoElement::tree_pseudo_element(name, Box::new([])) return PseudoElement::tree_pseudo_element(name, Box::new([]))
} }
} }

View file

@ -17,6 +17,7 @@ use selectors::parser::{SelectorParseErrorKind, Visit};
use selectors::parser::{self as selector_parser, Selector}; use selectors::parser::{self as selector_parser, Selector};
use selectors::visitor::SelectorVisitor; use selectors::visitor::SelectorVisitor;
use std::fmt; use std::fmt;
use str::starts_with_ignore_ascii_case;
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
use thin_slice::ThinBoxedSlice; use thin_slice::ThinBoxedSlice;
@ -468,8 +469,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
name: CowRcStr<'i>, name: CowRcStr<'i>,
parser: &mut Parser<'i, 't>, parser: &mut Parser<'i, 't>,
) -> Result<PseudoElement, ParseError<'i>> { ) -> Result<PseudoElement, ParseError<'i>> {
// FIXME: -moz-tree check should probably be ascii-case-insensitive. if starts_with_ignore_ascii_case(&name, "-moz-tree-") {
if name.starts_with("-moz-tree-") {
// Tree pseudo-elements can have zero or more arguments, separated // Tree pseudo-elements can have zero or more arguments, separated
// by either comma or space. // by either comma or space.
let mut args = Vec::new(); let mut args = Vec::new();