Auto merge of #16496 - BorisChiou:stylo/transition/trigger, r=heycam

stylo: Bug 1341372 - Detect new transitions and let it run.

These are interdependent patches of Bug 1341372. We let animation-only restyle also work for RESTYLE_CSS_TRANSITIONS, and check if we need to update transitions by each transition property. If it is necessary to create/replace/cancel transitions, we create a SequentialTask for CSS_TRANSITIONS.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix Bug 1341372
- [X] These changes do not require tests because there are tests in Gecko already.

<!-- 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/16496)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-17 05:07:23 -05:00 committed by GitHub
commit 4d8c9c10cb
11 changed files with 461 additions and 70 deletions

View file

@ -44,6 +44,7 @@ use gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull;
use gecko_bindings::bindings::{Gecko_ResetFilters, Gecko_CopyFiltersFrom};
use gecko_bindings::bindings::RawGeckoPresContextBorrowed;
use gecko_bindings::structs::{self, StyleComplexColor};
use gecko_bindings::structs::nsCSSPropertyID;
use gecko_bindings::structs::nsStyleVariables;
use gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
use gecko_bindings::sugar::ownership::HasArcFFI;
@ -1986,6 +1987,11 @@ fn static_assert() {
${impl_transition_time_value('duration', 'Duration')}
${impl_transition_timing_function()}
pub fn transition_combined_duration_at(&self, index: usize) -> f32 {
// https://drafts.csswg.org/css-transitions/#transition-combined-duration
self.gecko.mTransitions[index].mDuration.max(0.0) + self.gecko.mTransitions[index].mDelay
}
pub fn set_transition_property(&mut self, v: longhands::transition_property::computed_value::T) {
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_no_properties;
@ -2019,6 +2025,10 @@ fn static_assert() {
self.gecko.mTransitions[index].mProperty.into()
}
pub fn transition_nscsspropertyid_at(&self, index: usize) -> nsCSSPropertyID {
self.gecko.mTransitions[index].mProperty
}
pub fn copy_transition_property_from(&mut self, other: &Self) {
unsafe { self.gecko.mTransitions.ensure_len(other.gecko.mTransitions.len()) };