aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2015-10-09 21:38:24 -0700
committerBobby Holley <bobbyholley@gmail.com>2015-10-27 12:48:48 -0700
commit069c40f788ef69ee5523c1f88c898c849080c594 (patch)
tree13f211661cbb5a12905e13c781a09c6c2b02dbf4 /components/script/dom/window.rs
parent441c84d75d412d24281b67821662ee50e8b1152b (diff)
downloadservo-069c40f788ef69ee5523c1f88c898c849080c594.tar.gz
servo-069c40f788ef69ee5523c1f88c898c849080c594.zip
Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of avoiding dirtying in the case where an event state is toggled an even number of times between reflows. The main benefit here though is that it sets us up to be smarter about what we mark as dirty using restyle hints.
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 761ede6edf8..abe693696fd 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -957,16 +957,8 @@ impl Window {
///
/// TODO(pcwalton): Only wait for style recalc, since we have off-main-thread layout.
pub fn reflow(&self, goal: ReflowGoal, query_type: ReflowQueryType, reason: ReflowReason) {
- let document = self.Document();
- let root = document.r().GetDocumentElement();
- let root = match root.r() {
- Some(root) => root,
- None => return,
- };
-
- let root = root.upcast::<Node>();
- if query_type == ReflowQueryType::NoQuery && !root.get_has_dirty_descendants() {
- debug!("root has no dirty descendants; avoiding reflow (reason {:?})", reason);
+ if query_type == ReflowQueryType::NoQuery && !self.Document().needs_reflow() {
+ debug!("Document doesn't need reflow - skipping it (reason {:?})", reason);
return
}