Bug 374570, constrain popups to frame, r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@224799 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
enndeakin%sympatico.ca
2007-04-20 18:20:04 +00:00
parent 3b2a4fb8e4
commit 1f82e44d11
6 changed files with 85 additions and 50 deletions

View File

@@ -365,8 +365,6 @@ private:
nsresult GetPopupLinkNode(nsIDOMNode** aNode);
nsresult GetPopupImageNode(nsIImageLoadingContent** aNode);
void HideViewIfPopup(nsIView* aView);
void DumpContentToPPM(const char* aFileName);
void PrepareToStartLoad(void);
@@ -1261,40 +1259,10 @@ DocumentViewerImpl::PageHide(PRBool aIsUnload)
nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull, &status);
}
if (mPresShell) {
// look for open menupopups and close them after the unload event, in case
// the unload event listeners open any new popups
nsIViewManager *vm = mPresShell->GetViewManager();
if (vm) {
nsIView *rootView = nsnull;
vm->GetRootView(rootView);
if (rootView)
HideViewIfPopup(rootView);
}
}
return NS_OK;
}
void
DocumentViewerImpl::HideViewIfPopup(nsIView* aView)
{
nsIFrame* frame = NS_STATIC_CAST(nsIFrame*, aView->GetClientData());
if (frame) {
nsIMenuParent* parent;
CallQueryInterface(frame, &parent);
if (parent) {
parent->HideChain();
// really make sure the view is hidden
mViewManager->SetViewVisibility(aView, nsViewVisibility_kHide);
}
}
nsIView* child = aView->GetFirstChild();
while (child) {
HideViewIfPopup(child);
child = child->GetNextSibling();
}
// look for open menupopups and close them after the unload event, in case
// the unload event listeners open any new popups
if (mPresShell)
mPresShell->HidePopups();
}
static void