diff --git a/components/style/gecko/pseudo_element.rs b/components/style/gecko/pseudo_element.rs index 296b6339857..a08da8d40f1 100644 --- a/components/style/gecko/pseudo_element.rs +++ b/components/style/gecko/pseudo_element.rs @@ -162,15 +162,6 @@ impl PseudoElement { self.is_anon_box() && !self.is_tree_pseudo_element() } - /// Covert non-canonical pseudo-element to canonical one, and keep a - /// canonical one as it is. - pub fn canonical(&self) -> PseudoElement { - match *self { - PseudoElement::MozPlaceholder => PseudoElement::Placeholder, - _ => self.clone(), - } - } - /// Property flag that properties must have to apply to this pseudo-element. #[inline] pub fn property_restriction(&self) -> Option { diff --git a/components/style/gecko/pseudo_element_definition.mako.rs b/components/style/gecko/pseudo_element_definition.mako.rs index 30f71a496d8..06323699b19 100644 --- a/components/style/gecko/pseudo_element_definition.mako.rs +++ b/components/style/gecko/pseudo_element_definition.mako.rs @@ -234,6 +234,9 @@ impl PseudoElement { "-moz-selection" => { return Some(PseudoElement::Selection); } + "-moz-placeholder" => { + return Some(PseudoElement::Placeholder); + } _ => { // FIXME: -moz-tree check should probably be // ascii-case-insensitive. diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index b00755a1d5b..85e8c4eaef5 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -2267,7 +2267,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { // match the proper pseudo-element, given how we rulehash the stuff // based on the pseudo. match self.implemented_pseudo_element() { - Some(ref pseudo) => *pseudo == pseudo_element.canonical(), + Some(ref pseudo) => *pseudo == *pseudo_element, None => false, } } diff --git a/components/style/stylist.rs b/components/style/stylist.rs index f4614f945af..52feb19c411 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -898,7 +898,6 @@ impl Stylist { where E: TElement, { - let pseudo = pseudo.canonical(); debug_assert!(pseudo.is_lazy()); // Apply the selector flags. We should be in sequential mode @@ -1892,7 +1891,7 @@ impl ElementAndPseudoRules { let map = match pseudo_element { None => &mut self.element_map, Some(pseudo) => self.pseudos_map - .get_or_insert_with(&pseudo.canonical(), || Box::new(SelectorMap::new())), + .get_or_insert_with(pseudo, || Box::new(SelectorMap::new())), }; map.insert(rule, quirks_mode) @@ -1906,7 +1905,7 @@ impl ElementAndPseudoRules { #[inline] fn rules(&self, pseudo: Option<&PseudoElement>) -> Option<&SelectorMap> { match pseudo { - Some(pseudo) => self.pseudos_map.get(&pseudo.canonical()).map(|p| &**p), + Some(pseudo) => self.pseudos_map.get(pseudo).map(|p| &**p), None => Some(&self.element_map), } } @@ -2190,7 +2189,7 @@ impl CascadeData { precomputed_pseudo_element_decls .as_mut() .expect("Expected precomputed declarations for the UA level") - .get_or_insert_with(&pseudo.canonical(), Vec::new) + .get_or_insert_with(pseudo, Vec::new) .push(ApplicableDeclarationBlock::new( StyleSource::from_rule(locked.clone()), self.rules_source_order,