Diff
Modified: trunk/Source/WebCore/ChangeLog (115242 => 115243)
--- trunk/Source/WebCore/ChangeLog 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/ChangeLog 2012-04-25 21:13:33 UTC (rev 115243)
@@ -1,3 +1,42 @@
+2012-04-25 Ian Vollick <voll...@chromium.org>
+
+ [chromium] Add support for animation finished events.
+ https://bugs.webkit.org/show_bug.cgi?id=84454
+
+ Reviewed by James Robinson.
+
+ Tested in CCLayerTreeHostTestAnimationFinishedEvents
+
+ * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+ (WebCore::GraphicsLayerChromium::willBeDestroyed):
+ (WebCore::GraphicsLayerChromium::notifyAnimationFinished):
+ (WebCore):
+ * platform/graphics/chromium/GraphicsLayerChromium.h:
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::notifyAnimationStarted):
+ (WebCore::LayerChromium::notifyAnimationFinished):
+ (WebCore):
+ * platform/graphics/chromium/LayerChromium.h:
+ (WebCore):
+ (LayerChromium):
+ * platform/graphics/chromium/cc/CCAnimationEvents.h:
+ (WebCore::CCAnimationEvent::CCAnimationEvent):
+ (CCAnimationEvent):
+ (WebCore):
+ * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
+ (WebCore::CCLayerAnimationController::animate):
+ (WebCore::CCLayerAnimationController::notifyAnimationStarted):
+ (WebCore::CCLayerAnimationController::startAnimationsWaitingForNextTick):
+ (WebCore::CCLayerAnimationController::startAnimationsWaitingForStartTime):
+ (WebCore::CCLayerAnimationController::startAnimationsWaitingForTargetAvailability):
+ (WebCore::CCLayerAnimationController::purgeFinishedAnimations):
+ * platform/graphics/chromium/cc/CCLayerAnimationController.h:
+ (CCLayerAnimationController):
+ * platform/graphics/chromium/cc/CCLayerAnimationDelegate.h:
+ (CCLayerAnimationDelegate):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::setAnimationEventsRecursive):
+
2012-04-25 Enrica Casucci <enr...@apple.com>
REGRESSION (r110494): Dragging images from Safari to Finder results in .webloc rather than image file
Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp 2012-04-25 21:13:33 UTC (rev 115243)
@@ -110,7 +110,7 @@
// Be sure to reset the delegate, just in case.
m_transformLayer->setLayerAnimationDelegate(0);
}
-
+
GraphicsLayer::willBeDestroyed();
}
@@ -757,6 +757,11 @@
m_client->notifyAnimationStarted(this, startTime);
}
+void GraphicsLayerChromium::notifyAnimationFinished(double)
+{
+ // Do nothing.
+}
+
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h 2012-04-25 21:13:33 UTC (rev 115243)
@@ -117,6 +117,7 @@
// CCLayerAnimationDelegate implementation.
virtual void notifyAnimationStarted(double startTime);
+ virtual void notifyAnimationFinished(double finishTime);
// Exposed for tests.
LayerChromium* contentsLayer() const { return m_contentsLayer.get(); }
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-04-25 21:13:33 UTC (rev 115243)
@@ -644,12 +644,17 @@
return m_layerAnimationController->hasActiveAnimation();
}
-void LayerChromium::notifyAnimationStarted(const CCAnimationStartedEvent& event, double wallClockTime)
+void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double wallClockTime)
{
m_layerAnimationController->notifyAnimationStarted(event);
m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
}
+void LayerChromium::notifyAnimationFinished(double wallClockTime)
+{
+ m_layerAnimationDelegate->notifyAnimationFinished(wallClockTime);
+}
+
Region LayerChromium::visibleContentOpaqueRegion() const
{
if (opaque())
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-04-25 21:13:33 UTC (rev 115243)
@@ -56,7 +56,7 @@
namespace WebCore {
-struct CCAnimationStartedEvent;
+class CCAnimationEvent;
class CCLayerAnimationDelegate;
class CCLayerImpl;
class CCLayerTreeHost;
@@ -252,7 +252,8 @@
bool hasActiveAnimation() const;
- void notifyAnimationStarted(const CCAnimationStartedEvent&, double wallClockTime);
+ virtual void notifyAnimationStarted(const CCAnimationEvent&, double wallClockTime);
+ virtual void notifyAnimationFinished(double wallClockTime);
virtual Region visibleContentOpaqueRegion() const;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCAnimationEvents.h (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCAnimationEvents.h 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCAnimationEvents.h 2012-04-25 21:13:33 UTC (rev 115243)
@@ -27,26 +27,31 @@
#include "cc/CCActiveAnimation.h"
+#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
-struct CCAnimationStartedEvent {
- CCAnimationStartedEvent(int layerId, int groupId, CCActiveAnimation::TargetProperty targetProperty, double monotonicTime)
- : layerId(layerId)
+struct CCAnimationEvent {
+ enum Type { Started, Finished };
+
+ CCAnimationEvent(Type type, int layerId, int groupId, CCActiveAnimation::TargetProperty targetProperty, double monotonicTime)
+ : type(type)
+ , layerId(layerId)
, groupId(groupId)
, targetProperty(targetProperty)
, monotonicTime(monotonicTime)
{
}
+ Type type;
int layerId;
int groupId;
CCActiveAnimation::TargetProperty targetProperty;
double monotonicTime;
};
-typedef Vector<CCAnimationStartedEvent> CCAnimationEventsVector;
+typedef Vector<CCAnimationEvent> CCAnimationEventsVector;
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp 2012-04-25 21:13:33 UTC (rev 115243)
@@ -188,7 +188,7 @@
startAnimationsWaitingForTargetAvailability(monotonicTime, events);
resolveConflicts(monotonicTime);
tickAnimations(monotonicTime);
- purgeFinishedAnimations();
+ purgeFinishedAnimations(monotonicTime, events);
startAnimationsWaitingForTargetAvailability(monotonicTime, events);
}
@@ -223,7 +223,7 @@
return false;
}
-void CCLayerAnimationController::notifyAnimationStarted(const CCAnimationStartedEvent& event)
+void CCLayerAnimationController::notifyAnimationStarted(const CCAnimationEvent& event)
{
for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty) {
@@ -280,7 +280,7 @@
if (!m_activeAnimations[i]->hasSetStartTime())
m_activeAnimations[i]->setStartTime(monotonicTime);
if (events)
- events->append(CCAnimationStartedEvent(m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime));
+ events->append(CCAnimationEvent(CCAnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime));
}
}
}
@@ -291,7 +291,7 @@
if (m_activeAnimations[i]->runState() == CCActiveAnimation::WaitingForStartTime && m_activeAnimations[i]->startTime() <= monotonicTime) {
m_activeAnimations[i]->setRunState(CCActiveAnimation::Running, monotonicTime);
if (events)
- events->append(CCAnimationStartedEvent(m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime));
+ events->append(CCAnimationEvent(CCAnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime));
}
}
}
@@ -330,7 +330,7 @@
if (!m_activeAnimations[i]->hasSetStartTime())
m_activeAnimations[i]->setStartTime(monotonicTime);
if (events)
- events->append(CCAnimationStartedEvent(m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime));
+ events->append(CCAnimationEvent(CCAnimationEvent::Started, m_client->id(), m_activeAnimations[i]->group(), m_activeAnimations[i]->targetProperty(), monotonicTime));
for (size_t j = i + 1; j < m_activeAnimations.size(); ++j) {
if (m_activeAnimations[i]->group() == m_activeAnimations[j]->group()) {
m_activeAnimations[j]->setRunState(CCActiveAnimation::Running, monotonicTime);
@@ -364,7 +364,7 @@
}
}
-void CCLayerAnimationController::purgeFinishedAnimations()
+void CCLayerAnimationController::purgeFinishedAnimations(double monotonicTime, CCAnimationEventsVector* events)
{
// Each iteration, m_activeAnimations.size() decreases or i increments,
// guaranteeing progress towards loop termination.
@@ -382,15 +382,19 @@
}
}
if (allAnimsWithSameIdAreFinished) {
- // We now need to remove all animations with the same group id as groupId.
+ // We now need to remove all animations with the same group id as groupId
+ // (and send along animation finished notifications, if necessary).
// Each iteration, m_activeAnimations.size() decreases or j increments,
// guaranteeing progress towards loop termination. Also, we are guaranteed
// to remove at least one active animation.
for (size_t j = i; j < m_activeAnimations.size();) {
if (groupId != m_activeAnimations[j]->group())
j++;
- else
+ else {
+ if (events)
+ events->append(CCAnimationEvent(CCAnimationEvent::Finished, m_client->id(), m_activeAnimations[j]->group(), m_activeAnimations[j]->targetProperty(), monotonicTime));
m_activeAnimations.remove(j);
+ }
}
} else
i++;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h 2012-04-25 21:13:33 UTC (rev 115243)
@@ -88,7 +88,7 @@
// This is called in response to an animation being started on the impl thread. This
// function updates the corresponding main thread animation's start time.
- void notifyAnimationStarted(const CCAnimationStartedEvent&);
+ void notifyAnimationStarted(const CCAnimationEvent&);
protected:
explicit CCLayerAnimationController(CCLayerAnimationControllerClient*);
@@ -103,7 +103,7 @@
void startAnimationsWaitingForStartTime(double monotonicTime, CCAnimationEventsVector*);
void startAnimationsWaitingForTargetAvailability(double monotonicTime, CCAnimationEventsVector*);
void resolveConflicts(double monotonicTime);
- void purgeFinishedAnimations();
+ void purgeFinishedAnimations(double monotonicTime, CCAnimationEventsVector*);
void tickAnimations(double monotonicTime);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationDelegate.h (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationDelegate.h 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationDelegate.h 2012-04-25 21:13:33 UTC (rev 115243)
@@ -31,6 +31,7 @@
class CCLayerAnimationDelegate {
public:
virtual void notifyAnimationStarted(double time) = 0;
+ virtual void notifyAnimationFinished(double time) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (115242 => 115243)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-04-25 21:13:33 UTC (rev 115243)
@@ -700,8 +700,12 @@
return;
for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) {
- if (layer->id() == events[eventIndex].layerId)
- layer->notifyAnimationStarted(events[eventIndex], wallClockTime);
+ if (layer->id() == events[eventIndex].layerId) {
+ if (events[eventIndex].type == CCAnimationEvent::Started)
+ layer->notifyAnimationStarted(events[eventIndex], wallClockTime);
+ else
+ layer->notifyAnimationFinished(wallClockTime);
+ }
}
for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIndex)
Modified: trunk/Source/WebKit/chromium/ChangeLog (115242 => 115243)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-04-25 21:13:33 UTC (rev 115243)
@@ -1,5 +1,24 @@
2012-04-25 Ian Vollick <voll...@chromium.org>
+ [chromium] Add support for animation finished events.
+ https://bugs.webkit.org/show_bug.cgi?id=84454
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerAnimationControllerTest.cpp:
+ (WebKitTests::TEST):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::TestHooks::notifyAnimationFinished):
+ (WTF::TEST_F):
+ (WTF):
+ (CCLayerTreeHostTestAnimationFinishedEvents):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::CCLayerTreeHostTestAnimationFinishedEvents):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::beginTest):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::notifyAnimationFinished):
+ (WTF::CCLayerTreeHostTestAnimationFinishedEvents::afterTest):
+
+2012-04-25 Ian Vollick <voll...@chromium.org>
+
[chromium] Do not clobber synchronized start times.
https://bugs.webkit.org/show_bug.cgi?id=84605
Modified: trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp (115242 => 115243)
--- trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp 2012-04-25 21:13:33 UTC (rev 115243)
@@ -216,7 +216,8 @@
EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity)->runState());
// Notify main thread controller that the animation has started.
- controller->notifyAnimationStarted(CCAnimationStartedEvent(0, 0, CCActiveAnimation::Opacity, 0));
+ CCAnimationEvent animationStartedEvent(CCAnimationEvent::Started, 0, 0, CCActiveAnimation::Opacity, 0);
+ controller->notifyAnimationStarted(animationStartedEvent);
// Force animation to complete on impl thread.
controllerImpl->removeAnimation(0);
@@ -272,7 +273,7 @@
EXPECT_EQ(0, dummy.opacity());
// Send the synchronized start time.
- controller->notifyAnimationStarted(CCAnimationStartedEvent(0, 1, CCActiveAnimation::Opacity, 2));
+ controller->notifyAnimationStarted(CCAnimationEvent(CCAnimationEvent::Started, 0, 1, CCActiveAnimation::Opacity, 2));
controller->animate(5, events.get());
EXPECT_EQ(1, dummy.opacity());
EXPECT_FALSE(controller->hasActiveAnimation());
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (115242 => 115243)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-04-25 20:59:28 UTC (rev 115242)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-04-25 21:13:33 UTC (rev 115243)
@@ -77,6 +77,7 @@
// Implementation of CCLayerAnimationDelegate
virtual void notifyAnimationStarted(double time) { }
+ virtual void notifyAnimationFinished(double time) { }
};
// Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks.
@@ -1065,6 +1066,11 @@
}
};
+TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread)
+{
+ runTestThreaded();
+}
+
// Ensures that main thread animations have their start times synchronized with impl thread animations.
class CCLayerTreeHostTestSynchronizeAnimationStartTimes : public CCLayerTreeHostTestThreadOnly {
public:
@@ -1111,7 +1117,31 @@
runTestThreaded();
}
-TEST_F(CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity, runMultiThread)
+// Ensures that main thread animations have their start times synchronized with impl thread animations.
+class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly {
+public:
+ CCLayerTreeHostTestAnimationFinishedEvents()
+ {
+ }
+
+ virtual void beginTest()
+ {
+ postAddInstantAnimationToMainThread();
+ }
+
+ virtual void notifyAnimationFinished(double time)
+ {
+ endTest();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+};
+
+TEST_F(CCLayerTreeHostTestAnimationFinishedEvents, runMultiThread)
{
runTestThreaded();
}