Bug 53513 - LayoutTests/animations/play-state.html has wrong behavior with accelerated compositing
Summary: LayoutTests/animations/play-state.html has wrong behavior with accelerated co...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Chris Marrin
URL:
Keywords:
: 54261 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-01 11:36 PST by Chris Marrin
Modified: 2011-02-10 20:25 PST (History)
7 users (show)

See Also:


Attachments
Patch (4.14 KB, patch)
2011-02-04 16:52 PST, Chris Marrin
no flags Details | Formatted Diff | Diff
Patch (10.22 KB, patch)
2011-02-07 11:25 PST, Chris Marrin
no flags Details | Formatted Diff | Diff
Patch (7.46 KB, patch)
2011-02-08 10:45 PST, Chris Marrin
no flags Details | Formatted Diff | Diff
Patch (9.95 KB, patch)
2011-02-08 19:53 PST, Chris Marrin
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Marrin 2011-02-01 11:36:37 PST
The top blue box is animated using -webkit-transform. It should stop after 2 sec and then continue from where it left off. But it continues to animation and then after 1 more second it hops back to where the red box is and continues its animation. The test passes because when we see the animation is stopped we simply return the current software value so we miss the fact that the animation is still running.

This is most likely a regression caused by recent restructuring of the accelerated animation code. We are probably failing to remove the hardware animation when a pause comes in.
Comment 1 Chris Marrin 2011-02-04 16:52:22 PST
Created attachment 81322 [details]
Patch
Comment 2 Simon Fraser (smfr) 2011-02-07 10:50:25 PST
Comment on attachment 81322 [details]
Patch

The copy ctor should take a const&
Comment 3 Chris Marrin 2011-02-07 11:25:56 PST
Created attachment 81500 [details]
Patch
Comment 4 Eric Seidel (no email) 2011-02-07 12:33:59 PST
This feels kinda strange to use Foo::create(*foo.get()).  I wonder if an explicit ->copy() call would be claeaner since there you can do Foo::create(*this) which I think is more common to see.

Not sure.  I'm trying to think of places where we have objects was pass around as pointer and yet have copy constructors.  I can't think of any.
Comment 5 James Robinson 2011-02-07 12:38:36 PST
Comment on attachment 81500 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=81500&action=review

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1510
> +    RefPtr<PlatformCAAnimation> newAnim = PlatformCAAnimation::create(*(curAnim.get()));

nit: *curAnim should do the same thing as *(curAnim.get()) for all of the WTF smart pointer types thanks to the operator* overload on them.
Comment 6 Chris Marrin 2011-02-07 16:23:56 PST
(In reply to comment #5)
> (From update of attachment 81500 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=81500&action=review
> 
> > Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1510
> > +    RefPtr<PlatformCAAnimation> newAnim = PlatformCAAnimation::create(*(curAnim.get()));
> 
> nit: *curAnim should do the same thing as *(curAnim.get()) for all of the WTF smart pointer types thanks to the operator* overload on them.

Good point. Actually this whole thing seems wrong. I put in my changelog that I was messing with the "copy constructor". Simon called me on it, saying that I was using the wrong signature for copy constructors, so I naively fixed that. The problem is that this isn't really a copy constructor at all. You can't call the constructor at all in fact. You have to go through the create method which doesn't have any implicit copy semantics as far as C++ is concerned.

So I think I should go back to the old call signature. Maybe i should call this method "copy()" rather than "create()" although that would break with convention a bit.
Comment 7 Eric Seidel (no email) 2011-02-07 16:34:27 PST
You could just have a ->copy() method on the instance which returns a new instance, no?
Comment 8 Chris Marrin 2011-02-07 17:37:31 PST
(In reply to comment #7)
> You could just have a ->copy() method on the instance which returns a new instance, no?

Sure, I've never seen that pattern. Typically these functions are called create() with the same signature as the ctor. But I'll call it copy to avoid the local confusion.
Comment 9 Darin Adler 2011-02-07 20:18:10 PST
(In reply to comment #8)
> Sure, I've never seen that pattern. Typically these functions are called create() with the same signature as the ctor. But I'll call it copy to avoid the local confusion.

I looked around for examples, and found them in these files:

CSSStyleDeclaration.h
CSSValueList.h
EditingStyle.h
FormData.h
HistoryItem.h
SVGPathByteStream.h
SVGRenderStyle.h
SVGRenderStyleDefs.h
SharedBuffer.h
StorageAreaImpl.h
StorageMap.h
StorageNamespace.h
StyleBackgroundData.h
StyleBoxData.h
StyleFlexibleBoxData.h
StyleInheritedData.h
StyleMarqueeData.h
StyleMultiColData.h
StyleRareInheritedData.h
StyleRareNonInheritedData.h
StyleSurroundData.h
StyleTransformData.h
StyleVisualData.h
Comment 10 Chris Marrin 2011-02-08 10:45:51 PST
Created attachment 81659 [details]
Patch
Comment 11 Simon Fraser (smfr) 2011-02-08 10:54:35 PST
Comment on attachment 81659 [details]
Patch

copy() should be a const method on the original, that returns a copy.
Comment 12 Chris Marrin 2011-02-08 19:53:57 PST
Created attachment 81736 [details]
Patch
Comment 13 Build Bot 2011-02-08 20:17:48 PST
Attachment 81736 [details] did not build on win:
Build output: http://queues.webkit.org/results/7791258
Comment 14 Simon Fraser (smfr) 2011-02-08 20:55:46 PST
Comment on attachment 81736 [details]
Patch

r=me assuming you fix the Windows build failure:
PlatformCAAnimationWin.cpp(190) : error C3861: 'setNonZeroBeginTimeFlag': identifier not found
Comment 15 Chris Marrin 2011-02-09 06:09:53 PST
Committed r78051: <http://trac.webkit.org/changeset/78051>
Comment 16 Dean Jackson 2011-02-10 20:25:24 PST
*** Bug 54261 has been marked as a duplicate of this bug. ***