mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Reorder style sharing checks so that cheaper and broader ones are earlier.
This commit is contained in:
parent
4c797dfb52
commit
a37bb8e6aa
1 changed files with 23 additions and 23 deletions
|
@ -656,6 +656,29 @@ impl<E: TElement> StyleSharingCache<E> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if target.local_name() != candidate.element.local_name() {
|
||||||
|
trace!("Miss: Local Name");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if target.namespace() != candidate.element.namespace() {
|
||||||
|
trace!("Miss: Namespace");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We do not ignore visited state here, because Gecko needs to store
|
||||||
|
// extra bits on visited style contexts, so these contexts cannot be
|
||||||
|
// shared.
|
||||||
|
if target.element.state() != candidate.state() {
|
||||||
|
trace!("Miss: User and Author State");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if target.is_link() != candidate.element.is_link() {
|
||||||
|
trace!("Miss: Link");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
// Note that in the XBL case, we should be able to assert that the
|
// Note that in the XBL case, we should be able to assert that the
|
||||||
// scopes are different, since two elements with different XBL bindings
|
// scopes are different, since two elements with different XBL bindings
|
||||||
// need to necessarily have different style (and thus children of them
|
// need to necessarily have different style (and thus children of them
|
||||||
|
@ -676,35 +699,12 @@ impl<E: TElement> StyleSharingCache<E> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.local_name() != candidate.element.local_name() {
|
|
||||||
trace!("Miss: Local Name");
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if target.namespace() != candidate.element.namespace() {
|
|
||||||
trace!("Miss: Namespace");
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if target.is_link() != candidate.element.is_link() {
|
|
||||||
trace!("Miss: Link");
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if target.matches_user_and_author_rules() !=
|
if target.matches_user_and_author_rules() !=
|
||||||
candidate.element.matches_user_and_author_rules() {
|
candidate.element.matches_user_and_author_rules() {
|
||||||
trace!("Miss: User and Author Rules");
|
trace!("Miss: User and Author Rules");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not ignore visited state here, because Gecko
|
|
||||||
// needs to store extra bits on visited style contexts,
|
|
||||||
// so these contexts cannot be shared
|
|
||||||
if target.element.state() != candidate.state() {
|
|
||||||
trace!("Miss: User and Author State");
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
// It's possible that there are no styles for either id.
|
// It's possible that there are no styles for either id.
|
||||||
let may_match_different_id_rules =
|
let may_match_different_id_rules =
|
||||||
checks::may_match_different_id_rules(
|
checks::may_match_different_id_rules(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue