popupMenu: do height-for-width negotiation

https://bugzilla.gnome.org/show_bug.cgi?id=652837
This commit is contained in:
Dan Winship 2011-08-22 14:29:22 -04:00
parent 4f22c61b16
commit caade78e79

View File

@ -214,7 +214,7 @@ PopupBaseMenuItem.prototype = {
let child = this._children[i]; let child = this._children[i];
if (i > 0) if (i > 0)
width += this._spacing; width += this._spacing;
let [min, natural] = child.actor.get_preferred_width(forHeight); let [min, natural] = child.actor.get_preferred_width(-1);
width += natural; width += natural;
} }
} }
@ -225,7 +225,7 @@ PopupBaseMenuItem.prototype = {
let height = 0; let height = 0;
for (let i = 0; i < this._children.length; i++) { for (let i = 0; i < this._children.length; i++) {
let child = this._children[i]; let child = this._children[i];
let [min, natural] = child.actor.get_preferred_height(-1); let [min, natural] = child.actor.get_preferred_height(forWidth);
if (natural > height) if (natural > height)
height = natural; height = natural;
} }
@ -319,7 +319,7 @@ PopupBaseMenuItem.prototype = {
} }
} }
let [minHeight, naturalHeight] = child.actor.get_preferred_height(-1); let [minHeight, naturalHeight] = child.actor.get_preferred_height(childBox.x2 - childBox.x1);
childBox.y1 = Math.round(box.y1 + (height - naturalHeight) / 2); childBox.y1 = Math.round(box.y1 + (height - naturalHeight) / 2);
childBox.y2 = childBox.y1 + naturalHeight; childBox.y2 = childBox.y1 + naturalHeight;