Bug 966241, revert some of bug 941051 and just use Intersect instead of IntersectRect, r=neil

This commit is contained in:
Neil Deakin 2014-02-06 20:08:31 -05:00
parent 9121a1f1c7
commit 2e3a80c115

View File

@ -911,22 +911,22 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(nsRect& anchorRect,
case POPUPALIGNMENT_LEFTCENTER:
pnt = nsPoint(anchorRect.x, anchorRect.y + anchorRect.height / 2);
anchorRect.y = pnt.y;
anchorRect.height = 1;
anchorRect.height = 0;
break;
case POPUPALIGNMENT_RIGHTCENTER:
pnt = nsPoint(anchorRect.XMost(), anchorRect.y + anchorRect.height / 2);
anchorRect.y = pnt.y;
anchorRect.height = 1;
anchorRect.height = 0;
break;
case POPUPALIGNMENT_TOPCENTER:
pnt = nsPoint(anchorRect.x + anchorRect.width / 2, anchorRect.y);
anchorRect.x = pnt.x;
anchorRect.width = 1;
anchorRect.width = 0;
break;
case POPUPALIGNMENT_BOTTOMCENTER:
pnt = nsPoint(anchorRect.x + anchorRect.width / 2, anchorRect.YMost());
anchorRect.x = pnt.x;
anchorRect.width = 1;
anchorRect.width = 0;
break;
case POPUPALIGNMENT_TOPRIGHT:
pnt = anchorRect.TopRight();
@ -1281,19 +1281,8 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove, bool aS
if (mInContentShell || (mFlip != FlipType_None && (!aIsMove || mPopupType != ePopupTypePanel))) {
nsRect screenRect = GetConstraintRect(anchorRect, rootScreenRect);
// ensure that anchorRect is on screen
if (!anchorRect.IntersectRect(anchorRect, screenRect)) {
anchorRect.width = anchorRect.height = 0;
// if the anchor isn't within the screen, move it to the edge of the screen.
if (anchorRect.x < screenRect.x)
anchorRect.x = screenRect.x;
if (anchorRect.XMost() > screenRect.XMost())
anchorRect.x = screenRect.XMost();
if (anchorRect.y < screenRect.y)
anchorRect.y = screenRect.y;
if (anchorRect.YMost() > screenRect.YMost())
anchorRect.y = screenRect.YMost();
}
// Ensure that anchorRect is on screen.
anchorRect = anchorRect.Intersect(screenRect);
// shrink the the popup down if it is larger than the screen size
if (mRect.width > screenRect.width)