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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.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/inspector/InspectorAnimationAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
index ca6e4b9bfdb4971d08e8e17fffdf151aeb2a5952..e745c4b54579813143f1a635e8f7f184ef7a8faf 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -10,8 +10,8 @@
#include "core/animation/ComputedTimingProperties.h"
#include "core/animation/EffectModel.h"
#include "core/animation/ElementAnimation.h"
-#include "core/animation/KeyframeEffect.h"
#include "core/animation/KeyframeEffectModel.h"
+#include "core/animation/KeyframeEffectReadOnly.h"
#include "core/animation/StringKeyframe.h"
#include "core/css/CSSKeyframeRule.h"
#include "core/css/CSSKeyframesRule.h"
@@ -92,7 +92,8 @@ void InspectorAnimationAgent::didCommitLoadForLocalFrame(LocalFrame* frame) {
}
static std::unique_ptr<protocol::Animation::AnimationEffect>
-buildObjectForAnimationEffect(KeyframeEffect* effect, bool isTransition) {
+buildObjectForAnimationEffect(KeyframeEffectReadOnly* effect,
+ bool isTransition) {
ComputedTimingProperties computedTiming = effect->getComputedTiming();
double delay = computedTiming.delay();
double duration = computedTiming.duration().getAsUnrestrictedDouble();
@@ -145,7 +146,7 @@ buildObjectForStringKeyframe(const StringKeyframe* keyframe) {
}
static std::unique_ptr<protocol::Animation::KeyframesRule>
-buildObjectForAnimationKeyframes(const KeyframeEffect* effect) {
+buildObjectForAnimationKeyframes(const KeyframeEffectReadOnly* effect) {
if (!effect || !effect->model() || !effect->model()->isKeyframeEffectModel())
return nullptr;
const KeyframeEffectModelBase* model =
@@ -170,7 +171,8 @@ buildObjectForAnimationKeyframes(const KeyframeEffect* effect) {
std::unique_ptr<protocol::Animation::Animation>
InspectorAnimationAgent::buildObjectForAnimation(blink::Animation& animation) {
- const Element* element = toKeyframeEffect(animation.effect())->target();
+ const Element* element =
+ toKeyframeEffectReadOnly(animation.effect())->target();
CSSAnimations& cssAnimations = element->elementAnimations()->cssAnimations();
std::unique_ptr<protocol::Animation::KeyframesRule> keyframeRule = nullptr;
String animationType;
@@ -180,8 +182,8 @@ InspectorAnimationAgent::buildObjectForAnimation(blink::Animation& animation) {
animationType = AnimationType::CSSTransition;
} else {
// Keyframe based animations
- keyframeRule =
- buildObjectForAnimationKeyframes(toKeyframeEffect(animation.effect()));
+ keyframeRule = buildObjectForAnimationKeyframes(
+ toKeyframeEffectReadOnly(animation.effect()));
animationType = cssAnimations.isAnimationForInspector(animation)
? AnimationType::CSSAnimation
: AnimationType::WebAnimation;
@@ -193,7 +195,7 @@ InspectorAnimationAgent::buildObjectForAnimation(blink::Animation& animation) {
std::unique_ptr<protocol::Animation::AnimationEffect> animationEffectObject =
buildObjectForAnimationEffect(
- toKeyframeEffect(animation.effect()),
+ toKeyframeEffectReadOnly(animation.effect()),
animationType == AnimationType::CSSTransition);
animationEffectObject->setKeyframesRule(std::move(keyframeRule));
@@ -275,7 +277,8 @@ blink::Animation* InspectorAnimationAgent::animationClone(
blink::Animation* animation) {
const String id = String::number(animation->sequenceNumber());
if (!m_idToAnimationClone.get(id)) {
- KeyframeEffect* oldEffect = toKeyframeEffect(animation->effect());
+ KeyframeEffectReadOnly* oldEffect =
+ toKeyframeEffectReadOnly(animation->effect());
ASSERT(oldEffect->model()->isKeyframeEffectModel());
KeyframeEffectModelBase* oldModel =
toKeyframeEffectModelBase(oldEffect->model());
@@ -408,7 +411,8 @@ void InspectorAnimationAgent::resolveAnimation(
return;
if (m_idToAnimationClone.get(animationId))
animation = m_idToAnimationClone.get(animationId);
- const Element* element = toKeyframeEffect(animation->effect())->target();
+ const Element* element =
+ toKeyframeEffectReadOnly(animation->effect())->target();
Document* document = element->ownerDocument();
LocalFrame* frame = document ? document->frame() : nullptr;
ScriptState* scriptState = frame ? ScriptState::forMainWorld(frame) : nullptr;
@@ -452,7 +456,7 @@ String InspectorAnimationAgent::createCSSId(blink::Animation& animation) {
m_idToAnimationType.get(String::number(animation.sequenceNumber()));
ASSERT(type != AnimationType::WebAnimation);
- KeyframeEffect* effect = toKeyframeEffect(animation.effect());
+ KeyframeEffectReadOnly* effect = toKeyframeEffectReadOnly(animation.effect());
Vector<CSSPropertyID> cssProperties;
if (type == AnimationType::CSSAnimation) {
for (CSSPropertyID property : animationProperties)

Powered by Google App Engine
This is Rietveld 408576698