style: Add a new Timer structure to the shared style context, and basic infrastructure for controlling animations.

This commit is contained in:
Emilio Cobos Álvarez 2016-07-09 22:43:52 -07:00
parent 2e68821014
commit 0b67b218d0
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
20 changed files with 178 additions and 26 deletions

View file

@ -581,6 +581,10 @@ impl TestBindingMethods for TestBinding {
}
}
fn AdvanceClock(&self, ms: i32) {
self.global().r().as_window().advance_animation_clock(ms);
}
fn Panic(&self) { panic!("explicit panic from script") }
}

View file

@ -424,6 +424,8 @@ interface TestBinding {
static void prefControlledStaticMethodDisabled();
[Pref="dom.testbinding.prefcontrolled.enabled"]
const unsigned short prefControlledConstDisabled = 0;
[Pref="layout.animations.test.enabled"]
void advanceClock(long millis);
[Pref="dom.testbinding.prefcontrolled2.enabled"]
readonly attribute boolean prefControlledAttributeEnabled;

View file

@ -1030,6 +1030,12 @@ impl Window {
recv.recv().unwrap_or((Size2D::zero(), Point2D::zero()))
}
/// 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();
}
/// Reflows the page unconditionally if possible and not suppressed. This
/// method will wait for the layout thread to complete (but see the `TODO`
/// below). If there is no window size yet, the page is presumed invisible