Bug 488771. Stop nsIRollUpListener from inheriting from nsISupports. r=roc

This commit is contained in:
Timothy Nikkel
2009-12-22 17:49:33 -06:00
parent ddb685be31
commit 7411ec87d0
24 changed files with 124 additions and 87 deletions

View File

@@ -114,7 +114,8 @@ static NS_DEFINE_IID(kCDragServiceCID, NS_DRAGSERVICE_CID);
static const int WHEEL_DELTA = 120;
static PRBool gGlobalsInitialized = PR_FALSE;
static nsCOMPtr<nsIRollupListener> gRollupListener;
static nsIRollupListener* gRollupListener;
static nsIMenuRollup* gMenuRollup;
static nsWeakPtr gRollupWindow;
static PRBool gConsumeRollupEvent;
@@ -250,6 +251,7 @@ nsWindow::Destroy(void)
gRollupListener->Rollup(nsnull, nsnull);
gRollupWindow = nsnull;
gRollupListener = nsnull;
NS_IF_RELEASE(gMenuRollup);
}
Show(PR_FALSE);
@@ -802,6 +804,7 @@ nsWindow::CaptureMouse(PRBool aCapture)
NS_IMETHODIMP
nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
nsIMenuRollup *aMenuRollup,
PRBool aDoCapture,
PRBool aConsumeRollupEvent)
{
@@ -813,10 +816,14 @@ nsWindow::CaptureRollupEvents(nsIRollupListener *aListener,
if (aDoCapture) {
gConsumeRollupEvent = aConsumeRollupEvent;
gRollupListener = aListener;
NS_IF_RELEASE(gMenuRollup);
gMenuRollup = aMenuRollup;
NS_IF_ADDREF(aMenuRollup);
gRollupWindow = do_GetWeakReference(static_cast<nsIWidget*>(this));
}
else {
gRollupListener = nsnull;
NS_IF_RELEASE(gMenuRollup);
gRollupWindow = nsnull;
}
@@ -844,11 +851,9 @@ check_for_rollup(double aMouseX, double aMouseY,
// we don't want to rollup if the clickis in a parent menu of
// the current submenu
PRUint32 popupsToRollup = PR_UINT32_MAX;
nsCOMPtr<nsIMenuRollup> menuRollup;
menuRollup = (do_QueryInterface(gRollupListener));
if (menuRollup) {
if (gMenuRollup) {
nsAutoTArray<nsIWidget*, 5> widgetChain;
PRUint32 sameTypeCount = menuRollup->GetSubmenuWidgetChain(&widgetChain);
PRUint32 sameTypeCount = gMenuRollup->GetSubmenuWidgetChain(&widgetChain);
for (PRUint32 i=0; i<widgetChain.Length(); ++i) {
nsIWidget* widget = widgetChain[i];
QWidget* currWindow =
@@ -874,6 +879,7 @@ check_for_rollup(double aMouseX, double aMouseY,
} else {
gRollupWindow = nsnull;
gRollupListener = nsnull;
gMenuRollup = nsnull;
}
return retVal;