Don't reconstruct the layout object when going from no pseudo to pseudo with no content for ::before and ::after.

Fixes Gecko bug 1376073.  r=emilio
This commit is contained in:
Boris Zbarsky 2017-07-28 17:41:53 -04:00
parent 12a49dc0be
commit 91d4956da5
5 changed files with 70 additions and 12 deletions

View file

@ -12,6 +12,8 @@ use cssparser::{ToCss, serialize_identifier};
use gecko_bindings::structs::{self, CSSPseudoElementType};
use properties::{PropertyFlags, APPLIES_TO_FIRST_LETTER, APPLIES_TO_FIRST_LINE};
use properties::APPLIES_TO_PLACEHOLDER;
use properties::ComputedValues;
use properties::longhands::display::computed_value as display;
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
use std::fmt;
use string_cache::Atom;
@ -132,4 +134,19 @@ impl PseudoElement {
_ => None,
}
}
/// Whether this pseudo-element should actually exist if it has
/// the given styles.
pub fn should_exist(&self, style: &ComputedValues) -> bool
{
let display = style.get_box().clone_display();
if display == display::T::none {
return false;
}
if self.is_before_or_after() && style.ineffective_content_property() {
return false;
}
true
}
}