| OLD | NEW |
| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 double AnimationTimeline::currentTime() { | 216 double AnimationTimeline::currentTime() { |
| 217 return CurrentTimeInternal() * 1000; | 217 return CurrentTimeInternal() * 1000; |
| 218 } | 218 } |
| 219 | 219 |
| 220 double AnimationTimeline::CurrentTimeInternal() { | 220 double AnimationTimeline::CurrentTimeInternal() { |
| 221 bool is_null; | 221 bool is_null; |
| 222 return CurrentTimeInternal(is_null); | 222 return CurrentTimeInternal(is_null); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void AnimationTimeline::setCurrentTime(double current_time, bool is_null) { | |
| 226 SetCurrentTimeInternal(current_time / 1000); | |
| 227 } | |
| 228 | |
| 229 void AnimationTimeline::SetCurrentTimeInternal(double current_time) { | |
| 230 if (!IsActive()) | |
| 231 return; | |
| 232 zero_time_ = playback_rate_ == 0 | |
| 233 ? current_time | |
| 234 : GetDocument()->GetAnimationClock().CurrentTime() - | |
| 235 current_time / playback_rate_; | |
| 236 zero_time_initialized_ = true; | |
| 237 | |
| 238 for (const auto& animation : animations_) { | |
| 239 // The Player needs a timing update to pick up a new time. | |
| 240 animation->SetOutdated(); | |
| 241 } | |
| 242 | |
| 243 // Any corresponding compositor animation will need to be restarted. Marking | |
| 244 // the effect changed forces this. | |
| 245 SetAllCompositorPending(true); | |
| 246 } | |
| 247 | |
| 248 double AnimationTimeline::EffectiveTime() { | 225 double AnimationTimeline::EffectiveTime() { |
| 249 double time = CurrentTimeInternal(); | 226 double time = CurrentTimeInternal(); |
| 250 return std::isnan(time) ? 0 : time; | 227 return std::isnan(time) ? 0 : time; |
| 251 } | 228 } |
| 252 | 229 |
| 253 void AnimationTimeline::PauseAnimationsForTesting(double pause_time) { | 230 void AnimationTimeline::PauseAnimationsForTesting(double pause_time) { |
| 254 for (const auto& animation : animations_needing_update_) | 231 for (const auto& animation : animations_needing_update_) |
| 255 animation->PauseForTesting(pause_time); | 232 animation->PauseForTesting(pause_time); |
| 256 ServiceAnimations(kTimingUpdateOnDemand); | 233 ServiceAnimations(kTimingUpdateOnDemand); |
| 257 } | 234 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 295 } |
| 319 | 296 |
| 320 DEFINE_TRACE(AnimationTimeline) { | 297 DEFINE_TRACE(AnimationTimeline) { |
| 321 visitor->Trace(document_); | 298 visitor->Trace(document_); |
| 322 visitor->Trace(timing_); | 299 visitor->Trace(timing_); |
| 323 visitor->Trace(animations_needing_update_); | 300 visitor->Trace(animations_needing_update_); |
| 324 visitor->Trace(animations_); | 301 visitor->Trace(animations_); |
| 325 } | 302 } |
| 326 | 303 |
| 327 } // namespace blink | 304 } // namespace blink |
| OLD | NEW |