Exemplo n.º 1
0
void
Animation::PostUpdate()
{
  if (!mEffect) {
    return;
  }

  KeyframeEffectReadOnly* keyframeEffect = mEffect->AsKeyframeEffect();
  if (!keyframeEffect) {
    return;
  }

  Maybe<NonOwningAnimationTarget> target = keyframeEffect->GetTarget();
  if (!target) {
    return;
  }

  nsPresContext* presContext = keyframeEffect->GetPresContext();
  if (!presContext) {
    return;
  }

  presContext->EffectCompositor()
             ->RequestRestyle(target->mElement,
                              target->mPseudoType,
                              EffectCompositor::RestyleType::Layer,
                              CascadeLevel());
}
Exemplo n.º 2
0
static inline Element*
GetTarget(Animation* aAnimation)
{
  KeyframeEffectReadOnly* effect = aAnimation->GetEffect();
  if (!effect) {
    return nullptr;
  }

  Element* target;
  nsCSSPseudoElements::Type pseudoType;
  effect->GetTarget(target, pseudoType);

  // If the animation targets a pseudo-element, we don't dispatch
  // notifications for it.  (In the future we will have PseudoElement
  // objects we can use as the target of the notifications.)
  if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
    return nullptr;
  }

  return effect->GetTarget();
}
Exemplo n.º 3
0
Maybe<NonOwningAnimationTarget>
nsNodeUtils::GetTargetForAnimation(const Animation* aAnimation)
{
  KeyframeEffectReadOnly* effect = aAnimation->GetEffect();
  return effect ? effect->GetTarget() : Nothing();
}