Title: [259604] branches/safari-609-branch/Source/WebCore
Revision
259604
Author
[email protected]
Date
2020-04-06 16:05:24 -0700 (Mon, 06 Apr 2020)

Log Message

Cherry-pick r259538. rdar://problem/61352452

    Additional sanity checks in compareAnimationsByCompositeOrder()
    https://bugs.webkit.org/show_bug.cgi?id=209996

    Reviewed by Geoffrey Garen.

    compareAnimationsByCompositeOrder() is used by std::sort() which requires strict weak ordering.
    This adds additional checks to ensure strict weak ordering is maintained, first by ensuring
    the transitionProperty string is different before returning that comparison, then by only using
    if the animation is a CSSTransition or CSSAnimation if the left hand and right hand sides differ.
    This should leave all remaining cases to sort by the global animation list.

    No new tests; this should be covered by existing tests and should not change functionality
    otherwise.

    * animation/WebAnimationUtilities.cpp:
    (WebCore::compareAnimationsByCompositeOrder):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259538 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (259603 => 259604)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-04-06 23:05:21 UTC (rev 259603)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-04-06 23:05:24 UTC (rev 259604)
@@ -1,5 +1,48 @@
 2020-04-06  Alan Coon  <[email protected]>
 
+        Cherry-pick r259538. rdar://problem/61352452
+
+    Additional sanity checks in compareAnimationsByCompositeOrder()
+    https://bugs.webkit.org/show_bug.cgi?id=209996
+    
+    Reviewed by Geoffrey Garen.
+    
+    compareAnimationsByCompositeOrder() is used by std::sort() which requires strict weak ordering.
+    This adds additional checks to ensure strict weak ordering is maintained, first by ensuring
+    the transitionProperty string is different before returning that comparison, then by only using
+    if the animation is a CSSTransition or CSSAnimation if the left hand and right hand sides differ.
+    This should leave all remaining cases to sort by the global animation list.
+    
+    No new tests; this should be covered by existing tests and should not change functionality
+    otherwise.
+    
+    * animation/WebAnimationUtilities.cpp:
+    (WebCore::compareAnimationsByCompositeOrder):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-04  Doug Kelly  <[email protected]>
+
+            Additional sanity checks in compareAnimationsByCompositeOrder()
+            https://bugs.webkit.org/show_bug.cgi?id=209996
+
+            Reviewed by Geoffrey Garen.
+
+            compareAnimationsByCompositeOrder() is used by std::sort() which requires strict weak ordering.
+            This adds additional checks to ensure strict weak ordering is maintained, first by ensuring
+            the transitionProperty string is different before returning that comparison, then by only using
+            if the animation is a CSSTransition or CSSAnimation if the left hand and right hand sides differ.
+            This should leave all remaining cases to sort by the global animation list.
+
+            No new tests; this should be covered by existing tests and should not change functionality
+            otherwise.
+
+            * animation/WebAnimationUtilities.cpp:
+            (WebCore::compareAnimationsByCompositeOrder):
+
+2020-04-06  Alan Coon  <[email protected]>
+
         Cherry-pick r259519. rdar://problem/61352446
 
     ASSERTION FAILED: objectStoreInfo in SQLiteIDBBackingStore::getRecord

Modified: branches/safari-609-branch/Source/WebCore/animation/WebAnimationUtilities.cpp (259603 => 259604)


