зеркало из https://github.com/mozilla/pjs.git
Bug 334075: Push mFlagsOrSlots to nsINode to allow storing flags and (in the future) slots on nsGenericDOMDataNodes. r=mrbkap sr=bz
This commit is contained in:
Родитель
044fbae683
Коммит
241120e16a
|
@ -54,6 +54,7 @@
|
|||
|
||||
class nsIDOMScriptObjectFactory;
|
||||
class nsIXPConnect;
|
||||
class nsINode;
|
||||
class nsIContent;
|
||||
class nsIDOMNode;
|
||||
class nsIDocument;
|
||||
|
@ -735,64 +736,63 @@ public:
|
|||
|
||||
/**
|
||||
* Add aRange to the list of ranges with a start- or endpoint containing
|
||||
* aContent. aCreated will be set to PR_TRUE if this call created a new list
|
||||
* aNode. aCreated will be set to PR_TRUE if this call created a new list
|
||||
* (meaning the list was empty before the call to AddToRangeList).
|
||||
*
|
||||
* @param aContent The node contained in the start- or endpoint of aRange.
|
||||
* @param aRange The range containing aContent in its start- or endpoint.
|
||||
* @param aNode The node contained in the start- or endpoint of aRange.
|
||||
* @param aRange The range containing aNode in its start- or endpoint.
|
||||
* @param aCreated [out] Set to PR_TRUE if a new list was created.
|
||||
*/
|
||||
static nsresult AddToRangeList(nsIContent *aContent, nsIDOMRange *aRange,
|
||||
static nsresult AddToRangeList(nsINode *aNode, nsIDOMRange *aRange,
|
||||
PRBool *aCreated);
|
||||
|
||||
/**
|
||||
* Remove aRange from the list of ranges with a start- or endpoint containing
|
||||
* aContent. This will return PR_TRUE if aRange was the last range in the
|
||||
* list.
|
||||
* aNode. This will return PR_TRUE if aRange was the last range in the list.
|
||||
*
|
||||
* @param aContent The node for which to remove aRange.
|
||||
* @param aNode The node for which to remove aRange.
|
||||
* @param aRange The range to remove.
|
||||
* @return PR_TRUE if aRange was the last range in the list.
|
||||
*/
|
||||
static PRBool RemoveFromRangeList(nsIContent *aContent, nsIDOMRange *aRange);
|
||||
static PRBool RemoveFromRangeList(nsINode *aNode, nsIDOMRange *aRange);
|
||||
|
||||
/**
|
||||
* Look up the list of ranges containing aContent.
|
||||
* Look up the list of ranges containing aNode.
|
||||
*
|
||||
* @param aContent The node for which to look up the range list.
|
||||
* @param aNode The node for which to look up the range list.
|
||||
* @return The range list if one exists.
|
||||
*/
|
||||
static const nsVoidArray* LookupRangeList(const nsIContent *aContent);
|
||||
static const nsVoidArray* LookupRangeList(const nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Remove the list of ranges containing aContent as their start- or endpoint.
|
||||
* Remove the list of ranges containing aNode as their start- or endpoint.
|
||||
*
|
||||
* @param aContent The node for which to remove the range list.
|
||||
* @param aNode The node for which to remove the range list.
|
||||
*/
|
||||
static void RemoveRangeList(nsIContent *aContent);
|
||||
static void RemoveRangeList(nsINode *aNode);
|
||||
|
||||
/**
|
||||
* Get the eventlistener manager for aContent. If a new eventlistener manager
|
||||
* Get the eventlistener manager for aNode. If a new eventlistener manager
|
||||
* was created, aCreated is set to PR_TRUE.
|
||||
*
|
||||
* @param aContent The node for which to get the eventlistener manager.
|
||||
* @param aNode The node for which to get the eventlistener manager.
|
||||
* @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
|
||||
* one already exists.
|
||||
* @param aResult [out] Set to the eventlistener manager for aContent.
|
||||
* @param aResult [out] Set to the eventlistener manager for aNode.
|
||||
* @param aCreated [out] Set to PR_TRUE if a new eventlistener manager was
|
||||
* created.
|
||||
*/
|
||||
static nsresult GetListenerManager(nsIContent *aContent,
|
||||
static nsresult GetListenerManager(nsINode *aNode,
|
||||
PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager **aResult,
|
||||
PRBool *aCreated);
|
||||
|
||||
/**
|
||||
* Remove the eventlistener manager for aContent.
|
||||
* Remove the eventlistener manager for aNode.
|
||||
*
|
||||
* @param aContent The node for which to remove the eventlistener manager.
|
||||
* @param aNode The node for which to remove the eventlistener manager.
|
||||
*/
|
||||
static void RemoveListenerManager(nsIContent *aContent);
|
||||
static void RemoveListenerManager(nsINode *aNode);
|
||||
|
||||
static PRBool IsInitialized()
|
||||
{
|
||||
|
|
|
@ -51,7 +51,6 @@ class nsVoidArray;
|
|||
class nsIDOMEvent;
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMRange;
|
||||
class nsIEventListenerManager;
|
||||
class nsIURI;
|
||||
class nsICSSStyleRule;
|
||||
|
@ -61,8 +60,8 @@ class nsAttrName;
|
|||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x26e42639, 0x013b, 0x442a, \
|
||||
{ 0xbe, 0xa0, 0x31, 0xad, 0x43, 0x33, 0x6f, 0x79 } }
|
||||
{ 0x823ca304, 0x2dc4, 0x4b06, \
|
||||
{ 0x98, 0x60, 0x1a, 0x21, 0x45, 0xb9, 0xf6, 0x1c } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
|
@ -165,14 +164,18 @@ public:
|
|||
* @see nsIAnonymousContentCreator
|
||||
* @return whether this content is anonymous
|
||||
*/
|
||||
virtual PRBool IsNativeAnonymous() const = 0;
|
||||
PRBool IsNativeAnonymous() const
|
||||
{
|
||||
return HasFlag(NODE_IS_ANONYMOUS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether this content is anonymous
|
||||
* This is virtual and non-inlined due to nsXULElement::SetNativeAnonymous
|
||||
* @see nsIAnonymousContentCreator
|
||||
* @param aAnonymous whether this content is anonymous
|
||||
*/
|
||||
virtual void SetNativeAnonymous(PRBool aAnonymous) = 0;
|
||||
virtual void SetNativeAnonymous(PRBool aAnonymous);
|
||||
|
||||
/**
|
||||
* Get the namespace that this element's tag is defined in
|
||||
|
@ -377,35 +380,6 @@ public:
|
|||
*/
|
||||
virtual PRUint32 GetAttrCount() const = 0;
|
||||
|
||||
/**
|
||||
* Inform content of range ownership changes. This allows content
|
||||
* to do the right thing to ranges in the face of changes to the content
|
||||
* model.
|
||||
* RangeRemove -- informs content that it no longer owns a range endpoint
|
||||
* GetRangeList -- returns the list of ranges that have one or both endpoints
|
||||
* within this content item
|
||||
*/
|
||||
/**
|
||||
* Inform content that it owns one or both range endpoints
|
||||
* @param aRange the range the content owns
|
||||
*/
|
||||
virtual nsresult RangeAdd(nsIDOMRange* aRange) = 0;
|
||||
|
||||
/**
|
||||
* Inform content that it no longer owns either range endpoint
|
||||
* @param aRange the range the content no longer owns
|
||||
*/
|
||||
virtual void RangeRemove(nsIDOMRange* aRange) = 0;
|
||||
|
||||
/**
|
||||
* Get the list of ranges that have either endpoint in this content
|
||||
* item.
|
||||
* @return the list of ranges owned partially by this content. The
|
||||
* nsVoidArray is owned by the content object and its lifetime is
|
||||
* controlled completely by the content object.
|
||||
*/
|
||||
virtual const nsVoidArray *GetRangeList() const = 0;
|
||||
|
||||
/**
|
||||
* Set the focus on this content. This is generally something for the event
|
||||
* state manager to do, not ordinary people. Ordinary people should do
|
||||
|
@ -506,18 +480,6 @@ public:
|
|||
*/
|
||||
virtual nsIContent *GetBindingParent() const = 0;
|
||||
|
||||
/**
|
||||
* Get the event listener manager, the guy you talk to to register for events
|
||||
* on this element.
|
||||
* @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
|
||||
* one already exists. [IN]
|
||||
* @param aResult The event listener manager [OUT]
|
||||
*
|
||||
* FIXME! Remove this method, there is similar in nsINode. Bug 329112
|
||||
*/
|
||||
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the base URI for any relative URIs within this piece of
|
||||
* content. Generally, this is the document's base URI, but certain
|
||||
|
@ -638,8 +600,10 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual void SetHasProperties() = 0;
|
||||
void SetHasProperties()
|
||||
{
|
||||
SetFlags(NODE_HAS_PROPERTIES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones this node, using aNodeInfoManager to get the nodeinfo for the
|
||||
|
|
|
@ -55,6 +55,32 @@ class nsEventChainPreVisitor;
|
|||
class nsEventChainPostVisitor;
|
||||
class nsIEventListenerManager;
|
||||
class nsIPrincipal;
|
||||
class nsIDOMRange;
|
||||
class nsVoidArray;
|
||||
|
||||
// This bit will be set if the node doesn't have nsDOMSlots
|
||||
#define NODE_DOESNT_HAVE_SLOTS 0x00000001U
|
||||
|
||||
// This bit will be set if the node has a range list in the range list hash
|
||||
#define NODE_HAS_RANGELIST 0x00000002U
|
||||
|
||||
// This bit will be set if the node has a listener manager in the listener
|
||||
// manager hash
|
||||
#define NODE_HAS_LISTENERMANAGER 0x00000004U
|
||||
|
||||
// Whether this node has had any properties set on it
|
||||
#define NODE_HAS_PROPERTIES 0x00000008U
|
||||
|
||||
// Whether this node is anonymous
|
||||
// NOTE: Should only be used on nsIContent nodes
|
||||
#define NODE_IS_ANONYMOUS 0x00000010U
|
||||
|
||||
// Whether this node may have a frame
|
||||
// NOTE: Should only be used on nsIContent nodes
|
||||
#define NODE_MAY_HAVE_FRAME 0x00000020U
|
||||
|
||||
// Remaining bits are node type specific.
|
||||
#define NODE_TYPE_SPECIFIC_BITS_OFFSET 6
|
||||
|
||||
// IID for the nsINode interface
|
||||
// f96eef82-43fc-4eee-9784-4259415e98a9
|
||||
|
@ -81,10 +107,13 @@ public:
|
|||
|
||||
nsINode(nsINodeInfo* aNodeInfo)
|
||||
: mNodeInfo(aNodeInfo),
|
||||
mParentPtrBits(0)
|
||||
mParentPtrBits(0),
|
||||
mFlagsOrSlots(NODE_DOESNT_HAVE_SLOTS)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsINode();
|
||||
|
||||
/**
|
||||
* Bit-flags to pass (or'ed together) to IsNodeOfType()
|
||||
*/
|
||||
|
@ -114,7 +143,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* API for doing a quick check if a content object is of a given
|
||||
* API for doing a quick check if a content is of a given
|
||||
* type, such as HTML, XUL, Text, ... Use this when you can instead of
|
||||
* checking the tag.
|
||||
*
|
||||
|
@ -275,6 +304,35 @@ public:
|
|||
virtual void* UnsetProperty(nsIAtom *aPropertyName,
|
||||
nsresult *aStatus = nsnull);
|
||||
|
||||
/**
|
||||
* Inform node of range ownership changes. This allows the node to do the
|
||||
* right thing to ranges in the face of changes to the content model.
|
||||
*
|
||||
* RangeRemove -- informs content that it no longer owns a range endpoint
|
||||
* GetRangeList -- returns the list of ranges that have one or both endpoints
|
||||
* within this content item
|
||||
*/
|
||||
/**
|
||||
* Inform node that it owns one or both range endpoints
|
||||
* @param aRange the range the node owns
|
||||
*/
|
||||
virtual nsresult RangeAdd(nsIDOMRange* aRange);
|
||||
|
||||
/**
|
||||
* Inform node that it no longer owns either range endpoint
|
||||
* @param aRange the range the node no longer owns
|
||||
*/
|
||||
virtual void RangeRemove(nsIDOMRange* aRange);
|
||||
|
||||
/**
|
||||
* Get the list of ranges that have either endpoint in this node
|
||||
* item.
|
||||
* @return the list of ranges owned partially by this node. The
|
||||
* nsVoidArray is owned by the node object and its lifetime is
|
||||
* controlled completely by the node object.
|
||||
*/
|
||||
virtual const nsVoidArray *GetRangeList() const;
|
||||
|
||||
/**
|
||||
* Return the principal of this node. This is guaranteed to never be a null
|
||||
* pointer.
|
||||
|
@ -344,9 +402,8 @@ public:
|
|||
* one already exists. [IN]
|
||||
* @param aResult The event listener manager [OUT]
|
||||
*/
|
||||
virtual nsresult GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult)
|
||||
= 0;
|
||||
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult);
|
||||
|
||||
/**
|
||||
* Get the parent nsIContent for this node.
|
||||
|
@ -371,16 +428,91 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
// This class should be extended by subclasses that wish to store more
|
||||
// information in the slots.
|
||||
class nsSlots
|
||||
{
|
||||
public:
|
||||
nsSlots(PtrBits aFlags) : mFlags(aFlags)
|
||||
{
|
||||
}
|
||||
|
||||
PtrBits mFlags;
|
||||
|
||||
protected:
|
||||
// This is protected so that no-one accidentally deletes this rather than
|
||||
// the subclass
|
||||
~nsSlots() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Functions for managing flags and slots
|
||||
*/
|
||||
|
||||
PRBool HasSlots() const
|
||||
{
|
||||
return !(mFlagsOrSlots & NODE_DOESNT_HAVE_SLOTS);
|
||||
}
|
||||
|
||||
nsSlots* FlagsAsSlots() const
|
||||
{
|
||||
NS_ASSERTION(HasSlots(), "check HasSlots first");
|
||||
return NS_REINTERPRET_CAST(nsSlots*, mFlagsOrSlots);
|
||||
}
|
||||
|
||||
nsSlots* GetExistingSlots() const
|
||||
{
|
||||
return HasSlots() ? FlagsAsSlots() : nsnull;
|
||||
}
|
||||
|
||||
void SetSlots(nsSlots* aSlots)
|
||||
{
|
||||
NS_ASSERTION(!HasSlots(), "Already has slots");
|
||||
mFlagsOrSlots = NS_REINTERPRET_CAST(PtrBits, aSlots);
|
||||
}
|
||||
|
||||
PtrBits GetFlags() const
|
||||
{
|
||||
return NS_UNLIKELY(HasSlots()) ? FlagsAsSlots()->mFlags : mFlagsOrSlots;
|
||||
}
|
||||
|
||||
PRBool HasFlag(PtrBits aFlag) const
|
||||
{
|
||||
return !!(GetFlags() & aFlag);
|
||||
}
|
||||
|
||||
void SetFlags(PtrBits aFlagsToSet)
|
||||
{
|
||||
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS | NODE_MAY_HAVE_FRAME)) ||
|
||||
IsNodeOfType(eCONTENT),
|
||||
"Flag only permitted on nsIContent nodes");
|
||||
PtrBits* flags = HasSlots() ? &FlagsAsSlots()->mFlags :
|
||||
&mFlagsOrSlots;
|
||||
*flags |= aFlagsToSet;
|
||||
}
|
||||
|
||||
void UnsetFlags(PtrBits aFlagsToUnset)
|
||||
{
|
||||
PtrBits* flags = HasSlots() ? &FlagsAsSlots()->mFlags :
|
||||
&mFlagsOrSlots;
|
||||
*flags &= ~aFlagsToUnset;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINodeInfo> mNodeInfo;
|
||||
|
||||
typedef PRUword PtrBits;
|
||||
|
||||
enum { PARENT_BIT_INDOCUMENT = 1 << 0, PARENT_BIT_PARENT_IS_CONTENT = 1 << 1 };
|
||||
enum { kParentBitMask = 0x3 };
|
||||
|
||||
PtrBits mParentPtrBits;
|
||||
|
||||
/**
|
||||
* Used for either storing flags for this element or a pointer to
|
||||
* this contents nsContentSlots. See the definition of the
|
||||
* NODE_* macros for the layout of the bits in this
|
||||
* member.
|
||||
*/
|
||||
PtrBits mFlagsOrSlots;
|
||||
|
||||
#endif // MOZILLA_INTERNAL_API
|
||||
};
|
||||
|
||||
|
|
|
@ -2866,7 +2866,7 @@ PRBool
|
|||
NodeHasMutationListeners(nsINode* aNode)
|
||||
{
|
||||
nsCOMPtr<nsIEventListenerManager> manager;
|
||||
aNode->GetEventListenerManager(PR_FALSE, getter_AddRefs(manager));
|
||||
aNode->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
|
||||
if (manager) {
|
||||
PRBool hasListeners = PR_FALSE;
|
||||
manager->HasMutationListeners(&hasListeners);
|
||||
|
@ -2923,7 +2923,7 @@ nsContentUtils::HasMutationListeners(nsIContent* aContent,
|
|||
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::GetListenerManager(nsIContent *aContent,
|
||||
nsContentUtils::GetListenerManager(nsINode *aNode,
|
||||
PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager **aResult,
|
||||
PRBool *aCreated)
|
||||
|
@ -2941,7 +2941,7 @@ nsContentUtils::GetListenerManager(nsIContent *aContent,
|
|||
if (!aCreateIfNotFound) {
|
||||
EventListenerManagerMapEntry *entry =
|
||||
NS_STATIC_CAST(EventListenerManagerMapEntry *,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aContent,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
|
||||
PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
*aResult = entry->mListenerManager;
|
||||
|
@ -2952,7 +2952,7 @@ nsContentUtils::GetListenerManager(nsIContent *aContent,
|
|||
|
||||
EventListenerManagerMapEntry *entry =
|
||||
NS_STATIC_CAST(EventListenerManagerMapEntry *,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aContent,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
|
||||
PL_DHASH_ADD));
|
||||
|
||||
if (!entry) {
|
||||
|
@ -2969,7 +2969,7 @@ nsContentUtils::GetListenerManager(nsIContent *aContent,
|
|||
return rv;
|
||||
}
|
||||
|
||||
entry->mListenerManager->SetListenerTarget(aContent);
|
||||
entry->mListenerManager->SetListenerTarget(aNode);
|
||||
|
||||
*aCreated = PR_TRUE;
|
||||
}
|
||||
|
@ -2981,12 +2981,12 @@ nsContentUtils::GetListenerManager(nsIContent *aContent,
|
|||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::RemoveListenerManager(nsIContent *aContent)
|
||||
nsContentUtils::RemoveListenerManager(nsINode *aNode)
|
||||
{
|
||||
if (sEventListenerManagersHash.ops) {
|
||||
EventListenerManagerMapEntry *entry =
|
||||
NS_STATIC_CAST(EventListenerManagerMapEntry *,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aContent,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aNode,
|
||||
PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
nsCOMPtr<nsIEventListenerManager> listenerManager;
|
||||
|
@ -3003,7 +3003,7 @@ nsContentUtils::RemoveListenerManager(nsIContent *aContent)
|
|||
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::AddToRangeList(nsIContent *aContent, nsIDOMRange *aRange,
|
||||
nsContentUtils::AddToRangeList(nsINode *aNode, nsIDOMRange *aRange,
|
||||
PRBool *aCreated)
|
||||
{
|
||||
*aCreated = PR_FALSE;
|
||||
|
@ -3016,7 +3016,7 @@ nsContentUtils::AddToRangeList(nsIContent *aContent, nsIDOMRange *aRange,
|
|||
|
||||
RangeListMapEntry *entry =
|
||||
NS_STATIC_CAST(RangeListMapEntry *,
|
||||
PL_DHashTableOperate(&sRangeListsHash, aContent,
|
||||
PL_DHashTableOperate(&sRangeListsHash, aNode,
|
||||
PL_DHASH_ADD));
|
||||
|
||||
if (!entry) {
|
||||
|
@ -3064,7 +3064,7 @@ nsContentUtils::AddToRangeList(nsIContent *aContent, nsIDOMRange *aRange,
|
|||
|
||||
/* static */
|
||||
PRBool
|
||||
nsContentUtils::RemoveFromRangeList(nsIContent *aContent, nsIDOMRange *aRange)
|
||||
nsContentUtils::RemoveFromRangeList(nsINode *aNode, nsIDOMRange *aRange)
|
||||
{
|
||||
if (!sRangeListsHash.ops) {
|
||||
// We've already been shut down, don't bother removing a range...
|
||||
|
@ -3074,7 +3074,7 @@ nsContentUtils::RemoveFromRangeList(nsIContent *aContent, nsIDOMRange *aRange)
|
|||
|
||||
RangeListMapEntry *entry =
|
||||
NS_STATIC_CAST(RangeListMapEntry *,
|
||||
PL_DHashTableOperate(&sRangeListsHash, aContent,
|
||||
PL_DHashTableOperate(&sRangeListsHash, aNode,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_FREE(entry)) {
|
||||
|
@ -3097,7 +3097,7 @@ nsContentUtils::RemoveFromRangeList(nsIContent *aContent, nsIDOMRange *aRange)
|
|||
|
||||
/* static */
|
||||
const nsVoidArray*
|
||||
nsContentUtils::LookupRangeList(const nsIContent *aContent)
|
||||
nsContentUtils::LookupRangeList(const nsINode *aNode)
|
||||
{
|
||||
if (!sRangeListsHash.ops) {
|
||||
// We've already been shut down, don't bother getting a range list...
|
||||
|
@ -3107,7 +3107,7 @@ nsContentUtils::LookupRangeList(const nsIContent *aContent)
|
|||
|
||||
RangeListMapEntry *entry =
|
||||
NS_STATIC_CAST(RangeListMapEntry *,
|
||||
PL_DHashTableOperate(&sRangeListsHash, aContent,
|
||||
PL_DHashTableOperate(&sRangeListsHash, aNode,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
return PL_DHASH_ENTRY_IS_BUSY(entry) ? entry->mRangeList : nsnull;
|
||||
|
@ -3115,10 +3115,10 @@ nsContentUtils::LookupRangeList(const nsIContent *aContent)
|
|||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::RemoveRangeList(nsIContent *aContent)
|
||||
nsContentUtils::RemoveRangeList(nsINode *aNode)
|
||||
{
|
||||
if (sRangeListsHash.ops) {
|
||||
PL_DHashTableOperate(&sRangeListsHash, aContent, PL_DHASH_REMOVE);
|
||||
PL_DHashTableOperate(&sRangeListsHash, aNode, PL_DHASH_REMOVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,13 +73,6 @@ nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
|
|||
|
||||
nsDOMAttribute::~nsDOMAttribute()
|
||||
{
|
||||
nsIDocument *doc = GetOwnerDoc();
|
||||
if (doc) {
|
||||
doc->CallUserDataHandler(nsIDOMUserDataHandler::NODE_DELETED, this,
|
||||
nsnull, nsnull);
|
||||
doc->PropertyTable()->DeleteAllPropertiesFor(this);
|
||||
}
|
||||
|
||||
if (mChildList) {
|
||||
mChildList->DropReference();
|
||||
NS_RELEASE(mChildList);
|
||||
|
@ -850,14 +843,6 @@ nsDOMAttribute::DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::EnsureChildState(PRBool aSetText, PRBool &aHasChild) const
|
||||
{
|
||||
|
|
|
@ -122,8 +122,6 @@ public:
|
|||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
nsPresContext* aPresContext,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual nsresult GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult);
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
|
|
|
@ -729,6 +729,12 @@ nsDocument::~nsDocument()
|
|||
|
||||
mInDestructor = PR_TRUE;
|
||||
|
||||
// We can't rely on the nsINode dtor doing this for us since
|
||||
// by the time it runs GetOwnerDoc will return null.
|
||||
// This is because we call mNodeInfoManager->DropReference()
|
||||
// below, which will run before the nsINode dtor. Additionally
|
||||
// the properties hash and the document will have been destroyed,
|
||||
// so there would be no way to find the handlers.
|
||||
CallUserDataHandler(nsIDOMUserDataHandler::NODE_DELETED,
|
||||
this, nsnull, nsnull);
|
||||
|
||||
|
|
|
@ -542,10 +542,6 @@ public:
|
|||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
nsPresContext* aPresContext,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual nsresult GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult) {
|
||||
return GetListenerManager(aCreateIfNotFound, aResult);
|
||||
};
|
||||
|
||||
// nsIRadioGroupContainer
|
||||
NS_IMETHOD WalkRadioGroup(const nsAString& aName,
|
||||
|
|
|
@ -75,22 +75,7 @@ nsGenericDOMDataNode::nsGenericDOMDataNode(nsINodeInfo *aNodeInfo)
|
|||
|
||||
nsGenericDOMDataNode::~nsGenericDOMDataNode()
|
||||
{
|
||||
if (CouldHaveProperties()) {
|
||||
nsIDocument *document = GetOwnerDoc();
|
||||
if (document) {
|
||||
document->CallUserDataHandler(nsIDOMUserDataHandler::NODE_DELETED,
|
||||
this, nsnull, nsnull);
|
||||
document->PropertyTable()->DeleteAllPropertiesFor(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (CouldHaveEventListenerManager()) {
|
||||
nsContentUtils::RemoveListenerManager(this);
|
||||
}
|
||||
|
||||
if (CouldHaveRangeList()) {
|
||||
nsContentUtils::RemoveRangeList(this);
|
||||
}
|
||||
NS_ASSERTION(!HasSlots(), "Datanodes should not have slots");
|
||||
}
|
||||
|
||||
|
||||
|
@ -315,7 +300,7 @@ nsGenericDOMDataNode::CloneNode(PRBool aDeep, nsIDOMNode *aSource,
|
|||
rv = CallQueryInterface(newContent, aResult);
|
||||
|
||||
nsIDocument *ownerDoc = GetOwnerDoc();
|
||||
if (NS_SUCCEEDED(rv) && ownerDoc && CouldHaveProperties()) {
|
||||
if (NS_SUCCEEDED(rv) && ownerDoc && HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
ownerDoc->CallUserDataHandler(nsIDOMUserDataHandler::NODE_CLONED,
|
||||
NS_STATIC_CAST(const nsIContent*, this),
|
||||
aSource, *aResult);
|
||||
|
@ -558,28 +543,6 @@ nsGenericDOMDataNode::ReplaceData(PRUint32 aOffset, PRUint32 aCount,
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult)
|
||||
{
|
||||
// No need to call nsContentUtils::GetListenerManager if we're sure that
|
||||
// there is no event listener manager.
|
||||
if (!aCreateIfNotFound && !CouldHaveEventListenerManager()) {
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool created;
|
||||
nsresult rv = nsContentUtils::GetListenerManager(this, aCreateIfNotFound,
|
||||
aResult, &created);
|
||||
if (NS_SUCCEEDED(rv) && created) {
|
||||
SetHasEventListenerManager();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Implementation of nsIContent
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -725,7 +688,7 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
}
|
||||
|
||||
if (oldOwnerDocument && oldOwnerDocument != newOwnerDocument) {
|
||||
if (newOwnerDocument && CouldHaveProperties()) {
|
||||
if (newOwnerDocument && HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
// Copy UserData to the new document.
|
||||
oldOwnerDocument->CopyUserData(this, newOwnerDocument);
|
||||
}
|
||||
|
@ -772,19 +735,6 @@ nsGenericDOMDataNode::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
mParentPtrBits = aNullParent ? 0 : mParentPtrBits & ~PARENT_BIT_INDOCUMENT;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericDOMDataNode::IsNativeAnonymous() const
|
||||
{
|
||||
nsIContent* parent = GetParent();
|
||||
return parent && parent->IsNativeAnonymous();
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericDOMDataNode::SetNativeAnonymous(PRBool aAnonymous)
|
||||
{
|
||||
// XXX Need to fix this to do something - bug 165110
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsGenericDOMDataNode::GetIDAttributeName() const
|
||||
{
|
||||
|
@ -905,19 +855,6 @@ nsGenericDOMDataNode::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::SetProperty(nsIAtom *aPropertyName,
|
||||
void *aValue,
|
||||
NSPropertyDtorFunc aDtor)
|
||||
{
|
||||
nsresult rv = nsITextContent::SetProperty(aPropertyName, aValue, aDtor);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
SetIsInAHash();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// virtual
|
||||
PRBool
|
||||
nsGenericDOMDataNode::MayHaveFrame() const
|
||||
|
@ -926,31 +863,6 @@ nsGenericDOMDataNode::MayHaveFrame() const
|
|||
return parent && parent->MayHaveFrame();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::RangeAdd(nsIDOMRange* aRange)
|
||||
{
|
||||
PRBool created;
|
||||
nsresult rv = nsContentUtils::AddToRangeList(this, aRange, &created);
|
||||
if (NS_SUCCEEDED(rv) && created) {
|
||||
SetHasRangeList();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericDOMDataNode::RangeRemove(nsIDOMRange* aRange)
|
||||
{
|
||||
if (CouldHaveRangeList()) {
|
||||
nsContentUtils::RemoveFromRangeList(this, aRange);
|
||||
}
|
||||
}
|
||||
|
||||
const nsVoidArray *
|
||||
nsGenericDOMDataNode::GetRangeList() const
|
||||
{
|
||||
return CouldHaveRangeList() ? nsContentUtils::LookupRangeList(this) : nsnull;
|
||||
}
|
||||
|
||||
nsIContent *
|
||||
nsGenericDOMDataNode::GetBindingParent() const
|
||||
{
|
||||
|
|
|
@ -197,13 +197,6 @@ public:
|
|||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
nsPresContext* aPresContext,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual nsresult GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult) {
|
||||
return GetListenerManager(aCreateIfNotFound, aResult);
|
||||
}
|
||||
virtual nsresult SetProperty(nsIAtom *aPropertyName,
|
||||
void *aValue,
|
||||
NSPropertyDtorFunc aDtor);
|
||||
|
||||
// Implementation for nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
|
@ -212,8 +205,6 @@ public:
|
|||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||
PRBool aNullParent = PR_TRUE);
|
||||
|
||||
virtual PRBool IsNativeAnonymous() const;
|
||||
virtual void SetNativeAnonymous(PRBool aAnonymous);
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
|
@ -236,22 +227,12 @@ public:
|
|||
virtual void DumpContent(FILE* out, PRInt32 aIndent, PRBool aDumpAll) const;
|
||||
#endif
|
||||
|
||||
virtual nsresult RangeAdd(nsIDOMRange* aRange);
|
||||
virtual void RangeRemove(nsIDOMRange* aRange);
|
||||
virtual const nsVoidArray *GetRangeList() const;
|
||||
|
||||
virtual nsIContent *GetBindingParent() const;
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
||||
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult);
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
|
||||
virtual PRBool MayHaveFrame() const;
|
||||
virtual void SetHasProperties()
|
||||
{
|
||||
SetIsInAHash();
|
||||
}
|
||||
|
||||
/**
|
||||
* This calls Clone to do the actual cloning so that we end up with the
|
||||
|
@ -304,46 +285,12 @@ protected:
|
|||
virtual nsGenericDOMDataNode *Clone(nsINodeInfo *aNodeInfo,
|
||||
PRBool aCloneText) const = 0;
|
||||
|
||||
PRBool CouldHaveProperties() const
|
||||
{
|
||||
return GetIsInAHash();
|
||||
}
|
||||
|
||||
nsTextFragment mText;
|
||||
|
||||
private:
|
||||
void SetBidiStatus();
|
||||
|
||||
already_AddRefed<nsIAtom> GetCurrentValueAtom();
|
||||
|
||||
void SetIsInAHash()
|
||||
{
|
||||
mText.SetExtraBit(PR_TRUE);
|
||||
}
|
||||
PRBool GetIsInAHash() const
|
||||
{
|
||||
return mText.GetExtraBit();
|
||||
}
|
||||
|
||||
void SetHasRangeList()
|
||||
{
|
||||
SetIsInAHash();
|
||||
}
|
||||
|
||||
void SetHasEventListenerManager()
|
||||
{
|
||||
SetIsInAHash();
|
||||
}
|
||||
|
||||
PRBool CouldHaveRangeList() const
|
||||
{
|
||||
return GetIsInAHash();
|
||||
}
|
||||
|
||||
PRBool CouldHaveEventListenerManager() const
|
||||
{
|
||||
return GetIsInAHash();
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -138,6 +138,51 @@ PRBool nsIContent::sTabFocusModelAppliesToXUL = PR_FALSE;
|
|||
nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult);
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsINode::~nsINode()
|
||||
{
|
||||
NS_ASSERTION(!HasSlots(), "Don't know how to kill the slots");
|
||||
|
||||
if (HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
nsIDocument *document = GetOwnerDoc();
|
||||
if (document) {
|
||||
document->CallUserDataHandler(nsIDOMUserDataHandler::NODE_DELETED,
|
||||
this, nsnull, nsnull);
|
||||
document->PropertyTable()->DeleteAllPropertiesFor(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (HasFlag(NODE_HAS_RANGELIST)) {
|
||||
#ifdef DEBUG
|
||||
if (!nsContentUtils::LookupRangeList(this) &&
|
||||
nsContentUtils::IsInitialized()) {
|
||||
NS_ERROR("Huh, our bit says we have a range list, but there's nothing "
|
||||
"in the hash!?!!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsContentUtils::RemoveRangeList(this);
|
||||
}
|
||||
|
||||
if (HasFlag(NODE_HAS_LISTENERMANAGER)) {
|
||||
#ifdef DEBUG
|
||||
if (nsContentUtils::IsInitialized()) {
|
||||
nsCOMPtr<nsIEventListenerManager> manager;
|
||||
PRBool created;
|
||||
nsContentUtils::GetListenerManager(this, PR_FALSE,
|
||||
getter_AddRefs(manager), &created);
|
||||
if (!manager) {
|
||||
NS_ERROR("Huh, our bit says we have a listener manager list, "
|
||||
"but there's nothing in the hash!?!!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsContentUtils::RemoveListenerManager(this);
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
nsINode::GetProperty(nsIAtom *aPropertyName, nsresult *aStatus) const
|
||||
{
|
||||
|
@ -158,8 +203,13 @@ nsINode::SetProperty(nsIAtom *aPropertyName,
|
|||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return doc->PropertyTable()->SetProperty(this, aPropertyName,
|
||||
nsresult rv = doc->PropertyTable()->SetProperty(this, aPropertyName,
|
||||
aValue, aDtor, nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SetFlags(NODE_HAS_PROPERTIES);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -183,6 +233,81 @@ nsINode::UnsetProperty(nsIAtom *aPropertyName, nsresult *aStatus)
|
|||
aStatus);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::RangeAdd(nsIDOMRange* aRange)
|
||||
{
|
||||
PRBool created;
|
||||
nsresult rv = nsContentUtils::AddToRangeList(this, aRange, &created);
|
||||
if (NS_SUCCEEDED(rv) && created) {
|
||||
NS_ASSERTION(!HasFlag(NODE_HAS_RANGELIST),
|
||||
"Huh, nsGenericElement flags don't reflect reality!!!");
|
||||
SetFlags(NODE_HAS_RANGELIST);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsINode::RangeRemove(nsIDOMRange* aRange)
|
||||
{
|
||||
if (!HasFlag(NODE_HAS_RANGELIST)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PRBool removed = nsContentUtils::RemoveFromRangeList(this, aRange);
|
||||
if (removed) {
|
||||
UnsetFlags(NODE_HAS_RANGELIST);
|
||||
}
|
||||
}
|
||||
|
||||
const nsVoidArray *
|
||||
nsINode::GetRangeList() const
|
||||
{
|
||||
if (!HasFlag(NODE_HAS_RANGELIST)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const nsVoidArray* rangeList = nsContentUtils::LookupRangeList(this);
|
||||
|
||||
NS_ASSERTION(rangeList || !nsContentUtils::IsInitialized(),
|
||||
"Huh, our bit says we have a range list, but there's nothing "
|
||||
"in the hash!?!!");
|
||||
|
||||
return rangeList;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult)
|
||||
{
|
||||
// No need to call nsContentUtils::GetListenerManager if we don't have
|
||||
// an event listener manager.
|
||||
if (!aCreateIfNotFound && !HasFlag(NODE_HAS_LISTENERMANAGER)) {
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool created;
|
||||
nsresult rv =
|
||||
nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult,
|
||||
&created);
|
||||
if (NS_SUCCEEDED(rv) && created) {
|
||||
SetFlags(NODE_HAS_LISTENERMANAGER);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsIContent::SetNativeAnonymous(PRBool aAnonymous)
|
||||
{
|
||||
if (aAnonymous) {
|
||||
SetFlags(NODE_IS_ANONYMOUS);
|
||||
} else {
|
||||
UnsetFlags(NODE_IS_ANONYMOUS);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsChildContentList::nsChildContentList(nsIContent *aContent)
|
||||
|
@ -780,13 +905,13 @@ nsDOMEventRTTearoff::AddEventListener(const nsAString& aType,
|
|||
|
||||
PRUint32 nsMutationGuard::sMutationCount = 0;
|
||||
|
||||
nsDOMSlots::nsDOMSlots(PtrBits aFlags)
|
||||
: mFlags(aFlags),
|
||||
nsGenericElement::nsDOMSlots::nsDOMSlots(PtrBits aFlags)
|
||||
: nsINode::nsSlots(aFlags),
|
||||
mBindingParent(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
nsDOMSlots::~nsDOMSlots()
|
||||
nsGenericElement::nsDOMSlots::~nsDOMSlots()
|
||||
{
|
||||
if (mChildNodes) {
|
||||
mChildNodes->DropReference();
|
||||
|
@ -802,14 +927,13 @@ nsDOMSlots::~nsDOMSlots()
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsDOMSlots::IsEmpty()
|
||||
nsGenericElement::nsDOMSlots::IsEmpty()
|
||||
{
|
||||
return (!mChildNodes && !mStyle && !mAttributeMap && !mBindingParent);
|
||||
}
|
||||
|
||||
nsGenericElement::nsGenericElement(nsINodeInfo *aNodeInfo)
|
||||
: nsIXMLContent(aNodeInfo),
|
||||
mFlagsOrSlots(GENERIC_ELEMENT_DOESNT_HAVE_DOMSLOTS)
|
||||
: nsIXMLContent(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -818,54 +942,12 @@ nsGenericElement::~nsGenericElement()
|
|||
NS_PRECONDITION(!IsInDoc(),
|
||||
"Please remove this from the document properly");
|
||||
|
||||
if (HasProperties()) {
|
||||
nsIDocument *document = GetOwnerDoc();
|
||||
if (document) {
|
||||
document->CallUserDataHandler(nsIDOMUserDataHandler::NODE_DELETED,
|
||||
this, nsnull, nsnull);
|
||||
document->PropertyTable()->DeleteAllPropertiesFor(this);
|
||||
}
|
||||
}
|
||||
|
||||
// pop any enclosed ranges out
|
||||
// nsRange::OwnerGone(mContent); not used for now
|
||||
|
||||
if (HasRangeList()) {
|
||||
#ifdef DEBUG
|
||||
if (!nsContentUtils::LookupRangeList(this) &&
|
||||
nsContentUtils::IsInitialized()) {
|
||||
NS_ERROR("Huh, our bit says we have a range list, but there's nothing "
|
||||
"in the hash!?!!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsContentUtils::RemoveRangeList(this);
|
||||
}
|
||||
|
||||
if (HasEventListenerManager()) {
|
||||
#ifdef DEBUG
|
||||
if (nsContentUtils::IsInitialized()) {
|
||||
nsCOMPtr<nsIEventListenerManager> manager;
|
||||
PRBool created;
|
||||
nsContentUtils::GetListenerManager(this, PR_FALSE,
|
||||
getter_AddRefs(manager), &created);
|
||||
if (!manager) {
|
||||
NS_ERROR("Huh, our bit says we have a listener manager list, "
|
||||
"but there's nothing in the hash!?!!");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsContentUtils::RemoveListenerManager(this);
|
||||
}
|
||||
|
||||
if (HasDOMSlots()) {
|
||||
nsDOMSlots *slots = GetDOMSlots();
|
||||
|
||||
if (HasSlots()) {
|
||||
nsDOMSlots* slots = GetDOMSlots();
|
||||
PtrBits flags = slots->mFlags | NODE_DOESNT_HAVE_SLOTS;
|
||||
delete slots;
|
||||
mFlagsOrSlots = flags;
|
||||
}
|
||||
|
||||
// No calling GetFlags() beyond this point...
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1782,7 +1864,7 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
// Handle a change in our owner document.
|
||||
|
||||
if (oldOwnerDocument && oldOwnerDocument != newOwnerDocument) {
|
||||
if (newOwnerDocument && HasProperties()) {
|
||||
if (newOwnerDocument && HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
// Copy UserData to the new document.
|
||||
oldOwnerDocument->CopyUserData(this, newOwnerDocument);
|
||||
}
|
||||
|
@ -1873,22 +1955,6 @@ nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericElement::IsNativeAnonymous() const
|
||||
{
|
||||
return !!(GetFlags() & GENERIC_ELEMENT_IS_ANONYMOUS);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericElement::SetNativeAnonymous(PRBool aAnonymous)
|
||||
{
|
||||
if (aAnonymous) {
|
||||
SetFlags(GENERIC_ELEMENT_IS_ANONYMOUS);
|
||||
} else {
|
||||
UnsetFlags(GENERIC_ELEMENT_IS_ANONYMOUS);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
{
|
||||
|
@ -2130,48 +2196,6 @@ nsGenericElement::GetBaseURI() const
|
|||
return base;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::RangeAdd(nsIDOMRange* aRange)
|
||||
{
|
||||
PRBool created;
|
||||
nsresult rv = nsContentUtils::AddToRangeList(this, aRange, &created);
|
||||
if (NS_SUCCEEDED(rv) && created) {
|
||||
NS_ASSERTION(!HasRangeList(),
|
||||
"Huh, nsGenericElement flags don't reflect reality!!!");
|
||||
SetFlags(GENERIC_ELEMENT_HAS_RANGELIST);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericElement::RangeRemove(nsIDOMRange* aRange)
|
||||
{
|
||||
if (!HasRangeList()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PRBool removed = nsContentUtils::RemoveFromRangeList(this, aRange);
|
||||
if (removed) {
|
||||
UnsetFlags(GENERIC_ELEMENT_HAS_RANGELIST);
|
||||
}
|
||||
}
|
||||
|
||||
const nsVoidArray *
|
||||
nsGenericElement::GetRangeList() const
|
||||
{
|
||||
if (!HasRangeList()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
const nsVoidArray* rangeList = nsContentUtils::LookupRangeList(this);
|
||||
|
||||
NS_ASSERTION(rangeList || !nsContentUtils::IsInitialized(),
|
||||
"Huh, our bit says we have a range list, but there's nothing "
|
||||
"in the hash!?!!");
|
||||
|
||||
return rangeList;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericElement::SetFocus(nsPresContext* aPresContext)
|
||||
{
|
||||
|
@ -2242,35 +2266,14 @@ nsGenericElement::IsNodeOfType(PRUint32 aFlags) const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
nsGenericElement::GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult)
|
||||
{
|
||||
// No need to call nsContentUtils::GetListenerManager if we don't have
|
||||
// an event listener manager.
|
||||
if (!aCreateIfNotFound && !HasEventListenerManager()) {
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool created;
|
||||
nsresult rv =
|
||||
nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult,
|
||||
&created);
|
||||
if (NS_SUCCEEDED(rv) && created) {
|
||||
SetFlags(GENERIC_ELEMENT_HAS_LISTENERMANAGER);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void
|
||||
nsGenericElement::SetMayHaveFrame(PRBool aMayHaveFrame)
|
||||
{
|
||||
if (aMayHaveFrame) {
|
||||
SetFlags(GENERIC_ELEMENT_MAY_HAVE_FRAME);
|
||||
SetFlags(NODE_MAY_HAVE_FRAME);
|
||||
} else {
|
||||
UnsetFlags(GENERIC_ELEMENT_MAY_HAVE_FRAME);
|
||||
UnsetFlags(NODE_MAY_HAVE_FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2278,7 +2281,7 @@ nsGenericElement::SetMayHaveFrame(PRBool aMayHaveFrame)
|
|||
PRBool
|
||||
nsGenericElement::MayHaveFrame() const
|
||||
{
|
||||
return !!(GetFlags() & GENERIC_ELEMENT_MAY_HAVE_FRAME);
|
||||
return HasFlag(NODE_MAY_HAVE_FRAME);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -3829,25 +3832,6 @@ nsGenericElement::GetContentsAsText(nsAString& aText)
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::SetProperty(nsIAtom *aPropertyName,
|
||||
void *aValue,
|
||||
NSPropertyDtorFunc aDtor)
|
||||
{
|
||||
nsresult rv = nsIXMLContent::SetProperty(aPropertyName, aValue, aDtor);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
SetFlags(GENERIC_ELEMENT_HAS_PROPERTIES);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericElement::SetHasProperties()
|
||||
{
|
||||
SetFlags(GENERIC_ELEMENT_HAS_PROPERTIES);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericElement::CloneNode(PRBool aDeep, nsIDOMNode *aSource,
|
||||
nsIDOMNode **aResult) const
|
||||
|
@ -3862,7 +3846,7 @@ nsGenericElement::CloneNode(PRBool aDeep, nsIDOMNode *aSource,
|
|||
rv = CallQueryInterface(newContent, aResult);
|
||||
|
||||
nsIDocument *ownerDoc = GetOwnerDoc();
|
||||
if (NS_SUCCEEDED(rv) && ownerDoc && HasProperties()) {
|
||||
if (NS_SUCCEEDED(rv) && ownerDoc && HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
ownerDoc->CallUserDataHandler(nsIDOMUserDataHandler::NODE_CLONED,
|
||||
this, aSource, *aResult);
|
||||
}
|
||||
|
|
|
@ -75,35 +75,6 @@ class nsIEventListenerManager;
|
|||
|
||||
typedef unsigned long PtrBits;
|
||||
|
||||
/**
|
||||
* This bit will be set if the nsGenericElement doesn't have nsDOMSlots
|
||||
*/
|
||||
#define GENERIC_ELEMENT_DOESNT_HAVE_DOMSLOTS 0x00000001U
|
||||
|
||||
/**
|
||||
* This bit will be set if the element has a range list in the range list hash
|
||||
*/
|
||||
#define GENERIC_ELEMENT_HAS_RANGELIST 0x00000002U
|
||||
|
||||
/**
|
||||
* This bit will be set if the element has a listener manager in the listener
|
||||
* manager hash
|
||||
*/
|
||||
#define GENERIC_ELEMENT_HAS_LISTENERMANAGER 0x00000004U
|
||||
|
||||
/** Whether this content is anonymous */
|
||||
#define GENERIC_ELEMENT_IS_ANONYMOUS 0x00000008U
|
||||
|
||||
/** Whether this content has had any properties set on it */
|
||||
#define GENERIC_ELEMENT_HAS_PROPERTIES 0x00000010U
|
||||
|
||||
/** Whether this content may have a frame */
|
||||
#define GENERIC_ELEMENT_MAY_HAVE_FRAME 0x00000020U
|
||||
|
||||
/** Three bits are element type specific. */
|
||||
#define ELEMENT_TYPE_SPECIFIC_BITS_OFFSET 6
|
||||
|
||||
|
||||
/**
|
||||
* Class that implements the nsIDOMNodeList interface (a list of children of
|
||||
* the content), by holding a reference to the content and delegating GetLength
|
||||
|
@ -130,57 +101,6 @@ private:
|
|||
nsIContent *mContent;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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
|
||||
* accessed through the DOM.
|
||||
*/
|
||||
class nsDOMSlots
|
||||
{
|
||||
public:
|
||||
nsDOMSlots(PtrBits aFlags);
|
||||
~nsDOMSlots();
|
||||
|
||||
PRBool IsEmpty();
|
||||
|
||||
PtrBits mFlags;
|
||||
|
||||
/**
|
||||
* An object implementing nsIDOMNodeList for this content (childNodes)
|
||||
* @see nsIDOMNodeList
|
||||
* @see nsGenericHTMLElement::GetChildNodes
|
||||
*/
|
||||
nsRefPtr<nsChildContentList> mChildNodes;
|
||||
|
||||
/**
|
||||
* The .style attribute (an interface that forwards to the actual
|
||||
* style rules)
|
||||
* @see nsGenericHTMLElement::GetStyle */
|
||||
nsRefPtr<nsDOMCSSDeclaration> mStyle;
|
||||
|
||||
/**
|
||||
* An object implementing nsIDOMNamedNodeMap for this content (attributes)
|
||||
* @see nsGenericElement::GetAttributes
|
||||
*/
|
||||
nsRefPtr<nsDOMAttributeMap> mAttributeMap;
|
||||
|
||||
union {
|
||||
/**
|
||||
* The nearest enclosing content node with a binding that created us.
|
||||
* @see nsGenericElement::GetBindingParent
|
||||
*/
|
||||
nsIContent* mBindingParent; // [Weak]
|
||||
|
||||
/**
|
||||
* The controllers of the XUL Element.
|
||||
*/
|
||||
nsIControllers* mControllers; // [OWNER]
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* A tearoff class for nsGenericElement to implement the nsIDOM3Node functions
|
||||
*/
|
||||
|
@ -397,13 +317,6 @@ public:
|
|||
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
|
||||
nsPresContext* aPresContext,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual nsresult GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult) {
|
||||
return GetListenerManager(aCreateIfNotFound, aResult);
|
||||
}
|
||||
virtual nsresult SetProperty(nsIAtom *aPropertyName,
|
||||
void *aValue,
|
||||
NSPropertyDtorFunc aDtor);
|
||||
|
||||
// nsIContent interface methods
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
|
@ -411,8 +324,6 @@ public:
|
|||
PRBool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||
PRBool aNullParent = PR_TRUE);
|
||||
virtual PRBool IsNativeAnonymous() const;
|
||||
virtual void SetNativeAnonymous(PRBool aAnonymous);
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
|
@ -440,18 +351,12 @@ public:
|
|||
PRBool aNotify);
|
||||
virtual const nsAttrName* GetAttrNameAt(PRUint32 aIndex) const;
|
||||
virtual PRUint32 GetAttrCount() const;
|
||||
virtual nsresult RangeAdd(nsIDOMRange* aRange);
|
||||
virtual void RangeRemove(nsIDOMRange* aRange);
|
||||
virtual const nsVoidArray *GetRangeList() const;
|
||||
virtual void SetFocus(nsPresContext* aContext);
|
||||
virtual nsIContent *GetBindingParent() const;
|
||||
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
|
||||
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aResult);
|
||||
virtual already_AddRefed<nsIURI> GetBaseURI() const;
|
||||
virtual void SetMayHaveFrame(PRBool aMayHaveFrame);
|
||||
virtual PRBool MayHaveFrame() const;
|
||||
void SetHasProperties();
|
||||
|
||||
/**
|
||||
* This calls Clone to do the actual cloning so that we end up with the
|
||||
|
@ -903,89 +808,73 @@ protected:
|
|||
*/
|
||||
virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
|
||||
PRBool HasDOMSlots() const
|
||||
/**
|
||||
* 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
|
||||
* accessed through the DOM.
|
||||
*/
|
||||
class nsDOMSlots : public nsSlots
|
||||
{
|
||||
return !(mFlagsOrSlots & GENERIC_ELEMENT_DOESNT_HAVE_DOMSLOTS);
|
||||
}
|
||||
public:
|
||||
nsDOMSlots(PtrBits aFlags);
|
||||
~nsDOMSlots();
|
||||
|
||||
PRBool IsEmpty();
|
||||
|
||||
/**
|
||||
* An object implementing nsIDOMNodeList for this content (childNodes)
|
||||
* @see nsIDOMNodeList
|
||||
* @see nsGenericHTMLElement::GetChildNodes
|
||||
*/
|
||||
nsRefPtr<nsChildContentList> mChildNodes;
|
||||
|
||||
/**
|
||||
* The .style attribute (an interface that forwards to the actual
|
||||
* style rules)
|
||||
* @see nsGenericHTMLElement::GetStyle */
|
||||
nsRefPtr<nsDOMCSSDeclaration> mStyle;
|
||||
|
||||
/**
|
||||
* An object implementing nsIDOMNamedNodeMap for this content (attributes)
|
||||
* @see nsGenericElement::GetAttributes
|
||||
*/
|
||||
nsRefPtr<nsDOMAttributeMap> mAttributeMap;
|
||||
|
||||
union {
|
||||
/**
|
||||
* The nearest enclosing content node with a binding that created us.
|
||||
* @see nsGenericElement::GetBindingParent
|
||||
*/
|
||||
nsIContent* mBindingParent; // [Weak]
|
||||
|
||||
/**
|
||||
* The controllers of the XUL Element.
|
||||
*/
|
||||
nsIControllers* mControllers; // [OWNER]
|
||||
};
|
||||
};
|
||||
|
||||
nsDOMSlots *GetDOMSlots()
|
||||
{
|
||||
if (!HasDOMSlots()) {
|
||||
if (!HasSlots()) {
|
||||
nsDOMSlots *slots = new nsDOMSlots(mFlagsOrSlots);
|
||||
|
||||
if (!slots) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
mFlagsOrSlots = NS_REINTERPRET_CAST(PtrBits, slots);
|
||||
SetSlots(slots);
|
||||
}
|
||||
|
||||
return NS_REINTERPRET_CAST(nsDOMSlots *, mFlagsOrSlots);
|
||||
return NS_STATIC_CAST(nsDOMSlots*, FlagsAsSlots());
|
||||
}
|
||||
|
||||
nsDOMSlots *GetExistingDOMSlots() const
|
||||
{
|
||||
if (!HasDOMSlots()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return NS_REINTERPRET_CAST(nsDOMSlots *, mFlagsOrSlots);
|
||||
}
|
||||
|
||||
PtrBits GetFlags() const
|
||||
{
|
||||
if (HasDOMSlots()) {
|
||||
return NS_REINTERPRET_CAST(nsDOMSlots *, mFlagsOrSlots)->mFlags;
|
||||
}
|
||||
|
||||
return mFlagsOrSlots;
|
||||
}
|
||||
|
||||
void SetFlags(PtrBits aFlagsToSet)
|
||||
{
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
|
||||
if (slots) {
|
||||
slots->mFlags |= aFlagsToSet;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mFlagsOrSlots |= aFlagsToSet;
|
||||
}
|
||||
|
||||
void UnsetFlags(PtrBits aFlagsToUnset)
|
||||
{
|
||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||
|
||||
if (slots) {
|
||||
slots->mFlags &= ~aFlagsToUnset;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mFlagsOrSlots &= ~aFlagsToUnset;
|
||||
}
|
||||
|
||||
PRBool HasRangeList() const
|
||||
{
|
||||
PtrBits flags = GetFlags();
|
||||
|
||||
return (flags & GENERIC_ELEMENT_HAS_RANGELIST);
|
||||
}
|
||||
|
||||
PRBool HasEventListenerManager() const
|
||||
{
|
||||
PtrBits flags = GetFlags();
|
||||
|
||||
return (flags & GENERIC_ELEMENT_HAS_LISTENERMANAGER);
|
||||
}
|
||||
|
||||
PRBool HasProperties() const
|
||||
{
|
||||
PtrBits flags = GetFlags();
|
||||
|
||||
return (flags & GENERIC_ELEMENT_HAS_PROPERTIES) != 0;
|
||||
return NS_STATIC_CAST(nsDOMSlots*, GetExistingSlots());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1027,14 +916,6 @@ protected:
|
|||
nsresult CloneNode(PRBool aDeep, nsIDOMNode *aSource,
|
||||
nsIDOMNode **aResult) const;
|
||||
|
||||
/**
|
||||
* Used for either storing flags for this element or a pointer to
|
||||
* this elements nsDOMSlots. See the definition of the
|
||||
* GENERIC_ELEMENT_* macros for the layout of the bits in this
|
||||
* member.
|
||||
*/
|
||||
PtrBits mFlagsOrSlots;
|
||||
|
||||
/**
|
||||
* Array containing all attributes and children for this element
|
||||
*/
|
||||
|
|
|
@ -117,9 +117,7 @@ nsTextFragment::ReleaseText()
|
|||
m1b = nsnull;
|
||||
|
||||
// Set mState.mIs2b, mState.mInHeap, and mState.mLength = 0 with mAllBits;
|
||||
PRBool tmp = mState.mExtraBit;
|
||||
mAllBits = 0;
|
||||
mState.mExtraBit = tmp;
|
||||
}
|
||||
|
||||
nsTextFragment&
|
||||
|
@ -138,9 +136,7 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
|
|||
}
|
||||
|
||||
if (m1b) {
|
||||
PRBool tmp = mState.mExtraBit;
|
||||
mAllBits = aOther.mAllBits;
|
||||
mState.mExtraBit = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,18 +143,6 @@ public:
|
|||
return PRInt32(mState.mLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store an extra bit of general purpose information. Default value is PR_FALSE;
|
||||
*/
|
||||
PRBool GetExtraBit() const
|
||||
{
|
||||
return mState.mExtraBit;
|
||||
}
|
||||
void SetExtraBit(PRBool aExtraBit)
|
||||
{
|
||||
mState.mExtraBit = aExtraBit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the given
|
||||
* buffer. Like operator= except a length is specified instead of
|
||||
|
@ -200,8 +188,7 @@ public:
|
|||
PRBool mInHeap : 1;
|
||||
PRBool mIs2b : 1;
|
||||
PRBool mIsBidi : 1;
|
||||
PRBool mExtraBit : 1;
|
||||
PRUint32 mLength : 28;
|
||||
PRUint32 mLength : 29;
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -227,7 +227,7 @@ nsEventTargetChainItem::GetListenerManager(PRBool aCreateIfNotFound)
|
|||
switch (mFlags & NS_TARGET_CHAIN_TYPE_MASK) {
|
||||
case NS_TARGET_CHAIN_IS_NODE:
|
||||
{
|
||||
mNode->GetEventListenerManager(aCreateIfNotFound, &manager);
|
||||
mNode->GetListenerManager(aCreateIfNotFound, &manager);
|
||||
break;
|
||||
}
|
||||
case NS_TARGET_CHAIN_IS_WINDOW:
|
||||
|
|
|
@ -1791,7 +1791,7 @@ nsGenericHTMLElement::GetBaseURI() const
|
|||
nsIDocument* doc = GetOwnerDoc();
|
||||
|
||||
void* prop;
|
||||
if (HasProperties() && (prop = GetProperty(nsHTMLAtoms::htmlBaseHref))) {
|
||||
if (HasFlag(NODE_HAS_PROPERTIES) && (prop = GetProperty(nsHTMLAtoms::htmlBaseHref))) {
|
||||
nsIURI* uri = NS_STATIC_CAST(nsIURI*, prop);
|
||||
NS_ADDREF(uri);
|
||||
|
||||
|
@ -1818,7 +1818,7 @@ void
|
|||
nsGenericHTMLElement::GetBaseTarget(nsAString& aBaseTarget) const
|
||||
{
|
||||
void* prop;
|
||||
if (HasProperties() && (prop = GetProperty(nsHTMLAtoms::htmlBaseTarget))) {
|
||||
if (HasFlag(NODE_HAS_PROPERTIES) && (prop = GetProperty(nsHTMLAtoms::htmlBaseTarget))) {
|
||||
NS_STATIC_CAST(nsIAtom*, prop)->ToString(aBaseTarget);
|
||||
|
||||
return;
|
||||
|
|
|
@ -833,7 +833,7 @@ nsXULElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
// Handle a change in our owner document.
|
||||
|
||||
if (oldOwnerDocument && oldOwnerDocument != newOwnerDocument) {
|
||||
if (newOwnerDocument && HasProperties()) {
|
||||
if (newOwnerDocument && HasFlag(NODE_HAS_PROPERTIES)) {
|
||||
// Copy UserData to the new document.
|
||||
oldOwnerDocument->CopyUserData(this, aDocument);
|
||||
}
|
||||
|
@ -984,12 +984,13 @@ nsXULElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
|
|||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXULElement::IsNativeAnonymous() const
|
||||
void
|
||||
nsXULElement::SetNativeAnonymous(PRBool aAnonymous)
|
||||
{
|
||||
// XXX Workaround for bug 280541, wallpaper for bug 326644
|
||||
return NodeInfo()->Equals(nsXULAtoms::popupgroup) &&
|
||||
nsGenericElement::IsNativeAnonymous();
|
||||
if (NodeInfo()->Equals(nsXULAtoms::popupgroup)) {
|
||||
nsGenericElement::SetNativeAnonymous(aAnonymous);
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32
|
||||
|
@ -1574,7 +1575,7 @@ nsXULElement::List(FILE* out, PRInt32 aIndent) const
|
|||
|
||||
rdf_Indent(out, aIndent);
|
||||
fputs("<XUL", out);
|
||||
if (HasDOMSlots()) fputs("*", out);
|
||||
if (HasSlots()) fputs("*", out);
|
||||
fputs(" ", out);
|
||||
|
||||
nsAutoString as;
|
||||
|
|
|
@ -399,7 +399,7 @@ public:
|
|||
|
||||
*/
|
||||
|
||||
#define XUL_ELEMENT_LAZY_STATE_OFFSET ELEMENT_TYPE_SPECIFIC_BITS_OFFSET
|
||||
#define XUL_ELEMENT_LAZY_STATE_OFFSET NODE_TYPE_SPECIFIC_BITS_OFFSET
|
||||
|
||||
class nsXULElement : public nsGenericElement,
|
||||
public nsIDOMXULElement,
|
||||
|
@ -466,10 +466,6 @@ public:
|
|||
virtual nsIContent *GetChildAt(PRUint32 aIndex) const;
|
||||
virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const;
|
||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||
virtual nsresult GetEventListenerManager(PRBool aCreateIfNotFound,
|
||||
nsIEventListenerManager** aRes) {
|
||||
return GetListenerManager(aCreateIfNotFound, aRes);
|
||||
}
|
||||
virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
PRBool aNotify);
|
||||
|
||||
|
@ -479,7 +475,7 @@ public:
|
|||
PRBool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
|
||||
PRBool aNullParent = PR_TRUE);
|
||||
virtual PRBool IsNativeAnonymous() const;
|
||||
virtual void SetNativeAnonymous(PRBool aAnonymous);
|
||||
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||
virtual nsIAtom *GetIDAttributeName() const;
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче