Bug 1390445 - Fix select popup positioning for oop extensions options_ui pages. r=billm,kats,kmag

MozReview-Commit-ID: Izt10SuUK0i

--HG--
extra : rebase_source : d6e302d4fd8b78100d98cbe52c4234bd49de1dfd
This commit is contained in:
Luca Greco 2017-09-20 20:03:58 +02:00
Родитель 65ca393243
Коммит 305df319dc
5 изменённых файлов: 41 добавлений и 2 удалений

Просмотреть файл

@ -3795,6 +3795,18 @@ nsFrameLoader::RequestFrameLoaderClose()
return browser->CloseBrowser();
}
void
nsFrameLoader::RequestUpdatePosition(ErrorResult& aRv)
{
if (auto* tabParent = TabParent::GetFrom(GetRemoteBrowser())) {
nsresult rv = tabParent->UpdatePosition();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
}
void
nsFrameLoader::Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,

Просмотреть файл

@ -165,6 +165,8 @@ public:
void RequestFrameLoaderClose(mozilla::ErrorResult& aRv);
void RequestUpdatePosition(mozilla::ErrorResult& aRv);
void Print(uint64_t aOuterWindowID,
nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aProgressListener,

Просмотреть файл

@ -354,6 +354,8 @@ public:
DimensionInfo GetDimensionInfo();
nsresult UpdatePosition();
void SizeModeChanged(const nsSizeMode& aSizeMode);
void UIResolutionChanged();
@ -669,8 +671,6 @@ private:
RefPtr<nsIContentParent> mManager;
void TryCacheDPIAndScale();
nsresult UpdatePosition();
bool AsyncPanZoomEnabled() const;
// Cached value indicating the docshell active state of the remote browser.

Просмотреть файл

@ -161,6 +161,12 @@ interface FrameLoader {
[Throws]
void requestFrameLoaderClose();
/**
* Force a remote browser to recompute its dimension and screen position.
*/
[Throws]
void requestUpdatePosition();
/**
* Print the current document.
*

Просмотреть файл

@ -13,6 +13,7 @@ var Ci = Components.interfaces;
var Cu = Components.utils;
var Cr = Components.results;
Cu.import("resource://gre/modules/DeferredTask.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DownloadUtils.jsm");
@ -4151,3 +4152,21 @@ var gBrowser = {
return null;
}
};
// Force the options_ui remote browser to recompute window.mozInnerScreenX and
// window.mozInnerScreenY when the "addon details" page has been scrolled
// (See Bug 1390445 for rationale).
{
const UPDATE_POSITION_DELAY = 100;
const updatePositionTask = new DeferredTask(() => {
const browser = document.getElementById("addon-options");
if (browser && browser.isRemoteBrowser) {
browser.frameLoader.requestUpdatePosition();
}
}, UPDATE_POSITION_DELAY);
window.addEventListener("scroll", () => {
updatePositionTask.arm();
}, true);
}