Commit b0108083 authored by samli@chromium.org's avatar samli@chromium.org

Rename WebAnimation to WebCompositorAnimation

Change WebAnimation to WebCompositorAnimation
Change WebAnimationCurve to WebCompositorAnimationCurve
Change WebAnimationDelegate to WebCompositorAnimationDelegate

This is patch 3 of 3. It builds on http://crrev.com/413983002

BUG=396358

Review URL: https://codereview.chromium.org/412123002

git-svn-id: svn://svn.chromium.org/blink/trunk@179910 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8273ea15
......@@ -35,7 +35,7 @@
#include "platform/transforms/ScaleTransformOperation.h"
#include "platform/transforms/TransformOperations.h"
#include "platform/transforms/TranslateTransformOperation.h"
#include "public/platform/WebAnimation.h"
#include "public/platform/WebCompositorAnimation.h"
#include "public/platform/WebFilterOperations.h"
#include "public/platform/WebTransformOperations.h"
#include "wtf/RefPtr.h"
......
......@@ -43,7 +43,7 @@
#include "core/rendering/compositing/CompositedLayerMapping.h"
#include "platform/geometry/FloatBox.h"
#include "public/platform/Platform.h"
#include "public/platform/WebAnimation.h"
#include "public/platform/WebCompositorAnimation.h"
#include "public/platform/WebCompositorSupport.h"
#include "public/platform/WebFilterAnimationCurve.h"
#include "public/platform/WebFilterKeyframe.h"
......@@ -257,7 +257,7 @@ bool CompositorAnimations::startAnimationOnCompositor(const Element& element, do
RenderLayer* layer = toRenderBoxModelObject(element.renderer())->layer();
ASSERT(layer);
Vector<OwnPtr<blink::WebAnimation> > animations;
Vector<OwnPtr<WebCompositorAnimation> > animations;
CompositorAnimationsImpl::getAnimationOnCompositor(timing, startTime, keyframeEffect, animations);
ASSERT(!animations.isEmpty());
for (size_t i = 0; i < animations.size(); ++i) {
......@@ -366,7 +366,7 @@ void addKeyframeWithTimingFunction(PlatformAnimationCurveType& curve, const Plat
switch (timingFunction->type()) {
case TimingFunction::LinearFunction:
curve.add(keyframe, blink::WebAnimationCurve::TimingFunctionTypeLinear);
curve.add(keyframe, WebCompositorAnimationCurve::TimingFunctionTypeLinear);
return;
case TimingFunction::CubicBezierFunction: {
......@@ -376,19 +376,19 @@ void addKeyframeWithTimingFunction(PlatformAnimationCurveType& curve, const Plat
curve.add(keyframe, cubic->x1(), cubic->y1(), cubic->x2(), cubic->y2());
} else {
blink::WebAnimationCurve::TimingFunctionType easeType;
WebCompositorAnimationCurve::TimingFunctionType easeType;
switch (cubic->subType()) {
case CubicBezierTimingFunction::Ease:
easeType = blink::WebAnimationCurve::TimingFunctionTypeEase;
easeType = WebCompositorAnimationCurve::TimingFunctionTypeEase;
break;
case CubicBezierTimingFunction::EaseIn:
easeType = blink::WebAnimationCurve::TimingFunctionTypeEaseIn;
easeType = WebCompositorAnimationCurve::TimingFunctionTypeEaseIn;
break;
case CubicBezierTimingFunction::EaseOut:
easeType = blink::WebAnimationCurve::TimingFunctionTypeEaseOut;
easeType = WebCompositorAnimationCurve::TimingFunctionTypeEaseOut;
break;
case CubicBezierTimingFunction::EaseInOut:
easeType = blink::WebAnimationCurve::TimingFunctionTypeEaseInOut;
easeType = WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut;
break;
// Custom Bezier are handled seperately.
......@@ -412,7 +412,7 @@ void addKeyframeWithTimingFunction(PlatformAnimationCurveType& curve, const Plat
} // namespace anoymous
void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& curve, const PropertySpecificKeyframeVector& keyframes, bool reverse)
void CompositorAnimationsImpl::addKeyframesToCurve(WebCompositorAnimationCurve& curve, const PropertySpecificKeyframeVector& keyframes, bool reverse)
{
for (size_t i = 0; i < keyframes.size(); i++) {
RefPtr<TimingFunction> reversedTimingFunction;
......@@ -432,27 +432,27 @@ void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& cur
const AnimatableValue* value = keyframes[i]->getAnimatableValue().get();
switch (curve.type()) {
case blink::WebAnimationCurve::AnimationCurveTypeFilter: {
OwnPtr<blink::WebFilterOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createFilterOperations());
case WebCompositorAnimationCurve::AnimationCurveTypeFilter: {
OwnPtr<WebFilterOperations> ops = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations());
toWebFilterOperations(toAnimatableFilterOperations(value)->operations(), ops.get());
blink::WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops.release());
blink::WebFilterAnimationCurve* filterCurve = static_cast<blink::WebFilterAnimationCurve*>(&curve);
WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops.release());
WebFilterAnimationCurve* filterCurve = static_cast<WebFilterAnimationCurve*>(&curve);
addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframeTimingFunction);
break;
}
case blink::WebAnimationCurve::AnimationCurveTypeFloat: {
blink::WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnimatableDouble(value)->toDouble());
blink::WebFloatAnimationCurve* floatCurve = static_cast<blink::WebFloatAnimationCurve*>(&curve);
case WebCompositorAnimationCurve::AnimationCurveTypeFloat: {
WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnimatableDouble(value)->toDouble());
WebFloatAnimationCurve* floatCurve = static_cast<WebFloatAnimationCurve*>(&curve);
addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTimingFunction);
break;
}
case blink::WebAnimationCurve::AnimationCurveTypeTransform: {
OwnPtr<blink::WebTransformOperations> ops = adoptPtr(blink::Platform::current()->compositorSupport()->createTransformOperations());
case WebCompositorAnimationCurve::AnimationCurveTypeTransform: {
OwnPtr<WebTransformOperations> ops = adoptPtr(Platform::current()->compositorSupport()->createTransformOperations());
toWebTransformOperations(toAnimatableTransform(value)->transformOperations(), ops.get());
blink::WebTransformKeyframe transformKeyframe(keyframes[i]->offset(), ops.release());
blink::WebTransformAnimationCurve* transformCurve = static_cast<blink::WebTransformAnimationCurve*>(&curve);
WebTransformKeyframe transformKeyframe(keyframes[i]->offset(), ops.release());
WebTransformAnimationCurve* transformCurve = static_cast<WebTransformAnimationCurve*>(&curve);
addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, keyframeTimingFunction);
break;
}
......@@ -462,7 +462,7 @@ void CompositorAnimationsImpl::addKeyframesToCurve(blink::WebAnimationCurve& cur
}
}
void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, double startTime, const KeyframeEffectModelBase& effect, Vector<OwnPtr<blink::WebAnimation> >& animations)
void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, double startTime, const KeyframeEffectModelBase& effect, Vector<OwnPtr<WebCompositorAnimation> >& animations)
{
ASSERT(animations.isEmpty());
CompositorTiming compositorTiming;
......@@ -476,27 +476,27 @@ void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, do
PropertySpecificKeyframeVector values;
getKeyframeValuesForProperty(&effect, *it, compositorTiming.scaledDuration, compositorTiming.reverse, values);
blink::WebAnimation::TargetProperty targetProperty;
OwnPtr<blink::WebAnimationCurve> curve;
WebCompositorAnimation::TargetProperty targetProperty;
OwnPtr<WebCompositorAnimationCurve> curve;
switch (*it) {
case CSSPropertyOpacity: {
targetProperty = blink::WebAnimation::TargetPropertyOpacity;
targetProperty = WebCompositorAnimation::TargetPropertyOpacity;
blink::WebFloatAnimationCurve* floatCurve = blink::Platform::current()->compositorSupport()->createFloatAnimationCurve();
WebFloatAnimationCurve* floatCurve = Platform::current()->compositorSupport()->createFloatAnimationCurve();
addKeyframesToCurve(*floatCurve, values, compositorTiming.reverse);
curve = adoptPtr(floatCurve);
break;
}
case CSSPropertyWebkitFilter: {
targetProperty = blink::WebAnimation::TargetPropertyFilter;
blink::WebFilterAnimationCurve* filterCurve = blink::Platform::current()->compositorSupport()->createFilterAnimationCurve();
targetProperty = WebCompositorAnimation::TargetPropertyFilter;
WebFilterAnimationCurve* filterCurve = Platform::current()->compositorSupport()->createFilterAnimationCurve();
addKeyframesToCurve(*filterCurve, values, compositorTiming.reverse);
curve = adoptPtr(filterCurve);
break;
}
case CSSPropertyTransform: {
targetProperty = blink::WebAnimation::TargetPropertyTransform;
blink::WebTransformAnimationCurve* transformCurve = blink::Platform::current()->compositorSupport()->createTransformAnimationCurve();
targetProperty = WebCompositorAnimation::TargetPropertyTransform;
WebTransformAnimationCurve* transformCurve = Platform::current()->compositorSupport()->createTransformAnimationCurve();
addKeyframesToCurve(*transformCurve, values, compositorTiming.reverse);
curve = adoptPtr(transformCurve);
break;
......@@ -507,7 +507,7 @@ void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, do
}
ASSERT(curve.get());
OwnPtr<blink::WebAnimation> animation = adoptPtr(blink::Platform::current()->compositorSupport()->createAnimation(*curve, targetProperty));
OwnPtr<WebCompositorAnimation> animation = adoptPtr(Platform::current()->compositorSupport()->createAnimation(*curve, targetProperty));
if (!std::isnan(startTime))
animation->setStartTime(startTime);
......
......@@ -32,10 +32,12 @@
#include "core/animation/KeyframeEffectModel.h"
#include "core/animation/Timing.h"
#include "platform/animation/TimingFunction.h"
#include "public/platform/WebAnimation.h"
#include "public/platform/WebCompositorAnimation.h"
namespace blink {
class WebCompositorAnimationCurve;
class CompositorAnimationsImpl {
private:
struct CompositorTiming {
......@@ -48,9 +50,9 @@ private:
static bool convertTimingForCompositor(const Timing&, CompositorTiming& out);
static void getAnimationOnCompositor(const Timing&, double startTime, const KeyframeEffectModelBase&, Vector<OwnPtr<blink::WebAnimation> >& animations);
static void getAnimationOnCompositor(const Timing&, double startTime, const KeyframeEffectModelBase&, Vector<OwnPtr<WebCompositorAnimation> >& animations);
static void addKeyframesToCurve(blink::WebAnimationCurve&, const AnimatableValuePropertySpecificKeyframeVector&, bool reverse);
static void addKeyframesToCurve(WebCompositorAnimationCurve&, const AnimatableValuePropertySpecificKeyframeVector&, bool reverse);
friend class CompositorAnimations;
friend class AnimationCompositorAnimationsTest;
......
......@@ -47,11 +47,11 @@ PassOwnPtr<T> CloneToPassOwnPtr(T& o)
} // namespace testing
// Test helpers and mocks for blink::Web* types
// Test helpers and mocks for Web* types
// -----------------------------------------------------------------------
namespace blink {
// blink::WebFloatKeyframe is a plain struct, so we just create an == operator
// WebFloatKeyframe is a plain struct, so we just create an == operator
// for it.
inline bool operator==(const WebFloatKeyframe& a, const WebFloatKeyframe& b)
{
......@@ -65,14 +65,14 @@ inline void PrintTo(const WebFloatKeyframe& frame, ::std::ostream* os)
// -----------------------------------------------------------------------
class WebAnimationMock : public blink::WebAnimation {
class WebCompositorAnimationMock : public WebCompositorAnimation {
private:
blink::WebAnimation::TargetProperty m_property;
WebCompositorAnimation::TargetProperty m_property;
public:
// Target Property is set through the constructor.
WebAnimationMock(blink::WebAnimation::TargetProperty p) : m_property(p) { }
virtual blink::WebAnimation::TargetProperty targetProperty() const { return m_property; };
WebCompositorAnimationMock(WebCompositorAnimation::TargetProperty p) : m_property(p) { }
virtual WebCompositorAnimation::TargetProperty targetProperty() const { return m_property; };
MOCK_METHOD0(id, int());
......@@ -89,25 +89,25 @@ public:
MOCK_METHOD1(setAlternatesDirection, void(bool));
MOCK_METHOD0(delete_, void());
~WebAnimationMock() { delete_(); }
~WebCompositorAnimationMock() { delete_(); }
};
template<typename CurveType, blink::WebAnimationCurve::AnimationCurveType CurveId, typename KeyframeType>
class WebAnimationCurveMock : public CurveType {
template<typename CurveType, WebCompositorAnimationCurve::AnimationCurveType CurveId, typename KeyframeType>
class WebCompositorAnimationCurveMock : public CurveType {
public:
MOCK_METHOD1_T(add, void(const KeyframeType&));
MOCK_METHOD2_T(add, void(const KeyframeType&, blink::WebAnimationCurve::TimingFunctionType));
MOCK_METHOD2_T(add, void(const KeyframeType&, WebCompositorAnimationCurve::TimingFunctionType));
MOCK_METHOD5_T(add, void(const KeyframeType&, double, double, double, double));
MOCK_CONST_METHOD1_T(getValue, float(double)); // Only on WebFloatAnimationCurve, but can't hurt to have here.
virtual blink::WebAnimationCurve::AnimationCurveType type() const { return CurveId; };
virtual WebCompositorAnimationCurve::AnimationCurveType type() const { return CurveId; };
MOCK_METHOD0(delete_, void());
~WebAnimationCurveMock() { delete_(); }
~WebCompositorAnimationCurveMock() { delete_(); }
};
typedef WebAnimationCurveMock<blink::WebFloatAnimationCurve, blink::WebAnimationCurve::AnimationCurveTypeFloat, blink::WebFloatKeyframe> WebFloatAnimationCurveMock;
typedef WebCompositorAnimationCurveMock<WebFloatAnimationCurve, WebCompositorAnimationCurve::AnimationCurveTypeFloat, WebFloatKeyframe> WebFloatAnimationCurveMock;
} // namespace blink
......@@ -117,39 +117,39 @@ class AnimationCompositorAnimationsTestBase : public ::testing::Test {
public:
AnimationCompositorAnimationsTestBase() : m_proxyPlatform(&m_mockCompositor) { };
class WebCompositorSupportMock : public blink::WebCompositorSupport {
class WebCompositorSupportMock : public WebCompositorSupport {
public:
MOCK_METHOD3(createAnimation, blink::WebAnimation*(const blink::WebAnimationCurve& curve, blink::WebAnimation::TargetProperty target, int animationId));
MOCK_METHOD0(createFloatAnimationCurve, blink::WebFloatAnimationCurve*());
MOCK_METHOD3(createAnimation, WebCompositorAnimation*(const WebCompositorAnimationCurve& curve, WebCompositorAnimation::TargetProperty target, int animationId));
MOCK_METHOD0(createFloatAnimationCurve, WebFloatAnimationCurve*());
};
private:
class PlatformProxy : public blink::Platform {
class PlatformProxy : public Platform {
public:
PlatformProxy(WebCompositorSupportMock** compositor) : m_compositor(compositor) { }
virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); }
private:
WebCompositorSupportMock** m_compositor;
virtual blink::WebCompositorSupport* compositorSupport() OVERRIDE { return *m_compositor; }
virtual WebCompositorSupport* compositorSupport() OVERRIDE { return *m_compositor; }
};
WebCompositorSupportMock* m_mockCompositor;
PlatformProxy m_proxyPlatform;
protected:
blink::Platform* m_platform;
Platform* m_platform;
virtual void SetUp()
{
m_mockCompositor = 0;
m_platform = blink::Platform::current();
blink::Platform::initialize(&m_proxyPlatform);
m_platform = Platform::current();
Platform::initialize(&m_proxyPlatform);
}
virtual void TearDown()
{
blink::Platform::initialize(m_platform);
Platform::initialize(m_platform);
}
void setCompositorForTesting(WebCompositorSupportMock& mock)
......
......@@ -38,7 +38,7 @@
#include "platform/scroll/ScrollableArea.h"
#include "platform/text/TextStream.h"
#include "public/platform/Platform.h"
#include "public/platform/WebAnimation.h"
#include "public/platform/WebCompositorAnimation.h"
#include "public/platform/WebCompositorSupport.h"
#include "public/platform/WebFilterOperations.h"
#include "public/platform/WebFloatPoint.h"
......@@ -59,7 +59,7 @@
#endif
using blink::Platform;
using blink::WebAnimation;
using blink::WebCompositorAnimation;
using blink::WebFilterOperations;
using blink::WebLayer;
using blink::WebPoint;
......@@ -952,9 +952,9 @@ void GraphicsLayer::setContentsToNinePatch(Image* image, const IntRect& aperture
setContentsTo(m_ninePatchLayer ? m_ninePatchLayer->layer() : 0);
}
bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation)
{
OwnPtr<WebAnimation> animation(popAnimation);
OwnPtr<WebCompositorAnimation> animation(popAnimation);
ASSERT(animation);
platformLayer()->setAnimationDelegate(this);
......@@ -1033,13 +1033,13 @@ void GraphicsLayer::paint(GraphicsContext& context, const IntRect& clip)
}
void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebAnimation::TargetProperty)
void GraphicsLayer::notifyAnimationStarted(double monotonicTime, WebCompositorAnimation::TargetProperty)
{
if (m_client)
m_client->notifyAnimationStarted(this, monotonicTime);
}
void GraphicsLayer::notifyAnimationFinished(double, WebAnimation::TargetProperty)
void GraphicsLayer::notifyAnimationFinished(double, WebCompositorAnimation::TargetProperty)
{
// Do nothing.
}
......
......@@ -38,7 +38,7 @@
#include "platform/graphics/OpaqueRectTrackingContentLayerDelegate.h"
#include "platform/graphics/filters/FilterOperations.h"
#include "platform/transforms/TransformationMatrix.h"
#include "public/platform/WebAnimationDelegate.h"
#include "public/platform/WebCompositorAnimationDelegate.h"
#include "public/platform/WebContentLayer.h"
#include "public/platform/WebImageLayer.h"
#include "public/platform/WebLayerClient.h"
......@@ -50,7 +50,7 @@
namespace blink {
class GraphicsLayerFactoryChromium;
class WebAnimation;
class WebCompositorAnimation;
class WebLayer;
}
......@@ -70,7 +70,7 @@ class PLATFORM_EXPORT LinkHighlightClient {
public:
virtual void invalidate() = 0;
virtual void clearCurrentGraphicsLayer() = 0;
virtual blink::WebLayer* layer() = 0;
virtual WebLayer* layer() = 0;
protected:
virtual ~LinkHighlightClient() { }
......@@ -81,7 +81,7 @@ typedef Vector<GraphicsLayer*, 64> GraphicsLayerVector;
// GraphicsLayer is an abstraction for a rendering surface with backing store,
// which may have associated transformation and animations.
class PLATFORM_EXPORT GraphicsLayer : public GraphicsContextPainter, public blink::WebAnimationDelegate, public blink::WebLayerScrollClient, public blink::WebLayerClient {
class PLATFORM_EXPORT GraphicsLayer : public GraphicsContextPainter, public WebCompositorAnimationDelegate, public WebLayerScrollClient, public WebLayerClient {
WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient*);
......@@ -90,8 +90,8 @@ public:
GraphicsLayerClient* client() const { return m_client; }
// blink::WebLayerClient implementation.
virtual blink::WebGraphicsLayerDebugInfo* takeDebugInfoFor(blink::WebLayer*) OVERRIDE;
// WebLayerClient implementation.
virtual WebGraphicsLayerDebugInfo* takeDebugInfoFor(WebLayer*) OVERRIDE;
GraphicsLayerDebugInfo& debugInfo();
......@@ -158,8 +158,8 @@ public:
bool contentsAreVisible() const { return m_contentsVisible; }
void setContentsVisible(bool);
void setScrollParent(blink::WebLayer*);
void setClipParent(blink::WebLayer*);
void setScrollParent(WebLayer*);
void setClipParent(WebLayer*);
// For special cases, e.g. drawing missing tiles on Android.
// The compositor should never paint this color in normal cases because the RenderLayer
......@@ -176,7 +176,7 @@ public:
float opacity() const { return m_opacity; }
void setOpacity(float);
void setBlendMode(blink::WebBlendMode);
void setBlendMode(WebBlendMode);
void setIsRootForIsolatedGroup(bool);
void setFilters(const FilterOperations&);
......@@ -196,18 +196,18 @@ public:
// Return true if the animation is handled by the compositing system. If this returns
// false, the animation will be run by AnimationController.
// These methods handle both transitions and keyframe animations.
bool addAnimation(PassOwnPtr<blink::WebAnimation>);
bool addAnimation(PassOwnPtr<WebCompositorAnimation>);
void pauseAnimation(int animationId, double /*timeOffset*/);
void removeAnimation(int animationId);
// Layer contents
void setContentsToImage(Image*);
void setContentsToNinePatch(Image*, const IntRect& aperture);
void setContentsToPlatformLayer(blink::WebLayer* layer) { setContentsTo(layer); }
void setContentsToPlatformLayer(WebLayer* layer) { setContentsTo(layer); }
bool hasContentsLayer() const { return m_contentsLayer; }
// For hosting this GraphicsLayer in a native layer hierarchy.
blink::WebLayer* platformLayer() const;
WebLayer* platformLayer() const;
typedef HashMap<int, int> RenderingContextMap;
PassRefPtr<JSONObject> layerTreeAsJSON(LayerTreeFlags, RenderingContextMap&) const;
......@@ -230,30 +230,30 @@ public:
void setScrollableArea(ScrollableArea*, bool isMainFrame);
ScrollableArea* scrollableArea() const { return m_scrollableArea; }
blink::WebContentLayer* contentLayer() const { return m_layer.get(); }
WebContentLayer* contentLayer() const { return m_layer.get(); }
static void registerContentsLayer(blink::WebLayer*);
static void unregisterContentsLayer(blink::WebLayer*);
static void registerContentsLayer(WebLayer*);
static void unregisterContentsLayer(WebLayer*);
// GraphicsContextPainter implementation.
virtual void paint(GraphicsContext&, const IntRect& clip) OVERRIDE;
// WebAnimationDelegate implementation.
virtual void notifyAnimationStarted(double monotonicTime, blink::WebAnimation::TargetProperty) OVERRIDE;
virtual void notifyAnimationFinished(double monotonicTime, blink::WebAnimation::TargetProperty) OVERRIDE;
// WebCompositorAnimationDelegate implementation.
virtual void notifyAnimationStarted(double monotonicTime, WebCompositorAnimation::TargetProperty) OVERRIDE;
virtual void notifyAnimationFinished(double monotonicTime, WebCompositorAnimation::TargetProperty) OVERRIDE;
// WebLayerScrollClient implementation.
virtual void didScroll() OVERRIDE;
protected:
String debugName(blink::WebLayer*) const;
String debugName(WebLayer*) const;
explicit GraphicsLayer(GraphicsLayerClient*);
// GraphicsLayerFactoryChromium that wants to create a GraphicsLayer need to be friends.
friend class blink::GraphicsLayerFactoryChromium;
friend class GraphicsLayerFactoryChromium;
// Exposed for tests.
virtual blink::WebLayer* contentsLayer() const { return m_contentsLayer; }
virtual WebLayer* contentsLayer() const { return m_contentsLayer; }
private:
// Callback from the underlying graphics system to draw layer contents.
......@@ -276,10 +276,10 @@ private:
void updateLayerIsDrawable();
void updateContentsRect();
void setContentsTo(blink::WebLayer*);
void setupContentsLayer(blink::WebLayer*);
void setContentsTo(WebLayer*);
void setupContentsLayer(WebLayer*);
void clearContentsLayerIfUnregistered();
blink::WebLayer* contentsLayerIfRegistered();
WebLayer* contentsLayerIfRegistered();
GraphicsLayerClient* m_client;
......@@ -296,7 +296,7 @@ private:
Color m_backgroundColor;
float m_opacity;
blink::WebBlendMode m_blendMode;
WebBlendMode m_blendMode;
bool m_hasTransformOrigin : 1;
bool m_contentsOpaque : 1;
......@@ -327,10 +327,10 @@ private:
int m_paintCount;
OwnPtr<blink::WebContentLayer> m_layer;
OwnPtr<blink::WebImageLayer> m_imageLayer;
OwnPtr<blink::WebNinePatchLayer> m_ninePatchLayer;
blink::WebLayer* m_contentsLayer;
OwnPtr<WebContentLayer> m_layer;
OwnPtr<WebImageLayer> m_imageLayer;
OwnPtr<WebNinePatchLayer> m_ninePatchLayer;
WebLayer* m_contentsLayer;
// We don't have ownership of m_contentsLayer, but we do want to know if a given layer is the
// same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point,
// we stash an ID away when we know m_contentsLayer is alive and use that for comparisons from that point
......
......@@ -101,7 +101,7 @@ TEST_F(GraphicsLayerTest, updateLayerShouldFlattenTransformWithAnimations)
OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve());
curve->add(WebFloatKeyframe(0.0, 0.0));
OwnPtr<WebAnimation> floatAnimation(adoptPtr(Platform::current()->compositorSupport()->createAnimation(*curve, WebAnimation::TargetPropertyOpacity)));
OwnPtr<WebCompositorAnimation> floatAnimation(adoptPtr(Platform::current()->compositorSupport()->createAnimation(*curve, WebCompositorAnimation::TargetPropertyOpacity)));
int animationId = floatAnimation->id();
ASSERT_TRUE(m_platformLayer->addAnimation(floatAnimation.leakPtr()));
......
......@@ -38,7 +38,7 @@ void ProgrammaticScrollAnimator::animateToOffset(FloatPoint offset)
{
m_startTime = 0.0;
m_targetOffset = offset;
m_animationCurve = adoptPtr(Platform::current()->compositorSupport()->createScrollOffsetAnimationCurve(m_targetOffset, WebAnimationCurve::TimingFunctionTypeEaseInOut));
m_animationCurve = adoptPtr(Platform::current()->compositorSupport()->createScrollOffsetAnimationCurve(m_targetOffset, WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut));
m_animationCurve->setInitialValue(FloatPoint(m_scrollableArea->scrollPosition()));
if (!m_scrollableArea->scheduleAnimation()) {
......
......@@ -40,7 +40,7 @@
#include "core/rendering/style/ShadowData.h"
#include "platform/graphics/Color.h"
#include "public/platform/Platform.h"
#include "public/platform/WebAnimationCurve.h"
#include "public/platform/WebCompositorAnimationCurve.h"
#include "public/platform/WebCompositorSupport.h"
#include "public/platform/WebFloatAnimationCurve.h"
#include "public/platform/WebFloatPoint.h"
......@@ -289,9 +289,9 @@ void LinkHighlight::startHighlightAnimationIfNeeded()
if (extraDurationRequired)
curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity));
// For layout tests we don't fade out.
curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, blink::layoutTestMode() ? startOpacity : 0));
curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, layoutTestMode() ? startOpacity : 0));
OwnPtr<WebAnimation> animation = adoptPtr(compositorSupport->createAnimation(*curve, WebAnimation::TargetPropertyOpacity));
OwnPtr<WebCompositorAnimation> animation = adoptPtr(compositorSupport->createAnimation(*curve, WebCompositorAnimation::TargetPropertyOpacity));
m_contentLayer->layer()->setDrawsContent(true);
m_contentLayer->layer()->addAnimation(animation.leakPtr());
......@@ -308,11 +308,11 @@ void LinkHighlight::clearGraphicsLayerLinkHighlightPointer()
}
}
void LinkHighlight::notifyAnimationStarted(double, blink::WebAnimation::TargetProperty)
void LinkHighlight::notifyAnimationStarted(double, WebCompositorAnimation::TargetProperty)
{
}
void LinkHighlight::notifyAnimationFinished(double, blink::WebAnimation::TargetProperty)
void LinkHighlight::notifyAnimationFinished(double, WebCompositorAnimation::TargetProperty)
{
// Since WebViewImpl may hang on to us for a while, make sure we
// release resources as soon as possible.
......
......@@ -30,7 +30,7 @@
#include "platform/geometry/IntPoint.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/graphics/Path.h"
#include "public/platform/WebAnimationDelegate.h"
#include "public/platform/WebCompositorAnimationDelegate.h"
#include "public/platform/WebContentLayer.h"
#include "public/platform/WebContentLayerClient.h"
#include "public/platform/WebLayer.h"
......@@ -49,7 +49,7 @@ struct WebFloatRect;
struct WebRect;
class WebViewImpl;
class LinkHighlight FINAL : public WebContentLayerClient, public WebAnimationDelegate, blink::LinkHighlightClient {
class LinkHighlight FINAL : public WebContentLayerClient, public WebCompositorAnimationDelegate, blink::LinkHighlightClient {
public:
static PassOwnPtr<LinkHighlight> create(blink::Node*, WebViewImpl*);
virtual ~LinkHighlight();
......@@ -63,9 +63,9 @@ public:
virtual void paintContents(WebCanvas*, const WebRect& clipRect, bool canPaintLCDText, WebFloatRect& opaque,
WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) OVERRIDE;
// WebAnimationDelegate implementation.
virtual void notifyAnimationStarted(double monotonicTime, blink::WebAnimation::TargetProperty) OVERRIDE;
virtual void notifyAnimationFinished(double monotonicTime, blink::WebAnimation::TargetProperty) OVERRIDE;
// WebCompositorAnimationDelegate implementation.
virtual void notifyAnimationStarted(double monotonicTime, blink::WebCompositorAnimation::TargetProperty) OVERRIDE;
virtual void notifyAnimationFinished(double monotonicTime, blink::WebCompositorAnimation::TargetProperty) OVERRIDE;
// LinkHighlightClient inplementation.
virtual void invalidate() OVERRIDE;
......
/*
* 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.
*/
#ifndef WebAnimation_h
#define WebAnimation_h
#include "WebCommon.h"
#include "WebNonCopyable.h"
#include "WebPrivateOwnPtr.h"
#if BLINK_IMPLEMENTATION
#include "wtf/Forward.h"
#endif
#define WebCompositorAnimation WebAnimation
namespace blink {
class CCActiveAnimation;
}
namespace blink {
class WebAnimationCurve;
// A compositor driven animation.
class WebAnimation {
public:
enum TargetProperty {
TargetPropertyTransform = 0,
TargetPropertyOpacity,
TargetPropertyFilter,
TargetPropertyScrollOffset
};
virtual ~WebAnimation() { }
// An id is effectively the animation's name, and it is not unique.
virtual int id() = 0;
virtual TargetProperty targetProperty() const = 0;
// This is the number of times that the animation will play. If this
// value is zero the animation will not play. If it is negative, then
// the animation will loop indefinitely.
virtual int iterations() const = 0;
virtual void setIterations(int) = 0;
virtual double startTime() const = 0;
virtual void setStartTime(double monotonicTime) = 0;
virtual double timeOffset() const = 0;
virtual void setTimeOffset(double monotonicTime) = 0;
// If alternatesDirection is true, on odd numbered iterations we reverse the curve.
virtual bool alternatesDirection() const = 0;
virtual void setAlternatesDirection(bool) = 0;
};
} // namespace blink
#endif // WebAnimation_h
/*
* 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.
*/
#ifndef WebAnimationCurve_h
#define WebAnimationCurve_h
#include "WebCommon.h"
#define WebCompositorAnimationCurve WebAnimationCurve
#define WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED 1
namespace blink {
class WebAnimationCurve {
public:
virtual ~WebAnimationCurve() { }
enum TimingFunctionType {
TimingFunctionTypeEase,
TimingFunctionTypeEaseIn,
TimingFunctionTypeEaseOut,
TimingFunctionTypeEaseInOut,
TimingFunctionTypeLinear
};
enum AnimationCurveType {
AnimationCurveTypeFilter,
AnimationCurveTypeFloat,
AnimationCurveTypeScrollOffset,
AnimationCurveTypeTransform,
};
virtual AnimationCurveType type() const = 0;
};
} // namespace blink
#endif // WebAnimationCurve_h
/*
* 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.
*/
#ifndef WebAnimationDelegate_h
#define WebAnimationDelegate_h
#include "WebAnimation.h"
#define WebCompositorAnimationDelegate WebAnimationDelegate
#define WEB_ANIMATION_DELEGATE_TAKES_MONOTONIC_TIME 1
namespace blink {
class WebAnimationDelegate {
public:
virtual void notifyAnimationStarted(double monotonicTime, WebAnimation::TargetProperty) = 0;
virtual void notifyAnimationFinished(double monotonicTime, WebAnimation::TargetProperty) = 0;
};
} // namespace blink
#endif // WebAnimationDelegate_h
......@@ -5,6 +5,42 @@
#ifndef WebCompositorAnimation_h
#define WebCompositorAnimation_h
#include "WebAnimation.h"
namespace blink {
// A compositor driven animation.
class WebCompositorAnimation {
public:
enum TargetProperty {
TargetPropertyTransform = 0,
TargetPropertyOpacity,
TargetPropertyFilter,
TargetPropertyScrollOffset
};
virtual ~WebCompositorAnimation() { }
// An id is effectively the animation's name, and it is not unique.
virtual int id() = 0;
virtual TargetProperty targetProperty() const = 0;
// This is the number of times that the animation will play. If this
// value is zero the animation will not play. If it is negative, then
// the animation will loop indefinitely.
virtual int iterations() const = 0;
virtual void setIterations(int) = 0;
virtual double startTime() const = 0;
virtual void setStartTime(double monotonicTime) = 0;
virtual double timeOffset() const = 0;
virtual void setTimeOffset(double monotonicTime) = 0;
// If alternatesDirection is true, on odd numbered iterations we reverse the curve.
virtual bool alternatesDirection() const = 0;
virtual void setAlternatesDirection(bool) = 0;
};
} // namespace blink
#endif // WebCompositorAnimation_h
......@@ -5,6 +5,32 @@
#ifndef WebCompositorAnimationCurve_h
#define WebCompositorAnimationCurve_h
#include "WebAnimationCurve.h"
#define WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED 1
namespace blink {
class WebCompositorAnimationCurve {
public:
virtual ~WebCompositorAnimationCurve() { }
enum TimingFunctionType {
TimingFunctionTypeEase,
TimingFunctionTypeEaseIn,
TimingFunctionTypeEaseOut,
TimingFunctionTypeEaseInOut,
TimingFunctionTypeLinear
};
enum AnimationCurveType {
AnimationCurveTypeFilter,
AnimationCurveTypeFloat,
AnimationCurveTypeScrollOffset,
AnimationCurveTypeTransform,
};
virtual AnimationCurveType type() const = 0;
};
} // namespace blink
#endif // WebCompositorAnimationCurve_h
......@@ -5,7 +5,21 @@
#ifndef WebCompositorAnimationDelegate_h
#define WebCompositorAnimationDelegate_h
#include "WebAnimationDelegate.h"
#include "WebCommon.h"
#include "WebCompositorAnimation.h"
#endif // WebCompositorAnimationDelegate_h
#define WEB_ANIMATION_DELEGATE_TAKES_MONOTONIC_TIME 1
namespace blink {
class BLINK_PLATFORM_EXPORT WebCompositorAnimationDelegate {
public:
virtual ~WebCompositorAnimationDelegate() { }
virtual void notifyAnimationStarted(double monotonicTime, WebCompositorAnimation::TargetProperty) = 0;
virtual void notifyAnimationFinished(double monotonicTime, WebCompositorAnimation::TargetProperty) = 0;
};
} // namespace blink
#endif // WebCompositorAnimationDelegate_h
......@@ -26,9 +26,9 @@
#ifndef WebCompositorSupport_h
#define WebCompositorSupport_h
#include "WebAnimation.h"
#include "WebAnimationCurve.h"
#include "WebCommon.h"
#include "WebCompositorAnimation.h"
#include "WebCompositorAnimationCurve.h"
#include "WebFloatPoint.h"
#include "WebLayerTreeView.h"
#include "WebScrollbar.h"
......@@ -36,7 +36,7 @@
namespace blink {
class WebAnimationCurve;
class WebCompositorAnimationCurve;
class WebCompositorOutputSurface;
class WebContentLayer;
class WebContentLayerClient;
......@@ -88,7 +88,7 @@ public:
virtual WebFloatAnimationCurve* createFloatAnimationCurve() { return 0; }
virtual WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(WebFloatPoint targetValue, WebAnimationCurve::TimingFunctionType) { return 0; }
virtual WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(WebFloatPoint targetValue, WebCompositorAnimationCurve::TimingFunctionType) { return 0; }
virtual WebTransformAnimationCurve* createTransformAnimationCurve() { return 0; }
......
......@@ -31,7 +31,7 @@
#ifndef WebFilterAnimationCurve_h
#define WebFilterAnimationCurve_h
#include "WebAnimationCurve.h"
#include "WebCompositorAnimationCurve.h"
#include "WebCommon.h"
#include "WebFilterKeyframe.h"
......@@ -39,7 +39,7 @@
namespace blink {
// A keyframed filter animation curve.
class WebFilterAnimationCurve : public WebAnimationCurve {
class WebFilterAnimationCurve : public WebCompositorAnimationCurve {
public:
virtual ~WebFilterAnimationCurve() { }
......
......@@ -25,7 +25,7 @@
#ifndef WebFloatAnimationCurve_h
#define WebFloatAnimationCurve_h
#include "WebAnimationCurve.h"
#include "WebCompositorAnimationCurve.h"
#include "WebCommon.h"
#include "WebFloatKeyframe.h"
......@@ -33,7 +33,7 @@
namespace blink {
// A keyframed float animation curve.
class WebFloatAnimationCurve : public WebAnimationCurve {
class WebFloatAnimationCurve : public WebCompositorAnimationCurve {
public:
virtual ~WebFloatAnimationCurve() { }
......
......@@ -26,11 +26,10 @@
#ifndef WebLayer_h
#define WebLayer_h
#include "WebAnimation.h"
#include "WebBlendMode.h"
#include "WebColor.h"
#include "WebCommon.h"
#include "WebCompositorAnimationDelegate.h"
#include "WebCompositorAnimation.h"
#include "WebFloatPoint3D.h"
#include "WebPoint.h"
#include "WebRect.h"
......@@ -42,6 +41,7 @@ class SkMatrix44;
class SkImageFilter;
namespace blink {
class WebCompositorAnimationDelegate;
class WebFilterOperations;
class WebLayerClient;
class WebLayerScrollClient;
......@@ -131,18 +131,18 @@ public:
// stopped. The WebLayer does not take ownership of the delegate, and it is
// the responsibility of the client to reset the layer's delegate before
// deleting the delegate.
virtual void setAnimationDelegate(WebAnimationDelegate*) = 0;
virtual void setAnimationDelegate(WebCompositorAnimationDelegate*) = 0;
// Returns false if the animation cannot be added.
// Takes ownership of the WebAnimation object.
// Takes ownership of the WebCompositorAnimation object.
virtual bool addAnimation(WebCompositorAnimation*) = 0;
// Removes all animations with the given id.
virtual void removeAnimation(int animationId) = 0;
// Removes all animations with the given id targeting the given property.
virtual void removeAnimation(int animationId, WebAnimation::TargetProperty) = 0;
virtual void removeAnimation(int animationId, WebCompositorAnimation::TargetProperty) = 0;
// Pauses all animations with the given id.
virtual void pauseAnimation(int animationId, double timeOffset) = 0;
......
......@@ -5,13 +5,13 @@
#ifndef WebScrollOffsetAnimationCurve_h
#define WebScrollOffsetAnimationCurve_h
#include "WebAnimationCurve.h"
#include "WebCompositorAnimationCurve.h"
#include "WebFloatPoint.h"
namespace blink {
class WebScrollOffsetAnimationCurve : public WebAnimationCurve {
class WebScrollOffsetAnimationCurve : public WebCompositorAnimationCurve {
public:
virtual ~WebScrollOffsetAnimationCurve() { }
......
......@@ -25,7 +25,7 @@
#ifndef WebTransformAnimationCurve_h
#define WebTransformAnimationCurve_h
#include "WebAnimationCurve.h"
#include "WebCompositorAnimationCurve.h"
#include "WebCommon.h"
#include "WebTransformKeyframe.h"
......@@ -33,7 +33,7 @@
namespace blink {
// A keyframed transform animation curve.
class WebTransformAnimationCurve : public WebAnimationCurve {
class WebTransformAnimationCurve : public WebCompositorAnimationCurve {
public:
virtual ~WebTransformAnimationCurve() { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment