Commit 3aaada28 authored by cmarrin@apple.com's avatar cmarrin@apple.com

2010-12-10 Chris Marrin <cmarrin@apple.com>

        Reviewed by Simon Fraser.

        Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations
        https://bugs.webkit.org/show_bug.cgi?id=49388

        Got rid of the NonZeroBeginTimeFlag. Functionality is now hidden inside
        the implementation.

        * platform/graphics/ca/GraphicsLayerCA.cpp:
        (WebCore::GraphicsLayerCA::setAnimationOnLayer):
        * platform/graphics/ca/PlatformCAAnimation.h:
        * platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
        (hasNonZeroBeginTimeFlag):
        (setNonZeroBeginTimeFlag):
        (PlatformCAAnimation::PlatformCAAnimation):
        (PlatformCAAnimation::setBeginTime):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 036cf88c
2010-12-10 Chris Marrin <cmarrin@apple.com>
Reviewed by Simon Fraser.
Share code between Mac (CA) and Windows (CACF) GraphicsLayer implementations
https://bugs.webkit.org/show_bug.cgi?id=49388
Got rid of the NonZeroBeginTimeFlag. Functionality is now hidden inside
the implementation.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setAnimationOnLayer):
* platform/graphics/ca/PlatformCAAnimation.h:
* platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
(hasNonZeroBeginTimeFlag):
(setNonZeroBeginTimeFlag):
(PlatformCAAnimation::PlatformCAAnimation):
(PlatformCAAnimation::setBeginTime):
2010-12-10 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Pavel Feldman.
......
......@@ -1406,10 +1406,8 @@ void GraphicsLayerCA::setAnimationOnLayer(PlatformCAAnimation* caAnim, AnimatedP
{
PlatformCALayer* layer = animatedLayer(property);
if (timeOffset) {
if (timeOffset)
caAnim->setBeginTime(CACurrentMediaTime() - timeOffset);
caAnim->setNonZeroBeginTimeFlag(true);
}
String animationID = animationIdentifier(animationName, property, index);
......
......@@ -77,9 +77,6 @@ public:
AnimationType animationType() const { return m_type; }
String keyPath() const;
bool hasNonZeroBeginTimeFlag() const;
void setNonZeroBeginTimeFlag(bool value);
CFTimeInterval beginTime() const;
void setBeginTime(CFTimeInterval);
......
......@@ -42,6 +42,16 @@ using namespace WebCore;
// This value must be the same as in PlatformCALayerMac.mm
static NSString * const WKNonZeroBeginTimeFlag = @"WKPlatformCAAnimationNonZeroBeginTimeFlag";
static bool hasNonZeroBeginTimeFlag(const PlatformCAAnimation* animation)
{
return [[animation->platformAnimation() valueForKey:WKNonZeroBeginTimeFlag] boolValue];
}
static void setNonZeroBeginTimeFlag(PlatformCAAnimation* animation, bool value)
{
[animation->platformAnimation() setValue:[NSNumber numberWithBool:value] forKey:WKNonZeroBeginTimeFlag];
}
static NSString* toCAFillModeType(PlatformCAAnimation::FillModeType type)
{
switch (type) {
......@@ -196,7 +206,7 @@ PlatformCAAnimation::PlatformCAAnimation(const PlatformCAAnimation* animation)
newAnimation->setValueFunction(animation->valueFunction());
#endif
newAnimation->setNonZeroBeginTimeFlag(animation->hasNonZeroBeginTimeFlag());
setNonZeroBeginTimeFlag(newAnimation, hasNonZeroBeginTimeFlag(animation));
// Copy the specific Basic or Keyframe values
if (animation->animationType() == Keyframe) {
......@@ -213,16 +223,6 @@ PlatformCAAnimation::~PlatformCAAnimation()
{
}
bool PlatformCAAnimation::hasNonZeroBeginTimeFlag() const
{
return [[m_animation.get() valueForKey:WKNonZeroBeginTimeFlag] boolValue];
}
void PlatformCAAnimation::setNonZeroBeginTimeFlag(bool value)
{
[m_animation.get() setValue:[NSNumber numberWithBool:value] forKey:WKNonZeroBeginTimeFlag];
}
bool PlatformCAAnimation::supportsValueFunction()
{
static bool sHaveValueFunction = [CAPropertyAnimation instancesRespondToSelector:@selector(setValueFunction:)];
......@@ -247,6 +247,13 @@ CFTimeInterval PlatformCAAnimation::beginTime() const
void PlatformCAAnimation::setBeginTime(CFTimeInterval value)
{
[m_animation.get() setBeginTime:value];
// Also set a flag to tell us if we've passed in a 0 value.
// The flag is needed because later beginTime will get changed
// to the time at which it fired and we need to know whether
// or not it was 0 to begin with.
if (value)
setNonZeroBeginTimeFlag(this, true);
}
CFTimeInterval PlatformCAAnimation::duration() const
......
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