Bug 563659 part 2 - Create FragmentOrElement and move all nsGenericElement functionality to it; r=bz
authorAryeh Gregor <ayg@aryeh.name>
Wed, 27 Jun 2012 16:01:55 +0300
changeset 101078 bc6363649ed4aa56d79d4e4823a43a79774a596d
parent 101077 657325841098ea7d7d4a95dee89382700fad7af4
child 101079 e349e8b0f48f55f1e50dd1e3030213ee2e529e1d
push id23212
push useremorley@mozilla.com
push dateWed, 01 Aug 2012 17:36:50 +0000
treeherdermozilla-central@bcfe6817a213 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs563659
milestone17.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 563659 part 2 - Create FragmentOrElement and move all nsGenericElement functionality to it; r=bz
content/base/public/FragmentOrElement.h
content/base/public/Makefile.in
content/base/src/FragmentOrElement.cpp
content/base/src/Makefile.in
content/base/src/nsDOMTokenList.cpp
content/base/src/nsDOMTokenList.h
content/base/src/nsGenericElement.cpp
content/base/src/nsGenericElement.h
content/base/src/nsStyledElement.h
copy from content/base/src/nsGenericElement.h
copy to content/base/public/FragmentOrElement.h
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/public/FragmentOrElement.h
@@ -4,18 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Base class for all element classes; this provides an implementation
  * of DOM Core's nsIDOMElement, implements nsIContent, provides
  * utility methods for subclasses, and so forth.
  */
 
-#ifndef nsGenericElement_h___
-#define nsGenericElement_h___
+#ifndef FragmentOrElement_h___
+#define FragmentOrElement_h___
 
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsILinkHandler.h"
 #include "nsNodeUtils.h"
@@ -96,17 +96,17 @@ public:
   }
 
 private:
   // The node whose children make up the list (weak reference)
   nsINode* mNode;
 };
 
 /**
- * A tearoff class for nsGenericElement to implement additional interfaces
+ * A tearoff class for FragmentOrElement to implement additional interfaces
  */
 class nsNode3Tearoff : public nsIDOMXPathNSResolver
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsNode3Tearoff)
 
@@ -171,17 +171,17 @@ public:
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsNodeSupportsWeakRefTearoff)
 
 private:
   nsCOMPtr<nsINode> mNode;
 };
 
 /**
- * A tearoff class for nsGenericElement to implement NodeSelector
+ * A tearoff class for FragmentOrElement to implement NodeSelector
  */
 class nsNodeSelectorTearoff MOZ_FINAL : public nsIDOMNodeSelector
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_DECL_NSIDOMNODESELECTOR
 
@@ -201,24 +201,27 @@ private:
 // Forward declare to allow being a friend
 class nsTouchEventReceiverTearoff;
 class nsInlineEventHandlersTearoff;
 
 /**
  * A generic base class for DOM elements, implementing many nsIContent,
  * nsIDOMNode and nsIDOMElement methods.
  */
-class nsGenericElement : public mozilla::dom::Element
+namespace mozilla {
+namespace dom {
+
+class FragmentOrElement : public mozilla::dom::Element
 {
 public:
-  nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsGenericElement();
+  FragmentOrElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual ~FragmentOrElement();
 
-  friend class nsTouchEventReceiverTearoff;
-  friend class nsInlineEventHandlersTearoff;
+  friend class ::nsTouchEventReceiverTearoff;
+  friend class ::nsInlineEventHandlersTearoff;
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_DECL_SIZEOF_EXCLUDING_THIS
 
   /**
    * Called during QueryInterface to give the binding manager a chance to
    * get an interface for this element.
@@ -577,17 +580,17 @@ public:
    * namespace ID must not be kNameSpaceID_Unknown and the name must not be
    * null.  Note that this can only return info on attributes that actually
    * live on this element (and is only virtual to handle XUL prototypes).  That
    * is, this should only be called from methods that only care about attrs
    * that effectively live in mAttrsAndChildren.
    */
   virtual nsAttrInfo GetAttrInfo(PRInt32 aNamespaceID, nsIAtom* aName) const;
 
-  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsGenericElement)
+  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(FragmentOrElement)
 
   virtual void NodeInfoChanged(nsINodeInfo* aOldNodeInfo)
   {
   }
 
   /**
    * Fire a DOMNodeRemoved mutation event for all children of this node
    */
@@ -716,17 +719,17 @@ protected:
    * @return true if the setting was attempted, false otherwise.
    */
   virtual bool SetMappedAttribute(nsIDocument* aDocument,
                                     nsIAtom* aName,
                                     nsAttrValue& aValue,
                                     nsresult* aRetval);
 
   /**
-   * Hook that is called by nsGenericElement::SetAttr to allow subclasses to
+   * Hook that is called by FragmentOrElement::SetAttr to allow subclasses to
    * deal with attribute sets.  This will only be called after we verify that
    * we're actually doing an attr set and will be called before
    * AttributeWillChange and before ParseAttribute and hence before we've set
    * the new value.
    *
    * @param aNamespaceID the namespace of the attr being set
    * @param aName the localname of the attribute being set
    * @param aValue the value it's being set to represented as either a string or
@@ -739,17 +742,17 @@ protected:
   virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                  const nsAttrValueOrString* aValue,
                                  bool aNotify)
   {
     return NS_OK;
   }
 
   /**
-   * Hook that is called by nsGenericElement::SetAttr to allow subclasses to
+   * Hook that is called by FragmentOrElement::SetAttr to allow subclasses to
    * deal with attribute sets.  This will only be called after we have called
    * SetAndTakeAttr and AttributeChanged (that is, after we have actually set
    * the attr).  It will always be called under a scriptblocker.
    *
    * @param aNamespaceID the namespace of the attr being set
    * @param aName the localname of the attribute being set
    * @param aValue the value it's being set to.  If null, the attr is being
    *        removed.
@@ -769,17 +772,17 @@ protected:
    */
   virtual nsEventListenerManager*
     GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
 
   /**
    * Copy attributes and state to another element
    * @param aDest the object to copy to
    */
-  nsresult CopyInnerTo(nsGenericElement* aDest);
+  nsresult CopyInnerTo(FragmentOrElement* aDest);
 
   /**
    * Internal hook for converting an attribute name-string to an atomized name
    */
   virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
 
   /**
    * Retrieve the rectangle for the offsetX properties, which
@@ -849,24 +852,24 @@ public:
 
     /**
      * Holds any SMIL override style rules for this element.
      */
     nsRefPtr<mozilla::css::StyleRule> mSMILOverrideStyleRule;
 
     /**
      * An object implementing nsIDOMNamedNodeMap for this content (attributes)
-     * @see nsGenericElement::GetAttributes
+     * @see FragmentOrElement::GetAttributes
      */
     nsRefPtr<nsDOMAttributeMap> mAttributeMap;
 
     union {
       /**
       * The nearest enclosing content node with a binding that created us.
-      * @see nsGenericElement::GetBindingParent
+      * @see FragmentOrElement::GetBindingParent
       */
       nsIContent* mBindingParent;  // [Weak]
 
       /**
       * The controllers of the XUL Element.
       */
       nsIControllers* mControllers; // [OWNER]
     };
@@ -961,17 +964,17 @@ protected:
    *
    * Note: for HTML this gets the value of the 'target' attribute; for XLink
    * this gets the value of the xlink:_moz_target attribute, or failing that,
    * the value of xlink:show, converted to a suitably equivalent named target
    * (e.g. _blank).
    */
   virtual void GetLinkTarget(nsAString& aTarget);
 
-  friend class ContentUnbinder;
+  friend class ::ContentUnbinder;
   /**
    * Array containing all attributes and children for this element
    */
   nsAttrAndChildArray mAttrsAndChildren;
 
 private:
   /**
    * Get this element's client area rect in app units.
@@ -979,16 +982,19 @@ private:
    */
   nsRect GetClientAreaRect();
 
   nsIScrollableFrame* GetScrollFrame(nsIFrame **aStyledFrame = nullptr);
 
   nsContentList* GetChildrenList();
 };
 
+} // namespace dom
+} // namespace mozilla
+
 /**
  * Macros to implement Clone(). _elementName is the class for which to implement
  * Clone.
  */
 #define NS_IMPL_ELEMENT_CLONE(_elementName)                                 \
 nsresult                                                                    \
 _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const        \
 {                                                                           \
@@ -1067,46 +1073,46 @@ class nsTouchEventReceiverTearoff MOZ_FI
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_FORWARD_NSITOUCHEVENTRECEIVER(mElement->)
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsTouchEventReceiverTearoff)
 
-  nsTouchEventReceiverTearoff(nsGenericElement *aElement) : mElement(aElement)
+  nsTouchEventReceiverTearoff(mozilla::dom::FragmentOrElement *aElement) : mElement(aElement)
   {
   }
 
 private:
-  nsRefPtr<nsGenericElement> mElement;
+  nsRefPtr<mozilla::dom::FragmentOrElement> mElement;
 };
 
 /**
  * Tearoff class to implement nsIInlineEventHandlers
  */
 class nsInlineEventHandlersTearoff MOZ_FINAL : public nsIInlineEventHandlers
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_FORWARD_NSIINLINEEVENTHANDLERS(mElement->)
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsInlineEventHandlersTearoff)
 
-  nsInlineEventHandlersTearoff(nsGenericElement *aElement) : mElement(aElement)
+  nsInlineEventHandlersTearoff(mozilla::dom::FragmentOrElement *aElement) : mElement(aElement)
   {
   }
 
 private:
-  nsRefPtr<nsGenericElement> mElement;
+  nsRefPtr<mozilla::dom::FragmentOrElement> mElement;
 };
 
 #define NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE                               \
-    rv = nsGenericElement::QueryInterface(aIID, aInstancePtr);                \
+    rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr);                \
     if (NS_SUCCEEDED(rv))                                                     \
       return rv;                                                              \
                                                                               \
     NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
 
 #define NS_ELEMENT_INTERFACE_MAP_END                                          \
     {                                                                         \
       return PostQueryInterface(aIID, aInstancePtr);                          \
@@ -1114,9 +1120,9 @@ private:
                                                                               \
     NS_ADDREF(foundInterface);                                                \
                                                                               \
     *aInstancePtr = foundInterface;                                           \
                                                                               \
     return NS_OK;                                                             \
   }
 
-#endif /* nsGenericElement_h___ */
+#endif /* FragmentOrElement_h___ */
--- a/content/base/public/Makefile.in
+++ b/content/base/public/Makefile.in
@@ -44,16 +44,17 @@ nsTreeSanitizer.h \
 nsXMLNameSpaceMap.h \
 nsIXFormsUtilityService.h \
 $(NULL)
 
 EXPORTS_NAMESPACES = mozilla/dom mozilla
 
 EXPORTS_mozilla/dom = \
 		Element.h \
+		FragmentOrElement.h \
 		FromParser.h \
 		$(NULL)
 
 EXPORTS_mozilla = \
 		CORSMode.h \
 		$(NULL)
 
 SDK_XPIDLSRCS   = \
copy from content/base/src/nsGenericElement.cpp
copy to content/base/src/FragmentOrElement.cpp
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/FragmentOrElement.cpp
@@ -7,17 +7,17 @@
 /*
  * Base class for all element classes; this provides an implementation
  * of DOM Core's nsIDOMElement, implements nsIContent, provides
  * utility methods for subclasses, and so forth.
  */
 
 #include "mozilla/Util.h"
 
-#include "nsGenericElement.h"
+#include "mozilla/dom/FragmentOrElement.h"
 
 #include "nsDOMAttribute.h"
 #include "nsDOMAttributeMap.h"
 #include "nsIAtom.h"
 #include "nsINodeInfo.h"
 #include "nsIDocument.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
@@ -186,17 +186,17 @@ nsIContent::UpdateEditableState(bool aNo
   // Guaranteed to be non-element content
   NS_ASSERTION(!IsElement(), "What happened here?");
   nsIContent *parent = GetParent();
 
   SetEditableFlag(parent && parent->HasFlag(NODE_IS_EDITABLE));
 }
 
 void
-nsGenericElement::UpdateEditableState(bool aNotify)
+FragmentOrElement::UpdateEditableState(bool aNotify)
 {
   nsIContent *parent = GetParent();
 
   SetEditableFlag(parent && parent->HasFlag(NODE_IS_EDITABLE));
   if (aNotify) {
     UpdateState(aNotify);
   } else {
     // Avoid calling UpdateState in this very common case, because
@@ -624,59 +624,59 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3
 NS_IMETHODIMP
 nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
                                    nsAString& aNamespaceURI)
 {
   return mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
 }
 
 nsIContent*
-nsGenericElement::GetFirstElementChild()
+FragmentOrElement::GetFirstElementChild()
 {
   nsAttrAndChildArray& children = mAttrsAndChildren;
   PRUint32 i, count = children.ChildCount();
   for (i = 0; i < count; ++i) {
     nsIContent* child = children.ChildAt(i);
     if (child->IsElement()) {
       return child;
     }
   }
   
   return nullptr;
 }
 
 nsIContent*
-nsGenericElement::GetLastElementChild()
+FragmentOrElement::GetLastElementChild()
 {
   nsAttrAndChildArray& children = mAttrsAndChildren;
   PRUint32 i = children.ChildCount();
   while (i > 0) {
     nsIContent* child = children.ChildAt(--i);
     if (child->IsElement()) {
       return child;
     }
   }
   
   return nullptr;
 }
 
 nsIContent*
-nsGenericElement::GetPreviousElementSibling()
+FragmentOrElement::GetPreviousElementSibling()
 {
   nsIContent* parent = GetParent();
   if (!parent) {
     return nullptr;
   }
 
   NS_ASSERTION(parent->IsElement() ||
                parent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT),
                "Parent content must be an element or a doc fragment");
 
   nsAttrAndChildArray& children =
-    static_cast<nsGenericElement*>(parent)->mAttrsAndChildren;
+    static_cast<FragmentOrElement*>(parent)->mAttrsAndChildren;
   PRInt32 index = children.IndexOfChild(this);
   if (index < 0) {
     return nullptr;
   }
 
   PRUint32 i = index;
   while (i > 0) {
     nsIContent* child = children.ChildAt((PRUint32)--i);
@@ -684,29 +684,29 @@ nsGenericElement::GetPreviousElementSibl
       return child;
     }
   }
   
   return nullptr;
 }
 
 nsIContent*
-nsGenericElement::GetNextElementSibling()
+FragmentOrElement::GetNextElementSibling()
 {
   nsIContent* parent = GetParent();
   if (!parent) {
     return nullptr;
   }
 
   NS_ASSERTION(parent->IsElement() ||
                parent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT),
                "Parent content must be an element or a doc fragment");
 
   nsAttrAndChildArray& children =
-    static_cast<nsGenericElement*>(parent)->mAttrsAndChildren;
+    static_cast<FragmentOrElement*>(parent)->mAttrsAndChildren;
   PRInt32 index = children.IndexOfChild(this);
   if (index < 0) {
     return nullptr;
   }
 
   PRUint32 i, count = children.ChildCount();
   for (i = (PRUint32)index + 1; i < count; ++i) {
     nsIContent* child = children.ChildAt(i);
@@ -714,90 +714,90 @@ nsGenericElement::GetNextElementSibling(
       return child;
     }
   }
   
   return nullptr;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetChildElementCount(PRUint32* aResult)
+FragmentOrElement::GetChildElementCount(PRUint32* aResult)
 {
   *aResult = GetChildrenList()->Length(true);
   return NS_OK;
 }
 
 // readonly attribute nsIDOMNodeList children
 NS_IMETHODIMP
