mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Expand animation test mode to support not force-ticking layout.
This commit is contained in:
parent
805988e839
commit
0e3d4ab407
5 changed files with 16 additions and 12 deletions
|
@ -674,8 +674,8 @@ impl LayoutThread {
|
||||||
let _rw_data = possibly_locked_rw_data.lock();
|
let _rw_data = possibly_locked_rw_data.lock();
|
||||||
sender.send(self.epoch).unwrap();
|
sender.send(self.epoch).unwrap();
|
||||||
},
|
},
|
||||||
Msg::AdvanceClockMs(how_many) => {
|
Msg::AdvanceClockMs(how_many, do_tick) => {
|
||||||
self.handle_advance_clock_ms(how_many, possibly_locked_rw_data);
|
self.handle_advance_clock_ms(how_many, possibly_locked_rw_data, do_tick);
|
||||||
}
|
}
|
||||||
Msg::GetWebFontLoadState(sender) => {
|
Msg::GetWebFontLoadState(sender) => {
|
||||||
let _rw_data = possibly_locked_rw_data.lock();
|
let _rw_data = possibly_locked_rw_data.lock();
|
||||||
|
@ -822,9 +822,12 @@ impl LayoutThread {
|
||||||
/// Advances the animation clock of the document.
|
/// Advances the animation clock of the document.
|
||||||
fn handle_advance_clock_ms<'a, 'b>(&mut self,
|
fn handle_advance_clock_ms<'a, 'b>(&mut self,
|
||||||
how_many_ms: i32,
|
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.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.
|
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
|
||||||
|
|
|
@ -613,8 +613,8 @@ impl TestBindingMethods for TestBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn AdvanceClock(&self, ms: i32) {
|
fn AdvanceClock(&self, ms: i32, tick: bool) {
|
||||||
self.global().r().as_window().advance_animation_clock(ms);
|
self.global().r().as_window().advance_animation_clock(ms, tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Panic(&self) { panic!("explicit panic from script") }
|
fn Panic(&self) { panic!("explicit panic from script") }
|
||||||
|
|
|
@ -439,7 +439,7 @@ interface TestBinding {
|
||||||
[Pref="dom.testbinding.prefcontrolled.enabled"]
|
[Pref="dom.testbinding.prefcontrolled.enabled"]
|
||||||
const unsigned short prefControlledConstDisabled = 0;
|
const unsigned short prefControlledConstDisabled = 0;
|
||||||
[Pref="layout.animations.test.enabled"]
|
[Pref="layout.animations.test.enabled"]
|
||||||
void advanceClock(long millis);
|
void advanceClock(long millis, optional boolean forceLayoutTick = true);
|
||||||
|
|
||||||
[Pref="dom.testbinding.prefcontrolled2.enabled"]
|
[Pref="dom.testbinding.prefcontrolled2.enabled"]
|
||||||
readonly attribute boolean prefControlledAttributeEnabled;
|
readonly attribute boolean prefControlledAttributeEnabled;
|
||||||
|
|
|
@ -1074,9 +1074,9 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Advances the layout animation clock by `delta` milliseconds, and then
|
/// Advances the layout animation clock by `delta` milliseconds, and then
|
||||||
/// forces a reflow.
|
/// forces a reflow if `tick` is true.
|
||||||
pub fn advance_animation_clock(&self, delta: i32) {
|
pub fn advance_animation_clock(&self, delta: i32, tick: bool) {
|
||||||
self.layout_chan.send(Msg::AdvanceClockMs(delta)).unwrap();
|
self.layout_chan.send(Msg::AdvanceClockMs(delta, tick)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reflows the page unconditionally if possible and not suppressed. This
|
/// Reflows the page unconditionally if possible and not suppressed. This
|
||||||
|
|
|
@ -42,8 +42,9 @@ pub enum Msg {
|
||||||
|
|
||||||
/// Updates layout's timer for animation testing from script.
|
/// Updates layout's timer for animation testing from script.
|
||||||
///
|
///
|
||||||
/// The inner field is the number of *milliseconds* to advance.
|
/// The inner field is the number of *milliseconds* to advance, and the bool
|
||||||
AdvanceClockMs(i32),
|
/// field is whether animations should be force-ticked.
|
||||||
|
AdvanceClockMs(i32, bool),
|
||||||
|
|
||||||
/// Requests that the layout thread reflow with a newly-loaded Web font.
|
/// Requests that the layout thread reflow with a newly-loaded Web font.
|
||||||
ReflowWithNewlyLoadedWebFont,
|
ReflowWithNewlyLoadedWebFont,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue