From a5e2bd79f9e3eada0b63d7f18c3183fcd1f876b2 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 11 Mar 2010 07:42:20 +0100 Subject: [PATCH] Bug 549779 - nsMenuPopupFrame::AdjustPositionForAnchorAlign creates undefined nsRects. r=enn --- layout/xul/base/src/nsMenuPopupFrame.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index fe02db3a7982..fdd8e2753261 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -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