Skip to content

Commit 91ee7b1

Browse files
committed
servo: Merge #17778 - stylo: Don't ignore visited state when deciding to share style contexts (from Manishearth:stylo-visited-fix); r=bz
r=bz https://bugzilla.mozilla.org/show_bug.cgi?id=1381635 Source-Repo: https://github.com/servo/servo Source-Revision: 38e808645292a1e4e9264937b979137b194c2196
1 parent ea9c408 commit 91ee7b1

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

servo/components/style/sharing/checks.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use Atom;
1010
use bloom::StyleBloom;
1111
use context::{SelectorFlagsMap, SharedStyleContext};
1212
use dom::TElement;
13-
use element_state::*;
1413
use sharing::{StyleSharingCandidate, StyleSharingTarget};
1514
use stylearc::Arc;
1615

@@ -68,20 +67,6 @@ pub fn have_same_class<E>(target: &mut StyleSharingTarget<E>,
6867
target.class_list() == candidate.class_list()
6968
}
7069

71-
/// Compare element and candidate state, but ignore visitedness. Styles don't
72-
/// actually changed based on visitedness (since both possibilities are computed
73-
/// up front), so it's safe to share styles if visitedness differs.
74-
pub fn have_same_state_ignoring_visitedness<E>(element: E,
75-
candidate: &StyleSharingCandidate<E>)
76-
-> bool
77-
where E: TElement,
78-
{
79-
let state_mask = !IN_VISITED_OR_UNVISITED_STATE;
80-
let state = element.get_state() & state_mask;
81-
let candidate_state = candidate.element.get_state() & state_mask;
82-
state == candidate_state
83-
}
84-
8570
/// Whether a given element and a candidate match the same set of "revalidation"
8671
/// selectors.
8772
///

servo/components/style/sharing/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,10 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
643643
miss!(UserAndAuthorRules)
644644
}
645645

646-
if !checks::have_same_state_ignoring_visitedness(target.element, candidate) {
646+
// We do not ignore visited state here, because Gecko
647+
// needs to store extra bits on visited style contexts,
648+
// so these contexts cannot be shared
649+
if target.element.get_state() != candidate.get_state() {
647650
miss!(State)
648651
}
649652

0 commit comments

Comments
 (0)