stylo: Cleanup the Gecko bits.

MozReview-Commit-ID: dbVDy1u4vp
This commit is contained in:
Emilio Cobos Álvarez 2017-07-18 14:29:12 +02:00
parent 655c842d2e
commit 07e1c6e75a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 148 additions and 111 deletions

View file

@ -107,7 +107,6 @@ impl PseudoElement {
}
}
/// Construct a `CSSPseudoElementType` from a pseudo-element
#[inline]
pub fn pseudo_type(&self) -> CSSPseudoElementType {
@ -133,6 +132,21 @@ impl PseudoElement {
(self.atom().as_ptr(), self.pseudo_type())
}
/// Construct a pseudo-element from an `Atom`.
#[inline]
pub fn from_atom(atom: &Atom) -> Option<Self> {
% for pseudo in PSEUDOS:
% if pseudo.is_tree_pseudo_element():
// We cannot generate ${pseudo_element_variant(pseudo)} from just an atom.
% else:
if atom == &atom!("${pseudo.value}") {
return Some(${pseudo_element_variant(pseudo)});
}
% endif
% endfor
None
}
/// Construct a pseudo-element from an anonymous box `Atom`.
#[inline]
pub fn from_anon_box_atom(atom: &Atom) -> Option<Self> {