layout: Don't start the reflow pass unless some node needs to be

reflowed.

Reduces CPU usage when mousing over simple pages.

Part of #9999.
This commit is contained in:
Patrick Walton 2016-03-15 16:18:00 -07:00
parent acfd8e448c
commit 7cb9429a0f

View file

@ -30,7 +30,8 @@ use gfx::font_context;
use gfx::paint_thread::LayoutToPaintMsg; use gfx::paint_thread::LayoutToPaintMsg;
use gfx_traits::{color, Epoch, LayerId, ScrollPolicy}; use gfx_traits::{color, Epoch, LayerId, ScrollPolicy};
use heapsize::HeapSizeOf; use heapsize::HeapSizeOf;
use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REPAINT}; use incremental::{LayoutDamageComputation, REFLOW, REFLOW_ENTIRE_DOCUMENT, REFLOW_OUT_OF_FLOW};
use incremental::{REPAINT};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER; use ipc_channel::router::ROUTER;
use layout_debug; use layout_debug;
@ -1331,6 +1332,7 @@ impl LayoutThread {
// Perform the primary layout passes over the flow tree to compute the locations of all // Perform the primary layout passes over the flow tree to compute the locations of all
// the boxes. // the boxes.
if flow::base(&*root_flow).restyle_damage.intersects(REFLOW | REFLOW_OUT_OF_FLOW) {
profile(time::ProfilerCategory::LayoutMain, profile(time::ProfilerCategory::LayoutMain,
self.profiler_metadata(), self.profiler_metadata(),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
@ -1351,6 +1353,7 @@ impl LayoutThread {
} }
} }
}); });
}
profile(time::ProfilerCategory::LayoutStoreOverflow, profile(time::ProfilerCategory::LayoutStoreOverflow,
self.profiler_metadata(), self.profiler_metadata(),