bug 622507 - snap popup menu's view position to device pixels. r+a=roc
authorJonathan Kew <jfkthame@gmail.com>
Mon, 21 Feb 2011 08:52:42 +0000
changeset 62895 338a48d9f6033fa5a3e7ed38ed9210e048472462
parent 62894 2ce0aeb5929caa71342cc26c55cb37aec0bae7f0
child 62896 7019dd8625a8e49013865d95450565de6897a8df
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
bugs622507
milestone2.0b12pre
bug 622507 - snap popup menu's view position to device pixels. r+a=roc
layout/xul/base/src/nsMenuPopupFrame.cpp
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -1276,16 +1276,21 @@ nsMenuPopupFrame::SetPopupPosition(nsIFr
   NS_ASSERTION(screenPoint.x >= screenRect.x && screenPoint.y >= screenRect.y &&
                screenPoint.x + mRect.width <= screenRect.XMost() &&
                screenPoint.y + mRect.height <= screenRect.YMost(),
                "Popup is offscreen");
 
   // determine the x and y position of the view by subtracting the desired
   // screen position from the screen position of the root frame.
   nsPoint viewPoint = screenPoint - rootScreenRect.TopLeft();
+
+  // snap the view's position to device pixels, see bug 622507
+  viewPoint.x = presContext->RoundAppUnitsToNearestDevPixels(viewPoint.x);
+  viewPoint.y = presContext->RoundAppUnitsToNearestDevPixels(viewPoint.y);
+
   nsIView* view = GetView();
   NS_ASSERTION(view, "popup with no view");
   presContext->GetPresShell()->GetViewManager()->
     MoveViewTo(view, viewPoint.x, viewPoint.y);
 
   // Offset the position by the width and height of the borders and titlebar.
   // Even though GetClientOffset should return (0, 0) when there is no
   // titlebar or borders, we skip these calculations anyway for non-panels