Bug 1380294: Anchor non-tab tooltips to the correct remote browser. r?aswan
MozReview-Commit-ID: EsJEseyfGYi
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4492,30 +4492,29 @@ var XULBrowserWindow = {
if (gURLBar && gURLBar._mayTrimURLs /* corresponds to browser.urlbar.trimURLs */)
url = trimURL(url);
this.overLink = url;
LinkTargetDisplay.update();
},
- showTooltip(x, y, tooltip, direction) {
+ showTooltip(x, y, tooltip, direction, browser) {
if (Cc["@mozilla.org/widget/dragservice;1"].getService(Ci.nsIDragService).
getCurrentSession()) {
return;
}
// The x,y coordinates are relative to the <browser> element using
// the chrome zoom level.
let elt = document.getElementById("remoteBrowserTooltip");
elt.label = tooltip;
elt.style.direction = direction;
- let anchor = gBrowser.selectedBrowser;
- elt.openPopupAtScreen(anchor.boxObject.screenX + x, anchor.boxObject.screenY + y, false, null);
+ elt.openPopupAtScreen(browser.boxObject.screenX + x, browser.boxObject.screenY + y, false, null);
},
hideTooltip() {
let elt = document.getElementById("remoteBrowserTooltip");
elt.hidePopup();
},
getTabCount() {
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1713,17 +1713,21 @@ mozilla::ipc::IPCResult
TabParent::RecvShowTooltip(const uint32_t& aX, const uint32_t& aY, const nsString& aTooltip,
const nsString& aDirection)
{
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow = GetXULBrowserWindow();
if (!xulBrowserWindow) {
return IPC_OK();
}
- xulBrowserWindow->ShowTooltip(aX, aY, aTooltip, aDirection);
+ nsCOMPtr<nsIFrameLoaderOwner> frame = do_QueryInterface(mFrameElement);
+ if (!frame)
+ return IPC_OK();
+
+ xulBrowserWindow->ShowTooltip(aX, aY, aTooltip, aDirection, frame);
return IPC_OK();
}
mozilla::ipc::IPCResult
TabParent::RecvHideTooltip()
{
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow = GetXULBrowserWindow();
if (!xulBrowserWindow) {
--- a/xpfe/appshell/nsIXULBrowserWindow.idl
+++ b/xpfe/appshell/nsIXULBrowserWindow.idl
@@ -8,16 +8,17 @@
#include "nsIURI.idl"
#include "nsIDOMNode.idl"
interface nsIBrowser;
interface nsIRequest;
interface nsIDOMElement;
interface nsIInputStream;
interface nsIDocShell;
+interface nsIFrameLoaderOwner;
interface nsITabParent;
interface nsIPrincipal;
interface mozIDOMWindowProxy;
/**
* The nsIXULBrowserWindow supplies the methods that may be called from the
* internals of the browser area to tell the containing xul window to update
* its ui.
@@ -71,17 +72,18 @@ interface nsIXULBrowserWindow : nsISuppo
bool shouldLoadURI(in nsIDocShell aDocShell,
in nsIURI aURI,
in nsIURI aReferrer,
in boolean aHasPostData,
in nsIPrincipal aTriggeringPrincipal);
/**
* Show/hide a tooltip (when the user mouses over a link, say).
*/
- void showTooltip(in long x, in long y, in AString tooltip, in AString direction);
+ void showTooltip(in long x, in long y, in AString tooltip, in AString direction,
+ in nsIFrameLoaderOwner browser);
void hideTooltip();
/**
* Return the number of tabs in this window.
*/
uint32_t getTabCount();
/**