aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/layout_thread.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2016-03-21 09:52:12 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2016-03-21 10:05:17 -0700
commit37636e8377a8f493e5cd4002ac49af7d277d89f5 (patch)
tree9f37ed593b8bc5ebaaace73536cf1d5dfb029ec9 /components/layout/layout_thread.rs
parente95368df6297e664122da8ae15f25724be557353 (diff)
downloadservo-37636e8377a8f493e5cd4002ac49af7d277d89f5.tar.gz
servo-37636e8377a8f493e5cd4002ac49af7d277d89f5.zip
Don't re-add stylesheets to recompute vw/vh lengths
This is a follow-up to #9876. It avoids clearing and rebuilding SelectorMaps when vh and vw units need to be recomputed. Instead it just dirties all nodes, to force elements to be re-cascaded. Filed #10104 for later follow-up work to dirty only affected nodes.
Diffstat (limited to 'components/layout/layout_thread.rs')
-rw-r--r--components/layout/layout_thread.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs
index 187655f92b0..e0b0ac20e82 100644
--- a/components/layout/layout_thread.rs
+++ b/components/layout/layout_thread.rs
@@ -1040,6 +1040,8 @@ impl LayoutThread {
};
// Handle conditions where the entire flow tree is invalid.
+ let mut needs_dirtying = false;
+
let viewport_size_changed = self.viewport_size != old_viewport_size;
if viewport_size_changed {
if let Some(constraints) = constraints {
@@ -1048,11 +1050,15 @@ impl LayoutThread {
constellation_chan.send(ConstellationMsg::ViewportConstrained(
self.id, constraints)).unwrap();
}
+ // FIXME (#10104): Only dirty nodes affected by vh/vw/vmin/vmax styles.
+ if data.document_stylesheets.iter().any(|sheet| sheet.dirty_on_viewport_size_change) {
+ needs_dirtying = true;
+ }
}
// If the entire flow tree is invalid, then it will be reflowed anyhow.
- let needs_dirtying = rw_data.stylist.update(&data.document_stylesheets,
- data.stylesheets_changed);
+ needs_dirtying |= rw_data.stylist.update(&data.document_stylesheets,
+ data.stylesheets_changed);
let needs_reflow = viewport_size_changed && !needs_dirtying;
unsafe {
if needs_dirtying {