From baf6fc16c7e51b1a3fe65c214ba242459fa22eb0 Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Mon, 9 Oct 2017 06:51:47 -0500 Subject: [PATCH] servo: Merge #18788 - Use defualt Debug trait for AnimationValue (from BorisChiou:style/animation_value/debug); r=emilio We use AnimationValue for animation backend to do interpolation, accumulation, or computing distance. While debugging it, dumping the property name is not enough. We need to dump the detailed value contained in it. For example: if we animate ```translate(100px)``` to ```translate(200px)```, and want to dump ```{:?} => {:?}```, the result is ```transform => transform```. I think what we want is something like: ```Transform([Translate(100px, 0px, 0px)]) => Transform([Translate(200px, 0px, 0px)])```. Using default Debug trait is not perfect because there are some redundant type strings, but it is still better than nothing. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [x] These changes are related to PR #18415. - [X] These changes do not require tests because this is debug only. Source-Repo: https://github.com/servo/servo Source-Revision: 64aadee62c1e0f100ad79ab50a56cd1f84285eeb --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 4418d524a31dd01cc7c36fe7254ea3b05e736494 --- .../style/properties/helpers/animated_properties.mako.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/servo/components/style/properties/helpers/animated_properties.mako.rs b/servo/components/style/properties/helpers/animated_properties.mako.rs index c3a272239ed3..5bf10a8b3dc1 100644 --- a/servo/components/style/properties/helpers/animated_properties.mako.rs +++ b/servo/components/style/properties/helpers/animated_properties.mako.rs @@ -337,7 +337,7 @@ unsafe impl HasSimpleFFI for AnimationValueMap {} /// /// FIXME: We need to add a path for custom properties, but that's trivial after /// this (is a similar path to that of PropertyDeclaration). -#[derive(Clone, PartialEq)] +#[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum AnimationValue { % for prop in data.longhands: @@ -352,12 +352,6 @@ pub enum AnimationValue { % endfor } -impl fmt::Debug for AnimationValue { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str(self.id().name()) - } -} - impl AnimationValue { /// Returns the longhand id this animated value corresponds to. pub fn id(&self) -> LonghandId {