mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #19426 - emilio:cache-invalidation, r=xidorn
style: Require an nth-index cache for invalidation. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19426) <!-- Reviewable:end -->
This commit is contained in:
commit
95aac490a5
4 changed files with 15 additions and 15 deletions
|
@ -239,7 +239,7 @@ impl ElementData {
|
|||
element: E,
|
||||
shared_context: &SharedStyleContext,
|
||||
stack_limit_checker: Option<&StackLimitChecker>,
|
||||
nth_index_cache: Option<&mut NthIndexCache>,
|
||||
nth_index_cache: &mut NthIndexCache,
|
||||
) -> InvalidationResult {
|
||||
// In animation-only restyle we shouldn't touch snapshot at all.
|
||||
if shared_context.traversal_flags.for_animation_only() {
|
||||
|
|
|
@ -71,12 +71,12 @@ impl<'a, 'b: 'a, E: TElement> StateAndAttrInvalidationProcessor<'a, 'b, E> {
|
|||
cut_off_inheritance: bool,
|
||||
element: E,
|
||||
data: &'a mut ElementData,
|
||||
nth_index_cache: Option<&'a mut NthIndexCache>,
|
||||
nth_index_cache: &'a mut NthIndexCache,
|
||||
) -> Self {
|
||||
let matching_context = MatchingContext::new_for_visited(
|
||||
MatchingMode::Normal,
|
||||
None,
|
||||
nth_index_cache,
|
||||
Some(nth_index_cache),
|
||||
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
|
||||
shared_context.quirks_mode(),
|
||||
);
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::{NodeInfo, OpaqueNode, TElement, TNode};
|
|||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use matching::{ChildCascadeRequirement, MatchMethods};
|
||||
use selector_parser::PseudoElement;
|
||||
use selectors::NthIndexCache;
|
||||
use sharing::StyleSharingTarget;
|
||||
use smallvec::SmallVec;
|
||||
use style_resolver::{PseudoElementResolution, StyleResolverForElement};
|
||||
|
@ -153,11 +154,12 @@ pub trait DomTraversal<E: TElement> : Sync {
|
|||
if !traversal_flags.for_animation_only() {
|
||||
// Invalidate our style, and that of our siblings and
|
||||
// descendants as needed.
|
||||
//
|
||||
// FIXME(emilio): an nth-index cache could be worth here, even
|
||||
// if temporary?
|
||||
let invalidation_result =
|
||||
data.invalidate_style_if_needed(root, shared_context, None, None);
|
||||
let invalidation_result = data.invalidate_style_if_needed(
|
||||
root,
|
||||
shared_context,
|
||||
None,
|
||||
&mut NthIndexCache::default(),
|
||||
);
|
||||
|
||||
if invalidation_result.has_invalidated_siblings() {
|
||||
let actual_root = root.traversal_parent()
|
||||
|
@ -802,7 +804,7 @@ where
|
|||
child,
|
||||
&context.shared,
|
||||
Some(&context.thread_local.stack_limit_checker),
|
||||
Some(&mut context.thread_local.nth_index_cache)
|
||||
&mut context.thread_local.nth_index_cache,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue