Bug 563659 part 2 - Create FragmentOrElement and move all nsGenericElement functionality to it; r=bz

--HG--
rename : content/base/src/nsGenericElement.h => content/base/public/FragmentOrElement.h
rename : content/base/src/nsGenericElement.cpp => content/base/src/FragmentOrElement.cpp
This commit is contained in:
Aryeh Gregor 2012-06-27 16:01:55 +03:00
Родитель 27da1ba521
Коммит 23180b27f1
9 изменённых файлов: 5973 добавлений и 15 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -49,6 +49,7 @@ EXPORTS_NAMESPACES = mozilla/dom mozilla
EXPORTS_mozilla/dom = \
Element.h \
FragmentOrElement.h \
FromParser.h \
$(NULL)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -125,6 +125,7 @@ CPPSRCS = \
nsXMLContentSerializer.cpp \
nsXMLHttpRequest.cpp \
nsXMLNameSpaceMap.cpp \
FragmentOrElement.cpp \
Link.cpp \
nsBlobProtocolHandler.cpp \
nsFrameMessageManager.cpp \

Просмотреть файл

@ -14,8 +14,10 @@
#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)
{

Просмотреть файл

@ -24,7 +24,7 @@ public:
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();
@ -50,7 +50,7 @@ protected:
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;
};

Просмотреть файл

@ -129,6 +129,7 @@
using namespace mozilla;
using namespace mozilla::dom;
#if 0
NS_DEFINE_IID(kThisPtrOffsetsSID, NS_THISPTROFFSETS_SID);
PRInt32 nsIContent::sTabFocusModel = eTabFocus_any;
@ -1343,20 +1344,14 @@ nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
mClassList = nullptr;
}
}
#endif
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: Element(aNodeInfo)
: FragmentOrElement(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();
}
#if 0
nsGenericElement::~nsGenericElement()
{
NS_PRECONDITION(!IsInDoc(),
@ -4809,4 +4804,4 @@ nsresult nsGenericElement::MozRequestFullScreen()
return NS_OK;
}
#endif

Просмотреть файл

@ -14,6 +14,7 @@
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "mozilla/dom/FragmentOrElement.h"
#include "mozilla/dom/Element.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentFragment.h"
@ -57,6 +58,7 @@ 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
@ -201,15 +203,17 @@ private:
// 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;
@ -365,14 +369,18 @@ public:
{
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);
@ -641,8 +649,10 @@ public:
* 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.
@ -807,8 +817,10 @@ protected:
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.
/**
@ -881,8 +893,10 @@ public:
*/
nsRefPtr<nsDOMTokenList> mClassList;
};
#endif
protected:
#if 0
// Override from nsINode
virtual nsINode::nsSlots* CreateSlots();
@ -971,8 +985,10 @@ protected:
* 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
@ -982,8 +998,10 @@ private:
nsIScrollableFrame* GetScrollFrame(nsIFrame **aStyledFrame = nullptr);
nsContentList* GetChildrenList();
#endif
};
#if 0
/**
* Macros to implement Clone(). _elementName is the class for which to implement
* Clone.
@ -1118,5 +1136,6 @@ private:
\
return NS_OK; \
}
#endif
#endif /* nsGenericElement_h___ */

Просмотреть файл

@ -68,7 +68,7 @@ protected:
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