mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Move one-off checks out of the recursive invalidation function.
There isn't a need to pay the cost for them multiple times. Bug: 1372068 MozReview-Commit-ID: 3K2mRcWTheJ
This commit is contained in:
parent
36bac58863
commit
6b0f4c0410
1 changed files with 26 additions and 13 deletions
|
@ -116,12 +116,37 @@ impl StylesheetInvalidationSet {
|
||||||
where E: TElement,
|
where E: TElement,
|
||||||
{
|
{
|
||||||
if let Some(e) = document_element {
|
if let Some(e) = document_element {
|
||||||
self.process_invalidations_in_subtree(e);
|
self.process_invalidations(e);
|
||||||
}
|
}
|
||||||
self.invalid_scopes.clear();
|
self.invalid_scopes.clear();
|
||||||
self.fully_invalid = false;
|
self.fully_invalid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn process_invalidations<E>(&self, element: E) -> bool
|
||||||
|
where E: TElement,
|
||||||
|
{
|
||||||
|
{
|
||||||
|
let mut data = match element.mutate_data() {
|
||||||
|
Some(data) => data,
|
||||||
|
None => return false,
|
||||||
|
};
|
||||||
|
|
||||||
|
if self.fully_invalid {
|
||||||
|
debug!("process_invalidations: fully_invalid({:?})",
|
||||||
|
element);
|
||||||
|
data.ensure_restyle().hint.insert(StoredRestyleHint::subtree());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.invalid_scopes.is_empty() {
|
||||||
|
debug!("process_invalidations: empty invalidation set");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.process_invalidations_in_subtree(element)
|
||||||
|
}
|
||||||
|
|
||||||
/// Process style invalidations in a given subtree, that is, look for all
|
/// Process style invalidations in a given subtree, that is, look for all
|
||||||
/// the relevant scopes in the subtree, and mark as dirty only the relevant
|
/// the relevant scopes in the subtree, and mark as dirty only the relevant
|
||||||
/// ones.
|
/// ones.
|
||||||
|
@ -148,18 +173,6 @@ impl StylesheetInvalidationSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.fully_invalid {
|
|
||||||
debug!("process_invalidations_in_subtree: fully_invalid({:?})",
|
|
||||||
element);
|
|
||||||
data.ensure_restyle().hint.insert(StoredRestyleHint::subtree());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.invalid_scopes.is_empty() {
|
|
||||||
debug!("process_invalidations_in_subtree: empty invalidation set");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for scope in &self.invalid_scopes {
|
for scope in &self.invalid_scopes {
|
||||||
if scope.matches(element) {
|
if scope.matches(element) {
|
||||||
debug!("process_invalidations_in_subtree: {:?} matched {:?}",
|
debug!("process_invalidations_in_subtree: {:?} matched {:?}",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue