зеркало из https://github.com/mozilla/gecko-dev.git
Bug 941051, use one pixel sized instead of zero pixel sized anchor rectangles to prevent it from being treated as empty during intersection with screen test, fixes arrow panel placement issues, r=neil
This commit is contained in:
Родитель
1bad5627f5
Коммит
45b899f53b
|
@ -904,22 +904,22 @@ nsMenuPopupFrame::AdjustPositionForAnchorAlign(nsRect& anchorRect,
|
|||
case POPUPALIGNMENT_LEFTCENTER:
|
||||
pnt = nsPoint(anchorRect.x, anchorRect.y + anchorRect.height / 2);
|
||||
anchorRect.y = pnt.y;
|
||||
anchorRect.height = 0;
|
||||
anchorRect.height = 1;
|
||||
break;
|
||||
case POPUPALIGNMENT_RIGHTCENTER:
|
||||
pnt = nsPoint(anchorRect.XMost(), anchorRect.y + anchorRect.height / 2);
|
||||
anchorRect.y = pnt.y;
|
||||
anchorRect.height = 0;
|
||||
anchorRect.height = 1;
|
||||
break;
|
||||
case POPUPALIGNMENT_TOPCENTER:
|
||||
pnt = nsPoint(anchorRect.x + anchorRect.width / 2, anchorRect.y);
|
||||
anchorRect.x = pnt.x;
|
||||
anchorRect.width = 0;
|
||||
anchorRect.width = 1;
|
||||
break;
|
||||
case POPUPALIGNMENT_BOTTOMCENTER:
|
||||
pnt = nsPoint(anchorRect.x + anchorRect.width / 2, anchorRect.YMost());
|
||||
anchorRect.x = pnt.x;
|
||||
anchorRect.width = 0;
|
||||
anchorRect.width = 1;
|
||||
break;
|
||||
case POPUPALIGNMENT_TOPRIGHT:
|
||||
pnt = anchorRect.TopRight();
|
||||
|
|
|
@ -231,26 +231,26 @@ function checkPanelPosition(panel)
|
|||
case "top":
|
||||
adj = vwinpos + parseInt(getComputedStyle(panel, "").marginTop);
|
||||
if (iscentered)
|
||||
adj += anchorRect.height / 2;
|
||||
is(Math.round(panelRect.top), Math.round(anchorRect.top * zoomFactor + + adj), "anchored on top");
|
||||
adj += Math.round(anchorRect.height) / 2;
|
||||
isWithinHalfPixel(panelRect.top, anchorRect.top * zoomFactor + adj, "anchored on top");
|
||||
break;
|
||||
case "bottom":
|
||||
adj = vwinpos + parseInt(getComputedStyle(panel, "").marginBottom);
|
||||
if (iscentered)
|
||||
adj += anchorRect.height / 2;
|
||||
is(Math.round(panelRect.bottom), Math.round(anchorRect.bottom * zoomFactor + - adj), "anchored on bottom");
|
||||
adj += Math.round(anchorRect.height) / 2;
|
||||
isWithinHalfPixel(panelRect.bottom, anchorRect.bottom * zoomFactor - adj, "anchored on bottom");
|
||||
break;
|
||||
case "left":
|
||||
adj = hwinpos + parseInt(getComputedStyle(panel, "").marginLeft);
|
||||
if (iscentered)
|
||||
adj += anchorRect.width / 2;
|
||||
is(Math.round(panelRect.left), Math.round((anchorRect.left * zoomFactor + adj)), "anchored on left ");
|
||||
adj += Math.round(anchorRect.width) / 2;
|
||||
isWithinHalfPixel(panelRect.left, anchorRect.left * zoomFactor + adj, "anchored on left ");
|
||||
break;
|
||||
case "right":
|
||||
adj = hwinpos + parseInt(getComputedStyle(panel, "").marginRight);
|
||||
if (iscentered)
|
||||
adj += anchorRect.width / 2;
|
||||
is(Math.round(panelRect.right), Math.round(anchorRect.right * zoomFactor + - adj), "anchored on right");
|
||||
adj += Math.round(anchorRect.width) / 2;
|
||||
isWithinHalfPixel(panelRect.right, anchorRect.right * zoomFactor - adj, "anchored on right");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -265,6 +265,11 @@ function checkPanelPosition(panel)
|
|||
panel.hidePopup();
|
||||
}
|
||||
|
||||
function isWithinHalfPixel(a, b)
|
||||
{
|
||||
return Math.abs(a - b) <= 0.5;
|
||||
}
|
||||
|
||||
function checkBigPanel(panel)
|
||||
{
|
||||
ok(panel.firstChild.getBoundingClientRect().height < 2800, "big panel height");
|
||||
|
|
Загрузка…
Ссылка в новой задаче