mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Hook the recursive invalidation traversal up to the stack checker machinery.
MozReview-Commit-ID: 3tX3gHFTBT
This commit is contained in:
parent
2136dd2bb7
commit
8c3cc9ba1f
4 changed files with 33 additions and 13 deletions
|
@ -6,7 +6,7 @@
|
|||
//! element styles need to be invalidated.
|
||||
|
||||
use Atom;
|
||||
use context::SharedStyleContext;
|
||||
use context::{SharedStyleContext, StackLimitChecker};
|
||||
use data::ElementData;
|
||||
use dom::{TElement, TNode};
|
||||
use element_state::{ElementState, IN_VISITED_OR_UNVISITED_STATE};
|
||||
|
@ -40,6 +40,7 @@ pub struct TreeStyleInvalidator<'a, 'b: 'a, E>
|
|||
// descendants if an element has no data, though.
|
||||
data: Option<&'a mut ElementData>,
|
||||
shared_context: &'a SharedStyleContext<'b>,
|
||||
stack_limit_checker: Option<&'a StackLimitChecker>,
|
||||
}
|
||||
|
||||
type InvalidationVector = SmallVec<[Invalidation; 10]>;
|
||||
|
@ -130,11 +131,13 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
|||
element: E,
|
||||
data: Option<&'a mut ElementData>,
|
||||
shared_context: &'a SharedStyleContext<'b>,
|
||||
stack_limit_checker: Option<&'a StackLimitChecker>,
|
||||
) -> Self {
|
||||
Self {
|
||||
element: element,
|
||||
data: data,
|
||||
shared_context: shared_context,
|
||||
element,
|
||||
data,
|
||||
shared_context,
|
||||
stack_limit_checker,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +279,8 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
|||
let mut sibling_invalidator = TreeStyleInvalidator::new(
|
||||
sibling,
|
||||
sibling_data,
|
||||
self.shared_context
|
||||
self.shared_context,
|
||||
self.stack_limit_checker,
|
||||
);
|
||||
|
||||
let mut invalidations_for_descendants = InvalidationVector::new();
|
||||
|
@ -338,7 +342,8 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
|||
let mut child_invalidator = TreeStyleInvalidator::new(
|
||||
child,
|
||||
child_data,
|
||||
self.shared_context
|
||||
self.shared_context,
|
||||
self.stack_limit_checker,
|
||||
);
|
||||
|
||||
let mut invalidations_for_descendants = InvalidationVector::new();
|
||||
|
@ -448,12 +453,21 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
|
|||
match self.data {
|
||||
None => return false,
|
||||
Some(ref data) => {
|
||||
// FIXME(emilio): Only needs to check RESTYLE_DESCENDANTS,
|
||||
// really.
|
||||
if data.restyle.hint.contains_subtree() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(checker) = self.stack_limit_checker {
|
||||
if checker.limit_exceeded() {
|
||||
self.data.as_mut().unwrap().restyle.hint.insert(RESTYLE_DESCENDANTS);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
let mut any_descendant = false;
|
||||
|
||||
if let Some(anon_content) = self.element.xbl_binding_anonymous_content() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue