diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index df7d1f92de7..9ee7fd81160 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1021,7 +1021,11 @@ impl Window { debug!("script: layout joined"); - self.pending_reflow_count.set(0); + // Pending reflows require display, so only reset the pending reflow count if this reflow + // was to be displayed. + if goal == ReflowGoal::ForDisplay { + self.pending_reflow_count.set(0); + } if let Some(marker) = marker { self.emit_timeline_marker(marker.end()); @@ -1104,7 +1108,7 @@ impl Window { pub fn hit_test_query(&self, hit_test_request: Point2D, update_cursor: bool) -> Option { - self.reflow(ReflowGoal::ForDisplay, + self.reflow(ReflowGoal::ForScriptQuery, ReflowQueryType::HitTestQuery(hit_test_request, update_cursor), ReflowReason::Query); self.layout_rpc.hit_test().node_address