Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 2 additions & 31 deletions style/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,6 @@ impl<E: TElement> PreTraverseToken<E> {
}
}

/// A global variable holding the state of
/// `is_servo_nonincremental_layout()`.
/// See [#22854](https://github.com/servo/servo/issues/22854).
#[cfg(feature = "servo")]
pub static IS_SERVO_NONINCREMENTAL_LAYOUT: std::sync::atomic::AtomicBool =
std::sync::atomic::AtomicBool::new(false);

#[cfg(feature = "servo")]
#[inline]
fn is_servo_nonincremental_layout() -> bool {
use std::sync::atomic::Ordering;

IS_SERVO_NONINCREMENTAL_LAYOUT.load(Ordering::Relaxed)
}

#[cfg(not(feature = "servo"))]
#[inline]
fn is_servo_nonincremental_layout() -> bool {
false
}

/// A DOM Traversal trait, that is used to generically implement styling for
/// Gecko and Servo.
pub trait DomTraversal<E: TElement>: Sync {
Expand Down Expand Up @@ -219,11 +198,6 @@ pub trait DomTraversal<E: TElement>: Sync {
el, traversal_flags, data
);

// Non-incremental layout visits every node.
if is_servo_nonincremental_layout() {
return true;
}

// Unwrap the data.
let data = match data {
Some(d) if d.has_styles() => d,
Expand Down Expand Up @@ -513,8 +487,7 @@ pub fn recalc_style_at<E, D, F>(
// We only do this if we're not a display: none root, since in that case
// it's useless to style children.
let mut traverse_children = has_dirty_descendants_for_this_restyle
|| !propagated_hint.is_empty()
|| is_servo_nonincremental_layout();
|| !propagated_hint.is_empty();

traverse_children = traverse_children && !data.styles.is_display_none();

Expand Down Expand Up @@ -759,9 +732,7 @@ fn note_children<E, D, F>(
let child = match child_node.as_element() {
Some(el) => el,
None => {
if is_servo_nonincremental_layout()
|| D::text_node_needs_traversal(child_node, data)
{
if D::text_node_needs_traversal(child_node, data) {
note_child(child_node);
}
continue;
Expand Down
Loading