Make tree pseudos not precomputed since they are not really anonymous boxes.

This commit is contained in:
Xidorn Quan 2017-10-20 14:08:36 +11:00
parent 4ce3dc7729
commit cd527733c5
4 changed files with 35 additions and 9 deletions

View file

@ -546,6 +546,26 @@ impl PseudoElement {
PseudoElement::Before | PseudoElement::After | PseudoElement::FirstLine | PseudoElement::FirstLetter)
}
/// Whether this pseudo-element is tree pseudo-element.
#[inline]
pub fn is_tree_pseudo_element(&self) -> bool {
match *self {
PseudoElement::MozTreeColumn(..) => true,
PseudoElement::MozTreeRow(..) => true,
PseudoElement::MozTreeSeparator(..) => true,
PseudoElement::MozTreeCell(..) => true,
PseudoElement::MozTreeIndentation(..) => true,
PseudoElement::MozTreeLine(..) => true,
PseudoElement::MozTreeTwisty(..) => true,
PseudoElement::MozTreeImage(..) => true,
PseudoElement::MozTreeCellText(..) => true,
PseudoElement::MozTreeCheckbox(..) => true,
PseudoElement::MozTreeProgressmeter(..) => true,
PseudoElement::MozTreeDropFeedback(..) => true,
_ => false,
}
}
/// Gets the flags associated to this pseudo-element, or 0 if it's an
/// anonymous box.
pub fn flags(&self) -> u32 {

View file

@ -46,7 +46,7 @@ impl PseudoElement {
return PseudoElementCascadeType::Eager
}
if self.is_anon_box() {
if self.is_precomputed() {
return PseudoElementCascadeType::Precomputed
}
@ -137,7 +137,7 @@ impl PseudoElement {
/// Whether this pseudo-element is precomputed.
#[inline]
pub fn is_precomputed(&self) -> bool {
self.is_anon_box()
self.is_anon_box() && !self.is_tree_pseudo_element()
}
/// Covert non-canonical pseudo-element to canonical one, and keep a

View file

@ -94,6 +94,17 @@ impl PseudoElement {
${" | ".join(map(lambda name: "PseudoElement::{}".format(name), EAGER_PSEUDOS))})
}
/// Whether this pseudo-element is tree pseudo-element.
#[inline]
pub fn is_tree_pseudo_element(&self) -> bool {
match *self {
% for pseudo in TREE_PSEUDOS:
${pseudo_element_variant(pseudo)} => true,
% endfor
_ => false,
}
}
/// Gets the flags associated to this pseudo-element, or 0 if it's an
/// anonymous box.
pub fn flags(&self) -> u32 {