Bug 562701, part b: Use Element in nsDOMWindowUtils::ComputeAnimationDistance; r=bzbarsky
authorMs2ger <ms2ger@gmail.com>
Mon, 28 Mar 2011 12:51:56 -0400
changeset 64094 cf3a78e9a3103e1ea541c1b89b4080b05b35bc46
parent 64093 d2f3c03bed30bd0c5dc00821ed9711ffce3f8cce
child 64095 f8aa658b3d39e6247e616f2960b82d297216c37a
push idunknown
push userunknown
push dateunknown
reviewersbzbarsky
bugs562701
milestone2.2a1pre
Bug 562701, part b: Use Element in nsDOMWindowUtils::ComputeAnimationDistance; r=bzbarsky
dom/base/nsDOMWindowUtils.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -77,16 +77,19 @@
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #endif
 
 #include "jsobj.h"
 
 #include "Layers.h"
 
+#include "mozilla/dom/Element.h"
+
+using namespace mozilla::dom;
 using namespace mozilla::layers;
 
 static PRBool IsUniversalXPConnectCapable()
 {
   PRBool hasCap = PR_FALSE;
   nsresult rv = nsContentUtils::GetSecurityManager()->
                   IsCapabilityEnabled("UniversalXPConnect", &hasCap);
   NS_ENSURE_SUCCESS(rv, PR_FALSE);
@@ -1618,22 +1621,23 @@ nsDOMWindowUtils::GetLayerManagerType(ns
     return NS_ERROR_FAILURE;
 
   mgr->GetBackendName(aType);
 
   return NS_OK;
 }
 
 static PRBool
-ComputeAnimationValue(nsCSSProperty aProperty, nsIContent* aContent,
+ComputeAnimationValue(nsCSSProperty aProperty,
+                      Element* aElement,
                       const nsAString& aInput,
                       nsStyleAnimation::Value& aOutput)
 {
 
-  if (!nsStyleAnimation::ComputeValue(aProperty, aContent, aInput,
+  if (!nsStyleAnimation::ComputeValue(aProperty, aElement, aInput,
                                       PR_FALSE, aOutput)) {
     return PR_FALSE;
   }
 
   // This matches TransExtractComputedValue in nsTransitionManager.cpp.
   if (aProperty == eCSSProperty_visibility) {
     NS_ABORT_IF_FALSE(aOutput.GetUnit() == nsStyleAnimation::eUnit_Enumerated,
                       "unexpected unit");
@@ -1673,18 +1677,18 @@ nsDOMWindowUtils::ComputeAnimationDistan
   }
 
   NS_ABORT_IF_FALSE(property == eCSSProperty_UNKNOWN ||
                     !nsCSSProps::IsShorthand(property),
                     "should not have shorthand");
 
   nsStyleAnimation::Value v1, v2;
   if (property == eCSSProperty_UNKNOWN ||
-      !ComputeAnimationValue(property, content, aValue1, v1) ||
-      !ComputeAnimationValue(property, content, aValue2, v2)) {
+      !ComputeAnimationValue(property, content->AsElement(), aValue1, v1) ||
+      !ComputeAnimationValue(property, content->AsElement(), aValue2, v2)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   if (!nsStyleAnimation::ComputeDistance(property, v1, v2, *aResult)) {
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;