style: Also cache the class list in the CurrentElementInfo.

This patch also removes all notion of style sharing from matching.rs, which is
nice.
This commit is contained in:
Emilio Cobos Álvarez 2017-05-29 22:54:17 +02:00
parent abcc9b301c
commit 03952a0c27
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 160 additions and 114 deletions

View file

@ -11,7 +11,7 @@ use dom::{DirtyDescendants, NodeInfo, OpaqueNode, TElement, TNode};
use matching::{ChildCascadeRequirement, MatchMethods};
use restyle_hints::{HintComputationContext, RestyleHint};
use selector_parser::RestyleDamage;
use sharing::StyleSharingBehavior;
use sharing::{StyleSharingBehavior, StyleSharingTarget};
#[cfg(feature = "servo")] use servo_config::opts;
use smallvec::SmallVec;
use std::borrow::BorrowMut;
@ -795,9 +795,9 @@ fn compute_style<E, D>(_traversal: &D,
// First, try the style sharing cache. If we get a match we can skip the rest
// of the work.
if let MatchAndCascade = kind {
let sharing_result = unsafe {
element.share_style_if_possible(context, data)
};
let target = StyleSharingTarget::new(element);
let sharing_result = target.share_style_if_possible(context, data);
if let StyleWasShared(index, had_damage) = sharing_result {
context.thread_local.statistics.styles_shared += 1;
context.thread_local.style_sharing_candidate_cache.touch(index);