зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578008 - Make promiseRDMZoom more simple and reliable. r=bradwerth
Now that we no longer have the various resolution shenanigans, we really just want to ensure that child processes observe the resize of the <browser> element, which can happen just fine if we ensure to flush layout. Differential Revision: https://phabricator.services.mozilla.com/D72552
This commit is contained in:
Родитель
9a9ab94bc2
Коммит
72d224913c
|
@ -93,4 +93,3 @@ tags = devtools geolocation
|
|||
[browser_viewport_zoom_toggle.js]
|
||||
[browser_window_close.js]
|
||||
[browser_window_sizing.js]
|
||||
skip-if = (os == 'linux' && bits == 64) || (os == 'mac') #Bug 1578008
|
||||
|
|
|
@ -924,22 +924,22 @@ function promiseContentReflow(ui) {
|
|||
// This function returns a promise that will be resolved when the
|
||||
// RDM zoom has been set and the content has finished rescaling
|
||||
// to the new size.
|
||||
function promiseRDMZoom(ui, browser, zoom) {
|
||||
return new Promise(resolve => {
|
||||
const currentZoom = ZoomManager.getZoomForBrowser(browser);
|
||||
if (currentZoom.toFixed(2) == zoom.toFixed(2)) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
async function promiseRDMZoom(ui, browser, zoom) {
|
||||
const currentZoom = ZoomManager.getZoomForBrowser(browser);
|
||||
if (currentZoom.toFixed(2) == zoom.toFixed(2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const zoomComplete = BrowserTestUtils.waitForEvent(
|
||||
browser,
|
||||
"FullZoomResolutionStable"
|
||||
);
|
||||
ZoomManager.setZoomForBrowser(browser, zoom);
|
||||
const width = browser.getBoundingClientRect().width;
|
||||
|
||||
// Await the zoom complete event, then reflow.
|
||||
zoomComplete.then(promiseContentReflow(ui)).then(resolve);
|
||||
ZoomManager.setZoomForBrowser(browser, zoom);
|
||||
|
||||
// RDM resizes the browser as a result of a zoom change, so we wait for that.
|
||||
//
|
||||
// This also has the side effect of updating layout which ensures that any
|
||||
// remote frame dimension update message gets there in time.
|
||||
await BrowserTestUtils.waitForCondition(function() {
|
||||
return browser.getBoundingClientRect().width != width;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче