mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
style: Introduce a generic way of gathering information from the cascade, and use it for viewport units.
This commit is contained in:
parent
40c04b4c6b
commit
9e88a495c8
12 changed files with 205 additions and 23 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue