Skip to content

Commit 5685b27

Browse files
authored
style: Don't traverse text nodes (#414)
This was functionality specific for servos old layout engine and is not required anymore. Part of servo/servo#46167 Servo PR: servo/servo#46272 Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
1 parent 5b71023 commit 5685b27

1 file changed

Lines changed: 3 additions & 19 deletions

File tree

style/traversal.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
use crate::context::{ElementCascadeInputs, SharedStyleContext, StyleContext};
88
use crate::data::{ElementData, ElementStyles, RestyleKind};
9-
use crate::dom::{NodeInfo, OpaqueNode, TElement, TNode};
9+
use crate::dom::{OpaqueNode, TElement, TNode};
1010
use crate::invalidation::element::restyle_hints::RestyleHint;
1111
use crate::matching::MatchMethods;
1212
use crate::selector_parser::PseudoElement;
@@ -179,14 +179,6 @@ pub trait DomTraversal<E: TElement>: Sync {
179179
PreTraverseToken(if should_traverse { Some(root) } else { None })
180180
}
181181

182-
/// Returns true if traversal should visit a text node. The style system
183-
/// never processes text nodes, but Servo overrides this to visit them for
184-
/// flow construction when necessary.
185-
fn text_node_needs_traversal(node: E::ConcreteNode, _parent_data: &ElementData) -> bool {
186-
debug_assert!(node.is_text_node());
187-
false
188-
}
189-
190182
/// Returns true if traversal is needed for the given element and subtree.
191183
fn element_needs_traversal(
192184
el: E,
@@ -472,7 +464,6 @@ pub fn recalc_style_at<E, D, F>(
472464
note_children::<E, D, F>(
473465
context,
474466
element,
475-
data,
476467
propagated_hint,
477468
is_initial_style,
478469
note_child,
@@ -687,7 +678,6 @@ where
687678
fn note_children<E, D, F>(
688679
context: &mut StyleContext<E>,
689680
element: E,
690-
data: &ElementData,
691681
propagated_hint: RestyleHint,
692682
is_initial_style: bool,
693683
mut note_child: F,
@@ -701,14 +691,8 @@ fn note_children<E, D, F>(
701691

702692
// Loop over all the traversal children.
703693
for child_node in element.traversal_children() {
704-
let child = match child_node.as_element() {
705-
Some(el) => el,
706-
None => {
707-
if D::text_node_needs_traversal(child_node, data) {
708-
note_child(child_node);
709-
}
710-
continue;
711-
},
694+
let Some(child) = child_node.as_element() else {
695+
continue;
712696
};
713697

714698
let mut child_data = child.mutate_data();

0 commit comments

Comments
 (0)