зеркало из https://github.com/mozilla/pjs.git
Bug 575328 - Fix for search suggestions box appears on wrong monitor in multiple monitor environment when window is maximized. r=enndeakin.
This commit is contained in:
Родитель
332e0bc938
Коммит
184e83f7d3
|
@ -1157,7 +1157,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove)
|
|||
hFlip = vFlip = PR_FALSE;
|
||||
}
|
||||
|
||||
nsRect screenRect = GetConstraintRect(anchorRect.TopLeft(), rootScreenRect);
|
||||
nsRect screenRect = GetConstraintRect(anchorRect, rootScreenRect);
|
||||
|
||||
// ensure that anchorRect is on screen
|
||||
if (!anchorRect.IntersectRect(anchorRect, screenRect)) {
|
||||
|
@ -1235,7 +1235,8 @@ nsMenuPopupFrame::GetCurrentMenuItem()
|
|||
}
|
||||
|
||||
nsRect
|
||||
nsMenuPopupFrame::GetConstraintRect(nsPoint aAnchorPoint, nsRect& aRootScreenRect)
|
||||
nsMenuPopupFrame::GetConstraintRect(const nsRect& aAnchorRect,
|
||||
const nsRect& aRootScreenRect)
|
||||
{
|
||||
nsIntRect screenRectPixels;
|
||||
nsPresContext* presContext = PresContext();
|
||||
|
@ -1250,10 +1251,12 @@ nsMenuPopupFrame::GetConstraintRect(nsPoint aAnchorPoint, nsRect& aRootScreenRec
|
|||
// This is because we need to constrain the content to this content area,
|
||||
// so we should use the same screen. Otherwise, use the screen where the
|
||||
// anchor is located.
|
||||
nsPoint pnt = mInContentShell ? aRootScreenRect.TopLeft() : aAnchorPoint;
|
||||
sm->ScreenForRect(presContext->AppUnitsToDevPixels(pnt.x),
|
||||
presContext->AppUnitsToDevPixels(pnt.y),
|
||||
1, 1, getter_AddRefs(screen));
|
||||
nsRect rect = mInContentShell ? aRootScreenRect : aAnchorRect;
|
||||
PRInt32 width = rect.width > 0 ? presContext->AppUnitsToDevPixels(rect.width) : 1;
|
||||
PRInt32 height = rect.height > 0 ? presContext->AppUnitsToDevPixels(rect.height) : 1;
|
||||
sm->ScreenForRect(presContext->AppUnitsToDevPixels(rect.x),
|
||||
presContext->AppUnitsToDevPixels(rect.y),
|
||||
width, height, getter_AddRefs(screen));
|
||||
if (screen) {
|
||||
// get the total screen area if the popup is allowed to overlap it.
|
||||
if (mMenuCanOverlapOSBar && !mInContentShell)
|
||||
|
|
|
@ -293,12 +293,12 @@ public:
|
|||
|
||||
nsIScrollableFrame* GetScrollFrame(nsIFrame* aStart);
|
||||
|
||||
// For a popup that should appear at the given anchor point, determine
|
||||
// For a popup that should appear anchored at the given rect, determine
|
||||
// the screen area that it is constrained by. This will be the available
|
||||
// area of the screen the popup should be displayed on. Content popups,
|
||||
// however, will also be constrained by the content area, given by
|
||||
// aRootScreenRect. All coordinates are in app units.
|
||||
nsRect GetConstraintRect(nsPoint aAnchorPoint, nsRect& aRootScreenRect);
|
||||
nsRect GetConstraintRect(const nsRect& aAnchorRect, const nsRect& aRootScreenRect);
|
||||
|
||||
// Determines whether the given edges of the popup may be moved, where
|
||||
// aHorizontalSide and aVerticalSide are one of the NS_SIDE_* constants, or
|
||||
|
|
|
@ -227,11 +227,11 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
else if (menuPopupFrame) {
|
||||
nsPoint framePoint = menuPopupFrame->GetScreenRectInAppUnits().TopLeft();
|
||||
nsRect frameRect = menuPopupFrame->GetScreenRectInAppUnits();
|
||||
nsIFrame* rootFrame = aPresContext->PresShell()->FrameManager()->GetRootFrame();
|
||||
nsRect rootScreenRect = rootFrame->GetScreenRectInAppUnits();
|
||||
|
||||
nsRect screenRect = menuPopupFrame->GetConstraintRect(framePoint, rootScreenRect);
|
||||
nsRect screenRect = menuPopupFrame->GetConstraintRect(frameRect, rootScreenRect);
|
||||
// round using ToInsidePixels as it's better to be a pixel too small
|
||||
// than be too large. If the popup is too large it could get flipped
|
||||
// to the opposite side of the anchor point while resizing.
|
||||
|
|
Загрузка…
Ссылка в новой задаче