Bug 824592 part 2. Give nsStyledElement an IID. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 02 Aug 2016 11:05:38 -0700
changeset 349142 68f5dadf42ac14a6e8b317060740db37c55cc222
parent 349141 65012571578df6f25efe711ac483eb131cde6559
child 349143 7fe1c4a7fdef23c4a12acd4be45be2e9d482eec7
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs824592
milestone51.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 824592 part 2. Give nsStyledElement an IID. r=peterv
dom/base/nsStyledElement.cpp
dom/base/nsStyledElement.h
--- a/dom/base/nsStyledElement.cpp
+++ b/dom/base/nsStyledElement.cpp
@@ -20,16 +20,20 @@
 #include "nsIDOMMutationEvent.h"
 #include "nsXULElement.h"
 #include "nsContentUtils.h"
 #include "nsStyleUtil.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
+NS_IMPL_QUERY_INTERFACE_INHERITED(nsStyledElement,
+                                  nsStyledElementBase,
+                                  nsStyledElement)
+
 //----------------------------------------------------------------------
 // nsIContent methods
 
 bool
 nsStyledElement::ParseAttribute(int32_t aNamespaceID,
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsAttrValue& aResult)
--- a/dom/base/nsStyledElement.h
+++ b/dom/base/nsStyledElement.h
@@ -18,36 +18,48 @@
 #include "mozilla/dom/Element.h"
 
 namespace mozilla {
 namespace css {
 class Declaration;
 } // namespace css
 } // namespace mozilla
 
+// IID for nsStyledElement interface
+#define NS_STYLED_ELEMENT_IID \
+{ 0xacbd9ea6, 0x15aa, 0x4f37, \
+ { 0x8c, 0xe0, 0x35, 0x1e, 0xd7, 0x21, 0xca, 0xe9 } }
+
 typedef mozilla::dom::Element nsStyledElementBase;
 
 class nsStyledElement : public nsStyledElementBase
 {
 
 protected:
 
   inline explicit nsStyledElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsStyledElementBase(aNodeInfo)
   {}
 
 public:
+  // We don't want to implement AddRef/Release because that would add an extra
+  // function call for those on pretty much all elements.  But we do need QI, so
+  // we can QI to nsStyledElement.
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
+
   // Element interface methods
   virtual mozilla::css::Declaration* GetInlineStyleDeclaration() override;
   virtual nsresult SetInlineStyleDeclaration(mozilla::css::Declaration* aDeclaration,
                                              const nsAString* aSerialized,
                                              bool aNotify) override;
 
   nsICSSDeclaration* Style();
 
+  NS_DECLARE_STATIC_IID_ACCESSOR(NS_STYLED_ELEMENT_IID)
+
 protected:
 
   /**
    * Parse a style attr value into a CSS rulestruct (or, if there is no
    * document, leave it as a string) and return as nsAttrValue.
    *
    * @param aValue the value to parse
    * @param aResult the resulting HTMLValue [OUT]
@@ -65,9 +77,10 @@ protected:
    * Create the style struct from the style attr.  Used when an element is
    * first put into a document.  Only has an effect if the old value is a
    * string.  If aForceInDataDoc is true, will reparse even if we're in a data
    * document.
    */
   nsresult  ReparseStyleAttribute(bool aForceInDataDoc);
 };
 
+NS_DEFINE_STATIC_IID_ACCESSOR(nsStyledElement, NS_STYLED_ELEMENT_IID)
 #endif // __NS_STYLEDELEMENT_H_