diff options
Diffstat (limited to 'components/style/servo/selector_parser.rs')
-rw-r--r-- | components/style/servo/selector_parser.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/style/servo/selector_parser.rs b/components/style/servo/selector_parser.rs index ae47b993ebc..c88b4faa3ad 100644 --- a/components/style/servo/selector_parser.rs +++ b/components/style/servo/selector_parser.rs @@ -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. |