summaryrefslogtreecommitdiffstats
path: root/dom/base/FragmentOrElement.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/FragmentOrElement.h')
-rw-r--r--dom/base/FragmentOrElement.h128
1 files changed, 81 insertions, 47 deletions
diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h
index a3a59ee43..4edd88908 100644
--- a/dom/base/FragmentOrElement.h
+++ b/dom/base/FragmentOrElement.h
@@ -15,6 +15,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
+#include "mozilla/UniquePtr.h"
#include "nsAttrAndChildArray.h" // member
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
#include "nsIContent.h" // base class
@@ -239,8 +240,6 @@ protected:
nsresult CopyInnerTo(FragmentOrElement* aDest);
public:
- // Because of a bug in MS C++ compiler nsDOMSlots must be declared public,
- // otherwise nsXULElement::nsXULSlots doesn't compile.
/**
* There are a set of DOM- and scripting-specific instance variables
* that may only be instantiated when a content object is accessed
@@ -249,29 +248,13 @@ public:
* in a side structure that's only allocated when the content is
* accessed through the DOM.
*/
- class nsDOMSlots : public nsINode::nsSlots
+
+ class nsExtendedDOMSlots
{
public:
- nsDOMSlots();
- virtual ~nsDOMSlots();
-
- void Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL);
- void Unlink(bool aIsXUL);
-
- size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
- /**
- * The .style attribute (an interface that forwards to the actual
- * style rules)
- * @see nsGenericHTMLElement::GetStyle
- */
- nsCOMPtr<nsICSSDeclaration> mStyle;
+ nsExtendedDOMSlots();
- /**
- * The .dataset attribute.
- * @see nsGenericHTMLElement::GetDataset
- */
- nsDOMStringMap* mDataset; // [Weak]
+ ~nsExtendedDOMSlots();
/**
* SMIL Overridde style rules (for SMIL animation of CSS properties)
@@ -285,35 +268,17 @@ public:
RefPtr<mozilla::DeclarationBlock> mSMILOverrideStyleDeclaration;
/**
- * An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
- * @see FragmentOrElement::GetAttributes
- */
- RefPtr<nsDOMAttributeMap> mAttributeMap;
-
- union {
- /**
- * The nearest enclosing content node with a binding that created us.
- * @see FragmentOrElement::GetBindingParent
- */
- nsIContent* mBindingParent; // [Weak]
-
- /**
- * The controllers of the XUL Element.
- */
- nsIControllers* mControllers; // [OWNER]
- };
+ * The nearest enclosing content node with a binding that created us.
+ * @see FragmentOrElement::GetBindingParent
+ */
+ nsIContent* mBindingParent; // [Weak]
/**
- * An object implementing the .children property for this element.
- */
- RefPtr<nsContentList> mChildrenList;
+ * The controllers of the XUL Element.
+ */
+ nsCOMPtr<nsIControllers> mControllers;
/**
- * An object implementing the .classList property for this element.
- */
- RefPtr<nsDOMTokenList> mClassList;
-
- /*
* An object implementing the .labels property for this element.
*/
RefPtr<nsLabelsNodeList> mLabelsList;
@@ -354,6 +319,55 @@ public:
*/
nsDataHashtable<nsRefPtrHashKey<DOMIntersectionObserver>, int32_t>
mRegisteredIntersectionObservers;
+
+ /**
+ * For XUL to hold either frameloader or opener.
+ */
+ nsCOMPtr<nsISupports> mFrameLoaderOrOpener;
+
+ };
+
+ class nsDOMSlots : public nsINode::nsSlots
+ {
+ public:
+ nsDOMSlots();
+ virtual ~nsDOMSlots();
+
+ void Traverse(nsCycleCollectionTraversalCallback &cb);
+ void Unlink();
+
+ size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
+
+ /**
+ * The .style attribute (an interface that forwards to the actual
+ * style rules)
+ * @see nsGenericHTMLElement::GetStyle
+ */
+ nsCOMPtr<nsICSSDeclaration> mStyle;
+
+ /**
+ * The .dataset attribute.
+ * @see nsGenericHTMLElement::GetDataset
+ */
+ nsDOMStringMap* mDataset; // [Weak]
+
+ /**
+ * An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
+ * @see FragmentOrElement::GetAttributes
+ */
+ RefPtr<nsDOMAttributeMap> mAttributeMap;
+
+ /**
+ * An object implementing the .children property for this element.
+ */
+ RefPtr<nsContentList> mChildrenList;
+
+ /**
+ * An object implementing the .classList property for this element.
+ */
+ RefPtr<nsDOMTokenList> mClassList;
+
+ mozilla::UniquePtr<nsExtendedDOMSlots> mExtendedSlots;
};
protected:
@@ -373,6 +387,26 @@ protected:
return static_cast<nsDOMSlots*>(GetExistingSlots());
}
+ nsExtendedDOMSlots* ExtendedDOMSlots()
+ {
+ nsDOMSlots* slots = DOMSlots();
+ if (!slots->mExtendedSlots) {
+ slots->mExtendedSlots = MakeUnique<nsExtendedDOMSlots>();
+ }
+
+ return slots->mExtendedSlots.get();
+ }
+
+ nsExtendedDOMSlots* GetExistingExtendedDOMSlots() const
+ {
+ nsDOMSlots* slots = GetExistingDOMSlots();
+ if (slots) {
+ return slots->mExtendedSlots.get();
+ }
+
+ return nullptr;
+ }
+
/**
* Calls SetIsElementInStyleScopeFlagOnSubtree for each shadow tree attached
* to this node, which is assumed to be an Element.