Bug 223393, DOMAttrModified mutation events fired on HTMLHtmlElement while page loads (anonymous content), r+sr=sicking

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-08-03 08:57:02 +00:00
Родитель 790344c5d8
Коммит 73043ed88f
4 изменённых файлов: 33 добавлений и 11 удалений

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

@ -62,8 +62,9 @@ class nsTextFragment;
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0x98f87249, 0x4cc8, 0x407d, \
{ 0x80, 0xb6, 0xfe, 0x12, 0x91, 0xd1, 0x4d, 0xc9 } }
{ 0x4e5f17a1, 0x68c5, 0x4d9b, \
{ 0xbf, 0x5b, 0xf6, 0x05, 0x10, 0xee, 0xc0, 0x41 } }
// hack to make egcs / gcc 2.95.2 happy
class nsIContent_base : public nsINode {
@ -164,6 +165,14 @@ public:
return HasFlag(NODE_IS_ANONYMOUS);
}
/**
* Returns PR_TRUE if this content is anonymous for event handling.
*/
PRBool IsAnonymousForEvents() const
{
return HasFlag(NODE_IS_ANONYMOUS_FOR_EVENTS);
}
/**
* Set whether this content is anonymous
* This is virtual and non-inlined due to nsXULElement::SetNativeAnonymous

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

@ -58,31 +58,35 @@ class nsVoidArray;
class nsIMutationObserver;
// This bit will be set if the node doesn't have nsSlots
#define NODE_DOESNT_HAVE_SLOTS 0x00000001U
#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
#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
#define NODE_HAS_LISTENERMANAGER 0x00000004U
// Whether this node has had any properties set on it
#define NODE_HAS_PROPERTIES 0x00000008U
#define NODE_HAS_PROPERTIES 0x00000008U
// Whether this node is anonymous
// NOTE: Should only be used on nsIContent nodes
#define NODE_IS_ANONYMOUS 0x00000010U
#define NODE_IS_ANONYMOUS 0x00000010U
// Whether this node is anonymous for events
// NOTE: Should only be used on nsIContent nodes
#define NODE_IS_ANONYMOUS_FOR_EVENTS 0x00000020U
// Whether this node may have a frame
// NOTE: Should only be used on nsIContent nodes
#define NODE_MAY_HAVE_FRAME 0x00000020U
#define NODE_MAY_HAVE_FRAME 0x00000040U
// Four bits for the script-type ID
#define NODE_SCRIPT_TYPE_OFFSET 6
#define NODE_SCRIPT_TYPE_OFFSET 7
// Remaining bits are node type specific.
#define NODE_TYPE_SPECIFIC_BITS_OFFSET 0x0a
#define NODE_TYPE_SPECIFIC_BITS_OFFSET 0x0b
// Useful macro for getting a node given an nsIContent and an nsIDocument
// Returns the first argument cast to nsINode if it is non-null, otherwise

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

@ -329,8 +329,10 @@ nsIContent::SetNativeAnonymous(PRBool aAnonymous)
{
if (aAnonymous) {
SetFlags(NODE_IS_ANONYMOUS);
SetFlags(NODE_IS_ANONYMOUS_FOR_EVENTS);
} else {
UnsetFlags(NODE_IS_ANONYMOUS);
UnsetFlags(NODE_IS_ANONYMOUS_FOR_EVENTS);
}
}
@ -2013,7 +2015,7 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent,
//FIXME! Document how this event retargeting works, Bug 329124.
aVisitor.mCanHandle = PR_TRUE;
nsCOMPtr<nsIContent> parent = aContent->GetParent();
if (aContent->IsNativeAnonymous()) {
if (aContent->IsAnonymousForEvents()) {
// Don't propagate mutation events which are dispatched somewhere inside
// native anonymous content.
if (aVisitor.mEvent->eventStructType == NS_MUTATION_EVENT) {

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

@ -999,6 +999,13 @@ nsXULElement::SetNativeAnonymous(PRBool aAnonymous)
// XXX Workaround for bug 280541, wallpaper for bug 326644
if (NodeInfo()->Equals(nsXULAtoms::popupgroup)) {
nsGenericElement::SetNativeAnonymous(aAnonymous);
} else {
// We still want to set the anonymous bit for events.
if (aAnonymous) {
SetFlags(NODE_IS_ANONYMOUS_FOR_EVENTS);
} else {
UnsetFlags(NODE_IS_ANONYMOUS_FOR_EVENTS);
}
}
}