This commit is contained in:
hyatt%netscape.com 2000-08-16 08:14:01 +00:00
Родитель e38c3b84b6
Коммит 62efdcb050
8 изменённых файлов: 38 добавлений и 8 удалений

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

@ -1103,7 +1103,10 @@ NS_IMETHODIMP
nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument)
{
if (aOldDocument != aNewDocument) {
mFirstHandler = nsnull;
if (mFirstHandler) {
mFirstHandler->MarkForDeath();
mFirstHandler = nsnull;
}
if (mNextBinding)
mNextBinding->ChangeDocument(aOldDocument, aNewDocument);

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

@ -376,6 +376,9 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
PRBool
nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
{
if (!mHandlerElement)
return PR_FALSE;
nsAutoString trueString; trueString.AssignWithConversion("true");
nsAutoString falseString; falseString.AssignWithConversion("false");
@ -493,6 +496,9 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
PRBool
nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
{
if (!mHandlerElement)
return PR_FALSE;
nsAutoString trueString; trueString.AssignWithConversion("true");
nsAutoString falseString; falseString.AssignWithConversion("false");
@ -606,6 +612,9 @@ nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
NS_IMETHODIMP
nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEvent)
{
if (!mHandlerElement)
return NS_ERROR_FAILURE;
// This is a special-case optimization to make command handling fast.
// It isn't really a part of XBL, but it helps speed things up.
nsAutoString command;

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

@ -92,6 +92,10 @@ public:
void RemoveEventHandlers();
void MarkForDeath() {
if (mNextHandler) mNextHandler->MarkForDeath(); mHandlerElement = mBoundElement = nsnull;
}
protected:
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
inline PRBool MouseEventMatched(nsIDOMMouseEvent* aMouseEvent);

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

@ -2183,9 +2183,6 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
nsresult rv;
if (aDocument != mDocument) {
mListenerManager = nsnull;
nsCOMPtr<nsIXULDocument> rdfDoc;
if (mDocument) {
// Release the named reference to the script object so it can
@ -2219,6 +2216,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
}
}
mListenerManager = nsnull;
mDocument = aDocument; // not refcounted
if (mBoxObject) {

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

@ -1103,7 +1103,10 @@ NS_IMETHODIMP
nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument)
{
if (aOldDocument != aNewDocument) {
mFirstHandler = nsnull;
if (mFirstHandler) {
mFirstHandler->MarkForDeath();
mFirstHandler = nsnull;
}
if (mNextBinding)
mNextBinding->ChangeDocument(aOldDocument, aNewDocument);

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

@ -376,6 +376,9 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
PRBool
nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
{
if (!mHandlerElement)
return PR_FALSE;
nsAutoString trueString; trueString.AssignWithConversion("true");
nsAutoString falseString; falseString.AssignWithConversion("false");
@ -493,6 +496,9 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent)
PRBool
nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
{
if (!mHandlerElement)
return PR_FALSE;
nsAutoString trueString; trueString.AssignWithConversion("true");
nsAutoString falseString; falseString.AssignWithConversion("false");
@ -606,6 +612,9 @@ nsXBLEventHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
NS_IMETHODIMP
nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEvent)
{
if (!mHandlerElement)
return NS_ERROR_FAILURE;
// This is a special-case optimization to make command handling fast.
// It isn't really a part of XBL, but it helps speed things up.
nsAutoString command;

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

@ -92,6 +92,10 @@ public:
void RemoveEventHandlers();
void MarkForDeath() {
if (mNextHandler) mNextHandler->MarkForDeath(); mHandlerElement = mBoundElement = nsnull;
}
protected:
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
inline PRBool MouseEventMatched(nsIDOMMouseEvent* aMouseEvent);

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

@ -2183,9 +2183,6 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
nsresult rv;
if (aDocument != mDocument) {
mListenerManager = nsnull;
nsCOMPtr<nsIXULDocument> rdfDoc;
if (mDocument) {
// Release the named reference to the script object so it can
@ -2219,6 +2216,8 @@ nsXULElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileE
}
}
mListenerManager = nsnull;
mDocument = aDocument; // not refcounted
if (mBoxObject) {