Bug 1353208 - Simplify logic in GetCSSPropertyToAnimate to remove double negatives; r?dholbert draft
authorBrian Birtles <birtles@gmail.com>
Tue, 04 Apr 2017 14:56:52 +0900
changeset 555810 d3b87bfebc50b15ea695d4a07bb8d82f2ffd3a76
parent 555809 05f06e5bb7848b5f324ac6131b6c5bf55d24b90c
child 555811 1a243ad6e9d9cd69cf8c74041e8d6a4bf137c039
push id52357
push userbbirtles@mozilla.com
push dateWed, 05 Apr 2017 01:20:37 +0000
reviewersdholbert
bugs1353208
milestone55.0a1
Bug 1353208 - Simplify logic in GetCSSPropertyToAnimate to remove double negatives; r?dholbert MozReview-Commit-ID: 41qhKdcNoNB
dom/smil/nsSMILCompositor.cpp
--- a/dom/smil/nsSMILCompositor.cpp
+++ b/dom/smil/nsSMILCompositor.cpp
@@ -149,22 +149,29 @@ nsSMILCompositor::GetCSSPropertyToAnimat
     return eCSSProperty_UNKNOWN;
   }
 
   // If we are animating the 'width' or 'height' of an outer SVG
   // element we should animate it as a CSS property, but for other elements
   // (e.g. <rect>) we should animate it as a length attribute.
   // The easiest way to test for an outer SVG element, is to see if it is an
   // SVG-namespace element mapping its width/height attribute to style.
-  bool animateAsAttr = (mKey.mAttributeName == nsGkAtoms::width ||
-                        mKey.mAttributeName == nsGkAtoms::height) &&
-                       mKey.mElement->GetNameSpaceID() == kNameSpaceID_SVG &&
-                       !mKey.mElement->IsAttributeMapped(mKey.mAttributeName);
+  //
+  // If we have animation of 'width' or 'height' on an SVG element that is
+  // NOT mapping that attributes to style then it must not be an outermost SVG
+  // element so we should return eCSSProperty_UNKNOWN to indicate that we
+  // should animate as an attribute instead.
+  if ((mKey.mAttributeName == nsGkAtoms::width ||
+       mKey.mAttributeName == nsGkAtoms::height) &&
+      mKey.mElement->GetNameSpaceID() == kNameSpaceID_SVG &&
+      !mKey.mElement->IsAttributeMapped(mKey.mAttributeName)) {
+    return eCSSProperty_UNKNOWN;
+  }
 
-  return animateAsAttr ? eCSSProperty_UNKNOWN : propID;
+  return propID;
 }
 
 uint32_t
 nsSMILCompositor::GetFirstFuncToAffectSandwich()
 {
   // For performance reasons, we throttle most animations on elements in
   // display:none subtrees. (We can't throttle animations that target the
   // "display" property itself, though -- if we did, display:none elements