mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
script: reset spurious frame counter *only* when reflow is triggered (#35435)
I had applied a review suggestion in the previous PR to combine the nested conditions, but this is wrong as this meant the spurious frame callback was getting reset not just when the reflow was triggered by the callback, but also each time the counter reached the threshold. The test added in the previous PR also had issues with the upstream WPT repo's lint checks - `test.step_timeout` should be used instead of the `setTimeout` function. This patch fixes the counter update logic and also addresses the linting issue caught by upstream's linter. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
695e5fe5f1
commit
b7b8619e87
3 changed files with 27 additions and 26 deletions
|
@ -2403,9 +2403,10 @@ impl Document {
|
|||
|
||||
// Update the counter of spurious animation frames.
|
||||
let spurious_frames = self.spurious_animation_frames.get();
|
||||
if callbacks_did_not_trigger_reflow && spurious_frames < SPURIOUS_ANIMATION_FRAME_THRESHOLD
|
||||
{
|
||||
self.spurious_animation_frames.set(spurious_frames + 1);
|
||||
if callbacks_did_not_trigger_reflow {
|
||||
if spurious_frames < SPURIOUS_ANIMATION_FRAME_THRESHOLD {
|
||||
self.spurious_animation_frames.set(spurious_frames + 1);
|
||||
}
|
||||
} else {
|
||||
self.spurious_animation_frames.set(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue