style: Introduce a generic way of gathering information from the cascade, and use it for viewport units.

This commit is contained in:
Emilio Cobos Álvarez 2016-08-12 16:30:35 -07:00
parent 40c04b4c6b
commit 9e88a495c8
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
12 changed files with 205 additions and 23 deletions

View file

@ -9,6 +9,7 @@
use animation;
use arc_ptr_eq;
use cache::{LRUCache, SimpleHashCache};
use cascade_info::CascadeInfo;
use context::{StyleContext, SharedStyleContext};
use data::PrivateStyleData;
use dom::{TElement, TNode, TRestyleDamage};
@ -443,6 +444,7 @@ trait PrivateMatchMethods: TNode {
&mut old_style) && cacheable;
}
let mut cascade_info = CascadeInfo::new();
let (this_style, is_cacheable) = match parent_style {
Some(ref parent_style) => {
let cache_entry = applicable_declarations_cache.find(applicable_declarations);
@ -456,6 +458,7 @@ trait PrivateMatchMethods: TNode {
shareable,
Some(&***parent_style),
cached_computed_values,
Some(&mut cascade_info),
shared_context.error_reporter.clone())
}
None => {
@ -464,9 +467,11 @@ trait PrivateMatchMethods: TNode {
shareable,
None,
None,
Some(&mut cascade_info),
shared_context.error_reporter.clone())
}
};
cascade_info.finish(self);
cacheable = cacheable && is_cacheable;
@ -497,7 +502,6 @@ trait PrivateMatchMethods: TNode {
cacheable = cacheable && !animations_started
}
// Cache the resolved style if it was cacheable.
if cacheable {
applicable_declarations_cache.insert(applicable_declarations.to_vec(),