-nsGenericElement::GetChildElements(nsIDOMNodeList** aResult)
+FragmentOrElement::GetChildElements(nsIDOMNodeList** aResult)
 {
   NS_ADDREF(*aResult = GetChildrenList());
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetFirstElementChild(nsIDOMElement** aResult)
+FragmentOrElement::GetFirstElementChild(nsIDOMElement** aResult)
 {
   *aResult = nullptr;
 
   nsIContent *result = GetFirstElementChild();
 
   return result ? CallQueryInterface(result, aResult) : NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetLastElementChild(nsIDOMElement** aResult)
+FragmentOrElement::GetLastElementChild(nsIDOMElement** aResult)
 {
   *aResult = nullptr;
 
   nsIContent *result = GetLastElementChild();
 
   return result ? CallQueryInterface(result, aResult) : NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetPreviousElementSibling(nsIDOMElement** aResult)
+FragmentOrElement::GetPreviousElementSibling(nsIDOMElement** aResult)
 {
   *aResult = nullptr;
 
   nsIContent *result = GetPreviousElementSibling();
 
   return result ? CallQueryInterface(result, aResult) : NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetNextElementSibling(nsIDOMElement** aResult)
+FragmentOrElement::GetNextElementSibling(nsIDOMElement** aResult)
 {
   *aResult = nullptr;
 
   nsIContent *result = GetNextElementSibling();
 
   return result ? CallQueryInterface(result, aResult) : NS_OK;
 }
 
 nsContentList*
-nsGenericElement::GetChildrenList()
-{
-  nsGenericElement::nsDOMSlots *slots = DOMSlots();
+FragmentOrElement::GetChildrenList()
+{
+  FragmentOrElement::nsDOMSlots *slots = DOMSlots();
 
   if (!slots->mChildrenList) {
     slots->mChildrenList = new nsContentList(this, kNameSpaceID_Wildcard, 
                                              nsGkAtoms::_asterix, nsGkAtoms::_asterix,
                                              false);
   }
 
   return slots->mChildrenList;
 }
 
 nsDOMTokenList*
-nsGenericElement::GetClassList(nsresult *aResult)
+FragmentOrElement::GetClassList(nsresult *aResult)
 {
   *aResult = NS_ERROR_OUT_OF_MEMORY;
 
-  nsGenericElement::nsDOMSlots *slots = DOMSlots();
+  FragmentOrElement::nsDOMSlots *slots = DOMSlots();
 
   if (!slots->mClassList) {
     nsCOMPtr<nsIAtom> classAttr = GetClassAttributeName();
     if (!classAttr) {
       *aResult = NS_OK;
 
       return nullptr;
     }
@@ -806,63 +806,63 @@ nsGenericElement::GetClassList(nsresult 
   }
 
   *aResult = NS_OK;
 
   return slots->mClassList;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetClassList(nsIDOMDOMTokenList** aResult)
+FragmentOrElement::GetClassList(nsIDOMDOMTokenList** aResult)
 {
   *aResult = nullptr;
 
   nsresult rv;
   nsIDOMDOMTokenList* list = GetClassList(&rv);
   NS_ENSURE_TRUE(list, rv);
 
   NS_ADDREF(*aResult = list);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetCapture(bool aRetargetToElement)
+FragmentOrElement::SetCapture(bool aRetargetToElement)
 {
   // If there is already an active capture, ignore this request. This would
   // occur if a splitter, frame resizer, etc had already captured and we don't
   // want to override those.
   if (nsIPresShell::GetCapturingContent())
     return NS_OK;
 
   nsIPresShell::SetCapturingContent(this, CAPTURE_PREVENTDRAG |
     (aRetargetToElement ? CAPTURE_RETARGETTOELEMENT : 0));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::ReleaseCapture()
+FragmentOrElement::ReleaseCapture()
 {
   if (nsIPresShell::GetCapturingContent() == this) {
     nsIPresShell::SetCapturingContent(nullptr, 0);
   }
 
   return NS_OK;
 }
 
 nsIFrame*
-nsGenericElement::GetStyledFrame()
+FragmentOrElement::GetStyledFrame()
 {
   nsIFrame *frame = GetPrimaryFrame(Flush_Layout);
   return frame ? nsLayoutUtils::GetStyleFrame(frame) : nullptr;
 }
 
 void
-nsGenericElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
+FragmentOrElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
 {
   *aOffsetParent = nullptr;
   aRect = nsRect();
 
   nsIFrame* frame = GetStyledFrame();
   if (!frame) {
     return;
   }
@@ -877,31 +877,31 @@ nsGenericElement::GetOffsetRect(nsRect& 
   // a bit faster by speeding up the internal GetOffsetTo operations.
   nsIFrame* parent = frame->GetParent() ? frame->GetParent() : frame;
   nsRect rcFrame = nsLayoutUtils::GetAllInFlowRectsUnion(frame, parent);
   aRect.width = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width);
   aRect.height = nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height);
 }
 
 nsIntSize
-nsGenericElement::GetPaddingRectSize()
+FragmentOrElement::GetPaddingRectSize()
 {
   nsIFrame* frame = GetStyledFrame();
   if (!frame) {
     return nsIntSize(0, 0);
   }
 
   NS_ASSERTION(frame->GetParent(), "Styled frame has no parent");
   nsRect rcFrame = nsLayoutUtils::GetAllInFlowPaddingRectsUnion(frame, frame->GetParent());
   return nsIntSize(nsPresContext::AppUnitsToIntCSSPixels(rcFrame.width),
                    nsPresContext::AppUnitsToIntCSSPixels(rcFrame.height));
 }
 
 nsIScrollableFrame*
-nsGenericElement::GetScrollFrame(nsIFrame **aStyledFrame)
+FragmentOrElement::GetScrollFrame(nsIFrame **aStyledFrame)
 {
   // it isn't clear what to return for SVG nodes, so just return nothing
   if (IsSVG()) {
     if (aStyledFrame) {
       *aStyledFrame = nullptr;
     }
     return nullptr;
   }
@@ -935,115 +935,115 @@ nsGenericElement::GetScrollFrame(nsIFram
     // the root scrollable frame.
     return frame->PresContext()->PresShell()->GetRootScrollFrameAsScrollable();
   }
 
   return nullptr;
 }
 
 PRInt32
-nsGenericElement::GetScrollTop()
+FragmentOrElement::GetScrollTop()
 {
   nsIScrollableFrame* sf = GetScrollFrame();
 
   return sf ?
          nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollPosition().y) :
          0;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetScrollTop(PRInt32* aScrollTop)
+FragmentOrElement::GetScrollTop(PRInt32* aScrollTop)
 {
   *aScrollTop = GetScrollTop();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetScrollTop(PRInt32 aScrollTop)
+FragmentOrElement::SetScrollTop(PRInt32 aScrollTop)
 {
   nsIScrollableFrame* sf = GetScrollFrame();
   if (sf) {
     nsPoint pt = sf->GetScrollPosition();
     sf->ScrollToCSSPixels(nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
                                      aScrollTop));
   }
   return NS_OK;
 }
 
 PRInt32
-nsGenericElement::GetScrollLeft()
+FragmentOrElement::GetScrollLeft()
 {
   nsIScrollableFrame* sf = GetScrollFrame();
 
   return sf ?
          nsPresContext::AppUnitsToIntCSSPixels(sf->GetScrollPosition().x) :
          0;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetScrollLeft(PRInt32* aScrollLeft)
+FragmentOrElement::GetScrollLeft(PRInt32* aScrollLeft)
 {
   *aScrollLeft = GetScrollLeft();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetScrollLeft(PRInt32 aScrollLeft)
+FragmentOrElement::SetScrollLeft(PRInt32 aScrollLeft)
 {
   nsIScrollableFrame* sf = GetScrollFrame();
   if (sf) {
     nsPoint pt = sf->GetScrollPosition();
     sf->ScrollToCSSPixels(nsIntPoint(aScrollLeft,
                                      nsPresContext::AppUnitsToIntCSSPixels(pt.y)));
   }
   return NS_OK;
 }
 
 PRInt32
-nsGenericElement::GetScrollHeight()
+FragmentOrElement::GetScrollHeight()
 {
   if (IsSVG())
     return 0;
 
   nsIScrollableFrame* sf = GetScrollFrame();
   if (!sf) {
     return GetPaddingRectSize().height;
   }
 
   nscoord height = sf->GetScrollRange().height + sf->GetScrollPortRect().height;
   return nsPresContext::AppUnitsToIntCSSPixels(height);
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetScrollHeight(PRInt32* aScrollHeight)
+FragmentOrElement::GetScrollHeight(PRInt32* aScrollHeight)
 {
   *aScrollHeight = GetScrollHeight();
 
   return NS_OK;
 }
 
 PRInt32
-nsGenericElement::GetScrollWidth()
+FragmentOrElement::GetScrollWidth()
 {
   if (IsSVG())
     return 0;
 
   nsIScrollableFrame* sf = GetScrollFrame();
   if (!sf) {
     return GetPaddingRectSize().width;
   }
 
   nscoord width = sf->GetScrollRange().width + sf->GetScrollPortRect().width;
   return nsPresContext::AppUnitsToIntCSSPixels(width);
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetScrollWidth(PRInt32 *aScrollWidth)
+FragmentOrElement::GetScrollWidth(PRInt32 *aScrollWidth)
 {
   *aScrollWidth = GetScrollWidth();
 
   return NS_OK;
 }
 
 PRInt32
 nsGenericElement::GetScrollLeftMax()
@@ -1079,17 +1079,17 @@ NS_IMETHODIMP
 nsGenericElement::GetScrollTopMax(PRInt32 *aScrollTopMax)
 {
   *aScrollTopMax = GetScrollTopMax();
 
   return NS_OK;
 }
 
 nsRect
-nsGenericElement::GetClientAreaRect()
+FragmentOrElement::GetClientAreaRect()
 {
   nsIFrame* styledFrame;
   nsIScrollableFrame* sf = GetScrollFrame(&styledFrame);
 
   if (sf) {
     return sf->GetScrollPortRect();
   }
 
@@ -1101,45 +1101,45 @@ nsGenericElement::GetClientAreaRect()
     return styledFrame->GetPaddingRect() - styledFrame->GetPositionIgnoringScrolling();
   }
 
   // SVG nodes reach here and just return 0
   return nsRect(0, 0, 0, 0);
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetClientTop(PRInt32 *aClientTop)
+FragmentOrElement::GetClientTop(PRInt32 *aClientTop)
 {
   *aClientTop = GetClientTop();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetClientLeft(PRInt32 *aClientLeft)
+FragmentOrElement::GetClientLeft(PRInt32 *aClientLeft)
 {
   *aClientLeft = GetClientLeft();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetClientHeight(PRInt32 *aClientHeight)
+FragmentOrElement::GetClientHeight(PRInt32 *aClientHeight)
 {
   *aClientHeight = GetClientHeight();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetClientWidth(PRInt32 *aClientWidth)
+FragmentOrElement::GetClientWidth(PRInt32 *aClientWidth)
 {
   *aClientWidth = GetClientWidth();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetBoundingClientRect(nsIDOMClientRect** aResult)
+FragmentOrElement::GetBoundingClientRect(nsIDOMClientRect** aResult)
 {
   // Weak ref, since we addref it below
   nsClientRect* rect = new nsClientRect();
   NS_ADDREF(*aResult = rect);
   
   nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
   if (!frame) {
     // display:none, perhaps? Return the empty rect
@@ -1149,24 +1149,24 @@ nsGenericElement::GetBoundingClientRect(
   nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(frame,
           nsLayoutUtils::GetContainingBlockForClientRect(frame),
           nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
   rect->SetLayoutRect(r);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetElementsByClassName(const nsAString& aClasses,
+FragmentOrElement::GetElementsByClassName(const nsAString& aClasses,
                                          nsIDOMNodeList** aReturn)
 {
   return nsContentUtils::GetElementsByClassName(this, aClasses, aReturn);
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetClientRects(nsIDOMClientRectList** aResult)
+FragmentOrElement::GetClientRects(nsIDOMClientRectList** aResult)
 {
   *aResult = nullptr;
 
   nsRefPtr<nsClientRectList> rectList = new nsClientRectList(this);
 
   nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
   if (!frame) {
     // display:none, perhaps? Return an empty list
@@ -1245,25 +1245,25 @@ NS_INTERFACE_MAP_END_AGGREGATED(mNode)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeSelectorTearoff)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeSelectorTearoff)
 
 NS_IMETHODIMP
 nsNodeSelectorTearoff::QuerySelector(const nsAString& aSelector,
                                      nsIDOMElement **aReturn)
 {
   nsresult rv;
-  nsIContent* result = nsGenericElement::doQuerySelector(mNode, aSelector, &rv);
+  nsIContent* result = FragmentOrElement::doQuerySelector(mNode, aSelector, &rv);
   return result ? CallQueryInterface(result, aReturn) : rv;
 }
 
 NS_IMETHODIMP
 nsNodeSelectorTearoff::QuerySelectorAll(const nsAString& aSelector,
                                         nsIDOMNodeList **aReturn)
 {
-  return nsGenericElement::doQuerySelectorAll(mNode, aSelector, aReturn);
+  return FragmentOrElement::doQuerySelectorAll(mNode, aSelector, aReturn);
 }
 
 //----------------------------------------------------------------------
 
 NS_IMPL_CYCLE_COLLECTION_1(nsTouchEventReceiverTearoff, mElement)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTouchEventReceiverTearoff)
   NS_INTERFACE_MAP_ENTRY(nsITouchEventReceiver)
@@ -1279,36 +1279,36 @@ NS_IMPL_CYCLE_COLLECTION_1(nsInlineEvent
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsInlineEventHandlersTearoff)
   NS_INTERFACE_MAP_ENTRY(nsIInlineEventHandlers)
 NS_INTERFACE_MAP_END_AGGREGATED(mElement)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsInlineEventHandlersTearoff)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsInlineEventHandlersTearoff)
 
 //----------------------------------------------------------------------
-nsGenericElement::nsDOMSlots::nsDOMSlots()
+FragmentOrElement::nsDOMSlots::nsDOMSlots()
   : nsINode::nsSlots(),
     mDataset(nullptr),
     mBindingParent(nullptr)
 {
 }
 
-nsGenericElement::nsDOMSlots::~nsDOMSlots()
+FragmentOrElement::nsDOMSlots::~nsDOMSlots()
 {
   if (mAttributeMap) {
     mAttributeMap->DropReference();
   }
 
   if (mClassList) {
     mClassList->DropReference();
   }
 }
 
 void
-nsGenericElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
+FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, bool aIsXUL)
 {
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mStyle");
   cb.NoteXPCOMChild(mStyle.get());
 
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mSMILOverrideStyle");
   cb.NoteXPCOMChild(mSMILOverrideStyle.get());
 
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mAttributeMap");
@@ -1322,107 +1322,107 @@ nsGenericElement::nsDOMSlots::Traverse(n
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
   cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
 
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mClassList");
   cb.NoteXPCOMChild(mClassList.get());
 }
 
 void
-nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
+FragmentOrElement::nsDOMSlots::Unlink(bool aIsXUL)
 {
   mStyle = nullptr;
   mSMILOverrideStyle = nullptr;
   if (mAttributeMap) {
     mAttributeMap->DropReference();
     mAttributeMap = nullptr;
   }
   if (aIsXUL)
     NS_IF_RELEASE(mControllers);
   mChildrenList = nullptr;
   if (mClassList) {
     mClassList->DropReference();
     mClassList = nullptr;
   }
 }
 
-nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+FragmentOrElement::FragmentOrElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : Element(aNodeInfo)
 {
   NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE ||
                     (mNodeInfo->NodeType() ==
                        nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
                      mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
                                        kNameSpaceID_None)),
                     "Bad NodeType in aNodeInfo");
 
   SetIsElement();
 }
 
-nsGenericElement::~nsGenericElement()
+FragmentOrElement::~FragmentOrElement()
 {
   NS_PRECONDITION(!IsInDoc(),
                   "Please remove this from the document properly");
   if (GetParent()) {
     NS_RELEASE(mParent);
   }
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetNodeName(nsAString& aNodeName)
+FragmentOrElement::GetNodeName(nsAString& aNodeName)
 {
   aNodeName = NodeName();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetLocalName(nsAString& aLocalName)
+FragmentOrElement::GetLocalName(nsAString& aLocalName)
 {
   aLocalName = LocalName();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetNodeValue(nsAString& aNodeValue)
+FragmentOrElement::GetNodeValue(nsAString& aNodeValue)
 {
   SetDOMStringToNull(aNodeValue);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetNodeValue(const nsAString& aNodeValue)
+FragmentOrElement::SetNodeValue(const nsAString& aNodeValue)
 {
   // The DOM spec says that when nodeValue is defined to be null "setting it
   // has no effect", so we don't throw an exception.
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetNodeType(PRUint16* aNodeType)
+FragmentOrElement::GetNodeType(PRUint16* aNodeType)
 {
   *aNodeType = NodeType();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetNamespaceURI(nsAString& aNamespaceURI)
+FragmentOrElement::GetNamespaceURI(nsAString& aNamespaceURI)
 {
   return mNodeInfo->GetNamespaceURI(aNamespaceURI);
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetPrefix(nsAString& aPrefix)
+FragmentOrElement::GetPrefix(nsAString& aPrefix)
 {
   mNodeInfo->GetPrefix(aPrefix);
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::InternalIsSupported(nsISupports* aObject,
+FragmentOrElement::InternalIsSupported(nsISupports* aObject,
                                       const nsAString& aFeature,
                                       const nsAString& aVersion,
                                       bool* aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   *aReturn = false;
 
   // Convert the incoming UTF16 strings to raw char*'s to save us some
@@ -1476,35 +1476,35 @@ nsGenericElement::InternalIsSupported(ns
       *aReturn = true;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::IsSupported(const nsAString& aFeature,
-                              const nsAString& aVersion,
-                              bool* aReturn)
+FragmentOrElement::IsSupported(const nsAString& aFeature,
+                               const nsAString& aVersion,
+                               bool* aReturn)
 {
   return InternalIsSupported(this, aFeature, aVersion, aReturn);
 }
 
 NS_IMETHODIMP
-nsGenericElement::HasAttributes(bool* aReturn)
+FragmentOrElement::HasAttributes(bool* aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
   *aReturn = GetAttrCount() > 0;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
+FragmentOrElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
 {
   if (!IsElement()) {
     *aAttributes = nullptr;
     return NS_OK;
   }
 
   nsDOMSlots *slots = DOMSlots();
 
@@ -1513,33 +1513,33 @@ nsGenericElement::GetAttributes(nsIDOMNa
   }
 
   NS_ADDREF(*aAttributes = slots->mAttributeMap);
 
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::HasChildNodes(bool* aReturn)
+FragmentOrElement::HasChildNodes(bool* aReturn)
 {
   *aReturn = mAttrsAndChildren.ChildCount() > 0;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetTagName(nsAString& aTagName)
+FragmentOrElement::GetTagName(nsAString& aTagName)
 {
   aTagName = NodeName();
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::GetAttribute(const nsAString& aName,
-                               nsAString& aReturn)
+FragmentOrElement::GetAttribute(const nsAString& aName,
+                                nsAString& aReturn)
 {
   const nsAttrValue* val =
     mAttrsAndChildren.GetAttr(aName,
                               IsHTML() && IsInHTMLDocument() ?
                                 eIgnoreCase : eCaseMatters);
   if (val) {
     val->ToString(aReturn);
   } else {
@@ -1551,17 +1551,17 @@ nsGenericElement::GetAttribute(const nsA
       SetDOMStringToNull(aReturn);
     }
   }
 
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::SetAttribute(const nsAString& aName,
+FragmentOrElement::SetAttribute(const nsAString& aName,
                                const nsAString& aValue)
 {
   const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
 
   if (!name) {
     nsresult rv = nsContentUtils::CheckQName(aName, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1571,17 +1571,17 @@ nsGenericElement::SetAttribute(const nsA
     return SetAttr(kNameSpaceID_None, nameAtom, aValue, true);
   }
 
   return SetAttr(name->NamespaceID(), name->LocalName(), name->GetPrefix(),
                  aValue, true);
 }
 
 nsresult
-nsGenericElement::RemoveAttribute(const nsAString& aName)
+FragmentOrElement::RemoveAttribute(const nsAString& aName)
 {
   const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
 
   if (!name) {
     // If there is no canonical nsAttrName for this attribute name, then the
     // attribute does not exist and we can't get its namespace ID and
     // local name below, so we return early.
     return NS_OK;
@@ -1591,17 +1591,17 @@ nsGenericElement::RemoveAttribute(const 
   // away during UnsetAttr. If it did UnsetAttr would be left with a
   // dangling pointer as argument without knowing it.
   nsAttrName tmp(*name);
 
   return UnsetAttr(name->NamespaceID(), name->LocalName(), true);
 }
 
 nsresult
-nsGenericElement::GetAttributeNode(const nsAString& aName,
+FragmentOrElement::GetAttributeNode(const nsAString& aName,
                                    nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   *aReturn = nullptr;
 
   nsIDocument* document = OwnerDoc();
   if (document) {
     document->WarnOnceAbout(nsIDocument::eGetAttributeNode);
@@ -1617,17 +1617,17 @@ nsGenericElement::GetAttributeNode(const
   if (NS_SUCCEEDED(rv) && node) {
     rv = CallQueryInterface(node, aReturn);
   }
 
   return rv;
 }
 
 nsresult
-nsGenericElement::SetAttributeNode(nsIDOMAttr* aAttribute,
+FragmentOrElement::SetAttributeNode(nsIDOMAttr* aAttribute,
                                    nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   NS_ENSURE_ARG_POINTER(aAttribute);
 
   *aReturn = nullptr;
 
   OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNode);
@@ -1643,17 +1643,17 @@ nsGenericElement::SetAttributeNode(nsIDO
   if (returnNode) {
     rv = CallQueryInterface(returnNode, aReturn);
   }
 
   return rv;
 }
 
 nsresult
-nsGenericElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
+FragmentOrElement::RemoveAttributeNode(nsIDOMAttr* aAttribute,
                                       nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   NS_ENSURE_ARG_POINTER(aAttribute);
 
   *aReturn = nullptr;
 
   OwnerDoc()->WarnOnceAbout(nsIDocument::eRemoveAttributeNode);
@@ -1673,29 +1673,29 @@ nsGenericElement::RemoveAttributeNode(ns
       rv = CallQueryInterface(node, aReturn);
     }
   }
 
   return rv;
 }
 
 nsresult
-nsGenericElement::GetElementsByTagName(const nsAString& aTagname,
+FragmentOrElement::GetElementsByTagName(const nsAString& aTagname,
                                        nsIDOMNodeList** aReturn)
 {
   nsContentList *list = NS_GetContentList(this, kNameSpaceID_Unknown, 
                                           aTagname).get();
 
   // transfer ref to aReturn
   *aReturn = list;
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::GetAttributeNS(const nsAString& aNamespaceURI,
+FragmentOrElement::GetAttributeNS(const nsAString& aNamespaceURI,
                                  const nsAString& aLocalName,
                                  nsAString& aReturn)
 {
   PRInt32 nsid =
     nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
 
   if (nsid == kNameSpaceID_Unknown) {
     // Unknown namespace means no attribute.
@@ -1708,34 +1708,34 @@ nsGenericElement::GetAttributeNS(const n
   if (!hasAttr) {
     SetDOMStringToNull(aReturn);
   }
 
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::SetAttributeNS(const nsAString& aNamespaceURI,
+FragmentOrElement::SetAttributeNS(const nsAString& aNamespaceURI,
                                  const nsAString& aQualifiedName,
                                  const nsAString& aValue)
 {
   nsCOMPtr<nsINodeInfo> ni;
   nsresult rv =
     nsContentUtils::GetNodeInfoFromQName(aNamespaceURI, aQualifiedName,
                                          mNodeInfo->NodeInfoManager(),
                                          nsIDOMNode::ATTRIBUTE_NODE,
                                          getter_AddRefs(ni));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return SetAttr(ni->NamespaceID(), ni->NameAtom(), ni->GetPrefixAtom(),
                  aValue, true);
 }
 
 nsresult
-nsGenericElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
+FragmentOrElement::RemoveAttributeNS(const nsAString& aNamespaceURI,
                                     const nsAString& aLocalName)
 {
   nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
   PRInt32 nsid =
     nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
 
   if (nsid == kNameSpaceID_Unknown) {
     // If the namespace ID is unknown, it means there can't possibly be an
@@ -1745,30 +1745,30 @@ nsGenericElement::RemoveAttributeNS(cons
   }
 
   UnsetAttr(nsid, name, true);
 
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
+FragmentOrElement::GetAttributeNodeNS(const nsAString& aNamespaceURI,
                                      const nsAString& aLocalName,
                                      nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   *aReturn = nullptr;
 
   OwnerDoc()->WarnOnceAbout(nsIDocument::eGetAttributeNodeNS);
 
   return GetAttributeNodeNSInternal(aNamespaceURI, aLocalName, aReturn);
 }
 
 nsresult
-nsGenericElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
+FragmentOrElement::GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
                                              const nsAString& aLocalName,
                                              nsIDOMAttr** aReturn)
 {
   nsCOMPtr<nsIDOMNamedNodeMap> map;
   nsresult rv = GetAttributes(getter_AddRefs(map));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIDOMNode> node;
@@ -1777,17 +1777,17 @@ nsGenericElement::GetAttributeNodeNSInte
   if (NS_SUCCEEDED(rv) && node) {
     rv = CallQueryInterface(node, aReturn);
   }
 
   return rv;
 }
 
 nsresult
-nsGenericElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
+FragmentOrElement::SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
                                      nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   NS_ENSURE_ARG_POINTER(aNewAttr);
   *aReturn = nullptr;
 
   OwnerDoc()->WarnOnceAbout(nsIDocument::eSetAttributeNodeNS);
 
@@ -1802,17 +1802,17 @@ nsGenericElement::SetAttributeNodeNS(nsI
   if (returnNode) {
     rv = CallQueryInterface(returnNode, aReturn);
   }
 
   return rv;
 }
 
 nsresult
-nsGenericElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
+FragmentOrElement::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
                                          const nsAString& aLocalName,
                                          nsIDOMNodeList** aReturn)
 {
   PRInt32 nameSpaceId = kNameSpaceID_Wildcard;
 
   if (!aNamespaceURI.EqualsLiteral("*")) {
     nsresult rv =
       nsContentUtils::NameSpaceManager()->RegisterNameSpace(aNamespaceURI,
@@ -1825,28 +1825,28 @@ nsGenericElement::GetElementsByTagNameNS
   nsContentList *list = NS_GetContentList(this, nameSpaceId, aLocalName).get();
 
   // transfer ref to aReturn
   *aReturn = list;
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::HasAttribute(const nsAString& aName, bool* aReturn)
+FragmentOrElement::HasAttribute(const nsAString& aName, bool* aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
   const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
   *aReturn = (name != nullptr);
 
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::HasAttributeNS(const nsAString& aNamespaceURI,
+FragmentOrElement::HasAttributeNS(const nsAString& aNamespaceURI,
                                  const nsAString& aLocalName,
                                  bool* aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
   PRInt32 nsid =
     nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
 
@@ -1914,17 +1914,17 @@ BindNodesInInsertPoints(nsXBLBinding* aB
       }
     }
   }
 
   return NS_OK;
 }
 
 nsresult
-nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
+FragmentOrElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                              nsIContent* aBindingParent,
                              bool aCompileEventHandlers)
 {
   NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
   NS_PRECONDITION(HasSameOwnerDoc(NODE_FROM(aParent, aDocument)),
                   "Must have the same owner document");
   NS_PRECONDITION(!aParent || aDocument == aParent->GetCurrentDoc(),
                   "aDocument must be current doc of aParent");
@@ -2124,17 +2124,17 @@ public:
 private:
   nsRefPtr<nsBindingManager> mManager;
   nsRefPtr<Element> mElement;
   nsCOMPtr<nsIDocument> mDoc;
   nsCOMPtr<nsIContent> mBindingParent;
 };
 
 void
-nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
+FragmentOrElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   NS_PRECONDITION(aDeep || (!GetCurrentDoc() && !GetBindingParent()),
                   "Shallow unbind won't clear document and binding parent on "
                   "kids!");
 
   RemoveFromIdTable();
 
   // Make sure to unbind this node before doing the kids
@@ -2222,17 +2222,17 @@ nsGenericElement::UnbindFromTree(bool aD
       mAttrsAndChildren.ChildAt(i)->UnbindFromTree(true, false);
     }
   }
 
   nsNodeUtils::ParentChainChanged(this);
 }
 
 already_AddRefed<nsINodeList>
-nsGenericElement::GetChildren(PRUint32 aFilter)
+FragmentOrElement::GetChildren(PRUint32 aFilter)
 {
   nsRefPtr<nsSimpleContentList> list = new nsSimpleContentList(this);
   if (!list) {
     return nullptr;
   }
 
   nsIFrame *frame = GetPrimaryFrame();
 
@@ -2420,52 +2420,52 @@ nsIContent::PreHandleEvent(nsEventChainP
     aVisitor.mParentTarget = parent;
   } else {
     aVisitor.mParentTarget = GetCurrentDoc();
   }
   return NS_OK;
 }
 
 const nsAttrValue*
-nsGenericElement::DoGetClasses() const
+FragmentOrElement::DoGetClasses() const
 {
   NS_NOTREACHED("Shouldn't ever be called");
   return nullptr;
 }
 
 NS_IMETHODIMP
-nsGenericElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
+FragmentOrElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
   return NS_OK;
 }
 
 nsICSSDeclaration*
-nsGenericElement::GetSMILOverrideStyle()
-{
-  nsGenericElement::nsDOMSlots *slots = DOMSlots();
+FragmentOrElement::GetSMILOverrideStyle()
+{
+  FragmentOrElement::nsDOMSlots *slots = DOMSlots();
 
   if (!slots->mSMILOverrideStyle) {
     slots->mSMILOverrideStyle = new nsDOMCSSAttributeDeclaration(this, true);
   }
 
   return slots->mSMILOverrideStyle;
 }
 
 css::StyleRule*
-nsGenericElement::GetSMILOverrideStyleRule()
-{
-  nsGenericElement::nsDOMSlots *slots = GetExistingDOMSlots();
+FragmentOrElement::GetSMILOverrideStyleRule()
+{
+  FragmentOrElement::nsDOMSlots *slots = GetExistingDOMSlots();
   return slots ? slots->mSMILOverrideStyleRule.get() : nullptr;
 }
 
 nsresult
-nsGenericElement::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
+FragmentOrElement::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
                                            bool aNotify)
 {
-  nsGenericElement::nsDOMSlots *slots = DOMSlots();
+  FragmentOrElement::nsDOMSlots *slots = DOMSlots();
 
   slots->mSMILOverrideStyleRule = aStyleRule;
 
   if (aNotify) {
     nsIDocument* doc = GetCurrentDoc();
     // Only need to request a restyle if we're in a document.  (We might not
     // be in a document, if we're clearing animation effects on a target node
     // that's been detached since the previous animation sample.)
@@ -2476,74 +2476,74 @@ nsGenericElement::SetSMILOverrideStyleRu
       }
     }
   }
 
   return NS_OK;
 }
 
 bool
-nsGenericElement::IsLabelable() const
+FragmentOrElement::IsLabelable() const
 {
   return false;
 }
 
 css::StyleRule*
-nsGenericElement::GetInlineStyleRule()
+FragmentOrElement::GetInlineStyleRule()
 {
   return nullptr;
 }
 
 nsresult
-nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
+FragmentOrElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
                                      const nsAString* aSerialized,
                                      bool aNotify)
 {
-  NS_NOTYETIMPLEMENTED("nsGenericElement::SetInlineStyleRule");
+  NS_NOTYETIMPLEMENTED("FragmentOrElement::SetInlineStyleRule");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP_(bool)
-nsGenericElement::IsAttributeMapped(const nsIAtom* aAttribute) const
+FragmentOrElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   return false;
 }
 
 nsChangeHint
-nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
+FragmentOrElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
                                          PRInt32 aModType) const
 {
   return nsChangeHint(0);
 }
 
 nsIAtom *
-nsGenericElement::GetClassAttributeName() const
+FragmentOrElement::GetClassAttributeName() const
 {
   return nullptr;
 }
 
 bool
-nsGenericElement::FindAttributeDependence(const nsIAtom* aAttribute,
+FragmentOrElement::FindAttributeDependence(const nsIAtom* aAttribute,
                                           const MappedAttributeEntry* const aMaps[],
                                           PRUint32 aMapCount)
 {
   for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) {
     for (const MappedAttributeEntry* map = aMaps[mapindex];
          map->attribute; ++map) {
       if (aAttribute == *map->attribute) {
         return true;
       }
     }
   }
 
   return false;
 }
 
 already_AddRefed<nsINodeInfo>
-nsGenericElement::GetExistingAttrNameFromQName(const nsAString& aStr) const
+FragmentOrElement::GetExistingAttrNameFromQName(const nsAString& aStr) const
 {
   const nsAttrName* name = InternalGetExistingAttrNameFromQName(aStr);
   if (!name) {
     return nullptr;
   }
 
   nsINodeInfo* nodeInfo;
   if (name->IsAtom()) {
@@ -2554,25 +2554,25 @@ nsGenericElement::GetExistingAttrNameFro
   else {
     NS_ADDREF(nodeInfo = name->NodeInfo());
   }
 
   return nodeInfo;
 }
 
 bool
-nsGenericElement::IsLink(nsIURI** aURI) const
+FragmentOrElement::IsLink(nsIURI** aURI) const
 {
   *aURI = nullptr;
   return false;
 }
 
 // static
 bool
-nsGenericElement::ShouldBlur(nsIContent *aContent)
+FragmentOrElement::ShouldBlur(nsIContent *aContent)
 {
   // Determine if the current element is focused, if it is not focused
   // then we should not try to blur
   nsIDocument *document = aContent->GetDocument();
   if (!document)
     return false;
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(document->GetWindow());
@@ -2586,69 +2586,69 @@ nsGenericElement::ShouldBlur(nsIContent 
     return true;
 
   // if focus on this element would get redirected, then check the redirected
   // content as well when blurring.
   return (contentToBlur && nsFocusManager::GetRedirectedFocus(aContent) == contentToBlur);
 }
 
 nsIContent*
-nsGenericElement::GetBindingParent() const
+FragmentOrElement::GetBindingParent() const
 {
   nsDOMSlots *slots = GetExistingDOMSlots();
 
   if (slots) {
     return slots->mBindingParent;
   }
   return nullptr;
 }
 
 bool
-nsGenericElement::IsNodeOfType(PRUint32 aFlags) const
+FragmentOrElement::IsNodeOfType(PRUint32 aFlags) const
 {
   return !(aFlags & ~eCONTENT);
 }
 
 nsresult
-nsGenericElement::InsertChildAt(nsIContent* aKid,
+FragmentOrElement::InsertChildAt(nsIContent* aKid,
                                 PRUint32 aIndex,
                                 bool aNotify)
 {
   NS_PRECONDITION(aKid, "null ptr");
 
   return doInsertChildAt(aKid, aIndex, aNotify, mAttrsAndChildren);
 }
 
 void
-nsGenericElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
+FragmentOrElement::RemoveChildAt(PRUint32 aIndex, bool aNotify)
 {
   nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
   NS_ASSERTION(oldKid == GetChildAt(aIndex), "Unexpected child in RemoveChildAt");
 
   if (oldKid) {
     doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
   }
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetTextContent(nsAString &aTextContent)
+FragmentOrElement::GetTextContent(nsAString &aTextContent)
 {
   nsContentUtils::GetNodeTextContent(this, true, aTextContent);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetTextContent(const nsAString& aTextContent)
+FragmentOrElement::SetTextContent(const nsAString& aTextContent)
 {
   return nsContentUtils::SetNodeTextContent(this, aTextContent, false);
 }
 
 /* static */
 nsresult
-nsGenericElement::DispatchEvent(nsPresContext* aPresContext,
+FragmentOrElement::DispatchEvent(nsPresContext* aPresContext,
                                 nsEvent* aEvent,
                                 nsIContent* aTarget,
                                 bool aFullDispatch,
                                 nsEventStatus* aStatus)
 {
   NS_PRECONDITION(aTarget, "Must have target");
   NS_PRECONDITION(aEvent, "Must have source event");
   NS_PRECONDITION(aStatus, "Null out param?");
@@ -2666,17 +2666,17 @@ nsGenericElement::DispatchEvent(nsPresCo
     return shell->HandleEventWithTarget(aEvent, nullptr, aTarget, aStatus);
   }
 
   return shell->HandleDOMEventWithTarget(aTarget, aEvent, aStatus);
 }
 
 /* static */
 nsresult
-nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
+FragmentOrElement::DispatchClickEvent(nsPresContext* aPresContext,
                                      nsInputEvent* aSourceEvent,
                                      nsIContent* aTarget,
                                      bool aFullDispatch,
                                      PRUint32 aFlags,
                                      nsEventStatus* aStatus)
 {
   NS_PRECONDITION(aTarget, "Must have target");
   NS_PRECONDITION(aSourceEvent, "Must have source event");
@@ -2700,32 +2700,32 @@ nsGenericElement::DispatchClickEvent(nsP
   event.inputSource = inputSource;
   event.modifiers = aSourceEvent->modifiers;
   event.flags |= aFlags; // Be careful not to overwrite existing flags!
 
   return DispatchEvent(aPresContext, &event, aTarget, aFullDispatch, aStatus);
 }
 
 nsIFrame*
-nsGenericElement::GetPrimaryFrame(mozFlushType aType)
+FragmentOrElement::GetPrimaryFrame(mozFlushType aType)
 {
   nsIDocument* doc = GetCurrentDoc();
   if (!doc) {
     return nullptr;
   }
 
   // Cause a flush, so we get up-to-date frame
   // information
   doc->FlushPendingNotifications(aType);
 
   return GetPrimaryFrame();
 }
 
 void
-nsGenericElement::DestroyContent()
+FragmentOrElement::DestroyContent()
 {
   nsIDocument *document = OwnerDoc();
   document->BindingManager()->RemovedFromDocument(this, document);
   document->ClearBoxObjectFor(this);
 
   // XXX We really should let cycle collection do this, but that currently still
   //     leaks (see https://bugzilla.mozilla.org/show_bug.cgi?id=406684).
   nsContentUtils::ReleaseWrapper(this, this);
@@ -2733,30 +2733,30 @@ nsGenericElement::DestroyContent()
   PRUint32 i, count = mAttrsAndChildren.ChildCount();
   for (i = 0; i < count; ++i) {
     // The child can remove itself from the parent in BindToTree.
     mAttrsAndChildren.ChildAt(i)->DestroyContent();
   }
 }
 
 void
-nsGenericElement::SaveSubtreeState()
+FragmentOrElement::SaveSubtreeState()
 {
   PRUint32 i, count = mAttrsAndChildren.ChildCount();
   for (i = 0; i < count; ++i) {
     mAttrsAndChildren.ChildAt(i)->SaveSubtreeState();
   }
 }
 
 //----------------------------------------------------------------------
 
 // Generic DOMNode implementations
 
 void
-nsGenericElement::FireNodeInserted(nsIDocument* aDoc,
+FragmentOrElement::FireNodeInserted(nsIDocument* aDoc,
                                    nsINode* aParent,
                                    nsTArray<nsCOMPtr<nsIContent> >& aNodes)
 {
   PRUint32 count = aNodes.Length();
   for (PRUint32 i = 0; i < count; ++i) {
     nsIContent* childContent = aNodes[i];
 
     if (nsContentUtils::HasMutationListeners(childContent,
@@ -2769,17 +2769,17 @@ nsGenericElement::FireNodeInserted(nsIDo
     }
   }
 }
 
 //----------------------------------------------------------------------
 
 // nsISupports implementation
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericElement)
+NS_IMPL_CYCLE_COLLECTION_CLASS(FragmentOrElement)
 
 #define SUBTREE_UNBINDINGS_PER_RUNNABLE 500
 
 class ContentUnbinder : public nsRunnable
 {
 public:
   ContentUnbinder()
   {
@@ -2794,17 +2794,17 @@ public:
   }
 
   void UnbindSubtree(nsIContent* aNode)
   {
     if (aNode->NodeType() != nsIDOMNode::ELEMENT_NODE &&
         aNode->NodeType() != nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
       return;  
     }
-    nsGenericElement* container = static_cast<nsGenericElement*>(aNode);
+    FragmentOrElement* container = static_cast<FragmentOrElement*>(aNode);
     PRUint32 childCount = container->mAttrsAndChildren.ChildCount();
     if (childCount) {
       while (childCount-- > 0) {
         // Hold a strong ref to the node when we remove it, because we may be
         // the last reference to it.  We need to call TakeChildAt() and
         // update mFirstChild before calling UnbindFromTree, since this last
         // can notify various observers and they should really see consistent
         // tree state.
@@ -2878,22 +2878,22 @@ private:
   nsRefPtr<ContentUnbinder>                     mNext;
   ContentUnbinder*                              mLast;
   static ContentUnbinder*                       sContentUnbinder;
 };
 
 ContentUnbinder* ContentUnbinder::sContentUnbinder = nullptr;
 
 void
-nsGenericElement::ClearContentUnbinder()
+FragmentOrElement::ClearContentUnbinder()
 {
   ContentUnbinder::UnbindAll();
 }
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
   nsINode::Unlink(tmp);
 
   if (tmp->HasProperties()) {
     if (tmp->IsHTML()) {
       tmp->DeleteProperty(nsGkAtoms::microdataProperties);
       tmp->DeleteProperty(nsGkAtoms::itemtype);
       tmp->DeleteProperty(nsGkAtoms::itemref);
       tmp->DeleteProperty(nsGkAtoms::itemprop);
@@ -2940,53 +2940,53 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
   {
     nsIDocument *doc;
     if (!tmp->GetNodeParent() && (doc = tmp->OwnerDoc())) {
       doc->BindingManager()->RemovedFromDocument(tmp, doc);
     }
   }
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericElement)
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(FragmentOrElement)
   nsINode::Trace(tmp, aCallback, aClosure);
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 void
-nsGenericElement::MarkUserData(void* aObject, nsIAtom* aKey, void* aChild,
+FragmentOrElement::MarkUserData(void* aObject, nsIAtom* aKey, void* aChild,
                                void* aData)
 {
   PRUint32* gen = static_cast<PRUint32*>(aData);
   xpc_MarkInCCGeneration(static_cast<nsISupports*>(aChild), *gen);
 }
 
 void
-nsGenericElement::MarkUserDataHandler(void* aObject, nsIAtom* aKey,
+FragmentOrElement::MarkUserDataHandler(void* aObject, nsIAtom* aKey,
                                       void* aChild, void* aData)
 {
   xpc_TryUnmarkWrappedGrayObject(static_cast<nsISupports*>(aChild));
 }
 
 void
-nsGenericElement::MarkNodeChildren(nsINode* aNode)
+FragmentOrElement::MarkNodeChildren(nsINode* aNode)
 {
   JSObject* o = GetJSObjectChild(aNode);
   xpc_UnmarkGrayObject(o);
 
   nsEventListenerManager* elm = aNode->GetListenerManager(false);
   if (elm) {
     elm->UnmarkGrayJSListeners();
   }
 
   if (aNode->HasProperties()) {
     nsIDocument* ownerDoc = aNode->OwnerDoc();
     ownerDoc->PropertyTable(DOM_USER_DATA)->
-      Enumerate(aNode, nsGenericElement::MarkUserData,
+      Enumerate(aNode, FragmentOrElement::MarkUserData,
                 &nsCCUncollectableMarker::sGeneration);
     ownerDoc->PropertyTable(DOM_USER_DATA_HANDLER)->
-      Enumerate(aNode, nsGenericElement::MarkUserDataHandler,
+      Enumerate(aNode, FragmentOrElement::MarkUserDataHandler,
                 &nsCCUncollectableMarker::sGeneration);
   }
 }
 
 nsINode*
 FindOptimizableSubtreeRoot(nsINode* aNode)
 {
   nsINode* p;
@@ -3018,17 +3018,17 @@ ClearBlackMarkedNodes()
     n->SetInCCBlackTree(false);
   }
   delete gCCBlackMarkedNodes;
   gCCBlackMarkedNodes = nullptr;
 }
 
 // static
 bool
-nsGenericElement::CanSkipInCC(nsINode* aNode)
+FragmentOrElement::CanSkipInCC(nsINode* aNode)
 {
   // Don't try to optimize anything during shutdown.
   if (nsCCUncollectableMarker::sGeneration == 0) {
     return false;
   }
 
   nsIDocument* currentDoc = aNode->GetCurrentDoc();
   if (currentDoc &&
@@ -3195,17 +3195,17 @@ OwnedByBindingManager(nsIDocument* aCurr
 
 // CanSkip checks if aNode is black, and if it is, returns
 // true. If aNode is in a black DOM tree, CanSkip may also remove other objects
 // from purple buffer and unmark event listeners and user data.
 // If the root of the DOM tree is a document, less optimizations are done
 // since checking the blackness of the current document is usually fast and we
 // don't want slow down such common cases.
 bool
-nsGenericElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
+FragmentOrElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
 {
   // Don't try to optimize anything during shutdown.
   if (nsCCUncollectableMarker::sGeneration == 0) {
     return false;
   }
 
   bool unoptimizable = aNode->UnoptimizableCCNode();
   nsIDocument* currentDoc = aNode->GetCurrentDoc();
@@ -3324,47 +3324,47 @@ nsGenericElement::CanSkip(nsINode* aNode
     if ((n != aNode || aRemovingAllowed) && n->IsPurple()) {
       n->RemovePurple();
     }
   }
   return true;
 }
 
 bool
-nsGenericElement::CanSkipThis(nsINode* aNode)
+FragmentOrElement::CanSkipThis(nsINode* aNode)
 {
   if (nsCCUncollectableMarker::sGeneration == 0) {
     return false;
   }
   if (aNode->IsBlack()) {
     return true;
   }
   nsIDocument* c = aNode->GetCurrentDoc();
   return 
     ((c && nsCCUncollectableMarker::InGeneration(c->GetMarkedCCGeneration())) ||
      aNode->InCCBlackTree()) && !NeedsScriptTraverse(aNode);
 }
 
 void
-nsGenericElement::InitCCCallbacks()
+FragmentOrElement::InitCCCallbacks()
 {
   nsCycleCollector_setForgetSkippableCallback(ClearCycleCollectorCleanupData);
   nsCycleCollector_setBeforeUnlinkCallback(ClearBlackMarkedNodes);
 }
 
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGenericElement)
-  return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
+NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(FragmentOrElement)
+  return FragmentOrElement::CanSkip(tmp, aRemovingAllowed);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
 
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsGenericElement)
-  return nsGenericElement::CanSkipInCC(tmp);
+NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(FragmentOrElement)
+  return FragmentOrElement::CanSkipInCC(tmp);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
 
-NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsGenericElement)
-  return nsGenericElement::CanSkipThis(tmp);
+NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(FragmentOrElement)
+  return FragmentOrElement::CanSkipThis(tmp);
 NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
 
 static const char* kNSURIs[] = {
   " ([none])",
   " (xmlns)",
   " (xml)",
   " (xhtml)",
   " (XLink)",
@@ -3372,17 +3372,17 @@ static const char* kNSURIs[] = {
   " (XBL)",
   " (MathML)",
   " (RDF)",
   " (XUL)",
   " (SVG)",
   " (XML Events)"
 };
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
   if (NS_UNLIKELY(cb.WantDebugInfo())) {
     char name[512];
     PRUint32 nsid = tmp->GetNameSpaceID();
     nsAtomCString localName(tmp->NodeInfo()->NameAtom());
     nsCAutoString uri;
     if (tmp->OwnerDoc()->GetDocumentURI()) {
       tmp->OwnerDoc()->GetDocumentURI()->GetSpec(uri);
     }
@@ -3402,27 +3402,27 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
       nsAutoString classString;
       classAttrValue->ToString(classString);
       classString.ReplaceChar(PRUnichar('\n'), PRUnichar(' '));
       classes.Append(classString);
       classes.AppendLiteral("'");
     }
 
     const char* nsuri = nsid < ArrayLength(kNSURIs) ? kNSURIs[nsid] : "";
-    PR_snprintf(name, sizeof(name), "nsGenericElement%s %s%s%s %s",
+    PR_snprintf(name, sizeof(name), "FragmentOrElement%s %s%s%s %s",
                 nsuri,
                 localName.get(),
                 NS_ConvertUTF16toUTF8(id).get(),
                 NS_ConvertUTF16toUTF8(classes).get(),
                 uri.get());
-    cb.DescribeRefCountedNode(tmp->mRefCnt.get(), sizeof(nsGenericElement),
+    cb.DescribeRefCountedNode(tmp->mRefCnt.get(), sizeof(FragmentOrElement),
                               name);
   }
   else {
-    NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsGenericElement, tmp->mRefCnt.get())
+    NS_IMPL_CYCLE_COLLECTION_DESCRIBE(FragmentOrElement, tmp->mRefCnt.get())
   }
 
   // Always need to traverse script objects, so do that before we check
   // if we're uncollectable.
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 
   if (!nsINode::Traverse(tmp, cb)) {
     return NS_SUCCESS_INTERRUPTED_TRAVERSE;
@@ -3476,19 +3476,19 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
     nsDOMSlots *slots = tmp->GetExistingDOMSlots();
     if (slots) {
       slots->Traverse(cb, tmp->IsXUL());
     }
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 
-NS_INTERFACE_MAP_BEGIN(nsGenericElement)
+NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsGenericElement)
+  NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
   NS_INTERFACE_MAP_ENTRY(Element)
   NS_INTERFACE_MAP_ENTRY(nsIContent)
   NS_INTERFACE_MAP_ENTRY(nsINode)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
                                  new nsNodeSupportsWeakRefTearoff(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNodeSelector,
                                  new nsNodeSelectorTearoff(this))
@@ -3500,41 +3500,41 @@ NS_INTERFACE_MAP_BEGIN(nsGenericElement)
                                  new nsInlineEventHandlersTearoff(this))
   // nsNodeSH::PreCreate() depends on the identity pointer being the
   // same as nsINode (which nsIContent inherits), so if you change the
   // below line, make sure nsNodeSH::PreCreate() still does the right
   // thing!
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGenericElement)
-NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsGenericElement,
+NS_IMPL_CYCLE_COLLECTING_ADDREF(FragmentOrElement)
+NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(FragmentOrElement,
                                               nsNodeUtils::LastRelease(this))
 
 nsresult
-nsGenericElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr)
+FragmentOrElement::PostQueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
   return OwnerDoc()->BindingManager()->GetBindingImplementation(this, aIID,
                                                                 aInstancePtr);
 }
 
 //----------------------------------------------------------------------
 nsresult
-nsGenericElement::LeaveLink(nsPresContext* aPresContext)
+FragmentOrElement::LeaveLink(nsPresContext* aPresContext)
 {
   nsILinkHandler *handler = aPresContext->GetLinkHandler();
   if (!handler) {
     return NS_OK;
   }
 
   return handler->OnLeaveLink();
 }
 
 nsresult
-nsGenericElement::AddScriptEventListener(nsIAtom* aEventName,
+FragmentOrElement::AddScriptEventListener(nsIAtom* aEventName,
                                          const nsAString& aValue,
                                          bool aDefer)
 {
   nsIDocument *ownerDoc = OwnerDoc();
   if (ownerDoc->IsLoadedAsData()) {
     // Make this a no-op rather than throwing an error to avoid
     // the error causing problems setting the attribute.
     return NS_OK;
@@ -3553,40 +3553,40 @@ nsGenericElement::AddScriptEventListener
                                   defer, !nsContentUtils::IsChromeDoc(ownerDoc));
   return NS_OK;
 }
 
 
 //----------------------------------------------------------------------
 
 const nsAttrName*
-nsGenericElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const
+FragmentOrElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const
 {
   return mAttrsAndChildren.GetExistingAttrNameFromQName(aStr);
 }
 
 nsresult
-nsGenericElement::CopyInnerTo(nsGenericElement* aDst)
+FragmentOrElement::CopyInnerTo(FragmentOrElement* aDst)
 {
   PRUint32 i, count = mAttrsAndChildren.AttrCount();
   for (i = 0; i < count; ++i) {
     const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i);
     const nsAttrValue* value = mAttrsAndChildren.AttrAt(i);
     nsAutoString valStr;
     value->ToString(valStr);
     nsresult rv = aDst->SetAttr(name->NamespaceID(), name->LocalName(),
                                 name->GetPrefix(), valStr, false);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 bool
-nsGenericElement::MaybeCheckSameAttrVal(PRInt32 aNamespaceID,
+FragmentOrElement::MaybeCheckSameAttrVal(PRInt32 aNamespaceID,
                                         nsIAtom* aName,
                                         nsIAtom* aPrefix,
                                         const nsAttrValueOrString& aValue,
                                         bool aNotify,
                                         nsAttrValue& aOldValue,
                                         PRUint8* aModType,
                                         bool* aHasListeners)
 {
@@ -3633,17 +3633,17 @@ nsGenericElement::MaybeCheckSameAttrVal(
   }
   *aModType = modification ?
     static_cast<PRUint8>(nsIDOMMutationEvent::MODIFICATION) :
     static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION);
   return false;
 }
 
 nsresult
-nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
+FragmentOrElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                           nsIAtom* aPrefix, const nsAString& aValue,
                           bool aNotify)
 {
   // Keep this in sync with SetParsedAttr below
 
   NS_ENSURE_ARG_POINTER(aName);
   NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
                "Don't call SetAttr with unknown namespace");
@@ -3679,17 +3679,17 @@ nsGenericElement::SetAttr(PRInt32 aNames
   }
 
   return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
                           attrValue, modType, hasListeners, aNotify,
                           kCallAfterSetAttr);
 }
 
 nsresult
-nsGenericElement::SetParsedAttr(PRInt32 aNamespaceID, nsIAtom* aName,
+FragmentOrElement::SetParsedAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                 nsIAtom* aPrefix, nsAttrValue& aParsedValue,
                                 bool aNotify)
 {
   // Keep this in sync with SetAttr above
 
   NS_ENSURE_ARG_POINTER(aName);
   NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
                "Don't call SetAttr with unknown namespace");
@@ -3717,17 +3717,17 @@ nsGenericElement::SetParsedAttr(PRInt32 
   }
 
   return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
                           aParsedValue, modType, hasListeners, aNotify,
                           kCallAfterSetAttr);
 }
 
 nsresult
-nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
+FragmentOrElement::SetAttrAndNotify(PRInt32 aNamespaceID,
                                    nsIAtom* aName,
                                    nsIAtom* aPrefix,
                                    const nsAttrValue& aOldValue,
                                    nsAttrValue& aParsedValue,
                                    PRUint8 aModType,
                                    bool aFireMutation,
                                    bool aNotify,
                                    bool aCallAfterSetAttr)
@@ -3743,17 +3743,17 @@ nsGenericElement::SetAttrAndNotify(PRInt
   // SetAndTakeMappedAttr below
   nsAttrValue aValueForAfterSetAttr;
   if (aCallAfterSetAttr) {
     aValueForAfterSetAttr.SetTo(aParsedValue);
   }
 
   if (aNamespaceID == kNameSpaceID_None) {
     // XXXbz Perhaps we should push up the attribute mapping function
-    // stuff to nsGenericElement?
+    // stuff to FragmentOrElement?
     if (!IsAttributeMapped(aName) ||
         !SetMappedAttribute(document, aName, aParsedValue, &rv)) {
       rv = mAttrsAndChildren.SetAndTakeAttr(aName, aParsedValue);
     }
   }
   else {
     nsCOMPtr<nsINodeInfo> ni;
     ni = mNodeInfo->NodeInfoManager()->GetNodeInfo(aName, aPrefix,
@@ -3812,61 +3812,61 @@ nsGenericElement::SetAttrAndNotify(PRInt
     mozAutoSubtreeModified subtree(OwnerDoc(), this);
     (new nsAsyncDOMEvent(this, mutation))->RunDOMEventWhenSafe();
   }
 
   return NS_OK;
 }
 
 bool
-nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
+FragmentOrElement::ParseAttribute(PRInt32 aNamespaceID,
                                  nsIAtom* aAttribute,
                                  const nsAString& aValue,
                                  nsAttrValue& aResult)
 {
   return false;
 }
 
 bool
-nsGenericElement::SetMappedAttribute(nsIDocument* aDocument,
+FragmentOrElement::SetMappedAttribute(nsIDocument* aDocument,
                                      nsIAtom* aName,
                                      nsAttrValue& aValue,
                                      nsresult* aRetval)
 {
   *aRetval = NS_OK;
   return false;
 }
 
 nsEventListenerManager*
-nsGenericElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
+FragmentOrElement::GetEventListenerManagerForAttr(nsIAtom* aAttrName,
                                                  bool* aDefer)
 {
   *aDefer = true;
   return GetListenerManager(true);
 }
 
-nsGenericElement::nsAttrInfo
-nsGenericElement::GetAttrInfo(PRInt32 aNamespaceID, nsIAtom* aName) const
+FragmentOrElement::nsAttrInfo
+FragmentOrElement::GetAttrInfo(PRInt32 aNamespaceID, nsIAtom* aName) const
 {
   NS_ASSERTION(nullptr != aName, "must have attribute name");
   NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown,
                "must have a real namespace ID!");
 
   PRInt32 index = mAttrsAndChildren.IndexOfAttr(aName, aNamespaceID);
   if (index >= 0) {
     return nsAttrInfo(mAttrsAndChildren.AttrNameAt(index),
                       mAttrsAndChildren.AttrAt(index));
   }
 
   return nsAttrInfo(nullptr, nullptr);
 }
   
 
 bool
-nsGenericElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
+FragmentOrElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                           nsAString& aResult) const
 {
   NS_ASSERTION(nullptr != aName, "must have attribute name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
                "must have a real namespace ID!");
 
   const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
   if (!val) {
@@ -3879,54 +3879,54 @@ nsGenericElement::GetAttr(PRInt32 aNameS
   }
 
   val->ToString(aResult);
 
   return true;
 }
 
 bool
-nsGenericElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
+FragmentOrElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
 {
   NS_ASSERTION(nullptr != aName, "must have attribute name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
                "must have a real namespace ID!");
 
   return mAttrsAndChildren.IndexOfAttr(aName, aNameSpaceID) >= 0;
 }
 
 bool
-nsGenericElement::AttrValueIs(PRInt32 aNameSpaceID,
+FragmentOrElement::AttrValueIs(PRInt32 aNameSpaceID,
                               nsIAtom* aName,
                               const nsAString& aValue,
                               nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
 
   const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
   return val && val->Equals(aValue, aCaseSensitive);
 }
 
 bool
-nsGenericElement::AttrValueIs(PRInt32 aNameSpaceID,
+FragmentOrElement::AttrValueIs(PRInt32 aNameSpaceID,
                               nsIAtom* aName,
                               nsIAtom* aValue,
                               nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
   NS_ASSERTION(aValue, "Null value atom");
 
   const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
   return val && val->Equals(aValue, aCaseSensitive);
 }
 
 PRInt32
-nsGenericElement::FindAttrValueIn(PRInt32 aNameSpaceID,
+FragmentOrElement::FindAttrValueIn(PRInt32 aNameSpaceID,
                                   nsIAtom* aName,
                                   AttrValuesArray* aValues,
                                   nsCaseTreatment aCaseSensitive) const
 {
   NS_ASSERTION(aName, "Must have attr name");
   NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
   NS_ASSERTION(aValues, "Null value array");
   
@@ -3938,17 +3938,17 @@ nsGenericElement::FindAttrValueIn(PRInt3
       }
     }
     return ATTR_VALUE_NO_MATCH;
   }
   return ATTR_MISSING;
 }
 
 nsresult
-nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
+FragmentOrElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
                             bool aNotify)
 {
   NS_ASSERTION(nullptr != aName, "must have attribute name");
 
   PRInt32 index = mAttrsAndChildren.IndexOfAttr(aName, aNameSpaceID);
   if (index < 0) {
     return NS_OK;
   }
@@ -4026,78 +4026,78 @@ nsGenericElement::UnsetAttr(PRInt32 aNam
     mozAutoSubtreeModified subtree(OwnerDoc(), this);
     (new nsAsyncDOMEvent(this, mutation))->RunDOMEventWhenSafe();
   }
 
   return NS_OK;
 }
 
 const nsAttrName*
-nsGenericElement::GetAttrNameAt(PRUint32 aIndex) const
+FragmentOrElement::GetAttrNameAt(PRUint32 aIndex) const
 {
   return mAttrsAndChildren.GetSafeAttrNameAt(aIndex);
 }
 
 PRUint32
-nsGenericElement::GetAttrCount() const
+FragmentOrElement::GetAttrCount() const
 {
   return mAttrsAndChildren.AttrCount();
 }
 
 const nsTextFragment*
-nsGenericElement::GetText()
+FragmentOrElement::GetText()
 {
   return nullptr;
 }
 
 PRUint32
-nsGenericElement::TextLength() const
+FragmentOrElement::TextLength() const
 {
   // We can remove this assertion if it turns out to be useful to be able
   // to depend on this returning 0
-  NS_NOTREACHED("called nsGenericElement::TextLength");
+  NS_NOTREACHED("called FragmentOrElement::TextLength");
 
   return 0;
 }
 
 nsresult
-nsGenericElement::SetText(const PRUnichar* aBuffer, PRUint32 aLength,
+FragmentOrElement::SetText(const PRUnichar* aBuffer, PRUint32 aLength,
                           bool aNotify)
 {
-  NS_ERROR("called nsGenericElement::SetText");
+  NS_ERROR("called FragmentOrElement::SetText");
 
   return NS_ERROR_FAILURE;
 }
 
 nsresult
-nsGenericElement::AppendText(const PRUnichar* aBuffer, PRUint32 aLength,
+FragmentOrElement::AppendText(const PRUnichar* aBuffer, PRUint32 aLength,
                              bool aNotify)
 {
-  NS_ERROR("called nsGenericElement::AppendText");
+  NS_ERROR("called FragmentOrElement::AppendText");
 
   return NS_ERROR_FAILURE;
 }
 
 bool
-nsGenericElement::TextIsOnlyWhitespace()
+FragmentOrElement::TextIsOnlyWhitespace()
 {
   return false;
 }
 
 void
-nsGenericElement::AppendTextTo(nsAString& aResult)
+FragmentOrElement::AppendTextTo(nsAString& aResult)
 {
   // We can remove this assertion if it turns out to be useful to be able
   // to depend on this appending nothing.
-  NS_NOTREACHED("called nsGenericElement::TextLength");
+  NS_NOTREACHED("called FragmentOrElement::TextLength");
 }
 
 #ifdef DEBUG
 void
-nsGenericElement::ListAttributes(FILE* out) const
+FragmentOrElement::ListAttributes(FILE* out) const
 {
   PRUint32 index, count = mAttrsAndChildren.AttrCount();
   for (index = 0; index < count; index++) {
     nsAutoString buffer;
 
     // name
     mAttrsAndChildren.AttrNameAt(index)->GetQualifiedName(buffer);
 
@@ -4113,17 +4113,17 @@ nsGenericElement::ListAttributes(FILE* o
     buffer.AppendLiteral("\"");
 
     fputs(" ", out);
     fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
   }
 }
 
 void
-nsGenericElement::List(FILE* out, PRInt32 aIndent,
+FragmentOrElement::List(FILE* out, PRInt32 aIndent,
                        const nsCString& aPrefix) const
 {
   PRInt32 indent;
   for (indent = aIndent; --indent >= 0; ) fputs("  ", out);
 
   fputs(aPrefix.get(), out);
 
   fputs(NS_LossyConvertUTF16toASCII(mNodeInfo->QualifiedName()).get(), out);
@@ -4150,17 +4150,17 @@ nsGenericElement::List(FILE* out, PRInt3
       child->List(out, aIndent + 1);
     }
 
     for (indent = aIndent; --indent >= 0; ) fputs("  ", out);
   }
 
   fputs(">\n", out);
   
-  nsGenericElement* nonConstThis = const_cast<nsGenericElement*>(this);
+  FragmentOrElement* nonConstThis = const_cast<FragmentOrElement*>(this);
 
   // XXX sXBL/XBL2 issue! Owner or current document?
   nsIDocument *document = OwnerDoc();
 
   // Note: not listing nsIAnonymousContentCreator-created content...
 
   nsBindingManager* bindingManager = document->BindingManager();
   nsCOMPtr<nsIDOMNodeList> anonymousChildren;
@@ -4208,17 +4208,17 @@ nsGenericElement::List(FILE* out, PRInt3
 
       for (indent = aIndent; --indent >= 0; ) fputs("  ", out);
       fputs(">\n", out);
     }
   }
 }
 
 void
-nsGenericElement::DumpContent(FILE* out, PRInt32 aIndent,
+FragmentOrElement::DumpContent(FILE* out, PRInt32 aIndent,
                               bool aDumpAll) const
 {
   PRInt32 indent;
   for (indent = aIndent; --indent >= 0; ) fputs("  ", out);
 
   const nsString& buf = mNodeInfo->QualifiedName();
   fputs("<", out);
   fputs(NS_LossyConvertUTF16toASCII(buf).get(), out);
@@ -4240,47 +4240,47 @@ nsGenericElement::DumpContent(FILE* out,
   fputs(NS_LossyConvertUTF16toASCII(buf).get(), out);
   fputs(">", out);
 
   if(aIndent) fputs("\n", out);
 }
 #endif
 
 PRUint32
-nsGenericElement::GetChildCount() const
+FragmentOrElement::GetChildCount() const
 {
   return mAttrsAndChildren.ChildCount();
 }
 
 nsIContent *
-nsGenericElement::GetChildAt(PRUint32 aIndex) const
+FragmentOrElement::GetChildAt(PRUint32 aIndex) const
 {
   return mAttrsAndChildren.GetSafeChildAt(aIndex);
 }
 
 nsIContent * const *
-nsGenericElement::GetChildArray(PRUint32* aChildCount) const
+FragmentOrElement::GetChildArray(PRUint32* aChildCount) const
 {
   return mAttrsAndChildren.GetChildArray(aChildCount);
 }
 
 PRInt32
-nsGenericElement::IndexOf(nsINode* aPossibleChild) const
+FragmentOrElement::IndexOf(nsINode* aPossibleChild) const
 {
   return mAttrsAndChildren.IndexOfChild(aPossibleChild);
 }
 
 nsINode::nsSlots*
-nsGenericElement::CreateSlots()
+FragmentOrElement::CreateSlots()
 {
   return new nsDOMSlots();
 }
 
 bool
-nsGenericElement::CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
+FragmentOrElement::CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
                                                        nsIURI** aURI) const
 {
   if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
       (!NS_IS_TRUSTED_EVENT(aVisitor.mEvent) &&
        (aVisitor.mEvent->message != NS_MOUSE_CLICK) &&
        (aVisitor.mEvent->message != NS_KEY_PRESS) &&
        (aVisitor.mEvent->message != NS_UI_ACTIVATE)) ||
       !aVisitor.mPresContext ||
@@ -4288,17 +4288,17 @@ nsGenericElement::CheckHandleEventForLin
     return false;
   }
 
   // Make sure we actually are a link
   return IsLink(aURI);
 }
 
 nsresult
-nsGenericElement::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
+FragmentOrElement::PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor)
 {
   // Optimisation: return early if this event doesn't interest us.
   // IMPORTANT: this switch and the switch below it must be kept in sync!
   switch (aVisitor.mEvent->message) {
   case NS_MOUSE_ENTER_SYNTH:
   case NS_FOCUS_CONTENT:
   case NS_MOUSE_EXIT_SYNTH:
   case NS_BLUR_CONTENT:
@@ -4349,17 +4349,17 @@ nsGenericElement::PreHandleEventForLinks
     NS_NOTREACHED("switch statements not in sync");
     return NS_ERROR_UNEXPECTED;
   }
 
   return rv;
 }
 
 nsresult
-nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
+FragmentOrElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
 {
   // Optimisation: return early if this event doesn't interest us.
   // IMPORTANT: this switch and the switch below it must be kept in sync!
   switch (aVisitor.mEvent->message) {
   case NS_MOUSE_BUTTON_DOWN:
   case NS_MOUSE_CLICK:
   case NS_UI_ACTIVATE:
   case NS_KEY_PRESS:
@@ -4458,17 +4458,17 @@ nsGenericElement::PostHandleEventForLink
     NS_NOTREACHED("switch statements not in sync");
     return NS_ERROR_UNEXPECTED;
   }
 
   return rv;
 }
 
 void
-nsGenericElement::FireNodeRemovedForChildren()
+FragmentOrElement::FireNodeRemovedForChildren()
 {
   nsIDocument* doc = OwnerDoc();
   // Optimize the common case
   if (!nsContentUtils::
         HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
     return;
   }
 
@@ -4478,17 +4478,17 @@ nsGenericElement::FireNodeRemovedForChil
   for (child = GetFirstChild();
        child && child->GetNodeParent() == this;
        child = child->GetNextSibling()) {
     nsContentUtils::MaybeFireNodeRemoved(child, this, doc);
   }
 }
 
 void
-nsGenericElement::GetLinkTarget(nsAString& aTarget)
+FragmentOrElement::GetLinkTarget(nsAString& aTarget)
 {
   aTarget.Truncate();
 }
 
 // NOTE: The aPresContext pointer is NOT addrefed.
 // *aSelectorList might be null even if NS_OK is returned; this
 // happens when all the selectors were pseudo-element selectors.
 static nsresult
@@ -4614,45 +4614,45 @@ struct ElementHolder {
     NS_ABORT_IF_FALSE(!mElement, "Should only get one element");
     mElement = aElement;
   }
   Element* mElement;
 };
 
 /* static */
 nsIContent*
-nsGenericElement::doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
+FragmentOrElement::doQuerySelector(nsINode* aRoot, const nsAString& aSelector,
                                   nsresult *aResult)
 {
   NS_PRECONDITION(aResult, "Null out param?");
 
   ElementHolder holder;
   *aResult = FindMatchingElements<true>(aRoot, aSelector, holder);
 
   return holder.mElement;
 }
 
 /* static */
 nsresult
-nsGenericElement::doQuerySelectorAll(nsINode* aRoot,
+FragmentOrElement::doQuerySelectorAll(nsINode* aRoot,
                                      const nsAString& aSelector,
                                      nsIDOMNodeList **aReturn)
 {
   NS_PRECONDITION(aReturn, "Null out param?");
 
   nsSimpleContentList* contentList = new nsSimpleContentList(aRoot);
   NS_ENSURE_TRUE(contentList, NS_ERROR_OUT_OF_MEMORY);
   NS_ADDREF(*aReturn = contentList);
   
   return FindMatchingElements<false>(aRoot, aSelector, *contentList);
 }
 
 
 bool
-nsGenericElement::MozMatchesSelector(const nsAString& aSelector, nsresult* aResult)
+FragmentOrElement::MozMatchesSelector(const nsAString& aSelector, nsresult* aResult)
 {
   nsAutoPtr<nsCSSSelectorList> selectorList;
   bool matches = false;
 
   *aResult = ParseSelectorList(this, aSelector, getter_Transfers(selectorList));
 
   if (NS_SUCCEEDED(*aResult)) {
     OwnerDoc()->FlushPendingLinkUpdates();
@@ -4663,101 +4663,101 @@ nsGenericElement::MozMatchesSelector(con
     matches = nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
                                                       selectorList);
   }
 
   return matches;
 }
 
 NS_IMETHODIMP
-nsGenericElement::MozMatchesSelector(const nsAString& aSelector, bool* aReturn)
+FragmentOrElement::MozMatchesSelector(const nsAString& aSelector, bool* aReturn)
 {
   NS_PRECONDITION(aReturn, "Null out param?");
 
   nsresult rv;
   *aReturn = MozMatchesSelector(aSelector, &rv);
 
   return rv;
 }
 
 size_t
-nsGenericElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
+FragmentOrElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
   return Element::SizeOfExcludingThis(aMallocSizeOf) +
          mAttrsAndChildren.SizeOfExcludingThis(aMallocSizeOf);
 }
 
 static const nsAttrValue::EnumTable kCORSAttributeTable[] = {
   // Order matters here
   // See ParseCORSValue
   { "anonymous",       CORS_ANONYMOUS       },
   { "use-credentials", CORS_USE_CREDENTIALS },
   { 0 }
 };
 
 /* static */ void
-nsGenericElement::ParseCORSValue(const nsAString& aValue,
+FragmentOrElement::ParseCORSValue(const nsAString& aValue,
                                  nsAttrValue& aResult)
 {
   DebugOnly<bool> success =
     aResult.ParseEnumValue(aValue, kCORSAttributeTable, false,
                            // default value is anonymous if aValue is
                            // not a value we understand
                            &kCORSAttributeTable[0]);
   MOZ_ASSERT(success);
 }
 
 /* static */ CORSMode
-nsGenericElement::StringToCORSMode(const nsAString& aValue)
+FragmentOrElement::StringToCORSMode(const nsAString& aValue)
 {
   if (aValue.IsVoid()) {
     return CORS_NONE;
   }
 
   nsAttrValue val;
-  nsGenericElement::ParseCORSValue(aValue, val);
+  FragmentOrElement::ParseCORSValue(aValue, val);
   return CORSMode(val.GetEnumValue());
 }
 
 /* static */ CORSMode
-nsGenericElement::AttrValueToCORSMode(const nsAttrValue* aValue)
+FragmentOrElement::AttrValueToCORSMode(const nsAttrValue* aValue)
 {
   if (!aValue) {
     return CORS_NONE;
   }
 
   return CORSMode(aValue->GetEnumValue());
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetOnmouseenter(JSContext* cx, JS::Value* vp)
+FragmentOrElement::GetOnmouseenter(JSContext* cx, JS::Value* vp)
 {
   return nsINode::GetOnmouseenter(cx, vp);
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetOnmouseenter(JSContext* cx, const JS::Value& v)
+FragmentOrElement::SetOnmouseenter(JSContext* cx, const JS::Value& v)
 {
   return nsINode::SetOnmouseenter(cx, v);
 }
 
 NS_IMETHODIMP
-nsGenericElement::GetOnmouseleave(JSContext* cx, JS::Value* vp)
+FragmentOrElement::GetOnmouseleave(JSContext* cx, JS::Value* vp)
 {
   return nsINode::GetOnmouseleave(cx, vp);
 }
 
 NS_IMETHODIMP
-nsGenericElement::SetOnmouseleave(JSContext* cx, const JS::Value& v)
+FragmentOrElement::SetOnmouseleave(JSContext* cx, const JS::Value& v)
 {
   return nsINode::SetOnmouseleave(cx, v);
 }
 
 NS_IMETHODIMP
-nsGenericElement::MozRequestPointerLock()
+FragmentOrElement::MozRequestPointerLock()
 {
   OwnerDoc()->RequestPointerLock(this);
   return NS_OK;
 }
 
 static const char*
 GetFullScreenError(nsIDocument* aDoc)
 {
@@ -4776,17 +4776,17 @@ GetFullScreenError(nsIDocument* aDoc)
 
   if (nsContentUtils::IsSitePermDeny(aDoc->NodePrincipal(), "fullscreen")) {
     return "FullScreenDeniedBlocked";
   }
 
   return nullptr;
 }
 
-nsresult nsGenericElement::MozRequestFullScreen()
+nsresult FragmentOrElement::MozRequestFullScreen()
 {
   // Only grant full-screen requests if this is called from inside a trusted
   // event handler (i.e. inside an event handler for a user initiated event).
   // This stops the full-screen from being abused similar to the popups of old,
   // and it also makes it harder for bad guys' script to go full-screen and
   // spoof the browser chrome/window and phish logins etc.
   // Note that requests for fullscreen inside a web app's origin are exempt
   // from this restriction.
--- a/content/base/src/Makefile.in
+++ b/content/base/src/Makefile.in
@@ -120,16 +120,17 @@ CPPSRCS		= \
 		nsTraversal.cpp \
 		nsTreeSanitizer.cpp \
 		nsTreeWalker.cpp \
 		nsWebSocket.cpp \
 		nsXHTMLContentSerializer.cpp \
 		nsXMLContentSerializer.cpp \
 		nsXMLHttpRequest.cpp \
 		nsXMLNameSpaceMap.cpp \
+		FragmentOrElement.cpp \
 		Link.cpp \
 		nsBlobProtocolHandler.cpp \
 		nsFrameMessageManager.cpp \
 		nsInProcessTabChildGlobal.cpp \
 		ThirdPartyUtil.cpp \
 		nsEventSource.cpp \
 		FileIOObject.cpp \
 		nsDOMMutationObserver.cpp \
--- a/content/base/src/nsDOMTokenList.cpp
+++ b/content/base/src/nsDOMTokenList.cpp
@@ -9,18 +9,20 @@
 #include "nsDOMTokenList.h"
 
 #include "nsAttrValue.h"
 #include "nsContentUtils.h"
 #include "nsDOMError.h"
 #include "nsGenericElement.h"
 #include "dombindings.h"
 
+using namespace mozilla;
+using namespace mozilla::dom;
 
-nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
+nsDOMTokenList::nsDOMTokenList(FragmentOrElement *aElement, nsIAtom* aAttrAtom)
   : mElement(aElement),
     mAttrAtom(aAttrAtom)
 {
   // We don't add a reference to our element. If it goes away,
   // we'll be told to drop our reference
   SetIsDOMBinding();
 }
 
--- a/content/base/src/nsDOMTokenList.h
+++ b/content/base/src/nsDOMTokenList.h
@@ -19,17 +19,17 @@ class nsAttrValue;
 class nsDOMTokenList : public nsIDOMDOMTokenList,
                        public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTokenList)
   NS_DECL_NSIDOMDOMTOKENLIST
 
-  nsDOMTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
+  nsDOMTokenList(mozilla::dom::FragmentOrElement* aElement, nsIAtom* aAttrAtom);
 
   void DropReference();
 
   virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
                                bool *triedToWrap);
 
   nsINode *GetParentObject()
   {
@@ -45,13 +45,13 @@ public:
 
 protected:
   virtual ~nsDOMTokenList();
 
   nsresult CheckToken(const nsAString& aStr);
   void AddInternal(const nsAttrValue* aAttr, const nsAString& aToken);
   void RemoveInternal(const nsAttrValue* aAttr, const nsAString& aToken);
 
-  nsGenericElement* mElement;
+  mozilla::dom::FragmentOrElement* mElement;
   nsCOMPtr<nsIAtom> mAttrAtom;
 };
 
 #endif // nsDOMTokenList_h___
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -124,16 +124,17 @@
 
 #include "mozilla/CORSMode.h"
 
 #include "nsStyledElement.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
+#if 0
 NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
 
 PRInt32 nsIContent::sTabFocusModel = eTabFocus_any;
 bool nsIContent::sTabFocusModelAppliesToXUL = false;
 PRUint32 nsMutationGuard::sMutationCount = 0;
 
 nsEventStates
 Element::IntrinsicState() const
@@ -1338,30 +1339,24 @@ nsGenericElement::nsDOMSlots::Unlink(boo
   if (aIsXUL)
     NS_IF_RELEASE(mControllers);
   mChildrenList = nullptr;
   if (mClassList) {
     mClassList->DropReference();
     mClassList = nullptr;
   }
 }
+#endif
 
 nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : Element(aNodeInfo)
-{
-  NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE ||
-                    (mNodeInfo->NodeType() ==
-                       nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
-                     mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
-                                       kNameSpaceID_None)),
-                    "Bad NodeType in aNodeInfo");
-
-  SetIsElement();
-}
-
+  : FragmentOrElement(aNodeInfo)
+{
+}
+
+#if 0
 nsGenericElement::~nsGenericElement()
 {
   NS_PRECONDITION(!IsInDoc(),
                   "Please remove this from the document properly");
   if (GetParent()) {
     NS_RELEASE(mParent);
   }
 }
@@ -4804,9 +4799,9 @@ nsresult nsGenericElement::MozRequestFul
     e->PostDOMEvent();
     return NS_OK;
   }
 
   OwnerDoc()->AsyncRequestFullScreen(this);
 
   return NS_OK;
 }
-
+#endif
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -9,16 +9,17 @@
  * utility methods for subclasses, and so forth.
  */
 
 #ifndef nsGenericElement_h___
 #define nsGenericElement_h___
 
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
+#include "mozilla/dom/FragmentOrElement.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsILinkHandler.h"
 #include "nsNodeUtils.h"
 #include "nsAttrAndChildArray.h"
 #include "mozFlushType.h"
 #include "nsDOMAttributeMap.h"
@@ -52,16 +53,17 @@ class nsIScrollableFrame;
 class nsAttrValueOrString;
 class nsContentList;
 class nsDOMTokenList;
 class ContentUnbinder;
 struct nsRect;
 
 typedef PRUptrdiff PtrBits;
 
+#if 0
 /**
  * Class that implements the nsIDOMNodeList interface (a list of children of
  * the content), by holding a reference to the content and delegating GetLength
  * and Item to its existing child list.
  * @see nsIDOMNodeList
  */
 class nsChildContentList MOZ_FINAL : public nsINodeList
 {
@@ -196,25 +198,27 @@ private:
 
 private:
   nsCOMPtr<nsINode> mNode;
 };
 
 // Forward declare to allow being a friend
 class nsTouchEventReceiverTearoff;
 class nsInlineEventHandlersTearoff;
+#endif
 
 /**
  * A generic base class for DOM elements, implementing many nsIContent,
  * nsIDOMNode and nsIDOMElement methods.
  */
-class nsGenericElement : public mozilla::dom::Element
+class nsGenericElement : public mozilla::dom::FragmentOrElement
 {
 public:
   nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+#if 0
   virtual ~nsGenericElement();
 
   friend class nsTouchEventReceiverTearoff;
   friend class nsInlineEventHandlersTearoff;
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_DECL_SIZEOF_EXCLUDING_THIS
@@ -360,24 +364,28 @@ public:
    */
   template<size_t N>
   static bool
   FindAttributeDependence(const nsIAtom* aAttribute,
                           const MappedAttributeEntry* const (&aMaps)[N])
   {
     return FindAttributeDependence(aAttribute, aMaps, N);
   }
+#endif
 
 private:
+#if 0
   static bool
   FindAttributeDependence(const nsIAtom* aAttribute,
                           const MappedAttributeEntry* const aMaps[],
                           PRUint32 aMapCount);
+#endif
 
 public:
+#if 0
   // nsIDOMNode method implementation
   NS_IMETHOD GetNodeName(nsAString& aNodeName);
   NS_IMETHOD GetLocalName(nsAString& aLocalName);
   NS_IMETHOD GetNodeValue(nsAString& aNodeValue);
   NS_IMETHOD SetNodeValue(const nsAString& aNodeValue);
   NS_IMETHOD GetNodeType(PRUint16* aNodeType);
   NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes);
   NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI);
@@ -636,18 +644,20 @@ public:
    */
   static mozilla::CORSMode StringToCORSMode(const nsAString& aValue);
   
   /**
    * Return the CORS mode for a given nsAttrValue (which may be null,
    * but if not should have been parsed via ParseCORSValue).
    */
   static mozilla::CORSMode AttrValueToCORSMode(const nsAttrValue* aValue);
+#endif
 
 protected:
+#if 0
   /*
    * Named-bools for use with SetAttrAndNotify to make call sites easier to
    * read.
    */
   static const bool kFireMutationEvent           = true;
   static const bool kDontFireMutationEvent       = false;
   static const bool kNotifyDocumentObservers     = true;
   static const bool kDontNotifyDocumentObservers = false;
@@ -802,18 +812,20 @@ protected:
   virtual mozilla::dom::Element* GetNameSpaceElement()
   {
     return this;
   }
 
   nsresult GetAttributeNodeNSInternal(const nsAString& aNamespaceURI,
                                       const nsAString& aLocalName,
                                       nsIDOMAttr** aReturn);
+#endif
 
 public:
+#if 0
   // 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
    * through the DOM. Rather than burn actual slots in the content
    * objects for each of these instance variables, we put them off
    * in a side structure that's only allocated when the content is
@@ -876,18 +888,20 @@ public:
      */
     nsRefPtr<nsContentList> mChildrenList;
 
     /**
      * An object implementing the .classList property for this element.
      */
     nsRefPtr<nsDOMTokenList> mClassList;
   };
+#endif
 
 protected:
+#if 0
   // Override from nsINode
   virtual nsINode::nsSlots* CreateSlots();
 
   nsDOMSlots *DOMSlots()
   {
     return static_cast<nsDOMSlots*>(GetSlots());
   }
 
@@ -966,29 +980,33 @@ protected:
    */
   virtual void GetLinkTarget(nsAString& aTarget);
 
   friend class ContentUnbinder;
   /**
    * Array containing all attributes and children for this element
    */
   nsAttrAndChildArray mAttrsAndChildren;
+#endif
 
 private:
+#if 0
   /**
    * Get this element's client area rect in app units.
    * @return the frame's client area
    */
   nsRect GetClientAreaRect();
 
   nsIScrollableFrame* GetScrollFrame(nsIFrame **aStyledFrame = nullptr);
 
   nsContentList* GetChildrenList();
+#endif
 };
 
+#if 0
 /**
  * Macros to implement Clone(). _elementName is the class for which to implement
  * Clone.
  */
 #define NS_IMPL_ELEMENT_CLONE(_elementName)                                 \
 nsresult                                                                    \
 _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const        \
 {                                                                           \
@@ -1113,10 +1131,11 @@ private:
     }                                                                         \
                                                                               \
     NS_ADDREF(foundInterface);                                                \
                                                                               \
     *aInstancePtr = foundInterface;                                           \
                                                                               \
     return NS_OK;                                                             \
   }
+#endif
 
 #endif /* nsGenericElement_h___ */
--- a/content/base/src/nsStyledElement.h
+++ b/content/base/src/nsStyledElement.h
@@ -63,17 +63,17 @@ protected:
    */
   void ParseStyleAttribute(const nsAString& aValue,
                            nsAttrValue& aResult,
                            bool aForceInDataDoc);
 
   virtual bool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
                                 const nsAString& aValue, nsAttrValue& aResult);
 
-  friend class nsGenericElement;
+  friend class mozilla::dom::FragmentOrElement;
 
   /**
    * 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);