mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Bug 1341372 - Part 6: Trigger transitions.
1. We need to call get_after_change_style, which is the computed styles without transition rules, while process_animations. 2. If we have after-change style, we may replace the new computed values with after-change style, according to whether we really need to update transitions. 3. There are some cases we don't update transitions, so we need to early return. might_needs_transitions_update() will check it first and it will filter out most common cases. 4. needs_transitions_update() will check each property and existing running transitions to make sure we really don't need to update transitions. The logic of this function is similar with that of nsTransitionManager::DoUpdateTransitions(). MozReview-Commit-ID: 2ccdPjgrxKz
This commit is contained in:
parent
2399cde504
commit
eb8db7b892
6 changed files with 315 additions and 16 deletions
|
@ -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;
|
||||
|
@ -1985,6 +1986,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;
|
||||
|
||||
|
@ -2018,6 +2024,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()) };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue