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

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

Issue 2809543002: bindings: Pass is_null flag to attribute setters when they are nullable (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | 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 "core/inspector/InspectorAnimationAgent.h" 5 #include "core/inspector/InspectorAnimationAgent.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "core/animation/Animation.h" 9 #include "core/animation/Animation.h"
10 #include "core/animation/AnimationEffectReadOnly.h" 10 #include "core/animation/AnimationEffectReadOnly.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (!response.isSuccess()) 260 if (!response.isSuccess())
261 return response; 261 return response;
262 blink::Animation* clone = AnimationClone(animation); 262 blink::Animation* clone = AnimationClone(animation);
263 if (!clone) 263 if (!clone)
264 return Response::Error("Failed to clone detached animation"); 264 return Response::Error("Failed to clone detached animation");
265 if (paused && !clone->Paused()) { 265 if (paused && !clone->Paused()) {
266 // Ensure we restore a current time if the animation is limited. 266 // Ensure we restore a current time if the animation is limited.
267 double current_time = 267 double current_time =
268 clone->timeline()->currentTime() - clone->startTime(); 268 clone->timeline()->currentTime() - clone->startTime();
269 clone->pause(); 269 clone->pause();
270 clone->setCurrentTime(current_time); 270 clone->setCurrentTime(current_time, false);
271 } else if (!paused && clone->Paused()) { 271 } else if (!paused && clone->Paused()) {
272 clone->Unpause(); 272 clone->Unpause();
273 } 273 }
274 } 274 }
275 return Response::OK(); 275 return Response::OK();
276 } 276 }
277 277
278 blink::Animation* InspectorAnimationAgent::AnimationClone( 278 blink::Animation* InspectorAnimationAgent::AnimationClone(
279 blink::Animation* animation) { 279 blink::Animation* animation) {
280 const String id = String::Number(animation->SequenceNumber()); 280 const String id = String::Number(animation->SequenceNumber());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 KeyframeEffect* new_effect = KeyframeEffect::Create( 317 KeyframeEffect* new_effect = KeyframeEffect::Create(
318 old_effect->Target(), new_model, old_effect->SpecifiedTiming()); 318 old_effect->Target(), new_model, old_effect->SpecifiedTiming());
319 is_cloning_ = true; 319 is_cloning_ = true;
320 blink::Animation* clone = 320 blink::Animation* clone =
321 blink::Animation::Create(new_effect, animation->timeline()); 321 blink::Animation::Create(new_effect, animation->timeline());
322 is_cloning_ = false; 322 is_cloning_ = false;
323 id_to_animation_clone_.Set(id, clone); 323 id_to_animation_clone_.Set(id, clone);
324 id_to_animation_.Set(String::Number(clone->SequenceNumber()), clone); 324 id_to_animation_.Set(String::Number(clone->SequenceNumber()), clone);
325 clone->play(); 325 clone->play();
326 clone->setStartTime(animation->startTime()); 326 clone->setStartTime(animation->startTime(), false);
327 327
328 animation->SetEffectSuppressed(true); 328 animation->SetEffectSuppressed(true);
329 } 329 }
330 return id_to_animation_clone_.at(id); 330 return id_to_animation_clone_.at(id);
331 } 331 }
332 332
333 Response InspectorAnimationAgent::seekAnimations( 333 Response InspectorAnimationAgent::seekAnimations(
334 std::unique_ptr<protocol::Array<String>> animation_ids, 334 std::unique_ptr<protocol::Array<String>> animation_ids,
335 double current_time) { 335 double current_time) {
336 for (size_t i = 0; i < animation_ids->length(); ++i) { 336 for (size_t i = 0; i < animation_ids->length(); ++i) {
337 String animation_id = animation_ids->get(i); 337 String animation_id = animation_ids->get(i);
338 blink::Animation* animation = nullptr; 338 blink::Animation* animation = nullptr;
339 Response response = AssertAnimation(animation_id, animation); 339 Response response = AssertAnimation(animation_id, animation);
340 if (!response.isSuccess()) 340 if (!response.isSuccess())
341 return response; 341 return response;
342 blink::Animation* clone = AnimationClone(animation); 342 blink::Animation* clone = AnimationClone(animation);
343 if (!clone) 343 if (!clone)
344 return Response::Error("Failed to clone a detached animation."); 344 return Response::Error("Failed to clone a detached animation.");
345 if (!clone->Paused()) 345 if (!clone->Paused())
346 clone->play(); 346 clone->play();
347 clone->setCurrentTime(current_time); 347 clone->setCurrentTime(current_time, false);
348 } 348 }
349 return Response::OK(); 349 return Response::OK();
350 } 350 }
351 351
352 Response InspectorAnimationAgent::releaseAnimations( 352 Response InspectorAnimationAgent::releaseAnimations(
353 std::unique_ptr<protocol::Array<String>> animation_ids) { 353 std::unique_ptr<protocol::Array<String>> animation_ids) {
354 for (size_t i = 0; i < animation_ids->length(); ++i) { 354 for (size_t i = 0; i < animation_ids->length(); ++i) {
355 String animation_id = animation_ids->get(i); 355 String animation_id = animation_ids->get(i);
356 blink::Animation* animation = id_to_animation_.at(animation_id); 356 blink::Animation* animation = id_to_animation_.at(animation_id);
357 if (animation) 357 if (animation)
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 DEFINE_TRACE(InspectorAnimationAgent) { 565 DEFINE_TRACE(InspectorAnimationAgent) {
566 visitor->Trace(inspected_frames_); 566 visitor->Trace(inspected_frames_);
567 visitor->Trace(css_agent_); 567 visitor->Trace(css_agent_);
568 visitor->Trace(id_to_animation_); 568 visitor->Trace(id_to_animation_);
569 visitor->Trace(id_to_animation_clone_); 569 visitor->Trace(id_to_animation_clone_);
570 InspectorBaseAgent::Trace(visitor); 570 InspectorBaseAgent::Trace(visitor);
571 } 571 }
572 572
573 } // namespace blink 573 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698