void
nsSMILAnimationController::AddStyleUpdatesTo(RestyleTracker& aTracker)
{
  MOZ_ASSERT(mMightHavePendingStyleUpdates,
             "Should only add style updates when we think we might have some");

  for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
    SVGAnimationElement* animElement = iter.Get()->GetKey();

    nsSMILTargetIdentifier key;
    if (!GetTargetIdentifierForAnimation(animElement, key)) {
      // Something's wrong/missing about animation's target; skip this animation
      continue;
    }

    // mIsCSS true means that the rules are the ones returned from
    // Element::GetSMILOverrideStyleDeclaration (via nsSMILCSSProperty objects),
    // and mIsCSS false means the rules are nsSMILMappedAttribute objects
    // returned from nsSVGElement::GetAnimatedContentStyleRule.
    nsRestyleHint rshint = key.mIsCSS ? eRestyle_StyleAttribute_Animations
                                      : eRestyle_SVGAttrAnimations;
    aTracker.AddPendingRestyle(key.mElement, rshint, nsChangeHint(0));
  }

  mMightHavePendingStyleUpdates = false;
}
Example #2
0
void
CommonAnimationManager::AddStyleUpdatesTo(RestyleTracker& aTracker)
{
    TimeStamp now = mPresContext->RefreshDriver()->MostRecentRefresh();

    PRCList* next = PR_LIST_HEAD(&mElementCollections);
    while (next != &mElementCollections) {
        AnimationPlayerCollection* collection =
            static_cast<AnimationPlayerCollection*>(next);
        next = PR_NEXT_LINK(next);

        if (!collection->mNeedsRefreshes) {
            continue;
        }

        collection->EnsureStyleRuleFor(now, EnsureStyleRule_IsNotThrottled);

        dom::Element* elementToRestyle = collection->GetElementToRestyle();
        if (elementToRestyle) {
            nsRestyleHint rshint = collection->IsForTransitions()
                                   ? eRestyle_CSSTransitions : eRestyle_CSSAnimations;
            aTracker.AddPendingRestyle(elementToRestyle, rshint, nsChangeHint(0));
        }
    }
}
Example #3
0
void
CommonAnimationManager::AddStyleUpdatesTo(RestyleTracker& aTracker)
{
  TimeStamp now = mPresContext->RefreshDriver()->MostRecentRefresh();

  for (AnimationCollection* collection = mElementCollections.getFirst();
       collection; collection = collection->getNext()) {
    collection->EnsureStyleRuleFor(now);

    dom::Element* elementToRestyle = collection->GetElementToRestyle();
    if (elementToRestyle) {
      nsRestyleHint rshint = collection->IsForTransitions()
        ? eRestyle_CSSTransitions : eRestyle_CSSAnimations;
      aTracker.AddPendingRestyle(elementToRestyle, rshint, nsChangeHint(0));
    }
  }
}
void
nsSMILAnimationController::AddStyleUpdatesTo(RestyleTracker& aTracker)
{
  MOZ_ASSERT(mMightHavePendingStyleUpdates,
             "Should only add style updates when we think we might have some");

  for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
    SVGAnimationElement* animElement = iter.Get()->GetKey();

    nsSMILTargetIdentifier key;
    if (!GetTargetIdentifierForAnimation(animElement, key)) {
      // Something's wrong/missing about animation's target; skip this animation
      continue;
    }

    aTracker.AddPendingRestyle(key.mElement,
                               eRestyle_StyleAttribute_Animations,
                               nsChangeHint(0));
  }

  mMightHavePendingStyleUpdates = false;
}