mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
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:
parent
12a49dc0be
commit
91d4956da5
5 changed files with 70 additions and 12 deletions
|
@ -13,7 +13,9 @@ use dom::{OpaqueNode, TElement, TNode};
|
|||
use element_state::ElementState;
|
||||
use fnv::FnvHashMap;
|
||||
use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use properties::ComputedValues;
|
||||
use properties::PropertyFlags;
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, ElementExt, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::Element;
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
|
@ -181,6 +183,21 @@ impl PseudoElement {
|
|||
pub fn property_restriction(&self) -> Option<PropertyFlags> {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/// The type used for storing pseudo-class string arguments.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue