зеркало из https://github.com/mozilla/gecko-dev.git
Bug 874792 - Make adjustment sign consistent and use a transform for moving the arrow. r=Enn
This commit is contained in:
Родитель
09a84514ab
Коммит
1e6ad124bb
|
@ -1003,13 +1003,10 @@ nsMenuPopupFrame::SlideOrResize(nscoord& aScreenPoint, nscoord aSize,
|
|||
{
|
||||
// The popup may be positioned such that either the left/top or bottom/right
|
||||
// is outside the screen - but never both.
|
||||
if (aScreenPoint < aScreenBegin) {
|
||||
*aOffset = aScreenBegin - aScreenPoint;
|
||||
aScreenPoint = aScreenBegin;
|
||||
} else if (aScreenPoint + aSize > aScreenEnd) {
|
||||
*aOffset = aScreenPoint + aSize - aScreenEnd;
|
||||
aScreenPoint = std::max(aScreenEnd - aSize, 0);
|
||||
}
|
||||
nscoord newPos =
|
||||
std::max(aScreenBegin, std::min(aScreenEnd - aSize, aScreenPoint));
|
||||
*aOffset = newPos - aScreenPoint;
|
||||
aScreenPoint = newPos;
|
||||
return std::min(aSize, aScreenEnd - aScreenPoint);
|
||||
}
|
||||
|
||||
|
|
|
@ -380,17 +380,16 @@
|
|||
var position = this.alignmentPosition;
|
||||
var offset = this.alignmentOffset;
|
||||
// if this panel has a "sliding" arrow, we may have previously set margins...
|
||||
arrowbox.style.removeProperty("margin");
|
||||
arrowbox.style.removeProperty("transform");
|
||||
if (position.indexOf("start_") == 0 || position.indexOf("end_") == 0) {
|
||||
container.orient = "";
|
||||
arrowbox.orient = "vertical";
|
||||
if (position.indexOf("_after") > 0) {
|
||||
arrowbox.pack = "end";
|
||||
arrowbox.style.marginBottom = offset + "px";
|
||||
} else {
|
||||
arrowbox.pack = "start";
|
||||
arrowbox.style.marginTop = offset + "px";
|
||||
}
|
||||
arrowbox.style.transform = "translate(0, " + -offset + "px)";
|
||||
|
||||
// The assigned side stays the same regardless of direction.
|
||||
var isRTL = (window.getComputedStyle(this).direction == "rtl");
|
||||
|
@ -409,11 +408,10 @@
|
|||
arrowbox.orient = "";
|
||||
if (position.indexOf("_end") > 0) {
|
||||
arrowbox.pack = "end";
|
||||
arrowbox.style.marginRight = this.alignmentOffset + "px";
|
||||
} else {
|
||||
arrowbox.pack = "start";
|
||||
arrowbox.style.marginLeft = this.alignmentOffset + "px";
|
||||
}
|
||||
arrowbox.style.transform = "translate(" + -offset + "px, 0)";
|
||||
|
||||
if (position.indexOf("before_") == 0) {
|
||||
container.dir = "reverse";
|
||||
|
|
Загрузка…
Ссылка в новой задаче