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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp

Issue 1471193008: Devtools Animations: Maintain playback rate on navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac5d730ee450035e77ebc18993c7bbf84131542a..9422935bf913b95ae731ff5619164956b2e2c6c2 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -34,6 +34,7 @@
namespace AnimationAgentState {
static const char animationAgentEnabled[] = "animationAgentEnabled";
+static const char animationAgentPlaybackRate[] = "animationAgentPlaybackRate";
}
namespace blink {
@@ -60,11 +61,15 @@ void InspectorAnimationAgent::enable(ErrorString*)
{
m_state->setBoolean(AnimationAgentState::animationAgentEnabled, true);
m_instrumentingAgents->setInspectorAnimationAgent(this);
+ double playbackRate = m_state->getDouble(AnimationAgentState::animationAgentPlaybackRate);
pfeldman 2015/11/27 03:53:30 State should be clean on enable, this code belongs
samli 2015/11/27 04:10:55 Oh, didn't realise restore() is called during the
+ if (playbackRate != 1 && playbackRate != 0)
pfeldman 2015/11/27 03:53:30 why don't you restore 1 and 0?
samli 2015/11/27 04:10:55 No need to restore 1, already 1. If its not in the
+ setPlaybackRate(nullptr, playbackRate);
}
void InspectorAnimationAgent::disable(ErrorString*)
{
- setPlaybackRate(nullptr, 1);
+ for (LocalFrame* frame : *m_inspectedFrames)
+ frame->document()->timeline().setPlaybackRate(1);
m_state->setBoolean(AnimationAgentState::animationAgentEnabled, false);
pfeldman 2015/11/27 03:53:30 You need to clear the rate here as well.
samli 2015/11/27 04:10:55 Done.
m_instrumentingAgents->setInspectorAnimationAgent(nullptr);
m_idToAnimation.clear();
@@ -72,6 +77,11 @@ void InspectorAnimationAgent::disable(ErrorString*)
m_idToAnimationClone.clear();
}
+void InspectorAnimationAgent::clearFrontend()
+{
+ setPlaybackRate(nullptr, 1);
pfeldman 2015/11/27 03:53:30 Nothing should happen upon front-end disconnect -
samli 2015/11/27 04:10:55 Done.
+}
+
void InspectorAnimationAgent::didCommitLoadForLocalFrame(LocalFrame* frame)
{
if (frame == m_inspectedFrames->root()) {
@@ -79,6 +89,9 @@ void InspectorAnimationAgent::didCommitLoadForLocalFrame(LocalFrame* frame)
m_idToAnimationType.clear();
m_idToAnimationClone.clear();
}
+ double playbackRate = m_state->getDouble(AnimationAgentState::animationAgentPlaybackRate);
+ if (playbackRate != 1 && playbackRate != 0)
+ setPlaybackRate(nullptr, playbackRate);
}
static PassRefPtr<TypeBuilder::Animation::AnimationEffect> buildObjectForAnimationEffect(KeyframeEffect* effect, bool isTransition)
@@ -197,6 +210,7 @@ void InspectorAnimationAgent::setPlaybackRate(ErrorString*, double playbackRate)
{
for (LocalFrame* frame : *m_inspectedFrames)
frame->document()->timeline().setPlaybackRate(playbackRate);
+ m_state->setDouble(AnimationAgentState::animationAgentPlaybackRate, playbackRate);
}
void InspectorAnimationAgent::getCurrentTime(ErrorString* errorString, const String& id, double* currentTime)
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698