diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 403f30a96f5..958a2acc71e 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -674,8 +674,8 @@ impl LayoutThread { let _rw_data = possibly_locked_rw_data.lock(); sender.send(self.epoch).unwrap(); }, - Msg::AdvanceClockMs(how_many) => { - self.handle_advance_clock_ms(how_many, possibly_locked_rw_data); + Msg::AdvanceClockMs(how_many, do_tick) => { + self.handle_advance_clock_ms(how_many, possibly_locked_rw_data, do_tick); } Msg::GetWebFontLoadState(sender) => { let _rw_data = possibly_locked_rw_data.lock(); @@ -822,9 +822,12 @@ impl LayoutThread { /// Advances the animation clock of the document. fn handle_advance_clock_ms<'a, 'b>(&mut self, how_many_ms: i32, - possibly_locked_rw_data: &mut RwData<'a, 'b>) { + possibly_locked_rw_data: &mut RwData<'a, 'b>, + tick_animations: bool) { self.timer.increment(how_many_ms as f64 / 1000.0); - self.tick_all_animations(possibly_locked_rw_data); + if tick_animations { + self.tick_all_animations(possibly_locked_rw_data); + } } /// Sets quirks mode for the document, causing the quirks mode stylesheet to be used. diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 13579d71330..372055483c7 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -613,8 +613,8 @@ impl TestBindingMethods for TestBinding { } } - fn AdvanceClock(&self, ms: i32) { - self.global().r().as_window().advance_animation_clock(ms); + fn AdvanceClock(&self, ms: i32, tick: bool) { + self.global().r().as_window().advance_animation_clock(ms, tick); } fn Panic(&self) { panic!("explicit panic from script") } diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl index 9fc8a9e3bb6..9945f983ad7 100644 --- a/components/script/dom/webidls/TestBinding.webidl +++ b/components/script/dom/webidls/TestBinding.webidl @@ -439,7 +439,7 @@ interface TestBinding { [Pref="dom.testbinding.prefcontrolled.enabled"] const unsigned short prefControlledConstDisabled = 0; [Pref="layout.animations.test.enabled"] - void advanceClock(long millis); + void advanceClock(long millis, optional boolean forceLayoutTick = true); [Pref="dom.testbinding.prefcontrolled2.enabled"] readonly attribute boolean prefControlledAttributeEnabled; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index c25c826b4ec..8aaa0adcde3 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1074,9 +1074,9 @@ impl Window { } /// Advances the layout animation clock by `delta` milliseconds, and then - /// forces a reflow. - pub fn advance_animation_clock(&self, delta: i32) { - self.layout_chan.send(Msg::AdvanceClockMs(delta)).unwrap(); + /// forces a reflow if `tick` is true. + pub fn advance_animation_clock(&self, delta: i32, tick: bool) { + self.layout_chan.send(Msg::AdvanceClockMs(delta, tick)).unwrap(); } /// Reflows the page unconditionally if possible and not suppressed. This diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index b46703e778e..14580be4881 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -42,8 +42,9 @@ pub enum Msg { /// Updates layout's timer for animation testing from script. /// - /// The inner field is the number of *milliseconds* to advance. - AdvanceClockMs(i32), + /// The inner field is the number of *milliseconds* to advance, and the bool + /// field is whether animations should be force-ticked. + AdvanceClockMs(i32, bool), /// Requests that the layout thread reflow with a newly-loaded Web font. ReflowWithNewlyLoadedWebFont,