diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-20 13:38:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-20 13:38:31 -0500 |
commit | 14aeccc33ab44d706df86fbce67339218efe710c (patch) | |
tree | 623b24534550a56755d440d48f5a89cff6171ded /components/script/dom | |
parent | 46db988b906fbec0286fa07387bb34e76a5b3a94 (diff) | |
parent | 0b67b218d0c8dc48a5301227802296aff98af6d7 (diff) | |
download | servo-14aeccc33ab44d706df86fbce67339218efe710c.tar.gz servo-14aeccc33ab44d706df86fbce67339218efe710c.zip |
Auto merge of #12392 - emilio:test-animations, r=SimonSapin
style: Add support to test animations programatically.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #12120
<!-- Either: -->
- [x] There are tests for these changes OR
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
r? @SimonSapin for the style changes, @Ms2ger or @jdm for the dom and test changes
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12392)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/testbinding.rs | 4 | ||||
-rw-r--r-- | components/script/dom/webidls/TestBinding.webidl | 2 | ||||
-rw-r--r-- | components/script/dom/window.rs | 6 |
3 files changed, 12 insertions, 0 deletions
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 64fb6fb7578..8ee6dfe8025 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -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") } } diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl index 355141a4d92..48e647ee7bc 100644 --- a/components/script/dom/webidls/TestBinding.webidl +++ b/components/script/dom/webidls/TestBinding.webidl @@ -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; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 4878f33f994..07509a92e4a 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -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 |