зеркало из https://github.com/mozilla/pjs.git
Fix for bug 26452, context menus flashing in upper right corner of window. Wait until the very last moment before we set the menuactive attribute which causes the view to display. Also some minor cleanup. r=hyatt.
This commit is contained in:
Родитель
81c859dad9
Коммит
7903c3f754
|
@ -674,9 +674,8 @@ nsMenuFrame::Reflow(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (popupChild)
|
||||
{
|
||||
|
||||
// Handle reflowing our subordinate popup
|
||||
if (popupChild) {
|
||||
// Constrain the child's width and height to aAvailableWidth and aAvailableHeight
|
||||
nsSize availSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, popupChild,
|
||||
|
@ -690,16 +689,13 @@ nsMenuFrame::Reflow(nsIPresContext* aPresContext,
|
|||
nsresult rv = ReflowChild(popupChild, aPresContext, kidDesiredSize, kidReflowState,
|
||||
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW, aStatus);
|
||||
|
||||
// Set the child's width and height to its desired size
|
||||
// Note: don't position or size the view now, we'll do that in the
|
||||
// DidReflow() function
|
||||
popupChild->SizeTo(aPresContext, kidDesiredSize.width, kidDesiredSize.height);
|
||||
popupChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
||||
// Set the child's width and height to its desired size
|
||||
// Note: don't position or size the view now, we'll do that in the
|
||||
// DidReflow() function
|
||||
FinishReflowChild(popupChild, aPresContext, kidDesiredSize, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW);
|
||||
}
|
||||
|
||||
nsresult rv = nsBoxFrame::Reflow(aPresContext, aDesiredSize, boxState, aStatus);
|
||||
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -465,29 +465,16 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
|||
viewManager->MoveViewTo(view, xpos, ypos);
|
||||
viewManager->ResizeView(view, mRect.width, mRect.height);
|
||||
|
||||
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);
|
||||
#if 0
|
||||
if ((! viewWasVisible) && viewIsVisible) {
|
||||
view->SetVisibility(nsViewVisibility_kShow);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuPopupFrame::DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus)
|
||||
{
|
||||
return nsFrame::DidReflow(aPresContext, aStatus);
|
||||
|
||||
/*
|
||||
// Copied from nsContainerFrame reflow WITHOUT the call
|
||||
// nsFrame::DidReflow(). nsFrame::DidReflow() will move us to the
|
||||
// wrong place.
|
||||
nsresult result = NS_OK; /* = nsFrame::DidReflow(aPresContext, aStatus)
|
||||
|
||||
NS_FRAME_TRACE_OUT("nsContainerFrame::DidReflow");
|
||||
return result;
|
||||
*/
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuPopupFrame::GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult)
|
||||
|
|
|
@ -84,9 +84,6 @@ public:
|
|||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
|
|
@ -238,6 +238,7 @@ nsPopupSetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// Handle reflowing our subordinate popup
|
||||
if (popupChild) {
|
||||
// Constrain the child's width and height to aAvailableWidth and aAvailableHeight
|
||||
nsSize availSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
@ -440,8 +441,6 @@ void
|
|||
nsPopupSetFrame::OpenPopup(PRBool aActivateFlag)
|
||||
{
|
||||
if (aActivateFlag) {
|
||||
ActivatePopup(PR_TRUE);
|
||||
|
||||
nsIFrame* activeChild = GetActiveChild();
|
||||
|
||||
nsCOMPtr<nsIMenuParent> childPopup = do_QueryInterface(activeChild);
|
||||
|
|
Загрузка…
Ссылка в новой задаче