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

Unified Diff: third_party/WebKit/Source/core/animation/Animation.cpp

Issue 2398373002: Construct KeyframeEffectReadOnly objects (Closed)
Patch Set: Test tweaks in response to review Created 4 years, 2 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: third_party/WebKit/Source/core/animation/Animation.cpp
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp
index e331b680f02168edcc1d12d5a0909129a754a557..8b9f2414f1bbeba0c50e8c9ef1c391e036445a92 100644
--- a/third_party/WebKit/Source/core/animation/Animation.cpp
+++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -32,7 +32,7 @@
#include "core/animation/AnimationTimeline.h"
#include "core/animation/CompositorPendingAnimations.h"
-#include "core/animation/KeyframeEffect.h"
+#include "core/animation/KeyframeEffectReadOnly.h"
#include "core/animation/css/CSSAnimations.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
@@ -388,10 +388,11 @@ void Animation::notifyStartTime(double timelineTime) {
}
bool Animation::affects(const Element& element, CSSPropertyID property) const {
- if (!m_content || !m_content->isKeyframeEffect())
+ if (!m_content || !m_content->isKeyframeEffectReadOnly())
return false;
- const KeyframeEffect* effect = toKeyframeEffect(m_content.get());
+ const KeyframeEffectReadOnly* effect =
+ toKeyframeEffectReadOnly(m_content.get());
return (effect->target() == &element) &&
effect->affects(PropertyHandle(property));
}
@@ -721,14 +722,15 @@ bool Animation::canStartAnimationOnCompositor() const {
(timeline() && timeline()->playbackRate() != 1))
return false;
- return m_timeline && m_content && m_content->isKeyframeEffect() && playing();
+ return m_timeline && m_content && m_content->isKeyframeEffectReadOnly() &&
+ playing();
}
bool Animation::isCandidateForAnimationOnCompositor() const {
if (!canStartAnimationOnCompositor())
return false;
- return toKeyframeEffect(m_content.get())
+ return toKeyframeEffectReadOnly(m_content.get())
->isCandidateForAnimationOnCompositor(m_playbackRate);
}
@@ -750,7 +752,7 @@ bool Animation::maybeStartAnimationOnCompositor() {
timeOffset = timeOffset / fabs(m_playbackRate);
}
DCHECK_NE(m_compositorGroup, 0);
- return toKeyframeEffect(m_content.get())
+ return toKeyframeEffectReadOnly(m_content.get())
->maybeStartAnimationOnCompositor(m_compositorGroup, startTime,
timeOffset, m_playbackRate);
}
@@ -777,27 +779,28 @@ void Animation::setCompositorPending(bool effectChanged) {
void Animation::cancelAnimationOnCompositor() {
if (hasActiveAnimationsOnCompositor())
- toKeyframeEffect(m_content.get())->cancelAnimationOnCompositor();
+ toKeyframeEffectReadOnly(m_content.get())->cancelAnimationOnCompositor();
destroyCompositorPlayer();
}
void Animation::restartAnimationOnCompositor() {
if (hasActiveAnimationsOnCompositor())
- toKeyframeEffect(m_content.get())->restartAnimationOnCompositor();
+ toKeyframeEffectReadOnly(m_content.get())->restartAnimationOnCompositor();
}
void Animation::cancelIncompatibleAnimationsOnCompositor() {
- if (m_content && m_content->isKeyframeEffect())
- toKeyframeEffect(m_content.get())
+ if (m_content && m_content->isKeyframeEffectReadOnly())
+ toKeyframeEffectReadOnly(m_content.get())
->cancelIncompatibleAnimationsOnCompositor();
}
bool Animation::hasActiveAnimationsOnCompositor() {
- if (!m_content || !m_content->isKeyframeEffect())
+ if (!m_content || !m_content->isKeyframeEffectReadOnly())
return false;
- return toKeyframeEffect(m_content.get())->hasActiveAnimationsOnCompositor();
+ return toKeyframeEffectReadOnly(m_content.get())
+ ->hasActiveAnimationsOnCompositor();
}
bool Animation::update(TimingUpdateReason reason) {
@@ -947,9 +950,9 @@ void Animation::attachCompositedLayers() {
return;
DCHECK(m_content);
- DCHECK(m_content->isKeyframeEffect());
+ DCHECK(m_content->isKeyframeEffectReadOnly());
- toKeyframeEffect(m_content.get())->attachCompositedLayers();
+ toKeyframeEffectReadOnly(m_content.get())->attachCompositedLayers();
}
void Animation::detachCompositedLayers() {
@@ -1077,7 +1080,7 @@ void Animation::pauseForTesting(double pauseTime) {
RELEASE_ASSERT(!paused());
setCurrentTimeInternal(pauseTime, TimingUpdateOnDemand);
if (hasActiveAnimationsOnCompositor())
- toKeyframeEffect(m_content.get())
+ toKeyframeEffectReadOnly(m_content.get())
->pauseAnimationForTestingOnCompositor(currentTimeInternal());
m_isPausedForTesting = true;
pause();
@@ -1095,10 +1098,10 @@ void Animation::disableCompositedAnimationForTesting() {
}
void Animation::invalidateKeyframeEffect(const TreeScope& treeScope) {
- if (!m_content || !m_content->isKeyframeEffect())
+ if (!m_content || !m_content->isKeyframeEffectReadOnly())
return;
- Element& target = *toKeyframeEffect(m_content.get())->target();
+ Element& target = *toKeyframeEffectReadOnly(m_content.get())->target();
if (CSSAnimations::isAffectedByKeyframesFromScope(target, treeScope))
target.setNeedsStyleRecalc(LocalStyleChange,

Powered by Google App Engine
This is Rietveld 408576698