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

@ -7,7 +7,6 @@
#[cfg(feature = "servo")] use animation::Animation;
use animation::PropertyAnimation;
use app_units::Au;
use bit_vec::BitVec;
use bloom::StyleBloom;
use cache::LRUCache;
use data::ElementData;
@ -23,7 +22,7 @@ use selector_parser::SnapshotMap;
use selectors::matching::ElementSelectorFlags;
#[cfg(feature = "servo")] use servo_config::opts;
use shared_lock::StylesheetGuards;
use sharing::StyleSharingCandidateCache;
use sharing::{CachedStyleSharingData, StyleSharingCandidateCache};
#[cfg(feature = "servo")] use std::collections::HashMap;
#[cfg(feature = "gecko")] use std::env;
use std::fmt;
@ -165,9 +164,8 @@ pub struct CurrentElementInfo {
element: OpaqueNode,
/// Whether the element is being styled for the first time.
is_initial_style: bool,
/// Lazy cache of the result of matching the current element against the
/// revalidation selectors.
pub revalidation_match_results: Option<BitVec>,
/// Lazy cache of the different data used for style sharing.
pub cached_style_sharing_data: CachedStyleSharingData,
/// A Vec of possibly expired animations. Used only by Servo.
#[allow(dead_code)]
pub possibly_expired_animations: Vec<PropertyAnimation>,
@ -465,7 +463,7 @@ impl<E: TElement> ThreadLocalStyleContext<E> {
self.current_element_info = Some(CurrentElementInfo {
element: element.as_node().opaque(),
is_initial_style: !data.has_styles(),
revalidation_match_results: None,
cached_style_sharing_data: CachedStyleSharingData::new(),
possibly_expired_animations: Vec::new(),
});
}