diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-12-17 09:29:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-17 08:29:33 +0000 |
commit | 6cddb88f6446a3de8437137891f9046fc00d7b26 (patch) | |
tree | a45f553fb9c0da6beb5991ccc60435e37ef99b5d /components | |
parent | b7e528d2ff8bd8d50278f81cf5b8bdce370115ec (diff) | |
download | servo-6cddb88f6446a3de8437137891f9046fc00d7b26.tar.gz servo-6cddb88f6446a3de8437137891f9046fc00d7b26.zip |
script: Fix assertion verifying that reflow isn't necessary after reflow (#34645)
A reflow might still be necessary if it's necessary for display and the
reflow itself wasn't for display. After this happens a display becomes
necessary and the page is still dirty for layout purposes.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/window.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 4b8da19b50d..6547b1f424b 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -2023,23 +2023,22 @@ impl Window { let mut issued_reflow = false; let condition = self.Document().needs_reflow(); let updating_the_rendering = reflow_goal == ReflowGoal::UpdateTheRendering; + let for_display = reflow_goal.needs_display(); if !updating_the_rendering || condition.is_some() { debug!("Reflowing document ({:?})", self.pipeline_id()); issued_reflow = self.force_reflow(reflow_goal, condition); - // We shouldn't need a reflow immediately after a - // reflow, except if we're waiting for a deferred paint. - let condition = self.Document().needs_reflow(); - assert!( - { - condition.is_none() || - (!updating_the_rendering && - condition == Some(ReflowTriggerCondition::PaintPostponed)) || - self.layout_blocker.get().layout_blocked() - }, - "condition was {:?}", - condition - ); + // We shouldn't need a reflow immediately after a completed reflow, unless the reflow didn't + // display anything and it wasn't for display. Queries can cause this to happen. + if issued_reflow { + let condition = self.Document().needs_reflow(); + let display_is_pending = condition == Some(ReflowTriggerCondition::PaintPostponed); + assert!( + condition.is_none() || (display_is_pending && !for_display), + "Needed reflow after reflow: {:?}", + condition + ); + } } else { debug!( "Document ({:?}) doesn't need reflow - skipping it (goal {reflow_goal:?})", |