diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2016-03-18 15:23:08 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2016-03-25 18:39:16 -0700 |
commit | b29719e36bdf2867b1391bbc3b017675975e27ae (patch) | |
tree | d45bd79776dc8c60df8868627e4c7c73bd8c2f26 /components/layout/layout_thread.rs | |
parent | 9b2ae3a62faafceb3149dc455fc6123de2b306f7 (diff) | |
download | servo-b29719e36bdf2867b1391bbc3b017675975e27ae.tar.gz servo-b29719e36bdf2867b1391bbc3b017675975e27ae.zip |
layout: Rewrite the block formatting context/float inline-size
speculation code.
The old code tried to do the speculation as a single bottom-up pass
after intrinsic inline-size calculation, which was unable to handle
cases like this:
<div>
<div style="float: left">Foo</div>
</div>
<div>
<div style="overflow: hidden">Bar</div>
</div>
No single bottom-up pass could possibly handle this case, because the
inline-size of the float flowing out of the "Foo" block could never make
it down to the "Bar" block, where it is needed for speculation.
On the pages I tried, this regresses layout performance by 1%-2%.
I first noticed this breaking some pages, like the Google SERPs, several
months ago.
Diffstat (limited to 'components/layout/layout_thread.rs')
-rw-r--r-- | components/layout/layout_thread.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs index df555b1d485..e6412348e6c 100644 --- a/components/layout/layout_thread.rs +++ b/components/layout/layout_thread.rs @@ -1345,6 +1345,12 @@ impl LayoutThread { self.time_profiler_chan.clone(), || sequential::resolve_generated_content(&mut root_flow, &layout_context)); + // Guess float placement. + profile(time::ProfilerCategory::LayoutFloatPlacementSpeculation, + self.profiler_metadata(), + self.time_profiler_chan.clone(), + || sequential::guess_float_placement(flow_ref::deref_mut(&mut root_flow))); + // Perform the primary layout passes over the flow tree to compute the locations of all // the boxes. if flow::base(&*root_flow).restyle_damage.intersects(REFLOW | REFLOW_OUT_OF_FLOW) { |