void KeyframeEffect::applyEffects() { ASSERT(isInEffect()); ASSERT(animation()); if (!m_target || !m_model) return; if (hasIncompatibleStyle()) animation()->cancelAnimationOnCompositor(); double iteration = currentIteration(); ASSERT(iteration >= 0); bool changed = false; if (m_sampledEffect) { changed = m_model->sample(clampTo<int>(iteration, 0), timeFraction(), iterationDuration(), m_sampledEffect->mutableInterpolations()); } else { Vector<RefPtr<Interpolation>> interpolations; m_model->sample(clampTo<int>(iteration, 0), timeFraction(), iterationDuration(), interpolations); if (!interpolations.isEmpty()) { SampledEffect* sampledEffect = SampledEffect::create(this); sampledEffect->mutableInterpolations().swap(interpolations); m_sampledEffect = sampledEffect; ensureAnimationStack(m_target).add(sampledEffect); changed = true; } else { return; } } if (changed) { m_target->setNeedsAnimationStyleRecalc(); if (RuntimeEnabledFeatures::webAnimationsSVGEnabled() && m_target->isSVGElement()) toSVGElement(*m_target).setWebAnimationsPending(); } }
void KeyframeEffect::applyEffects() { ASSERT(isInEffect()); ASSERT(animation()); if (!m_target || !m_model) return; // Cancel composited animation of transform if a motion path has been introduced on the element. if (m_target->computedStyle() && m_target->computedStyle()->hasMotionPath() && animation()->hasActiveAnimationsOnCompositor() && animation()->affects(*m_target, CSSPropertyTransform)) { animation()->cancelAnimationOnCompositor(); } double iteration = currentIteration(); ASSERT(iteration >= 0); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> interpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullptr; // FIXME: Handle iteration values which overflow int. m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDuration(), interpolations); if (m_sampledEffect) { m_sampledEffect->setInterpolations(interpolations.release()); } else if (interpolations && !interpolations->isEmpty()) { OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create(this, interpolations.release()); m_sampledEffect = sampledEffect.get(); ensureAnimationStack(m_target).add(sampledEffect.release()); } else { return; } m_target->setNeedsAnimationStyleRecalc(); if (m_target->isSVGElement()) m_sampledEffect->applySVGUpdate(toSVGElement(*m_target)); }
PassOwnPtr<AnimationEffect::CompositableValueList> InertAnimation::sample() { updateInheritedTime(0); if (!isInEffect()) return nullptr; double iteration = currentIteration(); ASSERT(iteration >= 0); // FIXME: Handle iteration values which overflow int. return m_effect->sample(static_cast<int>(iteration), timeFraction()); }
PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > InertAnimation::sample(double inheritedTime) { updateInheritedTime(inheritedTime, TimingUpdateOnDemand); if (!isInEffect()) return nullptr; double iteration = currentIteration(); ASSERT(iteration >= 0); // FIXME: Handle iteration values which overflow int. return m_effect->sample(static_cast<int>(iteration), timeFraction(), iterationDuration()); }
void InertEffect::sample(Vector<RefPtr<Interpolation>>& result) { updateInheritedTime(m_inheritedTime, TimingUpdateOnDemand); if (!isInEffect()) { result.clear(); return; } double iteration = currentIteration(); ASSERT(iteration >= 0); m_model->sample(clampTo<int>(iteration, 0), timeFraction(), iterationDuration(), result); }
void InertEffect::sample(OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>>& result) { updateInheritedTime(m_inheritedTime, TimingUpdateOnDemand); if (!isInEffect()) { result.clear(); return; } double iteration = currentIteration(); ASSERT(iteration >= 0); // FIXME: Handle iteration values which overflow int. return m_model->sample(static_cast<int>(iteration), timeFraction(), iterationDuration(), result); }
bool Animation::applyEffects(bool previouslyInEffect) { ASSERT(isInEffect()); if (!m_target || !m_effect) return false; if (player() && !previouslyInEffect) { ensureAnimationStack(m_target.get()).add(this); m_activeInAnimationStack = true; } double iteration = currentIteration(); ASSERT(iteration >= 0); // FIXME: Handle iteration values which overflow int. m_compositableValues = m_effect->sample(static_cast<int>(iteration), timeFraction()); if (player()) { m_target->setNeedsAnimationStyleRecalc(); return true; } return false; }
void Animation::applyEffects() { ASSERT(isInEffect()); ASSERT(player()); if (!m_target || !m_effect) return; double iteration = currentIteration(); ASSERT(iteration >= 0); OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> > > interpolations = m_sampledEffect ? m_sampledEffect->mutableInterpolations() : nullptr; // FIXME: Handle iteration values which overflow int. m_effect->sample(static_cast<int>(iteration), timeFraction(), iterationDuration(), interpolations); if (m_sampledEffect) { m_sampledEffect->setInterpolations(interpolations.release()); } else if (interpolations && !interpolations->isEmpty()) { OwnPtrWillBeRawPtr<SampledEffect> sampledEffect = SampledEffect::create(this, interpolations.release()); m_sampledEffect = sampledEffect.get(); ensureAnimationStack(m_target).add(sampledEffect.release()); } else { return; } m_target->setNeedsAnimationStyleRecalc(); }