From 861015cb4449619681bfda2b6135110588666f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Tue, 30 Apr 2019 15:03:21 +0000 Subject: [PATCH] Bug 1544030 - Fix quantumbar popup's vertical borders and position on Mac once again. r=mak Differential Revision: https://phabricator.services.mozilla.com/D29340 --HG-- extra : moz-landing-system : lando --- browser/components/urlbar/UrlbarView.jsm | 13 ++++++++++--- browser/themes/osx/browser.css | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/browser/components/urlbar/UrlbarView.jsm b/browser/components/urlbar/UrlbarView.jsm index a727a90764ef..b1be388d8b6f 100644 --- a/browser/components/urlbar/UrlbarView.jsm +++ b/browser/components/urlbar/UrlbarView.jsm @@ -12,6 +12,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm", UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm", UrlbarUtils: "resource:///modules/UrlbarUtils.jsm", + AppConstants: "resource://gre/modules/AppConstants.jsm", }); XPCOMUtils.defineLazyGetter(this, "bundle", function() { @@ -371,10 +372,16 @@ class UrlbarView { // Align the panel with the input's parent toolbar. let toolbarRect = this._getBoundsWithoutFlushing(this.input.textbox.closest("toolbar")); - this.panel.style.marginInlineStart = px(this.window.RTL_UI ? + let horizontalOffset = this.window.RTL_UI ? inputRect.right - documentRect.right : - documentRect.left - inputRect.left); - this.panel.style.marginTop = px(inputRect.top - toolbarRect.top); + documentRect.left - inputRect.left; + let verticalOffset = inputRect.top - toolbarRect.top; + if (AppConstants.platform == "macosx") { + // Adjust vertical offset to account for the popup's native outer border. + verticalOffset++; + } + this.panel.style.marginInlineStart = px(horizontalOffset); + this.panel.style.marginTop = px(verticalOffset); this.panel.openPopup(this.input.textbox, "after_start"); } diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index f2b77568dfd9..ff2824810d6d 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -336,6 +336,12 @@ html|input.urlbar-input { --urlbar-popup-action-color: hsl(178, 100%, 28%); } +/* Remove our custom border since we already get a native one that we can't + * seem to override. */ +#urlbar-results { + border-style: none; +} + /* Give an extra margin top to align the top of the awesomebar with the * bottom of the nav bar, OSX calculates the panel position with an missing * 1px - https://bugzilla.mozilla.org/show_bug.cgi?id=1406353