mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
style: Kill -servo-under-display-none.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
7d91b30172
commit
2c88248b87
5 changed files with 8 additions and 43 deletions
|
@ -1451,7 +1451,7 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
|||
node.insert_flags(HAS_NEWLY_CONSTRUCTED_FLOW);
|
||||
|
||||
// Bail out if this node has an ancestor with display: none.
|
||||
if node.style(self.style_context()).get_inheritedbox()._servo_under_display_none.0 {
|
||||
if node.style(self.style_context()).is_in_display_none_subtree() {
|
||||
self.set_flow_construction_result(node, ConstructionResult::None);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,6 @@
|
|||
context: &mut computed::Context) {
|
||||
longhands::_servo_display_for_hypothetical_box::derive_from_display(context);
|
||||
longhands::_servo_text_decorations_in_effect::derive_from_display(context);
|
||||
longhands::_servo_under_display_none::derive_from_display(context);
|
||||
}
|
||||
% endif
|
||||
|
||||
|
|
|
@ -249,43 +249,3 @@ ${helpers.single_keyword("image-rendering",
|
|||
}
|
||||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
// 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<W>(&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));
|
||||
}
|
||||
}
|
||||
</%helpers:longhand>
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue