mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Make Invalidation work in terms of a dependency, not a selector.
That way we can look at the parent dependency as described in the previous patch. An alternative would be to add a: parent_dependency: Option<&'a Dependency> on construction to `Invalidation`, but this way seems slightly better to avoid growing the struct. It's not even one more indirection because the selector is contained directly in the Dependency struct. Differential Revision: https://phabricator.services.mozilla.com/D71422
This commit is contained in:
parent
c1bc588c93
commit
4b5de772c6
5 changed files with 315 additions and 202 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
use crate::dom::TElement;
|
||||
use crate::element_state::DocumentState;
|
||||
use crate::invalidation::element::invalidation_map::Dependency;
|
||||
use crate::invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
|
||||
use crate::invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use crate::invalidation::element::state_and_attributes;
|
||||
|
@ -65,6 +66,11 @@ where
|
|||
E: TElement,
|
||||
I: Iterator<Item = &'a CascadeData>,
|
||||
{
|
||||
fn check_outer_dependency(&mut self, _: &Dependency, _: E) -> bool {
|
||||
debug_assert!(false, "how, we should only have parent-less dependencies here!");
|
||||
true
|
||||
}
|
||||
|
||||
fn collect_invalidations(
|
||||
&mut self,
|
||||
_element: E,
|
||||
|
@ -81,10 +87,14 @@ where
|
|||
|
||||
// We pass `None` as a scope, as document state selectors aren't
|
||||
// affected by the current scope.
|
||||
//
|
||||
// FIXME(emilio): We should really pass the relevant host for
|
||||
// self.rules, so that we invalidate correctly if the selector
|
||||
// happens to have something like :host(:-moz-window-inactive)
|
||||
// for example.
|
||||
self_invalidations.push(Invalidation::new(
|
||||
&dependency.selector,
|
||||
&dependency.dependency,
|
||||
/* scope = */ None,
|
||||
0,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue