Bug 1353208 - Simplify logic in GetCSSPropertyToAnimate to remove double negatives; r=dholbert
authorBrian Birtles <birtles@gmail.com>
Tue, 04 Apr 2017 14:56:52 +0900
changeset 351218 d3d051929c1e4d2722544511a1fd7d04446f785a
parent 351217 0d77b2992fc83adc2ff5f6916785149310129a99
child 351219 95e21766cd72bdda8da9bf8e8bd43909da3be861
push id31603
push usercbook@mozilla.com
push dateWed, 05 Apr 2017 12:30:29 +0000
treeherdermozilla-central@c7e37c13ea9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1353208
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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