Bug 388761 - fix MOZ_XUL-disabled builds

p=romaxa <romaxa@gmail.com>
r+sr=roc


git-svn-id: svn://10.0.0.236/trunk@230693 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
asqueella%gmail.com
2007-07-24 00:04:37 +00:00
parent 09d5eea4a6
commit 2617d636d9
6 changed files with 24 additions and 3 deletions

View File

@@ -161,7 +161,9 @@
#include "nsIObserverService.h"
#include "nsIXULAppInfo.h"
#include "nsNetUtil.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#endif
#include "plbase64.h"
@@ -3038,6 +3040,7 @@ nsGlobalWindow::SetScreenY(PRInt32 aScreenY)
nsresult
nsGlobalWindow::CheckSecurityWidthAndHeight(PRInt32* aWidth, PRInt32* aHeight)
{
#ifdef MOZ_XUL
if (!nsContentUtils::IsCallerTrustedForWrite()) {
// if attempting to resize the window, hide any open popups
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
@@ -3045,6 +3048,7 @@ nsGlobalWindow::CheckSecurityWidthAndHeight(PRInt32* aWidth, PRInt32* aHeight)
if (pm && doc)
pm->HidePopupsInDocument(doc);
}
#endif
// This one is easy. Just ensure the variable is greater than 100;
if ((aWidth && *aWidth < 100) || (aHeight && *aHeight < 100)) {
@@ -3072,11 +3076,13 @@ nsGlobalWindow::CheckSecurityLeftAndTop(PRInt32* aLeft, PRInt32* aTop)
// Check security state for use in determing window dimensions
if (!nsContentUtils::IsCallerTrustedForWrite()) {
#ifdef MOZ_XUL
// if attempting to move the window, hide any open popups
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
if (pm && doc)
pm->HidePopupsInDocument(doc);
#endif
PRInt32 screenLeft, screenTop, screenWidth, screenHeight;
PRInt32 winLeft, winTop, winWidth, winHeight;

View File

@@ -13064,6 +13064,7 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run()
// this is hard-coded to handle only menu popup frames
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(mContent);
if (frame && frame->GetType() == nsGkAtoms::menuPopupFrame) {
#ifdef MOZ_XUL
// it is possible that the frame is different than the one that requested
// the lazy generation, but as long as it's a popup frame that hasn't
// generated its children yet, that's OK.
@@ -13073,6 +13074,7 @@ nsCSSFrameConstructor::LazyGenerateChildrenEvent::Run()
// indicate that the children have been generated
menuPopupFrame->SetGeneratedChildren();
#endif
nsFrameItems childItems;
nsFrameConstructorState state(mPresShell, nsnull, nsnull, nsnull);

View File

@@ -109,8 +109,8 @@
#include "nsIDOMHTMLFrameSetElement.h"
#ifdef MOZ_XUL
#include "nsIXULDocument.h"
#endif
#include "nsXULPopupManager.h"
#endif
#include "nsPrintfCString.h"
#include "nsIClipboardHelper.h"
@@ -1151,11 +1151,13 @@ DocumentViewerImpl::PageHide(PRBool aIsUnload)
nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull, &status);
}
#ifdef MOZ_XUL
// look for open menupopups and close them after the unload event, in case
// the unload event listeners open any new popups
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm && mDocument)
pm->HidePopupsInDocument(mDocument);
#endif
return NS_OK;
}

View File

@@ -5418,6 +5418,7 @@ PresShell::HandleEvent(nsIView *aView,
if (framePresContext == rootPresContext &&
frame == FrameManager()->GetRootFrame()) {
#ifdef MOZ_XUL
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm) {
nsTArray<nsIFrame*> popups = pm->GetOpenPopups();
@@ -5433,6 +5434,7 @@ PresShell::HandleEvent(nsIView *aView,
}
}
}
#endif
}
nsPoint eventPoint

View File

@@ -79,10 +79,10 @@
#include "nsCellMap.h"
#include "nsTextFrameTextRunCache.h"
#include "nsCCUncollectableMarker.h"
#include "nsXULPopupManager.h"
#include "nsTextFragment.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#include "nsXULContentUtils.h"
#include "nsXULElement.h"
#include "nsXULPrototypeCache.h"
@@ -220,11 +220,13 @@ nsLayoutStatics::Initialize()
return rv;
}
#ifdef MOZ_XUL
rv = nsXULPopupManager::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsXULPopupManager");
return rv;
}
#endif
return NS_OK;
}
@@ -232,7 +234,9 @@ nsLayoutStatics::Initialize()
void
nsLayoutStatics::Shutdown()
{
#ifdef MOZ_XUL
nsXULPopupManager::Shutdown();
#endif
nsDOMStorageManager::Shutdown();
txMozillaXSLTProcessor::Shutdown();
nsDOMAttribute::Shutdown();

View File

@@ -58,7 +58,9 @@
#include "nsIScriptContext.h"
#include "nsPIDOMWindow.h"
#include "nsContentUtils.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
#endif
#include "nsIRootBox.h"
nsXULTooltipListener* nsXULTooltipListener::mInstance = nsnull;
@@ -507,7 +509,6 @@ nsXULTooltipListener::LaunchTooltip()
// Because of mutation events, mCurrentTooltip can be null.
return;
}
#endif
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm) {
@@ -516,16 +517,20 @@ nsXULTooltipListener::LaunchTooltip()
if (!pm->IsPopupOpen(mCurrentTooltip))
mCurrentTooltip = nsnull;
}
#endif
}
nsresult
nsXULTooltipListener::HideTooltip()
{
#ifdef MOZ_XUL
if (mCurrentTooltip) {
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm)
pm->HidePopup(mCurrentTooltip, PR_FALSE, PR_FALSE, PR_FALSE);
}
#endif
DestroyTooltip();
return NS_OK;