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

Side by Side Diff: Source/core/inspector/InspectorAnimationAgent.cpp

Issue 1165393002: Devtools Animations: Fix invalid memory access crash (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "core/inspector/InspectorAnimationAgent.h" 7 #include "core/inspector/InspectorAnimationAgent.h"
8 8
9 #include "core/animation/Animation.h" 9 #include "core/animation/Animation.h"
10 #include "core/animation/AnimationEffect.h" 10 #include "core/animation/AnimationEffect.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 Decimal decimal = Decimal::fromDouble(keyframe->offset() * 100); 112 Decimal decimal = Decimal::fromDouble(keyframe->offset() * 100);
113 String offset = decimal.toString(); 113 String offset = decimal.toString();
114 offset.append("%"); 114 offset.append("%");
115 115
116 RefPtr<TypeBuilder::Animation::KeyframeStyle> keyframeObject = TypeBuilder:: Animation::KeyframeStyle::create() 116 RefPtr<TypeBuilder::Animation::KeyframeStyle> keyframeObject = TypeBuilder:: Animation::KeyframeStyle::create()
117 .setOffset(offset) 117 .setOffset(offset)
118 .setEasing(keyframe->easing().toString()); 118 .setEasing(keyframe->easing().toString());
119 return keyframeObject.release(); 119 return keyframeObject.release();
120 } 120 }
121 121
122 static PassRefPtr<TypeBuilder::Animation::KeyframesRule> buildObjectForAnimation Keyframes(const KeyframeEffect* animation) 122 static PassRefPtr<TypeBuilder::Animation::KeyframesRule> buildObjectForAnimation Keyframes(const KeyframeEffect* effect)
123 { 123 {
124 if (!animation->model()->isKeyframeEffectModel()) 124 if (!effect || !effect->model() || !effect->model()->isKeyframeEffectModel() )
125 return nullptr; 125 return nullptr;
126 const KeyframeEffectModelBase* model = toKeyframeEffectModelBase(animation-> model()); 126 const KeyframeEffectModelBase* model = toKeyframeEffectModelBase(effect->mod el());
127 WillBeHeapVector<RefPtrWillBeMember<Keyframe> > normalizedKeyframes = Keyfra meEffectModelBase::normalizedKeyframesForInspector(model->getFrames()); 127 WillBeHeapVector<RefPtrWillBeMember<Keyframe> > normalizedKeyframes = Keyfra meEffectModelBase::normalizedKeyframesForInspector(model->getFrames());
128 RefPtr<TypeBuilder::Array<TypeBuilder::Animation::KeyframeStyle> > keyframes = TypeBuilder::Array<TypeBuilder::Animation::KeyframeStyle>::create(); 128 RefPtr<TypeBuilder::Array<TypeBuilder::Animation::KeyframeStyle> > keyframes = TypeBuilder::Array<TypeBuilder::Animation::KeyframeStyle>::create();
129 129
130 for (const auto& keyframe : normalizedKeyframes) { 130 for (const auto& keyframe : normalizedKeyframes) {
131 // Ignore CSS Transitions 131 // Ignore CSS Transitions
132 if (!keyframe.get()->isStringKeyframe()) 132 if (!keyframe.get()->isStringKeyframe())
133 continue; 133 continue;
134 const StringKeyframe* stringKeyframe = toStringKeyframe(keyframe.get()); 134 const StringKeyframe* stringKeyframe = toStringKeyframe(keyframe.get());
135 keyframes->addItem(buildObjectForStringKeyframe(stringKeyframe)); 135 keyframes->addItem(buildObjectForStringKeyframe(stringKeyframe));
136 } 136 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 #if ENABLE(OILPAN) 319 #if ENABLE(OILPAN)
320 visitor->trace(m_pageAgent); 320 visitor->trace(m_pageAgent);
321 visitor->trace(m_domAgent); 321 visitor->trace(m_domAgent);
322 visitor->trace(m_idToAnimation); 322 visitor->trace(m_idToAnimation);
323 visitor->trace(m_idToAnimationType); 323 visitor->trace(m_idToAnimationType);
324 #endif 324 #endif
325 InspectorBaseAgent::trace(visitor); 325 InspectorBaseAgent::trace(visitor);
326 } 326 }
327 327
328 } 328 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698