Bug 743975 - remove NS_DESTROY event, r=smaug

This commit is contained in:
Neil Deakin 2012-08-15 14:52:41 -04:00
parent fae99fd13d
commit 193db1ca6c
12 changed files with 20 additions and 33 deletions

View File

@ -2113,12 +2113,15 @@ nsObjectFrame::HandleEvent(nsPresContext* aPresContext,
}
#endif
/*
// XXXndeakin review note: I don't see how this would ever be called.
if (anEvent->message == NS_DESTROY) {
#ifdef MAC_CARBON_PLUGINS
mInstanceOwner->CancelTimer();
#endif
return rv;
}
*/
return nsObjectFrameSuper::HandleEvent(aPresContext, anEvent, anEventStatus);
}

View File

@ -821,7 +821,6 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
break;
}
case NS_DESTROY:
case NS_SETZLEVEL:
/* Don't pass these events through. Passing them through
causes performance problems on pages with lots of views/frames

View File

@ -519,7 +519,6 @@ public:
protected:
bool ReportDestroyEvent();
bool ReportMoveEvent();
bool ReportSizeEvent();

View File

@ -427,7 +427,7 @@ NS_IMETHODIMP nsChildView::Destroy()
nsBaseWidget::Destroy();
ReportDestroyEvent();
NotifyWindowDestroyed();
mParentWidget = nil;
TearDownView();
@ -1495,13 +1495,6 @@ bool nsChildView::DispatchWindowEvent(nsGUIEvent &event)
#pragma mark -
bool nsChildView::ReportDestroyEvent()
{
nsGUIEvent event(true, NS_DESTROY, this);
event.time = PR_IntervalNow();
return DispatchWindowEvent(event);
}
bool nsChildView::ReportMoveEvent()
{
nsGUIEvent moveEvent(true, NS_MOVE, this);

View File

@ -497,9 +497,7 @@ nsWindow::OnDestroy(void)
nsBaseWidget::Destroy();
mParent = nullptr;
nsGUIEvent event(true, NS_DESTROY, this);
nsEventStatus status;
DispatchEvent(&event, status);
NotifyWindowDestroyed();
}
bool

View File

@ -147,8 +147,6 @@ class nsHashKey;
// Widget may be destroyed
#define NS_XUL_CLOSE (NS_WINDOW_START + 1)
// Widget is being destroyed
#define NS_DESTROY (NS_WINDOW_START + 2)
// Widget was resized
#define NS_SIZE (NS_WINDOW_START + 3)
// Widget size mode was changed

View File

@ -1925,9 +1925,7 @@ void nsWindow::OnDestroy()
// from the Release() below. This is very bad...
if (!(nsWindowState_eDoingDelete & mWindowState)) {
AddRef();
nsGUIEvent event(true, NS_DESTROY, this);
InitEvent(event);
DispatchWindowEvent(&event);
NotifyWindowDestroyed();
Release();
}

View File

@ -3107,10 +3107,7 @@ nsWindow::OnDestroy(void)
mParent = nullptr;
nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
nsGUIEvent event(true, NS_DESTROY, this);
nsEventStatus status;
DispatchEvent(&event, status);
NotifyWindowDestroyed();
}
bool

View File

@ -3505,7 +3505,6 @@ NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus
case NS_DEACTIVATE:
case NS_ACTIVATE:
case NS_SIZEMODE:
case NS_DESTROY:
case NS_SETZLEVEL:
case NS_XUL_CLOSE:
case NS_MOVE:
@ -6992,9 +6991,9 @@ void nsWindow::OnDestroy()
// Make sure we don't get destroyed in the process of tearing down.
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
// Dispatch the NS_DESTROY event. Must be called before mEventCallback is cleared.
// Dispatch the destroy notification.
if (!mInDtor)
DispatchStandardEvent(NS_DESTROY);
NotifyWindowDestroyed();
// Prevent the widget from sending additional events.
mEventCallback = nullptr;

View File

@ -23,6 +23,7 @@
#include "LayerManagerOGL.h"
#include "nsIXULRuntime.h"
#include "nsIXULWindow.h"
#include "nsIBaseWindow.h"
#include "nsIDocShell.h"
#include "nsView.h"
#include "nsIViewManager.h"
@ -1369,6 +1370,15 @@ static nsIPresShell* GetPresShell(nsIWidget* aWidget, void* clientData)
return nullptr;
}
void
nsBaseWidget::NotifyWindowDestroyed()
{
nsCOMPtr<nsIBaseWindow> window(do_QueryInterface(static_cast<nsISupports *>(mClientData)));
if (window) {
window->Destroy();
}
}
void
nsBaseWidget::NotifySizeMoveDone()
{
@ -1461,7 +1471,6 @@ case _value: eventName.AssignLiteral(_name) ; break
switch(aGuiEvent->message)
{
_ASSIGN_eventName(NS_BLUR_CONTENT,"NS_BLUR_CONTENT");
_ASSIGN_eventName(NS_DESTROY,"NS_DESTROY");
_ASSIGN_eventName(NS_DRAGDROP_GESTURE,"NS_DND_GESTURE");
_ASSIGN_eventName(NS_DRAGDROP_DROP,"NS_DND_DROP");
_ASSIGN_eventName(NS_DRAGDROP_ENTER,"NS_DND_ENTER");

View File

@ -164,6 +164,7 @@ public:
NS_IMETHOD RegisterTouchWindow();
NS_IMETHOD UnregisterTouchWindow();
void NotifyWindowDestroyed();
void NotifySizeMoveDone();
// Should be called by derived implementations to notify on system color and

View File

@ -369,13 +369,6 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent)
eventWindow->Destroy();
break;
}
/*
* Notify the ApplicationShellService that the window is being closed...
*/
case NS_DESTROY: {
eventWindow->Destroy();
break;
}
case NS_SETZLEVEL: {
nsZLevelEvent *zEvent = (nsZLevelEvent *) aEvent;