mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Do a better job of detecting where there are transitions.
The current code thinks that every element has transitions.
This commit is contained in:
parent
cceaf7c619
commit
fbdfbb1dfa
3 changed files with 20 additions and 1 deletions
|
@ -298,7 +298,7 @@ impl<E: TElement> StyleSharingCandidateCache<E> {
|
|||
}
|
||||
|
||||
let box_style = style.get_box();
|
||||
if box_style.transition_property_count() > 0 {
|
||||
if box_style.specifies_transitions() {
|
||||
debug!("Failing to insert to the cache: transitions");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1890,6 +1890,19 @@ fn static_assert() {
|
|||
self.gecko.mTransitions[0].mProperty = nsCSSPropertyID_eCSSPropertyExtra_no_properties;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether there are any transitions specified.
|
||||
pub fn specifies_transitions(&self) -> bool {
|
||||
use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_all_properties;
|
||||
if self.gecko.mTransitionPropertyCount == 1 &&
|
||||
self.gecko.mTransitions[0].mProperty == eCSSPropertyExtra_all_properties &&
|
||||
self.gecko.mTransitions[0].mDuration.max(0.0) + self.gecko.mTransitions[0].mDelay <= 0.0f32 {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.gecko.mTransitionPropertyCount > 0
|
||||
}
|
||||
|
||||
pub fn transition_property_at(&self, index: usize)
|
||||
-> longhands::transition_property::computed_value::SingleComputedValue {
|
||||
self.gecko.mTransitions[index].mProperty.into()
|
||||
|
|
|
@ -1509,6 +1509,12 @@ pub mod style_structs {
|
|||
pub fn specifies_animations(&self) -> bool {
|
||||
self.animation_name_iter().any(|name| name.0 != atom!(""))
|
||||
}
|
||||
|
||||
/// Returns whether there are any transitions specified.
|
||||
#[cfg(feature = "servo")]
|
||||
pub fn specifies_transitions(&self) -> bool {
|
||||
self.transition_property_count() > 0
|
||||
}
|
||||
% endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue