mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 788189. Account for the context menu offset in the stored position of a context menu popup so that we don't end up in an infinite loop continually adding the context menu offset. r=enndeakin
This commit is contained in:
parent
e1e7eeb89e
commit
bd2c842580
@ -1201,7 +1201,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove)
|
||||
// context menu close up again.
|
||||
if (mAdjustOffsetForContextMenu) {
|
||||
int32_t offsetForContextMenuDev =
|
||||
nsPresContext::CSSPixelsToAppUnits(2) / factor;
|
||||
nsPresContext::CSSPixelsToAppUnits(CONTEXT_MENU_OFFSET_PIXELS) / factor;
|
||||
offsetForContextMenu = presContext->DevPixelsToAppUnits(offsetForContextMenuDev);
|
||||
}
|
||||
|
||||
@ -1846,6 +1846,15 @@ nsMenuPopupFrame::MoveTo(int32_t aLeft, int32_t aTop, bool aUpdateAttrs)
|
||||
// added to the position when SetPopupPosition is called.
|
||||
nsMargin margin(0, 0, 0, 0);
|
||||
GetStyleMargin()->GetMargin(margin);
|
||||
|
||||
// Workaround for bug 788189. See also bug 708278 comment #25 and following.
|
||||
if (mAdjustOffsetForContextMenu) {
|
||||
nscoord offsetForContextMenu =
|
||||
nsPresContext::CSSPixelsToAppUnits(CONTEXT_MENU_OFFSET_PIXELS);
|
||||
margin.left += offsetForContextMenu;
|
||||
margin.top += offsetForContextMenu;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
mScreenXPos = aLeft - presContext->AppUnitsToIntCSSPixels(margin.left);
|
||||
mScreenYPos = aTop - presContext->AppUnitsToIntCSSPixels(margin.top);
|
||||
|
@ -87,6 +87,8 @@ enum FlipStyle {
|
||||
// need to find a good place to put them together.
|
||||
// if someone changes one, please also change the other.
|
||||
|
||||
#define CONTEXT_MENU_OFFSET_PIXELS 2
|
||||
|
||||
nsIFrame* NS_NewMenuPopupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
|
||||
class nsIViewManager;
|
||||
|
Loading…
Reference in New Issue
Block a user