Bug 91322 - When using TextureMapper, WebKit does not retain final value of opacity in animations, unless it is specified on the last key frame
: When using TextureMapper, WebKit does not retain final value of opacity in an...
Status: RESOLVED FIXED
: WebKit
CSS
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-07-14 04:42 PST by
Modified: 2012-07-30 22:10 PST (History)


Attachments
Patch (6.45 KB, patch)
2012-07-23 16:56 PST, Hanyee Kim
no flags Review Patch | Details | Formatted Diff | Diff
Patch (6.47 KB, patch)
2012-07-23 17:34 PST, Hanyee Kim
no flags Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2012-07-14 04:42:05 PST
I am not sure if this is a bug in the spec, or WebKit, or a bug at all, but IMHO this behavior does not make sense:

Please compare this (http://jsfiddle.net/nX9sG/1/) and this (http://jsfiddle.net/RUk35/) to see what I mean.

In the first one, I have modified animate.css so that the opacity is set to 1 on the final key frame, even though it already gets set to this value in an earlier key frame. This makes the element to which this animation is applied retain the final opacity.

Here's the JS Fiddle code:

<div id="foo">
</div>​


#foo {
    opacity: 0;
    position: absolute;
    width: 100px;
    height: 200px;
    top: 10px;
    left: 10px;
    border: 1px solid black;
}

