Bug 1343507 - Search settings button moves to its own line with 150% zoom follow-up. r?florian
MozReview-Commit-ID: LGSiMzW6AT9
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1560,28 +1560,29 @@
this.settingsButton.setAttribute("width", buttonWidth);
if (rowCount == 1 && hasDummyItems) {
// When there's only one row, make the compact settings button
// hug the right edge of the panel. It may not due to the panel's
// width not being an integral multiple of the button width. (See
// the "There will be an emtpy area" comment above.) Increase the
// width of the last dummy item by the remainder.
//
- // There's one weird thing to guard against. When layout pixels
- // aren't an integral multiple of device pixels, the calculated
- // remainder can end up being ~1px too big, at least on Windows,
- // which pushes the settings button to a new row. The remainder
- // is integral, not a fraction, so that's not the problem. To
- // work around that, unscale the remainder, floor it, scale it
- // back, and then floor that.
+ // There's one weird thing to guard against: when layout pixels
+ // aren't an integral multiple of device pixels, the settings
+ // button sometimes gets pushed to a new row, depending on the
+ // panel and button widths. It's as if `remainder` is somehow
+ // too big, even though it's an integer. To work around that,
+ // decrement the remainder if the scale is not an integer.
let scale = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.screenPixelsPerCSSPixel;
let remainder = panelWidth - (enginesPerRow * buttonWidth);
- remainder = Math.floor(Math.floor(remainder * scale) / scale);
+ if (Math.floor(scale) != scale) {
+ remainder--;
+ }
let width = remainder + buttonWidth;
let lastDummyItem = this.settingsButton.previousSibling;
lastDummyItem.setAttribute("width", width);
}
}
]]></body>
</method>