mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Get rid of CurrentElementInfo.
It's out-of-band data I never liked, and the code has changed enough from when it was introduced, that now all of the information it stores can be local.
This commit is contained in:
parent
49fe3d1c9f
commit
6704122927
3 changed files with 13 additions and 72 deletions
|
@ -273,6 +273,7 @@ pub trait DomTraversal<E: TElement> : Sync {
|
|||
&self,
|
||||
context: &mut StyleContext<E>,
|
||||
parent: E,
|
||||
is_initial_style: bool,
|
||||
parent_data: &ElementData,
|
||||
) -> bool {
|
||||
debug_assert!(cfg!(feature = "gecko") ||
|
||||
|
@ -304,7 +305,7 @@ pub trait DomTraversal<E: TElement> : Sync {
|
|||
// happens, we may just end up doing wasted work, since Gecko
|
||||
// recursively drops Servo ElementData when the XBL insertion parent of
|
||||
// an Element is changed.
|
||||
if cfg!(feature = "gecko") && context.thread_local.is_initial_style() &&
|
||||
if cfg!(feature = "gecko") && is_initial_style &&
|
||||
parent_data.styles.primary().has_moz_binding()
|
||||
{
|
||||
debug!("Parent {:?} has XBL binding, deferring traversal", parent);
|
||||
|
@ -427,7 +428,8 @@ where
|
|||
use traversal_flags::TraversalFlags;
|
||||
|
||||
let flags = context.shared.traversal_flags;
|
||||
context.thread_local.begin_element(element, data);
|
||||
let is_initial_style = !data.has_styles();
|
||||
|
||||
context.thread_local.statistics.elements_traversed += 1;
|
||||
debug_assert!(flags.intersects(TraversalFlags::AnimationOnly | TraversalFlags::UnstyledOnly) ||
|
||||
!element.has_snapshot() || element.handled_snapshot(),
|
||||
|
@ -524,8 +526,9 @@ where
|
|||
data.reconstructed_self() ||
|
||||
is_servo_nonincremental_layout();
|
||||
|
||||
traverse_children = traverse_children &&
|
||||
!traversal.should_cull_subtree(context, element, &data);
|
||||
traverse_children =
|
||||
traverse_children &&
|
||||
!traversal.should_cull_subtree(context, element, is_initial_style, &data);
|
||||
|
||||
// Examine our children, and enqueue the appropriate ones for traversal.
|
||||
if traverse_children {
|
||||
|
@ -535,6 +538,7 @@ where
|
|||
data,
|
||||
propagated_hint,
|
||||
child_cascade_requirement,
|
||||
is_initial_style,
|
||||
note_child
|
||||
);
|
||||
}
|
||||
|
@ -550,8 +554,6 @@ where
|
|||
!element.has_animation_only_dirty_descendants(),
|
||||
"Should have cleared animation bits already");
|
||||
clear_state_after_traversing(element, data, flags);
|
||||
|
||||
context.thread_local.end_element(element);
|
||||
}
|
||||
|
||||
fn clear_state_after_traversing<E>(
|
||||
|
@ -776,6 +778,7 @@ fn note_children<E, D, F>(
|
|||
data: &ElementData,
|
||||
propagated_hint: RestyleHint,
|
||||
cascade_requirement: ChildCascadeRequirement,
|
||||
is_initial_style: bool,
|
||||
mut note_child: F,
|
||||
)
|
||||
where
|
||||
|
@ -785,7 +788,6 @@ where
|
|||
{
|
||||
trace!("note_children: {:?}", element);
|
||||
let flags = context.shared.traversal_flags;
|
||||
let is_initial_style = context.thread_local.is_initial_style();
|
||||
|
||||
// Loop over all the traversal children.
|
||||
for child_node in element.traversal_children() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue