mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
stylo: Don't ignore visited state when deciding to share style contexts
This commit is contained in:
parent
eb26194dd1
commit
8d7a368377
2 changed files with 4 additions and 16 deletions
|
@ -10,7 +10,6 @@ use Atom;
|
||||||
use bloom::StyleBloom;
|
use bloom::StyleBloom;
|
||||||
use context::{SelectorFlagsMap, SharedStyleContext};
|
use context::{SelectorFlagsMap, SharedStyleContext};
|
||||||
use dom::TElement;
|
use dom::TElement;
|
||||||
use element_state::*;
|
|
||||||
use sharing::{StyleSharingCandidate, StyleSharingTarget};
|
use sharing::{StyleSharingCandidate, StyleSharingTarget};
|
||||||
use stylearc::Arc;
|
use stylearc::Arc;
|
||||||
|
|
||||||
|
@ -68,20 +67,6 @@ pub fn have_same_class<E>(target: &mut StyleSharingTarget<E>,
|
||||||
target.class_list() == candidate.class_list()
|
target.class_list() == candidate.class_list()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compare element and candidate state, but ignore visitedness. Styles don't
|
|
||||||
/// actually changed based on visitedness (since both possibilities are computed
|
|
||||||
/// up front), so it's safe to share styles if visitedness differs.
|
|
||||||
pub fn have_same_state_ignoring_visitedness<E>(element: E,
|
|
||||||
candidate: &StyleSharingCandidate<E>)
|
|
||||||
-> bool
|
|
||||||
where E: TElement,
|
|
||||||
{
|
|
||||||
let state_mask = !IN_VISITED_OR_UNVISITED_STATE;
|
|
||||||
let state = element.get_state() & state_mask;
|
|
||||||
let candidate_state = candidate.element.get_state() & state_mask;
|
|
||||||
state == candidate_state
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether a given element and a candidate match the same set of "revalidation"
|
/// Whether a given element and a candidate match the same set of "revalidation"
|
||||||
/// selectors.
|
/// selectors.
|
||||||
///
|
///
|
||||||
|
|
|
@ -643,7 +643,10 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
|
||||||
miss!(UserAndAuthorRules)
|
miss!(UserAndAuthorRules)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !checks::have_same_state_ignoring_visitedness(target.element, candidate) {
|
// 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.get_state() != candidate.get_state() {
|
||||||
miss!(State)
|
miss!(State)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue