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

Side by Side Diff: third_party/WebKit/Source/core/animation/Animation.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 double Animation::EffectEnd() const { 130 double Animation::EffectEnd() const {
131 return content_ ? content_->EndTimeInternal() : 0; 131 return content_ ? content_->EndTimeInternal() : 0;
132 } 132 }
133 133
134 bool Animation::Limited(double current_time) const { 134 bool Animation::Limited(double current_time) const {
135 return (playback_rate_ < 0 && current_time <= 0) || 135 return (playback_rate_ < 0 && current_time <= 0) ||
136 (playback_rate_ > 0 && current_time >= EffectEnd()); 136 (playback_rate_ > 0 && current_time >= EffectEnd());
137 } 137 }
138 138
139 void Animation::setCurrentTime(double new_current_time) { 139 void Animation::setCurrentTime(double new_current_time, bool is_null) {
140 PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand); 140 PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand);
141 141
142 if (PlayStateInternal() == kIdle) 142 if (PlayStateInternal() == kIdle)
143 paused_ = true; 143 paused_ = true;
144 144
145 current_time_pending_ = false; 145 current_time_pending_ = false;
146 play_state_ = kUnset; 146 play_state_ = kUnset;
147 SetCurrentTimeInternal(new_current_time / 1000, kTimingUpdateOnDemand); 147 SetCurrentTimeInternal(new_current_time / 1000, kTimingUpdateOnDemand);
148 148
149 if (CalculatePlayState() == kFinished) 149 if (CalculatePlayState() == kFinished)
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 double Animation::CalculateStartTime(double current_time) const { 404 double Animation::CalculateStartTime(double current_time) const {
405 return timeline_->EffectiveTime() - current_time / playback_rate_; 405 return timeline_->EffectiveTime() - current_time / playback_rate_;
406 } 406 }
407 407
408 double Animation::CalculateCurrentTime() const { 408 double Animation::CalculateCurrentTime() const {
409 if (IsNull(start_time_) || !timeline_) 409 if (IsNull(start_time_) || !timeline_)
410 return 0; 410 return 0;
411 return (timeline_->EffectiveTime() - start_time_) * playback_rate_; 411 return (timeline_->EffectiveTime() - start_time_) * playback_rate_;
412 } 412 }
413 413
414 void Animation::setStartTime(double start_time) { 414 void Animation::setStartTime(double start_time, bool is_null) {
415 PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand); 415 PlayStateUpdateScope update_scope(*this, kTimingUpdateOnDemand);
416 416
417 if (start_time == start_time_) 417 if (start_time == start_time_)
418 return; 418 return;
419 419
420 current_time_pending_ = false; 420 current_time_pending_ = false;
421 play_state_ = kUnset; 421 play_state_ = kUnset;
422 paused_ = false; 422 paused_ = false;
423 SetStartTimeInternal(start_time / 1000); 423 SetStartTimeInternal(start_time / 1000);
424 } 424 }
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 DCHECK(!compositor_player_); 1175 DCHECK(!compositor_player_);
1176 } 1176 }
1177 1177
1178 void Animation::CompositorAnimationPlayerHolder::Detach() { 1178 void Animation::CompositorAnimationPlayerHolder::Detach() {
1179 DCHECK(compositor_player_); 1179 DCHECK(compositor_player_);
1180 compositor_player_->SetAnimationDelegate(nullptr); 1180 compositor_player_->SetAnimationDelegate(nullptr);
1181 animation_ = nullptr; 1181 animation_ = nullptr;
1182 compositor_player_.reset(); 1182 compositor_player_.reset();
1183 } 1183 }
1184 } // namespace blink 1184 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/Animation.h ('k') | third_party/WebKit/Source/core/animation/AnimationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698