diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index aeefa2d5d5e5..f863db067295 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -422,7 +422,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) case NS_MOVE: { // persist position, but not immediately, in case this OS is firing // repeated move events as the user drags the window - eventWindow->SetPersistenceTimer(PR_FALSE, PR_TRUE, PR_FALSE); + eventWindow->SetPersistenceTimer(PR_FALSE, PR_TRUE); break; } case NS_SIZE: { @@ -432,17 +432,14 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) sizeEvent->windowSize->height, PR_FALSE); // persist size, but not immediately, in case this OS is firing // repeated size events as the user drags the sizing handle - eventWindow->SetPersistenceTimer(PR_TRUE, PR_FALSE, PR_TRUE); + eventWindow->SetPersistenceTimer(PR_TRUE, PR_FALSE); result = nsEventStatus_eConsumeNoDefault; break; } case NS_SIZEMODE: { nsSizeModeEvent* modeEvent = (nsSizeModeEvent*)aEvent; aEvent->widget->SetSizeMode(modeEvent->mSizeMode); - // persist mode, but not immediately, because in many (all?) - // cases this will merge with the similar call in NS_SIZE and - // write the attribute values only once. - eventWindow->SetPersistenceTimer(PR_FALSE, PR_FALSE, PR_TRUE); + eventWindow->StoreBoundsToXUL(PR_FALSE, PR_FALSE, PR_TRUE); result = nsEventStatus_eConsumeDoDefault; // Note the current implementation of SetSizeMode just stores // the new state; it doesn't actually resize. So here we store @@ -595,7 +592,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) // since the window has been activated, replace persistent size data // with the newly activated window's if (eventWindow->mChromeLoaded) - eventWindow->PersistPositionAndSize(PR_TRUE, PR_TRUE, PR_TRUE); + eventWindow->StoreBoundsToXUL(PR_TRUE, PR_TRUE, PR_TRUE); break; } @@ -1156,14 +1153,13 @@ nsWebShellWindow::DestroyModalDialogEvent(PLEvent *aEvent) } void -nsWebShellWindow::SetPersistenceTimer(PRBool aSize, PRBool aPosition, PRBool aMode) +nsWebShellWindow::SetPersistenceTimer(PRBool aSize, PRBool aPosition) { PR_Lock(mSPTimerLock); if (mSPTimer) { mSPTimer->SetDelay(SIZE_PERSISTENCE_TIMEOUT); mSPTimerSize |= aSize; mSPTimerPosition |= aPosition; - mSPTimerMode |= aMode; } else { nsresult rv; mSPTimer = do_CreateInstance("@mozilla.org/timer;1", &rv); @@ -1172,7 +1168,6 @@ nsWebShellWindow::SetPersistenceTimer(PRBool aSize, PRBool aPosition, PRBool aMo SIZE_PERSISTENCE_TIMEOUT, NS_TYPE_ONE_SHOT); mSPTimerSize = aSize; mSPTimerPosition = aPosition; - mSPTimerMode = aMode; } } PR_Unlock(mSPTimerLock); @@ -1185,8 +1180,7 @@ nsWebShellWindow::FirePersistenceTimer(nsITimer *aTimer, void *aClosure) PR_Lock(win->mSPTimerLock); win->mSPTimer = nsnull; PR_Unlock(win->mSPTimerLock); - win->PersistPositionAndSize(win->mSPTimerPosition, win->mSPTimerSize, - win->mSPTimerMode); + win->StoreBoundsToXUL(win->mSPTimerPosition, win->mSPTimerSize, PR_FALSE); } @@ -1385,6 +1379,12 @@ nsCOMPtr nsWebShellWindow::GetNamedDOMDoc(const nsAString & aWeb //---------------------------------------- +/* copy the window's size and position to the window tag */ +void nsWebShellWindow::StoreBoundsToXUL(PRBool aPosition, PRBool aSize, PRBool aSizeMode) +{ + PersistPositionAndSize(aPosition, aSize, aSizeMode); +} // StoreBoundsToXUL + // if the main document URL specified URLs for any content areas, start them loading void nsWebShellWindow::LoadContentAreas() { @@ -1737,7 +1737,7 @@ NS_IMETHODIMP nsWebShellWindow::Destroy() if (mSPTimer) { mSPTimer->Cancel(); mSPTimer = nsnull; - PersistPositionAndSize(mSPTimerPosition, mSPTimerSize, mSPTimerMode); + StoreBoundsToXUL(mSPTimerPosition, mSPTimerSize, PR_FALSE); } PR_Unlock(mSPTimerLock); diff --git a/xpfe/appshell/src/nsWebShellWindow.h b/xpfe/appshell/src/nsWebShellWindow.h index 34222a4cb72a..70b635df6f9e 100644 --- a/xpfe/appshell/src/nsWebShellWindow.h +++ b/xpfe/appshell/src/nsWebShellWindow.h @@ -184,6 +184,7 @@ protected: nsCOMPtr GetDOMNodeFromWebShell(nsIWebShell *aShell); void ExecuteStartupCode(); + void StoreBoundsToXUL(PRBool aPosition, PRBool aSize, PRBool aSizeMode); void LoadContentAreas(); PRBool ExecuteCloseHandler(); @@ -202,11 +203,11 @@ protected: nsIDOMNode * contextMenuTest; nsCOMPtr mSPTimer; - PRBool mSPTimerSize, mSPTimerPosition, mSPTimerMode; + PRBool mSPTimerSize, mSPTimerPosition; PRLock * mSPTimerLock; nsCOMPtr mPrompter; - void SetPersistenceTimer(PRBool aSize, PRBool aPosition, PRBool aMode); + void SetPersistenceTimer(PRBool aSize, PRBool aPosition); static void FirePersistenceTimer(nsITimer *aTimer, void *aClosure); private: