Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't re-add stylesheets to recompute vw/vh lengths #10105

Merged
merged 1 commit into from Mar 22, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

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.
  • Loading branch information
mbrubeck committed Mar 21, 2016
commit 37636e8377a8f493e5cd4002ac49af7d277d89f5
@@ -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 {
@@ -226,10 +226,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
device = Device::new(MediaType::Screen, constraints.size);
}

let size_changed = device.viewport_size != self.device.viewport_size;

self.is_device_dirty |= stylesheets.iter().any(|stylesheet| {
(size_changed && stylesheet.dirty_on_viewport_size_change) ||
stylesheet.rules().media().any(|media_rule|
media_rule.evaluate(&self.device) != media_rule.evaluate(&device))
});
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.