/*
Animate.css - http://daneden.me/animate
LICENSED UNDER THE  MIT LICENSE (MIT)

Copyright (c) 2012 Dan Eden

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

.animated {
    -webkit-animation-fill-mode: both;
    -moz-animation-fill-mode: both;
    -ms-animation-fill-mode: both;
    -o-animation-fill-mode: both;
    animation-fill-mode: both;
    -webkit-animation-duration: 1s;
    -moz-animation-duration: 1s;
    -ms-animation-duration: 1s;
    -o-animation-duration: 1s;
    animation-duration: 1s;
}

.animated.hinge {
    -webkit-animation-duration: 2s;
    -moz-animation-duration: 2s;
    -ms-animation-duration: 2s;
    -o-animation-duration: 2s;
    animation-duration: 2s;
}

@-webkit-keyframes bounceIn {
    0% {
        opacity: 0;
        -webkit-transform: scale(.3);
    }

    50% {
        opacity: 1;
        -webkit-transform: scale(1.05);
    }

    70% {
        -webkit-transform: scale(.9);
    }

    100% {
        -webkit-transform: scale(1);
    opacity: 1;
    }
}

@-moz-keyframes bounceIn {
    0% {
        opacity: 0;
        -moz-transform: scale(.3);
    }

    50% {
        opacity: 1;
        -moz-transform: scale(1.05);
    }

    70% {
        -moz-transform: scale(.9);
    }

    100% {
        -moz-transform: scale(1);
    opacity: 1;
    }
}

@-o-keyframes bounceIn {
    0% {
        opacity: 0;
        -o-transform: scale(.3);
    }

    50% {
        opacity: 1;
        -o-transform: scale(1.05);
    }

    70% {
        -o-transform: scale(.9);
    }

    100% {
        -o-transform: scale(1);
    opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(.9);
    }

    100% {
        transform: scale(1);
    opacity: 1;
    }
}

.bounceIn {
    -webkit-animation-name: bounceIn;
    -moz-animation-name: bounceIn;
    -o-animation-name: bounceIn;
    animation-name: bounceIn;
}


$(document).ready(function() {
    $("#foo").addClass("animated bounceIn");
});​

I have reported this bug here too: https://github.com/daneden/animate.css/issues/37
------- Comment #1 From 2012-07-23 16:56:32 PST -------
Created an attachment (id=153901) [details]
Patch
------- Comment #2 From 2012-07-23 17:13:14 PST -------
This is a bug in WebKit.

According to your case, the opacity should be set to 1 on the final key frame.

I uploaded patch.

Thanks Behrang Saeedzadeh for reporting this bug.(In reply to comment #0)
> I am not sure if this is a bug in the spec, or WebKit, or a bug at all, but IMHO this behavior does not make sense:> 
> Please compare this (http://jsfiddle.net/nX9sG/1/) and this (http://jsfiddle.net/RUk35/) to see what I mean.
> 
> In the first one, I have modified animate.css so that the opacity is set to 1 on the final key frame, even though it already gets set to this value in an earlier key frame. This makes the element to which this animation is applied retain the final opacity.
> 
> Here's the JS Fiddle code:
> 
> <div id="foo">
> </div>​
> 
> 
> #foo {
>     opacity: 0;
>     position: absolute;
>     width: 100px;
>     height: 200px;
>     top: 10px;
>     left: 10px;
>     border: 1px solid black;
> }
> 
> /*
> Animate.css - http://daneden.me/animate
> LICENSED UNDER THE  MIT LICENSE (MIT)
> 
> Copyright (c) 2012 Dan Eden
> 
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
> 
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
> 
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> */
> 
> .animated {
>     -webkit-animation-fill-mode: both;
>     -moz-animation-fill-mode: both;
>     -ms-animation-fill-mode: both;
>     -o-animation-fill-mode: both;
>     animation-fill-mode: both;
>     -webkit-animation-duration: 1s;
>     -moz-animation-duration: 1s;
>     -ms-animation-duration: 1s;
>     -o-animation-duration: 1s;
>     animation-duration: 1s;
> }
> 
> .animated.hinge {
>     -webkit-animation-duration: 2s;
>     -moz-animation-duration: 2s;
>     -ms-animation-duration: 2s;
>     -o-animation-duration: 2s;
>     animation-duration: 2s;
> }
> 
> @-webkit-keyframes bounceIn {
>     0% {
>         opacity: 0;
>         -webkit-transform: scale(.3);
>     }
> 
>     50% {
>         opacity: 1;
>         -webkit-transform: scale(1.05);
>     }
> 
>     70% {
>         -webkit-transform: scale(.9);
>     }
> 
>     100% {
>         -webkit-transform: scale(1);
>     opacity: 1;
>     }
> }
> 
> @-moz-keyframes bounceIn {
>     0% {
>         opacity: 0;
>         -moz-transform: scale(.3);
>     }
> 
>     50% {
>         opacity: 1;
>         -moz-transform: scale(1.05);
>     }
> 
>     70% {
>         -moz-transform: scale(.9);
>     }
> 
>     100% {
>         -moz-transform: scale(1);
>     opacity: 1;
>     }
> }
> 
> @-o-keyframes bounceIn {
>     0% {
>         opacity: 0;
>         -o-transform: scale(.3);
>     }
> 
>     50% {
>         opacity: 1;
>         -o-transform: scale(1.05);
>     }
> 
>     70% {
>         -o-transform: scale(.9);
>     }
> 
>     100% {
>         -o-transform: scale(1);
>     opacity: 1;
>     }
> }
> 
> @keyframes bounceIn {
>     0% {
>         opacity: 0;
>         transform: scale(.3);
>     }
> 
>     50% {
>         opacity: 1;
>         transform: scale(1.05);
>     }
> 
>     70% {
>         transform: scale(.9);
>     }
> 
>     100% {
>         transform: scale(1);
>     opacity: 1;
>     }
> }
> 
> .bounceIn {
>     -webkit-animation-name: bounceIn;
>     -moz-animation-name: bounceIn;
>     -o-animation-name: bounceIn;
>     animation-name: bounceIn;
> }
> 
> 
> $(document).ready(function() {
>     $("#foo").addClass("animated bounceIn");
> });​
> 
> I have reported this bug here too: https://github.com/daneden/animate.css/issues/37
------- Comment #3 From 2012-07-23 17:23:13 PST -------
(From update of attachment 153901 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=153901&action=review

Thanks for catching this! Some nitpicks but otherwise good.

> Source/WebCore/ChangeLog:4
> +        WebKit does not retain final value of opacity in animations, unless it is specified on the last key frame
> +        https://bugs.webkit.org/show_bug.cgi?id=91322

This bug currently affects TextureMapper only (since other ports of GraphicsLayer don't use this file). That should be portrayed in the bug description and Changelog.

> Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp:54
> +        return 1.0;

Use 1 instead of 1.0.

> Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp:57
> +    return shouldReverseAnimationValue(direction, iterationCount) ? 1.0 : 0;

ditto
------- Comment #4 From 2012-07-23 17:34:54 PST -------
Created an attachment (id=153916) [details]
Patch
------- Comment #5 From 2012-07-23 17:36:29 PST -------
Thanks for reviewing.

I updated new patch for review.

I have one question.
Why i should use 1 instead of 1.0 to returning double value?

(In reply to comment #3)
------- Comment #6 From 2012-07-23 17:39:33 PST -------
> Why i should use 1 instead of 1.0 to returning double value?
http://www.webkit.org/coding/coding-style.html
Search for "floating point literals" :)
------- Comment #7 From 2012-07-23 17:47:06 PST -------
Thanks!

I read coding style guideline again. :) 

(In reply to comment #6)
------- Comment #8 From 2012-07-23 18:15:18 PST -------
(From update of attachment 153916 [details])
Clearing flags on attachment: 153916

Committed r123414: <http://trac.webkit.org/changeset/123414>
------- Comment #9 From 2012-07-23 18:15:22 PST -------
All reviewed patches have been landed.  Closing bug.
------- Comment #10 From 2012-07-30 22:10:12 PST -------
Hi all,

Thanks for the very quick fix!

All the best,
Behrang

(In reply to comment #2)
> This is a bug in WebKit.
> 
> According to your case, the opacity should be set to 1 on the final key frame.
> 
> I uploaded patch.
> 
> Thanks Behrang Saeedzadeh for reporting this bug.(In reply to comment #0)
> > I am not sure if this is a bug in the spec, or WebKit, or a bug at all, but IMHO this behavior does not make sense:> 
> > Please compare this (http://jsfiddle.net/nX9sG/1/) and this (http://jsfiddle.net/RUk35/) to see what I mean.
> > 
> > In the first one, I have modified animate.css so that the opacity is set to 1 on the final key frame, even though it already gets set to this value in an earlier key frame. This makes the element to which this animation is applied retain the final opacity.
> > 
> > Here's the JS Fiddle code:
> > 
> > <div id="foo">
> > </div>​
> > 
> > 
> > #foo {
> >     opacity: 0;
> >     position: absolute;
> >     width: 100px;
> >     height: 200px;
> >     top: 10px;
> >     left: 10px;
> >     border: 1px solid black;
> > }
> > 
> > /*
> > Animate.css - http://daneden.me/animate
> > LICENSED UNDER THE  MIT LICENSE (MIT)
> > 
> > Copyright (c) 2012 Dan Eden
> > 
> > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
> > 
> > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
> > 
> > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> > */
> > 
> > .animated {
> >     -webkit-animation-fill-mode: both;
> >     -moz-animation-fill-mode: both;
> >     -ms-animation-fill-mode: both;
> >     -o-animation-fill-mode: both;
> >     animation-fill-mode: both;
> >     -webkit-animation-duration: 1s;
> >     -moz-animation-duration: 1s;
> >     -ms-animation-duration: 1s;
> >     -o-animation-duration: 1s;
> >     animation-duration: 1s;
> > }
> > 
> > .animated.hinge {
> >     -webkit-animation-duration: 2s;
> >     -moz-animation-duration: 2s;
> >     -ms-animation-duration: 2s;
> >     -o-animation-duration: 2s;
> >     animation-duration: 2s;
> > }
> > 
> > @-webkit-keyframes bounceIn {
> >     0% {
> >         opacity: 0;
> >         -webkit-transform: scale(.3);
> >     }
> > 
> >     50% {
> >         opacity: 1;
> >         -webkit-transform: scale(1.05);
> >     }
> > 
> >     70% {
> >         -webkit-transform: scale(.9);
> >     }
> > 
> >     100% {
> >         -webkit-transform: scale(1);
> >     opacity: 1;
> >     }
> > }
> > 
> > @-moz-keyframes bounceIn {
> >     0% {
> >         opacity: 0;
> >         -moz-transform: scale(.3);
> >     }
> > 
> >     50% {
> >         opacity: 1;
> >         -moz-transform: scale(1.05);
> >     }
> > 
> >     70% {
> >         -moz-transform: scale(.9);
> >     }
> > 
> >     100% {
> >         -moz-transform: scale(1);
> >     opacity: 1;
> >     }
> > }
> > 
> > @-o-keyframes bounceIn {
> >     0% {
> >         opacity: 0;
> >         -o-transform: scale(.3);
> >     }
> > 
> >     50% {
> >         opacity: 1;
> >         -o-transform: scale(1.05);
> >     }
> > 
> >     70% {
> >         -o-transform: scale(.9);
> >     }
> > 
> >     100% {
> >         -o-transform: scale(1);
> >     opacity: 1;
> >     }
> > }
> > 
> > @keyframes bounceIn {
> >     0% {
> >         opacity: 0;
> >         transform: scale(.3);
> >     }
> > 
> >     50% {
> >         opacity: 1;
> >         transform: scale(1.05);
> >     }
> > 
> >     70% {
> >         transform: scale(.9);
> >     }
> > 
> >     100% {
> >         transform: scale(1);
> >     opacity: 1;
> >     }
> > }
> > 
> > .bounceIn {
> >     -webkit-animation-name: bounceIn;
> >     -moz-animation-name: bounceIn;
> >     -o-animation-name: bounceIn;
> >     animation-name: bounceIn;
> > }
> > 
> > 
> > $(document).ready(function() {
> >     $("#foo").addClass("animated bounceIn");
> > });​
> > 
> > I have reported this bug here too: https://github.com/daneden/animate.css/issues/37