style: More useful logging for transition-related stuff.

Transitions are still broken, but I found these messages more helpful than the
previous ones when diagnosing problems.
This commit is contained in:
Emilio Cobos Álvarez 2018-05-06 18:45:16 +02:00
parent a949e9e1e8
commit 561e9c81f1
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 32 additions and 32 deletions

View file

@ -89,6 +89,8 @@ pub fn update_animation_state<E>(
},
};
debug!("update_animation_state({:?}): {:?}", still_running, running_animation);
if still_running {
animations_still_running.push(running_animation);
continue;

View file

@ -438,9 +438,16 @@ pub fn start_transitions_if_applicable(
.iter()
.any(|animation| animation.has_the_same_end_value_as(&property_animation))
{
debug!(
"Not initiating transition for {}, other transition \
found with the same end value",
property_animation.property_name()
);
continue;
}
debug!("Kicking off transition of {:?}", property_animation);
// Kick off the animation.
let box_style = new_style.get_box();
let now = timer.seconds();
@ -451,7 +458,7 @@ pub fn start_transitions_if_applicable(
start_time,
AnimationFrame {
duration: box_style.transition_duration_mod(i).seconds() as f64,
property_animation: property_animation,
property_animation,
},
)).unwrap();
@ -657,12 +664,11 @@ pub fn update_style_for_animation<E>(
where
E: TElement,
{
debug!("update_style_for_animation: entering");
debug!("update_style_for_animation: {:?}", animation);
debug_assert!(!animation.is_expired());
match *animation {
Animation::Transition(_, start_time, ref frame) => {
debug!("update_style_for_animation: transition found");
let now = context.timer.seconds();
let mut new_style = (*style).clone();
let updated_style =
@ -678,10 +684,6 @@ where
AnimationUpdate::Regular
},
Animation::Keyframes(_, ref animation, ref name, ref state) => {
debug!(
"update_style_for_animation: animation found: \"{}\", {:?}",
name, state
);
let duration = state.duration;
let started_at = state.started_at;
@ -716,11 +718,6 @@ where
total_progress = 1.;
}
debug!(
"update_style_for_animation: anim \"{}\", steps: {:?}, state: {:?}, progress: {}",
name, animation.steps, state, total_progress
);
// Get the target and the last keyframe position.
let last_keyframe_position;
let target_keyframe_position;
@ -865,6 +862,7 @@ pub fn complete_expired_transitions(
had_animations_to_expire = animations_to_expire.is_some();
if let Some(ref animations) = animations_to_expire {
for animation in *animations {
debug!("Updating expired animation {:?}", animation);
// TODO: support animation-fill-mode
if let Animation::Transition(_, _, ref frame) = *animation {
frame.property_animation.update(Arc::make_mut(style), 1.0);

View file

@ -602,17 +602,8 @@ trait PrivateMatchMethods: TElement {
let mut all_running_animations = context.running_animations.write();
for mut running_animation in all_running_animations.get_mut(&this_opaque).unwrap() {
// This shouldn't happen frequently, but under some circumstances
// mainly huge load or debug builds, the constellation might be
// delayed in sending the `TickAllAnimations` message to layout.
//
// Thus, we can't assume all the animations have been already
// updated by layout, because other restyle due to script might be
// triggered by layout before the animation tick.
//
// See #12171 and the associated PR for an example where this
// happened while debugging other release panic.
if running_animation.is_expired() {
if let Animation::Transition(_, _, ref frame) = *running_animation {
possibly_expired_animations.push(frame.property_animation.clone());
continue;
}
@ -624,9 +615,7 @@ trait PrivateMatchMethods: TElement {
);
match *running_animation {
Animation::Transition(_, _, ref frame) => {
possibly_expired_animations.push(frame.property_animation.clone())
}
Animation::Transition(..) => unreachable!(),
Animation::Keyframes(_, _, _, ref mut state) => {
match update {
AnimationUpdate::Regular => {},

View file

@ -127,17 +127,22 @@ pub enum AnimatedProperty {
}
impl AnimatedProperty {
/// Get the name of this property.
pub fn name(&self) -> &'static str {
/// Get the id of the property we're animating.
pub fn id(&self) -> LonghandId {
match *self {
% for prop in data.longhands:
% if prop.animatable and not prop.logical:
AnimatedProperty::${prop.camel_case}(..) => "${prop.name}",
AnimatedProperty::${prop.camel_case}(..) => LonghandId::${prop.camel_case},
% endif
% endfor
}
}
/// Get the name of this property.
pub fn name(&self) -> &'static str {
self.id().name()
}
/// Whether this interpolation does animate, that is, whether the start and
/// end values are different.
pub fn does_animate(&self) -> bool {

View file

@ -1,6 +1,6 @@
[font-style-interpolation.html]
bug: https://github.com/servo/servo/issues/21570
expected: TIMEOUT
[font-style animation]
[font-style transition]
expected: TIMEOUT

View file

@ -0,0 +1,3 @@
[variable-transitions-transition-property-all-before-value.html]
[Verify substituted color value after transition]
expected: FAIL

View file

@ -0,0 +1,3 @@
[variable-transitions-value-before-transition-property-all.html]
[Verify substituted color value after transition]
expected: FAIL