mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Make the transitions code make sense again.
This commit is contained in:
parent
d44bd82703
commit
d6092fae27
2 changed files with 11 additions and 13 deletions
|
@ -357,8 +357,8 @@ impl PropertyAnimation {
|
||||||
|
|
||||||
let property_animation = PropertyAnimation {
|
let property_animation = PropertyAnimation {
|
||||||
property: animated_property,
|
property: animated_property,
|
||||||
timing_function: timing_function,
|
timing_function,
|
||||||
duration: duration,
|
duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
if property_animation.does_animate() {
|
if property_animation.does_animate() {
|
||||||
|
|
|
@ -331,7 +331,7 @@ trait PrivateMatchMethods: TElement {
|
||||||
fn process_animations(
|
fn process_animations(
|
||||||
&self,
|
&self,
|
||||||
context: &mut StyleContext<Self>,
|
context: &mut StyleContext<Self>,
|
||||||
old_values: &mut Option<Arc<ComputedValues>>,
|
old_values: Option<&Arc<ComputedValues>>,
|
||||||
new_values: &mut Arc<ComputedValues>,
|
new_values: &mut Arc<ComputedValues>,
|
||||||
restyle_hint: RestyleHint,
|
restyle_hint: RestyleHint,
|
||||||
important_rules_changed: bool,
|
important_rules_changed: bool,
|
||||||
|
@ -413,7 +413,7 @@ trait PrivateMatchMethods: TElement {
|
||||||
fn process_animations(
|
fn process_animations(
|
||||||
&self,
|
&self,
|
||||||
context: &mut StyleContext<Self>,
|
context: &mut StyleContext<Self>,
|
||||||
old_values: &mut Option<Arc<ComputedValues>>,
|
old_values: Option<&Arc<ComputedValues>>,
|
||||||
new_values: &mut Arc<ComputedValues>,
|
new_values: &mut Arc<ComputedValues>,
|
||||||
_restyle_hint: RestyleHint,
|
_restyle_hint: RestyleHint,
|
||||||
_important_rules_changed: bool,
|
_important_rules_changed: bool,
|
||||||
|
@ -423,11 +423,10 @@ trait PrivateMatchMethods: TElement {
|
||||||
|
|
||||||
let mut possibly_expired_animations = vec![];
|
let mut possibly_expired_animations = vec![];
|
||||||
let shared_context = context.shared;
|
let shared_context = context.shared;
|
||||||
if let Some(ref mut old) = *old_values {
|
if old_values.is_some() {
|
||||||
// FIXME(emilio, #20116): This makes no sense.
|
|
||||||
self.update_animations_for_cascade(
|
self.update_animations_for_cascade(
|
||||||
shared_context,
|
shared_context,
|
||||||
old,
|
new_values,
|
||||||
&mut possibly_expired_animations,
|
&mut possibly_expired_animations,
|
||||||
&context.thread_local.font_metrics_provider,
|
&context.thread_local.font_metrics_provider,
|
||||||
);
|
);
|
||||||
|
@ -446,7 +445,10 @@ trait PrivateMatchMethods: TElement {
|
||||||
|
|
||||||
// Trigger transitions if necessary. This will reset `new_values` back
|
// Trigger transitions if necessary. This will reset `new_values` back
|
||||||
// to its old value if it did trigger a transition.
|
// to its old value if it did trigger a transition.
|
||||||
if let Some(ref values) = *old_values {
|
//
|
||||||
|
// FIXME(emilio): We need logic to also stop the old transitions
|
||||||
|
// from running if transition-property / transition-duration changed.
|
||||||
|
if let Some(ref values) = old_values {
|
||||||
animation::start_transitions_if_applicable(
|
animation::start_transitions_if_applicable(
|
||||||
new_animations_sender,
|
new_animations_sender,
|
||||||
this_opaque,
|
this_opaque,
|
||||||
|
@ -573,10 +575,6 @@ trait PrivateMatchMethods: TElement {
|
||||||
|
|
||||||
// FIXME(emilio, #20116): It's not clear to me that the name of this method
|
// FIXME(emilio, #20116): It's not clear to me that the name of this method
|
||||||
// represents anything of what it does.
|
// represents anything of what it does.
|
||||||
//
|
|
||||||
// Also, this function gets the old style, for some reason I don't really
|
|
||||||
// get, but the functions called (mainly update_style_for_animation) expects
|
|
||||||
// the new style, wtf?
|
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
fn update_animations_for_cascade(
|
fn update_animations_for_cascade(
|
||||||
&self,
|
&self,
|
||||||
|
@ -680,7 +678,7 @@ pub trait MatchMethods: TElement {
|
||||||
|
|
||||||
self.process_animations(
|
self.process_animations(
|
||||||
context,
|
context,
|
||||||
&mut data.styles.primary,
|
data.styles.primary.as_ref(),
|
||||||
&mut new_styles.primary.style.0,
|
&mut new_styles.primary.style.0,
|
||||||
data.hint,
|
data.hint,
|
||||||
important_rules_changed,
|
important_rules_changed,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue