Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: Source/core/platform/graphics/GraphicsLayer.cpp

Issue 23431021: Refactoring animation code in accelerated path. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix typo Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index 6bae3b2b6188dfe0bdf56538530d2ae3c76a3c06..0c4d346a14f02a95b2fd6aae584791b0188114b4 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -35,7 +35,6 @@
#include "core/platform/graphics/GraphicsContext.h"
#include "core/platform/graphics/GraphicsLayerFactory.h"
#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/graphics/chromium/AnimationTranslationUtil.h"
#include "core/platform/graphics/chromium/TransformSkMatrix44Conversions.h"
#include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
#include "core/platform/graphics/skia/NativeImageSkia.h"
@@ -44,9 +43,6 @@
#include "wtf/CurrentTime.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
#include "public/platform/Platform.h"
@@ -341,16 +337,6 @@ void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
m_client->paintContents(this, context, m_paintingPhase, clip);
}
-String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property)
-{
- // | is not a valid identifier character in CSS, so this can never conflict with a keyframe identifier.
- StringBuilder id;
- id.appendLiteral("-|transition");
- id.appendNumber(static_cast<int>(property));
- id.append('-');
- return id.toString();
-}
-
void GraphicsLayer::setZPosition(float position)
{
m_zPosition = position;
@@ -983,39 +969,24 @@ void GraphicsLayer::setContentsToMedia(WebLayer* layer)
setContentsTo(ContentsLayerForVideo, layer);
}
-bool GraphicsLayer::addAnimation(const KeyframeValueList& values, const IntSize& boxSize, const CSSAnimationData* animation, const String& animationName, double timeOffset)
+bool GraphicsLayer::addAnimation(WebAnimation* animation)
{
+ ASSERT(animation);
platformLayer()->setAnimationDelegate(this);
- int animationId = 0;
-
- if (m_animationIdMap.contains(animationName))
- animationId = m_animationIdMap.get(animationName);
-
- OwnPtr<WebAnimation> toAdd(createWebAnimation(values, animation, animationId, timeOffset, boxSize));
-
- if (toAdd) {
- animationId = toAdd->id();
- m_animationIdMap.set(animationName, animationId);
-
- // Remove any existing animations with the same animation id and target property.
- platformLayer()->removeAnimation(animationId, toAdd->targetProperty());
- return platformLayer()->addAnimation(toAdd.get());
- }
-
- return false;
+ // Remove any existing animations with the same animation id and target property.
+ platformLayer()->removeAnimation(animation->id(), animation->targetProperty());
+ return platformLayer()->addAnimation(animation);
}
-void GraphicsLayer::pauseAnimation(const String& animationName, double timeOffset)
+void GraphicsLayer::pauseAnimation(int animationId, double timeOffset)
{
- if (m_animationIdMap.contains(animationName))
- platformLayer()->pauseAnimation(m_animationIdMap.get(animationName), timeOffset);
+ platformLayer()->pauseAnimation(animationId, timeOffset);
}
-void GraphicsLayer::removeAnimation(const String& animationName)
+void GraphicsLayer::removeAnimation(int animationId)
{
- if (m_animationIdMap.contains(animationName))
- platformLayer()->removeAnimation(m_animationIdMap.get(animationName));
+ platformLayer()->removeAnimation(animationId);
}
void GraphicsLayer::suspendAnimations(double wallClockTime)
« no previous file with comments | « Source/core/platform/graphics/GraphicsLayer.h ('k') | Source/core/platform/graphics/chromium/AnimationTranslationUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698