Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "core/inspector/InspectorAnimationAgent.h" | 5 #include "core/inspector/InspectorAnimationAgent.h" |
| 6 | 6 |
| 7 #include "core/animation/Animation.h" | 7 #include "core/animation/Animation.h" |
| 8 #include "core/animation/AnimationEffectReadOnly.h" | 8 #include "core/animation/AnimationEffectReadOnly.h" |
| 9 #include "core/animation/AnimationEffectTiming.h" | 9 #include "core/animation/AnimationEffectTiming.h" |
| 10 #include "core/animation/ComputedTimingProperties.h" | 10 #include "core/animation/ComputedTimingProperties.h" |
| 11 #include "core/animation/EffectModel.h" | 11 #include "core/animation/EffectModel.h" |
| 12 #include "core/animation/ElementAnimation.h" | 12 #include "core/animation/ElementAnimation.h" |
| 13 #include "core/animation/KeyframeEffect.h" | 13 #include "core/animation/KeyframeEffect.h" |
| 14 #include "core/animation/KeyframeEffectModel.h" | 14 #include "core/animation/KeyframeEffectModel.h" |
| 15 #include "core/animation/StringKeyframe.h" | 15 #include "core/animation/StringKeyframe.h" |
| 16 #include "core/css/CSSKeyframeRule.h" | 16 #include "core/css/CSSKeyframeRule.h" |
| 17 #include "core/css/CSSKeyframesRule.h" | 17 #include "core/css/CSSKeyframesRule.h" |
| 18 #include "core/css/CSSRuleList.h" | 18 #include "core/css/CSSRuleList.h" |
| 19 #include "core/css/CSSStyleRule.h" | 19 #include "core/css/CSSStyleRule.h" |
| 20 #include "core/css/resolver/StyleResolver.h" | 20 #include "core/css/resolver/StyleResolver.h" |
| 21 #include "core/dom/DOMNodeIds.h" | 21 #include "core/dom/DOMNodeIds.h" |
| 22 #include "core/dom/NodeComputedStyle.h" | 22 #include "core/dom/NodeComputedStyle.h" |
| 23 #include "core/frame/LocalFrame.h" | 23 #include "core/frame/LocalFrame.h" |
| 24 #include "core/inspector/InspectedFrames.h" | 24 #include "core/inspector/InspectedFrames.h" |
| 25 #include "core/inspector/InspectorCSSAgent.h" | 25 #include "core/inspector/InspectorCSSAgent.h" |
| 26 #include "core/inspector/InspectorDOMAgent.h" | 26 #include "core/inspector/InspectorDOMAgent.h" |
| 27 #include "core/inspector/InspectorStyleSheet.h" | 27 #include "core/inspector/InspectorStyleSheet.h" |
| 28 #include "core/inspector/V8InspectorStringView.h" | |
| 28 #include "platform/Decimal.h" | 29 #include "platform/Decimal.h" |
| 29 #include "platform/animation/TimingFunction.h" | 30 #include "platform/animation/TimingFunction.h" |
| 30 #include "platform/v8_inspector/public/V8InspectorSession.h" | 31 #include "platform/v8_inspector/public/V8InspectorSession.h" |
| 31 #include "wtf/text/Base64.h" | 32 #include "wtf/text/Base64.h" |
| 32 #include <memory> | 33 #include <memory> |
| 33 | 34 |
| 34 namespace AnimationAgentState { | 35 namespace AnimationAgentState { |
| 35 static const char animationAgentEnabled[] = "animationAgentEnabled"; | 36 static const char animationAgentEnabled[] = "animationAgentEnabled"; |
| 36 static const char animationAgentPlaybackRate[] = "animationAgentPlaybackRate"; | 37 static const char animationAgentPlaybackRate[] = "animationAgentPlaybackRate"; |
| 37 } | 38 } |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 42 static const char animationObjectGroup[] = "animation"; | |
|
caseq
2016/08/19 21:57:02
please move it into function that needs it, or use
dgozman
2016/08/20 02:04:51
Done.
| |
| 43 | |
| 41 InspectorAnimationAgent::InspectorAnimationAgent(InspectedFrames* inspectedFrame s, InspectorDOMAgent* domAgent, InspectorCSSAgent* cssAgent, v8_inspector::V8Ins pectorSession* v8Session) | 44 InspectorAnimationAgent::InspectorAnimationAgent(InspectedFrames* inspectedFrame s, InspectorDOMAgent* domAgent, InspectorCSSAgent* cssAgent, v8_inspector::V8Ins pectorSession* v8Session) |
| 42 : m_inspectedFrames(inspectedFrames) | 45 : m_inspectedFrames(inspectedFrames) |
| 43 , m_domAgent(domAgent) | 46 , m_domAgent(domAgent) |
| 44 , m_cssAgent(cssAgent) | 47 , m_cssAgent(cssAgent) |
| 45 , m_v8Session(v8Session) | 48 , m_v8Session(v8Session) |
| 46 , m_isCloning(false) | 49 , m_isCloning(false) |
| 47 { | 50 { |
| 48 } | 51 } |
| 49 | 52 |
| 50 void InspectorAnimationAgent::restore() | 53 void InspectorAnimationAgent::restore() |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 const Element* element = toKeyframeEffect(animation->effect())->target(); | 369 const Element* element = toKeyframeEffect(animation->effect())->target(); |
| 367 Document* document = element->ownerDocument(); | 370 Document* document = element->ownerDocument(); |
| 368 LocalFrame* frame = document ? document->frame() : nullptr; | 371 LocalFrame* frame = document ? document->frame() : nullptr; |
| 369 ScriptState* scriptState = frame ? ScriptState::forMainWorld(frame) : nullpt r; | 372 ScriptState* scriptState = frame ? ScriptState::forMainWorld(frame) : nullpt r; |
| 370 if (!scriptState) { | 373 if (!scriptState) { |
| 371 *errorString = "Element not associated with a document."; | 374 *errorString = "Element not associated with a document."; |
| 372 return; | 375 return; |
| 373 } | 376 } |
| 374 | 377 |
| 375 ScriptState::Scope scope(scriptState); | 378 ScriptState::Scope scope(scriptState); |
| 376 m_v8Session->releaseObjectGroup("animation"); | 379 m_v8Session->releaseObjectGroup(toV8InspectorStringView(animationObjectGroup )); |
| 377 *result = m_v8Session->wrapObject(scriptState->context(), toV8(animation, sc riptState->context()->Global(), scriptState->isolate()), "animation"); | 380 *result = m_v8Session->wrapObject(scriptState->context(), toV8(animation, sc riptState->context()->Global(), scriptState->isolate()), toV8InspectorStringView (animationObjectGroup)); |
| 378 if (!*result) | 381 if (!*result) |
| 379 *errorString = "Element not associated with a document."; | 382 *errorString = "Element not associated with a document."; |
| 380 } | 383 } |
| 381 | 384 |
| 382 static CSSPropertyID animationProperties[] = { | 385 static CSSPropertyID animationProperties[] = { |
| 383 CSSPropertyAnimationDelay, | 386 CSSPropertyAnimationDelay, |
| 384 CSSPropertyAnimationDirection, | 387 CSSPropertyAnimationDirection, |
| 385 CSSPropertyAnimationDuration, | 388 CSSPropertyAnimationDuration, |
| 386 CSSPropertyAnimationFillMode, | 389 CSSPropertyAnimationFillMode, |
| 387 CSSPropertyAnimationIterationCount, | 390 CSSPropertyAnimationIterationCount, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 { | 491 { |
| 489 visitor->trace(m_inspectedFrames); | 492 visitor->trace(m_inspectedFrames); |
| 490 visitor->trace(m_domAgent); | 493 visitor->trace(m_domAgent); |
| 491 visitor->trace(m_cssAgent); | 494 visitor->trace(m_cssAgent); |
| 492 visitor->trace(m_idToAnimation); | 495 visitor->trace(m_idToAnimation); |
| 493 visitor->trace(m_idToAnimationClone); | 496 visitor->trace(m_idToAnimationClone); |
| 494 InspectorBaseAgent::trace(visitor); | 497 InspectorBaseAgent::trace(visitor); |
| 495 } | 498 } |
| 496 | 499 |
| 497 } // namespace blink | 500 } // namespace blink |
| OLD | NEW |