Chromium Code Reviews| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 return element->ensureElementAnimations().defaultStack(); | 129 return element->ensureElementAnimations().defaultStack(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void KeyframeEffect::applyEffects() | 132 void KeyframeEffect::applyEffects() |
| 133 { | 133 { |
| 134 ASSERT(isInEffect()); | 134 ASSERT(isInEffect()); |
| 135 ASSERT(animation()); | 135 ASSERT(animation()); |
| 136 if (!m_target || !m_model) | 136 if (!m_target || !m_model) |
| 137 return; | 137 return; |
| 138 | 138 |
| 139 // Cancel composited animation of transform if a motion path has been introd uced on the element. | 139 // Cancel composited animation of transform if a motion path has been introd uced on the element. |
|
alancutter (OOO until 2018)
2015/06/24 01:17:09
Update comment.
soonm
2015/06/24 02:53:19
Done
| |
| 140 if (m_target->computedStyle() | 140 if (m_target->computedStyle() |
| 141 && m_target->computedStyle()->hasMotionPath() | 141 && (m_target->computedStyle()->hasMotionPath() |
| 142 || m_target->computedStyle()->translate() | |
| 143 || m_target->computedStyle()->rotate() | |
| 144 || m_target->computedStyle()->scale()) | |
| 142 && animation()->hasActiveAnimationsOnCompositor() | 145 && animation()->hasActiveAnimationsOnCompositor() |
| 143 && animation()->affects(*m_target, CSSPropertyTransform)) { | 146 && animation()->affects(*m_target, CSSPropertyTransform)) { |
| 144 animation()->cancelAnimationOnCompositor(); | 147 animation()->cancelAnimationOnCompositor(); |
| 145 } | 148 } |
| 146 | 149 |
| 147 double iteration = currentIteration(); | 150 double iteration = currentIteration(); |
| 148 ASSERT(iteration >= 0); | 151 ASSERT(iteration >= 0); |
| 149 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt r; | 152 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> inte rpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullpt r; |
| 150 // FIXME: Handle iteration values which overflow int. | 153 // FIXME: Handle iteration values which overflow int. |
| 151 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati on(), interpolations); | 154 m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDurati on(), interpolations); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 m_sampledEffect = nullptr; | 238 m_sampledEffect = nullptr; |
| 236 if (sampledEffect) | 239 if (sampledEffect) |
| 237 sampledEffect->clear(); | 240 sampledEffect->clear(); |
| 238 } | 241 } |
| 239 #endif | 242 #endif |
| 240 | 243 |
| 241 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac kRate) const | 244 bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac kRate) const |
| 242 { | 245 { |
| 243 if (!model() | 246 if (!model() |
| 244 || !m_target | 247 || !m_target |
| 245 || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPat h())) | 248 || (m_target->computedStyle() && (m_target->computedStyle()->hasMotionPa th() || m_target->computedStyle()->translate() || m_target->computedStyle()->rot ate() || m_target->computedStyle()->scale()))) |
| 246 return false; | 249 return false; |
| 247 | 250 |
| 248 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor (specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate); | 251 return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor (specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate); |
| 249 } | 252 } |
| 250 | 253 |
| 251 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime , double currentTime, double animationPlaybackRate) | 254 bool KeyframeEffect::maybeStartAnimationOnCompositor(int group, double startTime , double currentTime, double animationPlaybackRate) |
| 252 { | 255 { |
| 253 ASSERT(!hasActiveAnimationsOnCompositor()); | 256 ASSERT(!hasActiveAnimationsOnCompositor()); |
| 254 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate)) | 257 if (!isCandidateForAnimationOnCompositor(animationPlaybackRate)) |
| 255 return false; | 258 return false; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 335 |
| 333 DEFINE_TRACE(KeyframeEffect) | 336 DEFINE_TRACE(KeyframeEffect) |
| 334 { | 337 { |
| 335 visitor->trace(m_target); | 338 visitor->trace(m_target); |
| 336 visitor->trace(m_model); | 339 visitor->trace(m_model); |
| 337 visitor->trace(m_sampledEffect); | 340 visitor->trace(m_sampledEffect); |
| 338 AnimationEffect::trace(visitor); | 341 AnimationEffect::trace(visitor); |
| 339 } | 342 } |
| 340 | 343 |
| 341 } // namespace blink | 344 } // namespace blink |
| OLD | NEW |