diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-08-07 22:52:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-07 22:52:32 -0500 |
commit | 0b9832119e9d42bc3ba4d8e4a4e573a03705de3e (patch) | |
tree | 632e321030eecb9795c64a60db5a516d2ca8bdb4 /components/script | |
parent | fab2ab8b9e2c7f7a200f11a2b0ead259beac97df (diff) | |
parent | a3d1457809f76355764a43f6f36f10ddd9ff0948 (diff) | |
download | servo-0b9832119e9d42bc3ba4d8e4a4e573a03705de3e.tar.gz servo-0b9832119e9d42bc3ba4d8e4a4e573a03705de3e.zip |
Auto merge of #12751 - emilio:transitions-raf, r=pcwalton
compositor: Send animation ticks to layout even if there are script animation frames.
<!-- 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 #12749 (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
The script tick ends up only processing JS callbacks related to animation
frames, so CSS transitions/animations end up not working as expected.
This could have accidentally worked before #12563 because we over-restyled, but
now this is no longer the case.
Other possible way to do it is making a layout reflow with RAF handle CSS
animations/transitions too, but that may not work if the reflow ends up being
suppressed (that could very well be the case), and we'd need to handle a lot
more state in the document, so this solution (assuming it doesn't break try)
seems a bit less flacky.
Missing a test, will add one soon. Fixes #12749.
<!-- 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/12751)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-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, 6 insertions, 6 deletions
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 |