Bug 1200870, allow -1 as a value to popup.moveTo, r=tn

This commit is contained in:
Neil Deakin 2015-10-09 08:50:13 -04:00
parent 8ef8035706
commit a589e2d932
2 changed files with 9 additions and 5 deletions

View File

@ -2183,8 +2183,7 @@ nsMenuPopupFrame::MoveTo(const CSSIntPoint& aPos, bool aUpdateAttrs)
}
nsPresContext* presContext = PresContext();
mAnchorType = aPos.x == -1 || aPos.y == -1 ?
MenuPopupAnchorType_Node : MenuPopupAnchorType_Point;
mAnchorType = MenuPopupAnchorType_Point;
mScreenRect.x = aPos.x - presContext->AppUnitsToIntCSSPixels(margin.left);
mScreenRect.y = aPos.y - presContext->AppUnitsToIntCSSPixels(margin.top);

View File

@ -376,9 +376,14 @@ function testPopupMovement()
popup.moveTo(-1, -1);
[screenX, screenY] = getScreenXY(popup);
[buttonScreenX, buttonScreenY] = getScreenXY(button);
is(screenX, buttonScreenX, gTests[gTestIndex] + " original x");
is(screenY, buttonScreenY + Math.round(button.getBoundingClientRect().height), gTests[gTestIndex] + " original y");
expectedx = (overlapOSChrome ? screen.left : screen.availLeft);
expectedy = (overlapOSChrome ? screen.top : screen.availTop);
is(screenX, expectedx, gTests[gTestIndex] + " move after set left and top x to -1");
is(screenY, expectedy, gTests[gTestIndex] + " move after set left and top y to -1");
is(popup.left, "", gTests[gTestIndex] + " left is not set after moving to -1");
is(popup.top, "", gTests[gTestIndex] + " top is not set after moving to -1");
popup.hidePopup();
}