--- branches/safari-609-branch/Source/WebCore/animation/WebAnimationUtilities.cpp	2020-04-06 23:05:21 UTC (rev 259603)
+++ branches/safari-609-branch/Source/WebCore/animation/WebAnimationUtilities.cpp	2020-04-06 23:05:24 UTC (rev 259604)
@@ -44,16 +44,19 @@
     bool lhsIsCSSTransition = lhsHasOwningElement && is<CSSTransition>(lhsAnimation);
     bool rhsIsCSSTransition = rhsHasOwningElement && is<CSSTransition>(rhsAnimation);
     if (lhsIsCSSTransition || rhsIsCSSTransition) {
-        if (lhsIsCSSTransition == rhsIsCSSTransition) {
-            // Sort transitions first by their generation time, and then by transition-property.
-            // https://drafts.csswg.org/css-transitions-2/#animation-composite-order
-            auto& lhsCSSTransition = downcast<CSSTransition>(lhsAnimation);
-            auto& rhsCSSTransition = downcast<CSSTransition>(rhsAnimation);
-            if (lhsCSSTransition.generationTime() != rhsCSSTransition.generationTime())
-                return lhsCSSTransition.generationTime() < rhsCSSTransition.generationTime();
-            return lhsCSSTransition.transitionProperty().utf8() < rhsCSSTransition.transitionProperty().utf8();
-        }
-        return !rhsIsCSSTransition;
+        if (lhsIsCSSTransition != rhsIsCSSTransition)
+            return !rhsIsCSSTransition;
+
+        // Sort transitions first by their generation time, and then by transition-property.
+        // https://drafts.csswg.org/css-transitions-2/#animation-composite-order
+        auto& lhsCSSTransition = downcast<CSSTransition>(lhsAnimation);
+        auto& rhsCSSTransition = downcast<CSSTransition>(rhsAnimation);
+        if (lhsCSSTransition.generationTime() != rhsCSSTransition.generationTime())
+            return lhsCSSTransition.generationTime() < rhsCSSTransition.generationTime();
+        auto lhsCSSTransitionProperty = lhsCSSTransition.transitionProperty().utf8();
+        auto rhsCSSTransitionProperty = rhsCSSTransition.transitionProperty().utf8();
+        if (lhsCSSTransitionProperty != rhsCSSTransitionProperty)
+            return lhsCSSTransitionProperty < rhsCSSTransitionProperty;
     }
 
     // CSS Animations sort next.
@@ -60,28 +63,28 @@
     bool lhsIsCSSAnimation = lhsHasOwningElement && is<CSSAnimation>(lhsAnimation);
     bool rhsIsCSSAnimation = rhsHasOwningElement && is<CSSAnimation>(rhsAnimation);
     if (lhsIsCSSAnimation || rhsIsCSSAnimation) {
-        if (lhsIsCSSAnimation == rhsIsCSSAnimation) {
-            // We must have a list of CSS Animations if we have CSS Animations to sort through.
-            ASSERT(cssAnimationList);
-            ASSERT(!cssAnimationList->isEmpty());
+        if (lhsIsCSSAnimation != rhsIsCSSAnimation)
+            return !rhsIsCSSAnimation;
 
-            // https://drafts.csswg.org/css-animations-2/#animation-composite-order
-            // Sort A and B based on their position in the computed value of the animation-name property of the (common) owning element.
-            auto& lhsBackingAnimation = downcast<CSSAnimation>(lhsAnimation).backingAnimation();
-            auto& rhsBackingAnimation = downcast<CSSAnimation>(rhsAnimation).backingAnimation();
+        // We must have a list of CSS Animations if we have CSS Animations to sort through.
+        ASSERT(cssAnimationList);
+        ASSERT(!cssAnimationList->isEmpty());
 
-            for (size_t i = 0; i < cssAnimationList->size(); ++i) {
-                auto& animation = cssAnimationList->animation(i);
-                if (animation == lhsBackingAnimation)
-                    return true;
-                if (animation == rhsBackingAnimation)
-                    return false;
-            }
+        // https://drafts.csswg.org/css-animations-2/#animation-composite-order
+        // Sort A and B based on their position in the computed value of the animation-name property of the (common) owning element.
+        auto& lhsBackingAnimation = downcast<CSSAnimation>(lhsAnimation).backingAnimation();
+        auto& rhsBackingAnimation = downcast<CSSAnimation>(rhsAnimation).backingAnimation();
 
-            // We should have found either of those CSS animations in the CSS animations list.
-            ASSERT_NOT_REACHED();
+        for (size_t i = 0; i < cssAnimationList->size(); ++i) {
+            auto& animation = cssAnimationList->animation(i);
+            if (animation == lhsBackingAnimation)
+                return true;
+            if (animation == rhsBackingAnimation)
+                return false;
         }
-        return !rhsIsCSSAnimation;
+
+        // We should have found either of those CSS animations in the CSS animations list.
+        ASSERT_NOT_REACHED();
     }
 
     // JS-originated animations sort last based on their position in the global animation list.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to