Bug 744157 - Return nsICSSDeclaration from Element::GetSMILOverrideStyle
authorJignesh Kakadiya <jigneshhk1992@gmail.com>
Sat, 09 Jun 2012 15:19:25 -0700
changeset 96302 85613734e341480f9e0a42d200ae77514e28c1ac
parent 96301 b8a593d4e0e2fd0613f9bc3341a8f336620601e7
child 96303 708c967d2fd61d73d0d2ca5710cf320f2b9d37e6
push id842
push usertim.taubert@gmx.de
push dateMon, 11 Jun 2012 09:38:54 +0000
treeherderfx-team@af2a59c23347 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs744157
milestone16.0a1
Bug 744157 - Return nsICSSDeclaration from Element::GetSMILOverrideStyle
content/base/public/Element.h
content/base/src/nsGenericElement.cpp
content/smil/nsSMILCSSProperty.cpp
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -8,16 +8,17 @@
 #define mozilla_dom_Element_h__
 
 #include "nsIContent.h"
 #include "nsEventStates.h"
 
 class nsEventStateManager;
 class nsGlobalWindow;
 class nsFocusManager;
+class nsICSSDeclaration;
 
 // Element-specific flags
 enum {
   // Set if the element has a pending style change.
   ELEMENT_HAS_PENDING_RESTYLE     = (1 << NODE_TYPE_SPECIFIC_BITS_OFFSET),
 
   // Set if the element is a potential restyle root (that is, has a style
   // change pending _and_ that style change will attempt to restyle
@@ -175,20 +176,18 @@ public:
 
   /**
    * Get the SMIL override style for this element. This is a style declaration
    * that is applied *after* the inline style, and it can be used e.g. to store
    * animated style values.
    *
    * Note: This method is analogous to the 'GetStyle' method in
    * nsGenericHTMLElement and nsStyledElement.
-   *
-   * TODO: Bug 744157 - All callers QI to nsICSSDeclaration.
    */
-  virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle() = 0;
+  virtual nsICSSDeclaration* GetSMILOverrideStyle() = 0;
 
   /**
    * Returns if the element is labelable as per HTML specification.
    */
   virtual bool IsLabelable() const = 0;
 
 protected:
   /**
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -3513,17 +3513,17 @@ nsGenericElement::DoGetClasses() const
 }
 
 NS_IMETHODIMP
 nsGenericElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
   return NS_OK;
 }
 
-nsIDOMCSSStyleDeclaration*
+nsICSSDeclaration*
 nsGenericElement::GetSMILOverrideStyle()
 {
   nsGenericElement::nsDOMSlots *slots = DOMSlots();
 
   if (!slots->mSMILOverrideStyle) {
     slots->mSMILOverrideStyle = new nsDOMCSSAttributeDeclaration(this, true);
   }
 
--- a/content/smil/nsSMILCSSProperty.cpp
+++ b/content/smil/nsSMILCSSProperty.cpp
@@ -86,18 +86,17 @@ nsSMILCSSProperty::GetBaseValue() const
     nsSMILValue tmpVal(&nsSMILCSSValueType::sSingleton);
     baseValue.Swap(tmpVal);
     return baseValue;
   }
 
   // GENERAL CASE: Non-Shorthands
   // (1) Put empty string in override style for property mPropID
   // (saving old override style value, so we can set it again when we're done)
-  nsCOMPtr<nsICSSDeclaration> overrideDecl =
-    do_QueryInterface(mElement->GetSMILOverrideStyle());
+  nsICSSDeclaration* overrideDecl = mElement->GetSMILOverrideStyle();
   nsAutoString cachedOverrideStyleVal;
   if (overrideDecl) {
     overrideDecl->GetPropertyValue(mPropID, cachedOverrideStyleVal);
     // (Don't bother clearing override style if it's already empty)
     if (!cachedOverrideStyleVal.IsEmpty()) {
       overrideDecl->SetPropertyValue(mPropID, EmptyString());
     }
   }
@@ -158,35 +157,33 @@ nsSMILCSSProperty::SetAnimValue(const ns
   // Convert nsSMILValue to string
   nsAutoString valStr;
   if (!nsSMILCSSValueType::ValueToString(aValue, valStr)) {
     NS_WARNING("Failed to convert nsSMILValue for CSS property into a string");
     return NS_ERROR_FAILURE;
   }
 
   // Use string value to style the target element
-  nsCOMPtr<nsICSSDeclaration> overrideDecl =
-    do_QueryInterface(mElement->GetSMILOverrideStyle());
+  nsICSSDeclaration* overrideDecl = mElement->GetSMILOverrideStyle();
   if (overrideDecl) {
     nsAutoString oldValStr;
     overrideDecl->GetPropertyValue(mPropID, oldValStr);
     if (valStr.Equals(oldValStr)) {
       return NS_OK;
     }
     overrideDecl->SetPropertyValue(mPropID, valStr);
   }
   return NS_OK;
 }
 
 void
 nsSMILCSSProperty::ClearAnimValue()
 {
   // Put empty string in override style for our property
-  nsCOMPtr<nsICSSDeclaration> overrideDecl =
-    do_QueryInterface(mElement->GetSMILOverrideStyle());
+  nsICSSDeclaration* overrideDecl = mElement->GetSMILOverrideStyle();
   if (overrideDecl) {
     overrideDecl->SetPropertyValue(mPropID, EmptyString());
   }
 }
 
 // Based on http://www.w3.org/TR/SVG/propidx.html
 // static
 bool