[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.16.0esr-13.5-1] Bug 1923344. a=diannaS



Title: GitLab

ma1 pushed to branch mullvad-browser-115.16.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser

Commits:

  • 0697953d
    by Emilio Cobos Álvarez at 2024-10-08T20:49:30+02:00
    Bug 1923344.  a=diannaS
    
    Original Revision: https://phabricator.services.mozilla.com/D224958
    
    Differential Revision: https://phabricator.services.mozilla.com/D224963

2 changed files:

Changes:

  • dom/animation/AnimationTimeline.cpp
    ... ... @@ -41,41 +41,33 @@ AnimationTimeline::~AnimationTimeline() { mAnimationOrder.clear(); }
    41 41
     bool AnimationTimeline::Tick() {
    
    42 42
       bool needsTicks = false;
    
    43 43
     
    
    44
    -  nsTArray<Animation*> animationsToRemove;
    
    45
    -
    
    46
    -  for (Animation* animation = mAnimationOrder.getFirst(); animation;
    
    47
    -       animation =
    
    48
    -           static_cast<LinkedListElement<Animation>*>(animation)->getNext()) {
    
    44
    +  AutoTArray<RefPtr<Animation>, 32> animationsToTick;
    
    45
    +  for (Animation* animation : mAnimationOrder) {
    
    49 46
         MOZ_ASSERT(mAnimations.Contains(animation),
    
    50 47
                    "The sampling order list should be a subset of the hashset");
    
    51 48
         MOZ_ASSERT(!animation->IsHiddenByContentVisibility(),
    
    52 49
                    "The sampling order list should not contain any animations "
    
    53 50
                    "that are hidden by content-visibility");
    
    51
    +    animationsToTick.AppendElement(animation);
    
    52
    +  }
    
    54 53
     
    
    54
    +  for (Animation* animation : animationsToTick) {
    
    55 55
         // Skip any animations that are longer need associated with this timeline.
    
    56 56
         if (animation->GetTimeline() != this) {
    
    57
    -      // If animation has some other timeline, it better not be also in the
    
    58
    -      // animation list of this timeline object!
    
    59
    -      MOZ_ASSERT(!animation->GetTimeline());
    
    60
    -      animationsToRemove.AppendElement(animation);
    
    57
    +      RemoveAnimation(animation);
    
    61 58
           continue;
    
    62 59
         }
    
    63 60
     
    
    64 61
         needsTicks |= animation->NeedsTicks();
    
    65
    -    // Even if |animation| doesn't need future ticks, we should still
    
    66
    -    // Tick it this time around since it might just need a one-off tick in
    
    67
    -    // order to dispatch events.
    
    62
    +    // Even if |animation| doesn't need future ticks, we should still Tick it
    
    63
    +    // this time around since it might just need a one-off tick in order to
    
    64
    +    // dispatch events.
    
    68 65
         animation->Tick();
    
    69
    -
    
    70 66
         if (!animation->NeedsTicks()) {
    
    71
    -      animationsToRemove.AppendElement(animation);
    
    67
    +      RemoveAnimation(animation);
    
    72 68
         }
    
    73 69
       }
    
    74 70
     
    
    75
    -  for (Animation* animation : animationsToRemove) {
    
    76
    -    RemoveAnimation(animation);
    
    77
    -  }
    
    78
    -
    
    79 71
       return needsTicks;
    
    80 72
     }
    
    81 73
     
    
    ... ... @@ -91,11 +83,12 @@ void AnimationTimeline::NotifyAnimationUpdated(Animation& aAnimation) {
    91 83
     }
    
    92 84
     
    
    93 85
     void AnimationTimeline::RemoveAnimation(Animation* aAnimation) {
    
    94
    -  MOZ_ASSERT(!aAnimation->GetTimeline() || aAnimation->GetTimeline() == this);
    
    95
    -  if (static_cast<LinkedListElement<Animation>*>(aAnimation)->isInList()) {
    
    86
    +  if (static_cast<LinkedListElement<Animation>*>(aAnimation)->isInList() &&
    
    87
    +      MOZ_LIKELY(!aAnimation->GetTimeline() ||
    
    88
    +                 aAnimation->GetTimeline() == this)) {
    
    89
    +    static_cast<LinkedListElement<Animation>*>(aAnimation)->remove();
    
    96 90
         MOZ_ASSERT(mAnimations.Contains(aAnimation),
    
    97 91
                    "The sampling order list should be a subset of the hashset");
    
    98
    -    static_cast<LinkedListElement<Animation>*>(aAnimation)->remove();
    
    99 92
       }
    
    100 93
       mAnimations.Remove(aAnimation);
    
    101 94
     }
    

  • dom/animation/ScrollTimelineAnimationTracker.cpp
    ... ... @@ -13,13 +13,10 @@ namespace mozilla {
    13 13
     NS_IMPL_CYCLE_COLLECTION(ScrollTimelineAnimationTracker, mPendingSet, mDocument)
    
    14 14
     
    
    15 15
     void ScrollTimelineAnimationTracker::TriggerPendingAnimations() {
    
    16
    -  for (auto iter = mPendingSet.begin(), end = mPendingSet.end(); iter != end;
    
    17
    -       ++iter) {
    
    18
    -    dom::Animation* animation = *iter;
    
    19
    -
    
    16
    +  for (RefPtr<dom::Animation>& animation :
    
    17
    +       ToTArray<AutoTArray<RefPtr<dom::Animation>, 32>>(mPendingSet)) {
    
    20 18
         MOZ_ASSERT(animation->GetTimeline() &&
    
    21 19
                    !animation->GetTimeline()->IsMonotonicallyIncreasing());
    
    22
    -
    
    23 20
         // FIXME: Trigger now may not be correct because the spec says:
    
    24 21
         // If a user agent determines that animation is immediately ready, it may
    
    25 22
         // schedule the task (i.e. ResumeAt()) as a microtask such that it runs at
    
    ... ... @@ -39,9 +36,7 @@ void ScrollTimelineAnimationTracker::TriggerPendingAnimations() {
    39 36
           // inactive, and this also matches the current spec definition.
    
    40 37
           continue;
    
    41 38
         }
    
    42
    -
    
    43
    -    // Note: Remove() is legitimately called once per entry during the loop.
    
    44
    -    mPendingSet.Remove(iter);
    
    39
    +    mPendingSet.Remove(animation);
    
    45 40
       }
    
    46 41
     }
    
    47 42
     
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits