layout: Cache applicable-declarations-to-computed-values mappings.

If the cache is hit, then we can only compute inherited properties. This
is a WebKit optimization.
This commit is contained in:
Patrick Walton 2014-02-07 18:10:17 -08:00
parent 1678cc9a88
commit 0fa0940ce9
8 changed files with 453 additions and 78 deletions

View file

@ -5,7 +5,7 @@
//! The layout task. Performs layout on the DOM, builds display lists and sends them to be
/// rendered.
use css::matching::{ApplicableDeclarations, MatchMethods};
use css::matching::{ApplicableDeclarations, ApplicableDeclarationsCache, MatchMethods};
use css::select::new_stylist;
use css::node_style::StyledNode;
use layout::construct::{FlowConstructionResult, FlowConstructor, NoConstructionResult};
@ -568,10 +568,13 @@ impl LayoutTask {
match self.parallel_traversal {
None => {
let mut applicable_declarations = ApplicableDeclarations::new();
let mut applicable_declarations_cache =
ApplicableDeclarationsCache::new();
node.match_and_cascade_subtree(self.stylist,
&layout_ctx.layout_chan,
&mut applicable_declarations,
layout_ctx.initial_css_values.get(),
&mut applicable_declarations_cache,
None)
}
Some(ref mut traversal) => {