| Index: Source/core/inspector/InspectorDOMAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
|
| index 206ca7e8c99ff9bbc20769305b98f96034005527..e8a7a8dbc03368f053bab9299c14f813bf79ae9d 100644
|
| --- a/Source/core/inspector/InspectorDOMAgent.cpp
|
| +++ b/Source/core/inspector/InspectorDOMAgent.cpp
|
| @@ -34,6 +34,9 @@
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "bindings/core/v8/ScriptEventListener.h"
|
| #include "core/InputTypeNames.h"
|
| +#include "core/animation/AnimationNode.h"
|
| +#include "core/animation/AnimationPlayer.h"
|
| +#include "core/animation/ElementAnimation.h"
|
| #include "core/dom/Attr.h"
|
| #include "core/dom/CharacterData.h"
|
| #include "core/dom/ContainerNode.h"
|
| @@ -1351,6 +1354,54 @@ void InspectorDOMAgent::highlightFrame(
|
| }
|
| }
|
|
|
| +void InspectorDOMAgent::getAnimationPlayersForNode(ErrorString* errorString, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::DOM::AnimationPlayer> >& animationPlayersArray)
|
| +{
|
| + animationPlayersArray = TypeBuilder::Array<TypeBuilder::DOM::AnimationPlayer>::create();
|
| + Node* node = assertNode(errorString, nodeId);
|
| + if (!node)
|
| + return;
|
| + Element* element = toElement(node);
|
| + WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > players = ElementAnimation::getAnimationPlayers(*element);
|
| + for (WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> >::iterator it = players.begin(); it != players.end(); ++it) {
|
| + AnimationPlayer& player = *(it->get());
|
| + m_idToAnimationPlayer.set(player.sequenceNumber(), &player);
|
| + RefPtr<TypeBuilder::DOM::AnimationPlayer> animationPlayerObject = buildObjectForAnimationPlayer(player);
|
| + animationPlayersArray->addItem(animationPlayerObject);
|
| + }
|
| +}
|
| +
|
| +void InspectorDOMAgent::pauseAnimationPlayer(ErrorString* errorString, int sequenceNumber, RefPtr<TypeBuilder::DOM::AnimationPlayer>& animationPlayer)
|
| +{
|
| + RefPtrWillBeMember<AnimationPlayer> player = m_idToAnimationPlayer.get(sequenceNumber);
|
| + ASSERT(player);
|
| + player->pause();
|
| + animationPlayer = buildObjectForAnimationPlayer(*(player.get()));
|
| +}
|
| +
|
| +void InspectorDOMAgent::playAnimationPlayer(ErrorString* errorString, int sequenceNumber, RefPtr<TypeBuilder::DOM::AnimationPlayer>& animationPlayer)
|
| +{
|
| + RefPtrWillBeMember<AnimationPlayer> player = m_idToAnimationPlayer.get(sequenceNumber);
|
| + ASSERT(player);
|
| + player->play();
|
| + animationPlayer = buildObjectForAnimationPlayer(*(player.get()));
|
| +}
|
| +
|
| +void InspectorDOMAgent::setCurrentTimeAnimationPlayer(ErrorString* errorString, int sequenceNumber, double currentTime, RefPtr<TypeBuilder::DOM::AnimationPlayer>& animationPlayer)
|
| +{
|
| + RefPtrWillBeMember<AnimationPlayer> player = m_idToAnimationPlayer.get(sequenceNumber);
|
| + ASSERT(player);
|
| + player->setCurrentTime(currentTime);
|
| + animationPlayer = buildObjectForAnimationPlayer(*(player.get()));
|
| +}
|
| +
|
| +void InspectorDOMAgent::getStateAnimationPlayer(ErrorString* errorString, int sequenceNumber, double* currentTime, bool* isRunning)
|
| +{
|
| + RefPtrWillBeMember<AnimationPlayer> player = m_idToAnimationPlayer.get(sequenceNumber);
|
| + ASSERT(player);
|
| + *currentTime = player->currentTime();
|
| + *isRunning = !player->paused() && !player->finished();
|
| +}
|
| +
|
| void InspectorDOMAgent::hideHighlight(ErrorString*)
|
| {
|
| m_overlay->hideHighlight();
|
| @@ -1772,6 +1823,33 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > InspectorDOMAgent::build
|
| return pseudoElements.release();
|
| }
|
|
|
| +PassRefPtr<TypeBuilder::DOM::AnimationPlayer> InspectorDOMAgent::buildObjectForAnimationPlayer(AnimationPlayer& animationPlayer)
|
| +{
|
| + RefPtr<TypeBuilder::DOM::AnimationPlayer> playerObject = TypeBuilder::DOM::AnimationPlayer::create()
|
| + .setSequenceNumber(animationPlayer.sequenceNumber())
|
| + .setPaused(animationPlayer.paused())
|
| + .setFinished(animationPlayer.finished())
|
| + .setPlaybackRate(animationPlayer.playbackRate())
|
| + .setStartTime(animationPlayer.startTime())
|
| + .setCurrentTime(animationPlayer.currentTime())
|
| + .setAnimation(buildObjectForAnimationNode(*(animationPlayer.source())));
|
| + return playerObject.release();
|
| +}
|
| +
|
| +PassRefPtr<TypeBuilder::DOM::AnimationNode> InspectorDOMAgent::buildObjectForAnimationNode(AnimationNode& animationNode)
|
| +{
|
| + RefPtr<TypeBuilder::DOM::AnimationNode> animationObject = TypeBuilder::DOM::AnimationNode::create()
|
| + .setStartDelay(animationNode.specifiedTiming().startDelay)
|
| + .setPlaybackRate(animationNode.specifiedTiming().playbackRate)
|
| + .setIterationStart(animationNode.specifiedTiming().iterationStart)
|
| + .setIterationCount(animationNode.specifiedTiming().iterationCount)
|
| + .setDuration(animationNode.duration())
|
| + .setDirection(animationNode.specifiedTiming().direction)
|
| + .setFillMode(animationNode.specifiedTiming().fillMode)
|
| + .setTimeFraction(animationNode.timeFraction());
|
| + return animationObject.release();
|
| +}
|
| +
|
| Node* InspectorDOMAgent::innerFirstChild(Node* node)
|
| {
|
| node = node->firstChild();
|
| @@ -2199,6 +2277,7 @@ void InspectorDOMAgent::trace(Visitor* visitor)
|
| visitor->trace(m_document);
|
| visitor->trace(m_revalidateStyleAttrTask);
|
| visitor->trace(m_searchResults);
|
| + visitor->trace(m_idToAnimationPlayer);
|
| #endif
|
| visitor->trace(m_history);
|
| visitor->trace(m_domEditor);
|
|
|