コード例 #1
0
bool
CSSAnimation::HasLowerCompositeOrderThan(const Animation& aOther) const
{
  // 0. Object-equality case
  if (&aOther == this) {
    return false;
  }

  // 1. Transitions sort lower
  //
  // FIXME: We need to differentiate between transitions and generic Animations.
  // Generic animations don't exist yet (that's bug 1096773) so for now we're
  // ok.
  const CSSAnimation* otherAnimation = aOther.AsCSSAnimation();
  if (!otherAnimation) {
    MOZ_ASSERT(aOther.AsCSSTransition(),
               "Animation being compared is a CSS transition");
    return false;
  }

  // 2. CSS animations using custom composite ordering (i.e. those that
  //    correspond to an animation-name property) sort lower than other CSS
  //    animations (e.g. those created or kept-alive by script).
  if (!IsUsingCustomCompositeOrder()) {
    return !aOther.IsUsingCustomCompositeOrder() ?
           Animation::HasLowerCompositeOrderThan(aOther) :
           false;
  }
  if (!aOther.IsUsingCustomCompositeOrder()) {
    return true;
  }

  // 3. Sort by document order
  MOZ_ASSERT(mOwningElement.IsSet() && otherAnimation->OwningElement().IsSet(),
             "Animations using custom composite order should have an "
             "owning element");
  if (!mOwningElement.Equals(otherAnimation->OwningElement())) {
    return mOwningElement.LessThan(otherAnimation->OwningElement());
  }

  // 4. (Same element and pseudo): Sort by position in animation-name
  return mSequenceNum < otherAnimation->mSequenceNum;
}
コード例 #2
0
bool
CSSAnimation::HasLowerCompositeOrderThan(const Animation& aOther) const
{
  // 0. Object-equality case
  if (&aOther == this) {
    return false;
  }

  // 1. Transitions sort lower
  //
  // FIXME: We need to differentiate between transitions and generic Animations.
  // Generic animations don't exist yet (that's bug 1096773) so for now we're
  // ok.
  const CSSAnimation* otherAnimation = aOther.AsCSSAnimation();
  if (!otherAnimation) {
    MOZ_ASSERT(aOther.AsCSSTransition(),
               "Animation being compared is a CSS transition");
    return false;
  }

  // 2. CSS animations that correspond to an animation-name property sort lower
  //    than other CSS animations (e.g. those created or kept-alive by script).
  if (!IsTiedToMarkup()) {
    return !otherAnimation->IsTiedToMarkup() ?
           Animation::HasLowerCompositeOrderThan(aOther) :
           false;
  }
  if (!otherAnimation->IsTiedToMarkup()) {
    return true;
  }

  // 3. Sort by document order
  if (!mOwningElement.Equals(otherAnimation->mOwningElement)) {
    return mOwningElement.LessThan(otherAnimation->mOwningElement);
  }

  // 4. (Same element and pseudo): Sort by position in animation-name
  return mAnimationIndex < otherAnimation->mAnimationIndex;
}
コード例 #3
0
bool
CSSTransition::HasLowerCompositeOrderThan(const Animation& aOther) const
{
    // 0. Object-equality case
    if (&aOther == this) {
        return false;
    }

    // 1. Transitions sort lowest
    const CSSTransition* otherTransition = aOther.AsCSSTransition();
    if (!otherTransition) {
        return true;
    }

    // 2. CSS transitions that correspond to a transition-property property sort
    // lower than CSS transitions owned by script.
    if (!IsTiedToMarkup()) {
        return !otherTransition->IsTiedToMarkup() ?
               Animation::HasLowerCompositeOrderThan(aOther) :
               false;
    }
    if (!otherTransition->IsTiedToMarkup()) {
        return true;
    }

    // 3. Sort by document order
    if (!mOwningElement.Equals(otherTransition->mOwningElement)) {
        return mOwningElement.LessThan(otherTransition->mOwningElement);
    }

    // 4. (Same element and pseudo): Sort by transition generation
    if (mAnimationIndex != otherTransition->mAnimationIndex) {
        return mAnimationIndex < otherTransition->mAnimationIndex;
    }

    // 5. (Same transition generation): Sort by transition property
    return nsCSSProps::GetStringValue(TransitionProperty()) <
           nsCSSProps::GetStringValue(otherTransition->TransitionProperty());
}