Bug 17955. Don't unnecessarily add script event listeners to temporary nodes used for overlay hookup. r=hyatt, a=chofmann

This commit is contained in:
waterson%netscape.com 1999-11-04 19:43:43 +00:00
Родитель 0b5d621294
Коммит 1d630564b4
6 изменённых файлов: 54 добавлений и 48 удалений

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

@ -371,6 +371,7 @@ nsXULElement::~nsXULElement()
nsresult nsresult
nsXULElement::Create(nsXULPrototypeElement* aPrototype, nsXULElement::Create(nsXULPrototypeElement* aPrototype,
nsIDocument* aDocument, nsIDocument* aDocument,
PRBool aIsScriptable,
nsIContent** aResult) nsIContent** aResult)
{ {
// Create an nsXULElement from a prototype // Create an nsXULElement from a prototype
@ -401,6 +402,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype,
element->mPrototype = aPrototype; element->mPrototype = aPrototype;
element->mDocument = aDocument; element->mDocument = aDocument;
if (aIsScriptable) {
// Check each attribute on the prototype to see if we need to do // Check each attribute on the prototype to see if we need to do
// any additional processing and hookup that would otherwise be // any additional processing and hookup that would otherwise be
// done 'automagically' by SetAttribute(). // done 'automagically' by SetAttribute().
@ -428,6 +430,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype,
} }
} }
} }
}
*aResult = NS_REINTERPRET_CAST(nsIStyledContent*, element); *aResult = NS_REINTERPRET_CAST(nsIStyledContent*, element);
NS_ADDREF(*aResult); NS_ADDREF(*aResult);

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

@ -276,7 +276,7 @@ protected:
public: public:
static nsresult static nsresult
Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, nsIContent** aResult); Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, PRBool aIsScriptable, nsIContent** aResult);
static nsresult static nsresult
Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult); Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult);

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

@ -4721,7 +4721,7 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
else { else {
// If it's a XUL element, it'll be lightweight until somebody // If it's a XUL element, it'll be lightweight until somebody
// monkeys with it. // monkeys with it.
rv = nsXULElement::Create(aPrototype, this, getter_AddRefs(result)); rv = nsXULElement::Create(aPrototype, this, PR_TRUE, getter_AddRefs(result));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// We also need to pay special attention to the keyset tag to set up a listener // We also need to pay special attention to the keyset tag to set up a listener
@ -4763,7 +4763,7 @@ nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIConten
// element. I'd use an XML element, but it gets its knickers in a // element. I'd use an XML element, but it gets its knickers in a
// knot with DOM ranges when you try to remove its children. // knot with DOM ranges when you try to remove its children.
nsCOMPtr<nsIContent> element; nsCOMPtr<nsIContent> element;
rv = nsXULElement::Create(aPrototype, this, getter_AddRefs(element)); rv = nsXULElement::Create(aPrototype, this, PR_FALSE, getter_AddRefs(element));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
OverlayForwardReference* fwdref = new OverlayForwardReference(element); OverlayForwardReference* fwdref = new OverlayForwardReference(element);

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

@ -4721,7 +4721,7 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
else { else {
// If it's a XUL element, it'll be lightweight until somebody // If it's a XUL element, it'll be lightweight until somebody
// monkeys with it. // monkeys with it.
rv = nsXULElement::Create(aPrototype, this, getter_AddRefs(result)); rv = nsXULElement::Create(aPrototype, this, PR_TRUE, getter_AddRefs(result));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// We also need to pay special attention to the keyset tag to set up a listener // We also need to pay special attention to the keyset tag to set up a listener
@ -4763,7 +4763,7 @@ nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIConten
// element. I'd use an XML element, but it gets its knickers in a // element. I'd use an XML element, but it gets its knickers in a
// knot with DOM ranges when you try to remove its children. // knot with DOM ranges when you try to remove its children.
nsCOMPtr<nsIContent> element; nsCOMPtr<nsIContent> element;
rv = nsXULElement::Create(aPrototype, this, getter_AddRefs(element)); rv = nsXULElement::Create(aPrototype, this, PR_FALSE, getter_AddRefs(element));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
OverlayForwardReference* fwdref = new OverlayForwardReference(element); OverlayForwardReference* fwdref = new OverlayForwardReference(element);

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

@ -371,6 +371,7 @@ nsXULElement::~nsXULElement()
nsresult nsresult
nsXULElement::Create(nsXULPrototypeElement* aPrototype, nsXULElement::Create(nsXULPrototypeElement* aPrototype,
nsIDocument* aDocument, nsIDocument* aDocument,
PRBool aIsScriptable,
nsIContent** aResult) nsIContent** aResult)
{ {
// Create an nsXULElement from a prototype // Create an nsXULElement from a prototype
@ -401,6 +402,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype,
element->mPrototype = aPrototype; element->mPrototype = aPrototype;
element->mDocument = aDocument; element->mDocument = aDocument;
if (aIsScriptable) {
// Check each attribute on the prototype to see if we need to do // Check each attribute on the prototype to see if we need to do
// any additional processing and hookup that would otherwise be // any additional processing and hookup that would otherwise be
// done 'automagically' by SetAttribute(). // done 'automagically' by SetAttribute().
@ -428,6 +430,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype,
} }
} }
} }
}
*aResult = NS_REINTERPRET_CAST(nsIStyledContent*, element); *aResult = NS_REINTERPRET_CAST(nsIStyledContent*, element);
NS_ADDREF(*aResult); NS_ADDREF(*aResult);

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

@ -276,7 +276,7 @@ protected:
public: public:
static nsresult static nsresult
Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, nsIContent** aResult); Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, PRBool aIsScriptable, nsIContent** aResult);
static nsresult static nsresult
Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult); Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult);