mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 549779 - nsMenuPopupFrame::AdjustPositionForAnchorAlign creates undefined nsRects. r=enn
This commit is contained in:
parent
c852a726d4
commit
a5e2bd79f9
@ -782,9 +782,6 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(const nsRect& anchorRect,
|
||||
// first, determine at which corner of the anchor the popup should appear
|
||||
nsPoint pnt;
|
||||
switch (popupAnchor) {
|
||||
case POPUPALIGNMENT_TOPLEFT:
|
||||
pnt = anchorRect.TopLeft();
|
||||
break;
|
||||
case POPUPALIGNMENT_TOPRIGHT:
|
||||
pnt = anchorRect.TopRight();
|
||||
break;
|
||||
@ -794,6 +791,10 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(const nsRect& anchorRect,
|
||||
case POPUPALIGNMENT_BOTTOMRIGHT:
|
||||
pnt = anchorRect.BottomRight();
|
||||
break;
|
||||
case POPUPALIGNMENT_TOPLEFT:
|
||||
default:
|
||||
pnt = anchorRect.TopLeft();
|
||||
break;
|
||||
}
|
||||
|
||||
// If the alignment is on the right edge of the popup, move the popup left
|
||||
@ -803,9 +804,6 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(const nsRect& anchorRect,
|
||||
nsMargin margin(0, 0, 0, 0);
|
||||
GetStyleMargin()->GetMargin(margin);
|
||||
switch (popupAlign) {
|
||||
case POPUPALIGNMENT_TOPLEFT:
|
||||
pnt.MoveBy(margin.left, margin.top);
|
||||
break;
|
||||
case POPUPALIGNMENT_TOPRIGHT:
|
||||
pnt.MoveBy(-mRect.width - margin.right, margin.top);
|
||||
break;
|
||||
@ -815,6 +813,10 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(const nsRect& anchorRect,
|
||||
case POPUPALIGNMENT_BOTTOMRIGHT:
|
||||
pnt.MoveBy(-mRect.width - margin.right, -mRect.height - margin.bottom);
|
||||
break;
|
||||
case POPUPALIGNMENT_TOPLEFT:
|
||||
default:
|
||||
pnt.MoveBy(margin.left, margin.top);
|
||||
break;
|
||||
}
|
||||
|
||||
// Flipping horizontally is allowed as long as the popup is above or below
|
||||
|
Loading…
Reference in New Issue
Block a user