style: Lazily tweak the traversal root to account for sibling invalidations.

Bug: 1403078
Reviewed-by: heycam
MozReview-Commit-ID: Ij3nMOKu5FO
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-09-26 07:25:06 +02:00
parent 1282e0d808
commit 07d55a4bf8
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 69 additions and 63 deletions

View file

@ -1268,15 +1268,11 @@ impl LayoutThread {
None
};
// NB: Type inference falls apart here for some reason, so we need to be very verbose. :-(
let traversal = RecalcStyleAndConstructFlows::new(layout_context);
let token = {
let context = <RecalcStyleAndConstructFlows as
DomTraversal<ServoLayoutElement>>::shared_context(&traversal);
<RecalcStyleAndConstructFlows as
DomTraversal<ServoLayoutElement>>::pre_traverse(element,
context,
TraversalFlags::empty())
let shared =
<RecalcStyleAndConstructFlows as DomTraversal<ServoLayoutElement>>::shared_context(&traversal);
RecalcStyleAndConstructFlows::pre_traverse(element, shared)
};
if token.should_traverse() {
@ -1287,7 +1283,10 @@ impl LayoutThread {
|| {
// Perform CSS selector matching and flow construction.
driver::traverse_dom::<ServoLayoutElement, RecalcStyleAndConstructFlows>(
&traversal, element, token, thread_pool);
&traversal,
token,
thread_pool,
);
});
// TODO(pcwalton): Measure energy usage of text shaping, perhaps?
let text_shaping_time =