diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 852f16e893e..fa684029288 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1451,7 +1451,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal - -// Used in the bottom-up flow construction traversal to avoid constructing flows for -// descendants of nodes with `display: none`. -<%helpers:longhand name="-servo-under-display-none" - derived_from="display" - products="servo" - animation_value_type="none" - spec="Nonstandard (internal layout use only)"> - use std::fmt; - use style_traits::ToCss; - - #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] - #[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))] - #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)] - pub struct SpecifiedValue(pub bool); - - pub mod computed_value { - pub type T = super::SpecifiedValue; - } - - pub fn get_initial_value() -> computed_value::T { - SpecifiedValue(false) - } - - impl ToCss for SpecifiedValue { - fn to_css(&self, _: &mut W) -> fmt::Result where W: fmt::Write { - Ok(()) // Internal property - } - } - - #[inline] - pub fn derive_from_display(context: &mut Context) { - use super::display::computed_value::T as Display; - - if context.style().get_box().clone_display() == Display::none { - context.builder - .set__servo_under_display_none(SpecifiedValue(true)); - } - } - diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 7ecfcc5012a..6935650fa0d 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2026,6 +2026,13 @@ impl ComputedValues { pub fn visited_rules(&self) -> Option<<&StrongRuleNode> { self.visited_style.as_ref().and_then(|s| s.rules.as_ref()) } + + /// Returns whether we're in a display: none subtree. + pub fn is_in_display_none_subtree(&self) -> bool { + use properties::computed_value_flags::IS_IN_DISPLAY_NONE_SUBTREE; + + self.flags.contains(IS_IN_DISPLAY_NONE_SUBTREE) + } } #[cfg(feature = "servo")] diff --git a/components/style/servo/restyle_damage.rs b/components/style/servo/restyle_damage.rs index fd62a146ef7..29f055b476a 100644 --- a/components/style/servo/restyle_damage.rs +++ b/components/style/servo/restyle_damage.rs @@ -198,7 +198,6 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam REFLOW, RECONSTRUCT_FLOW], [ get_box.clear, get_box.float, get_box.display, get_box.position, get_counters.content, get_counters.counter_reset, get_counters.counter_increment, - get_inheritedbox._servo_under_display_none, get_list.quotes, get_list.list_style_type, // If these text or font properties change, we need to reconstruct the flow so that