Log Message
Merge 116786 - [chromium] Ensure that animations continue to run when transform-style is changed https://bugs.webkit.org/show_bug.cgi?id=83283
Source/WebCore: Make sure that we transfer animations when changing layers due to a transform-style change. Unit tested in GraphicsLayerChromiumTest.updateLayerPreserves3DWithAnimations Patch by Ian Vollick <[email protected]> on 2012-05-11 Reviewed by James Robinson. Test: animations/change-transform-style-during-animation.html * platform/graphics/chromium/GraphicsLayerChromium.cpp: (WebCore::GraphicsLayerChromium::updateLayerPreserves3D): * platform/graphics/chromium/LayerChromium.cpp: (WebCore::LayerChromium::setLayerAnimationController): (WebCore::LayerChromium::releaseLayerAnimationController): (WebCore): (WebCore::LayerChromium::notifyAnimationStarted): * platform/graphics/chromium/LayerChromium.h: (LayerChromium): * platform/graphics/chromium/cc/CCLayerAnimationController.cpp: (WebCore::CCLayerAnimationController::CCLayerAnimationController): (WebCore::CCLayerAnimationController::pushAnimationUpdatesTo): (WebCore::CCLayerAnimationController::notifyAnimationStarted): (WebCore::CCLayerAnimationController::setClient): (WebCore): (WebCore::CCLayerAnimationController::pushNewAnimationsToImplThread): (WebCore::CCLayerAnimationController::replaceImplThreadAnimations): * platform/graphics/chromium/cc/CCLayerAnimationController.h: (CCLayerAnimationController): (WebCore::CCLayerAnimationController::setForceSync): Source/WebKit/chromium: Patch by Ian Vollick <[email protected]> on 2012-05-11 Reviewed by James Robinson. * WebKit.gypi: * tests/GraphicsLayerChromiumTest.cpp: Added. (WebKitTests): (MockGraphicsLayerClient): (WebKitTests::MockGraphicsLayerClient::notifyAnimationStarted): (WebKitTests::MockGraphicsLayerClient::notifySyncRequired): (WebKitTests::MockGraphicsLayerClient::paintContents): (WebKitTests::MockGraphicsLayerClient::showDebugBorders): (WebKitTests::MockGraphicsLayerClient::showRepaintCounter): (WebKitTests::TEST): LayoutTests: Patch by Ian Vollick <[email protected]> on 2012-05-11 Reviewed by James Robinson. * animations/change-transform-style-during-animation-expected.png: Added. * animations/change-transform-style-during-animation-expected.txt: Added. * animations/change-transform-style-during-animation.html: Added. [email protected] Review URL: https://chromiumcodereview.appspot.com/10310152
Modified Paths
- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.h
- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp
- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h
- branches/chromium/1132/Source/WebKit/chromium/WebKit.gypi
Added Paths
- branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.png
- branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.txt
- branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation.html
- branches/chromium/1132/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp
Diff
Copied: branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.png (from rev 116786, trunk/LayoutTests/animations/change-transform-style-during-animation-expected.png) (0 => 116998)
--- branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.png (rev 0)
+++ branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.png 2012-05-14 21:12:00 UTC (rev 116998)
@@ -0,0 +1,7 @@
+\x89PNG
+
+
+IHDR X ' )tEXtchecksum 1ecf3b281e6e08bcec99c07b70fac274Z\xB6\xA4\xA3
+\xC0IDATx\x9C\xED\xDC\xC1 \xC4@\xC1\xDB\xC3yG.'Ѱx\xA9\x8A`\x9E\x8DZ3\xF3 \xA0\xF3\xDF= \xE04 &\xB0 b &\xB0 b &\xB0 b\xD7\xEE'X\xCF\xDA=\xE13\xE6\xF6w
+\x80\xF3\xB9` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4 @L` \xC4\xD6\xCC\xEC\xDE p, \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\x98\xC0 \x88 , \x80\xD8\xB3G
+\xAB\xD4B IEND\xAEB`\x82
\ No newline at end of file
Copied: branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.txt (from rev 116786, trunk/LayoutTests/animations/change-transform-style-during-animation-expected.txt) (0 => 116998)
--- branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.txt (rev 0)
+++ branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation-expected.txt 2012-05-14 21:12:00 UTC (rev 116998)
@@ -0,0 +1 @@
+PASS - Computed final position is correct.
Copied: branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation.html (from rev 116786, trunk/LayoutTests/animations/change-transform-style-during-animation.html) (0 => 116998)
--- branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation.html (rev 0)
+++ branches/chromium/1132/LayoutTests/animations/change-transform-style-during-animation.html 2012-05-14 21:12:00 UTC (rev 116998)
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ #container {
+ -webkit-transform: translateZ(0px);
+ -webkit-perspective: 400;
+ }
+
+ #revealed {
+ position: absolute;
+ left: 100px;
+ height: 100px;
+ width: 100px;
+ background-color: green;
+ }
+
+ #animated {
+ position: absolute;
+ left: 100px;
+ height: 100px;
+ width: 100px;
+ background-color: red;
+ -webkit-transform: translateZ(10px);
+ -webkit-transform-style: preserve-3d;
+ -webkit-animation-duration: 100ms;
+ -webkit-animation-fill-mode: both;
+ -webkit-animation-timing-function: linear;
+ -webkit-animation-iteration-count: 1;
+ }
+
+ @-webkit-keyframes anim {
+ from { -webkit-transform: translateZ(0px) translateX(0px); }
+ to { -webkit-transform: translateZ(200px) translateX(-200px); }
+ }
+ </style>
+
+ <script src=""
+ <script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ function animationDone()
+ {
+ var animated = document.getElementById('animated');
+ var result;
+ var expected = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -200, 0, 200, 1];
+ var computed = getPropertyValue("webkitTransform", "animated");
+ if (comparePropertyValue("webkitTransform", computed, expected, 0.002)) {
+ result = "PASS - Computed final position is correct.";
+ } else {
+ result = "FAIL - Computed final position is incorrect. Expected " + expected + ", got " + computed;
+ }
+ document.getElementById('result').innerHTML = result;
+ layoutTestController.notifyDone();
+ }
+
+ function animationStarted()
+ {
+ var animated = document.getElementById('animated');
+ animated.style.webkitTransformStyle = 'flat';
+ }
+
+ function startTest()
+ {
+ var animated = document.getElementById('animated');
+ animated.style.webkitAnimationName = "anim";
+ animated.addEventListener('webkitAnimationEnd', animationDone);
+ waitForAnimationToStart(animated, animationStarted);
+ }
+ </script>
+</head>
+<body _onload_="startTest()">
+ <!-- Test for DRT pauseAnimationAtTimeOnElementWithId() API on animations with multiple keyframes -->
+ <div id="container">
+ <div id="revealed"></div>
+ <div id="animated"></div>
+ </div>
+ <div id="result"></div>
+</body>
+</html>
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (116997 => 116998)
--- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp 2012-05-14 21:10:02 UTC (rev 116997)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp 2012-05-14 21:12:00 UTC (rev 116998)
@@ -588,6 +588,7 @@
m_transformLayer = LayerChromium::create();
m_transformLayer->setPreserves3D(true);
m_transformLayer->setLayerAnimationDelegate(this);
+ m_transformLayer->setLayerAnimationController(m_layer->releaseLayerAnimationController());
// Copy the position from this layer.
updateLayerPosition();
@@ -619,6 +620,9 @@
if (m_transformLayer->parent())
m_transformLayer->parent()->replaceChild(m_transformLayer.get(), m_layer.get());
+ m_layer->setLayerAnimationDelegate(this);
+ m_layer->setLayerAnimationController(m_transformLayer->releaseLayerAnimationController());
+
// Release the transform layer.
m_transformLayer->setLayerAnimationDelegate(0);
m_transformLayer = 0;
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (116997 => 116998)
--- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-05-14 21:10:02 UTC (rev 116997)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-05-14 21:12:00 UTC (rev 116998)
@@ -627,9 +627,20 @@
void LayerChromium::setLayerAnimationController(PassOwnPtr<CCLayerAnimationController> layerAnimationController)
{
m_layerAnimationController = layerAnimationController;
+ if (m_layerAnimationController) {
+ m_layerAnimationController->setClient(this);
+ m_layerAnimationController->setForceSync();
+ }
setNeedsCommit();
}
+PassOwnPtr<CCLayerAnimationController> LayerChromium::releaseLayerAnimationController()
+{
+ OwnPtr<CCLayerAnimationController> toReturn = m_layerAnimationController.release();
+ m_layerAnimationController = CCLayerAnimationController::create(this);
+ return toReturn.release();
+}
+
bool LayerChromium::hasActiveAnimation() const
{
return m_layerAnimationController->hasActiveAnimation();
@@ -638,7 +649,8 @@
void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double wallClockTime)
{
m_layerAnimationController->notifyAnimationStarted(event);
- m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
+ if (m_layerAnimationDelegate)
+ m_layerAnimationDelegate->notifyAnimationStarted(wallClockTime);
}
void LayerChromium::notifyAnimationFinished(double wallClockTime)
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.h (116997 => 116998)
--- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-05-14 21:10:02 UTC (rev 116997)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-05-14 21:12:00 UTC (rev 116998)
@@ -240,6 +240,7 @@
CCLayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); }
void setLayerAnimationController(PassOwnPtr<CCLayerAnimationController>);
+ PassOwnPtr<CCLayerAnimationController> releaseLayerAnimationController();
void setLayerAnimationDelegate(CCLayerAnimationDelegate* layerAnimationDelegate) { m_layerAnimationDelegate = layerAnimationDelegate; }
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (116997 => 116998)
--- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp 2012-05-14 21:10:02 UTC (rev 116997)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp 2012-05-14 21:12:00 UTC (rev 116998)
@@ -116,7 +116,8 @@
} // namepace
CCLayerAnimationController::CCLayerAnimationController(CCLayerAnimationControllerClient* client)
- : m_client(client)
+ : m_forceSync(false)
+ , m_client(client)
{
}
@@ -195,9 +196,14 @@
// are kept in sync.
void CCLayerAnimationController::pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl)
{
- pushNewAnimationsToImplThread(controllerImpl);
- removeAnimationsCompletedOnMainThread(controllerImpl);
- pushPropertiesToImplThread(controllerImpl);
+ if (m_forceSync) {
+ replaceImplThreadAnimations(controllerImpl);
+ m_forceSync = false;
+ } else {
+ pushNewAnimationsToImplThread(controllerImpl);
+ removeAnimationsCompletedOnMainThread(controllerImpl);
+ pushPropertiesToImplThread(controllerImpl);
+ }
}
void CCLayerAnimationController::animate(double monotonicTime, CCAnimationEventsVector* events)
@@ -245,8 +251,7 @@
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) {
- ASSERT(m_activeAnimations[i]->needsSynchronizedStartTime());
+ if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty && m_activeAnimations[i]->needsSynchronizedStartTime()) {
m_activeAnimations[i]->setNeedsSynchronizedStartTime(false);
m_activeAnimations[i]->setStartTime(event.monotonicTime);
return;
@@ -254,6 +259,11 @@
}
}
+void CCLayerAnimationController::setClient(CCLayerAnimationControllerClient* client)
+{
+ m_client = client;
+}
+
void CCLayerAnimationController::pushNewAnimationsToImplThread(CCLayerAnimationController* controllerImpl) const
{
// Any new animations owned by the main thread's controller are cloned and adde to the impl thread's controller.
@@ -273,6 +283,7 @@
ASSERT(!toAdd->needsSynchronizedStartTime());
// The new animation should be set to run as soon as possible.
toAdd->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0);
+ toAdd->setStartTime(0);
controllerImpl->add(toAdd.release());
}
}
@@ -429,6 +440,13 @@
}
}
+void CCLayerAnimationController::replaceImplThreadAnimations(CCLayerAnimationController* controllerImpl) const
+{
+ controllerImpl->m_activeAnimations.clear();
+ for (size_t i = 0; i < m_activeAnimations.size(); ++i)
+ controllerImpl->add(m_activeAnimations[i]->cloneForImplThread());
+}
+
void CCLayerAnimationController::tickAnimations(double monotonicTime)
{
for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h (116997 => 116998)
--- branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h 2012-05-14 21:10:02 UTC (rev 116997)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.h 2012-05-14 21:12:00 UTC (rev 116998)
@@ -90,6 +90,12 @@
// function updates the corresponding main thread animation's start time.
void notifyAnimationStarted(const CCAnimationEvent&);
+ // If a sync is forced, then the next time animation updates are pushed to the impl
+ // thread, all animations will be transferred.
+ void setForceSync() { m_forceSync = true; }
+
+ void setClient(CCLayerAnimationControllerClient*);
+
protected:
explicit CCLayerAnimationController(CCLayerAnimationControllerClient*);
@@ -99,6 +105,7 @@
void pushNewAnimationsToImplThread(CCLayerAnimationController*) const;
void removeAnimationsCompletedOnMainThread(CCLayerAnimationController*) const;
void pushPropertiesToImplThread(CCLayerAnimationController*) const;
+ void replaceImplThreadAnimations(CCLayerAnimationController*) const;
void startAnimationsWaitingForNextTick(double monotonicTime, CCAnimationEventsVector*);
void startAnimationsWaitingForStartTime(double monotonicTime, CCAnimationEventsVector*);
@@ -108,6 +115,9 @@
void tickAnimations(double monotonicTime);
+ // If this is true, we force a sync to the impl thread.
+ bool m_forceSync;
+
CCLayerAnimationControllerClient* m_client;
Vector<OwnPtr<CCActiveAnimation> > m_activeAnimations;
};
Modified: branches/chromium/1132/Source/WebKit/chromium/WebKit.gypi (116997 => 116998)
--- branches/chromium/1132/Source/WebKit/chromium/WebKit.gypi 2012-05-14 21:10:02 UTC (rev 116997)
+++ branches/chromium/1132/Source/WebKit/chromium/WebKit.gypi 2012-05-14 21:12:00 UTC (rev 116998)
@@ -103,6 +103,7 @@
'tests/FloatQuadTest.cpp',
'tests/FrameTestHelpers.cpp',
'tests/FrameTestHelpers.h',
+ 'tests/GraphicsLayerChromiumTest.cpp',
'tests/IDBBindingUtilitiesTest.cpp',
'tests/IDBKeyPathTest.cpp',
'tests/IDBLevelDBCodingTest.cpp',
Copied: branches/chromium/1132/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp (from rev 116786, trunk/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp) (0 => 116998)
--- branches/chromium/1132/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp (rev 0)
+++ branches/chromium/1132/Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp 2012-05-14 21:12:00 UTC (rev 116998)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "GraphicsLayerChromium.h"
+
+#include "CCAnimationTestCommon.h"
+#include "GraphicsLayer.h"
+#include <gtest/gtest.h>
+#include <wtf/PassOwnPtr.h>
+
+using namespace WebCore;
+using namespace WebKitTests;
+
+namespace {
+
+class MockGraphicsLayerClient : public GraphicsLayerClient {
+ public:
+ virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { }
+ virtual void notifySyncRequired(const GraphicsLayer*) { }
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) { }
+ virtual bool showDebugBorders(const GraphicsLayer*) const { return false; }
+ virtual bool showRepaintCounter(const GraphicsLayer*) const { return false; }
+};
+
+TEST(GraphicsLayerChromiumTest, updateLayerPreserves3DWithAnimations)
+{
+ MockGraphicsLayerClient client;
+ OwnPtr<GraphicsLayerChromium> graphicsLayer = static_pointer_cast<GraphicsLayerChromium>(GraphicsLayer::create(&client));
+ ASSERT_TRUE(graphicsLayer.get());
+
+ LayerChromium* platformLayer = static_cast<LayerChromium*>(graphicsLayer->platformLayer());
+ ASSERT_TRUE(platformLayer);
+
+ ASSERT_FALSE(platformLayer->hasActiveAnimation());
+
+ OwnPtr<CCActiveAnimation> floatAnimation(CCActiveAnimation::create(adoptPtr(new FakeFloatAnimationCurve), 0, 1, CCActiveAnimation::Opacity));
+ platformLayer->layerAnimationController()->add(floatAnimation.release());
+
+ ASSERT_TRUE(platformLayer->hasActiveAnimation());
+
+ graphicsLayer->setPreserves3D(true);
+
+ platformLayer = static_cast<LayerChromium*>(graphicsLayer->platformLayer());
+ ASSERT_TRUE(platformLayer);
+
+ ASSERT_TRUE(platformLayer->hasActiveAnimation());
+ platformLayer->removeAnimation(0);
+ ASSERT_FALSE(platformLayer->hasActiveAnimation());
+
+ graphicsLayer->setPreserves3D(false);
+
+ platformLayer = static_cast<LayerChromium*>(graphicsLayer->platformLayer());
+ ASSERT_TRUE(platformLayer);
+
+ ASSERT_FALSE(platformLayer->hasActiveAnimation());
+}
+
+} // namespace
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes
