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:
Emilio Cobos Álvarez 2020-04-29 21:44:05 +00:00
Родитель 0169492da2
Коммит 94e88b71b3
2 изменённых файлов: 14 добавлений и 15 удалений

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

@ -93,4 +93,3 @@ tags = devtools geolocation
[browser_viewport_zoom_toggle.js] [browser_viewport_zoom_toggle.js]
[browser_window_close.js] [browser_window_close.js]
[browser_window_sizing.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 // This function returns a promise that will be resolved when the
// RDM zoom has been set and the content has finished rescaling // RDM zoom has been set and the content has finished rescaling
// to the new size. // to the new size.
function promiseRDMZoom(ui, browser, zoom) { async function promiseRDMZoom(ui, browser, zoom) {
return new Promise(resolve => { const currentZoom = ZoomManager.getZoomForBrowser(browser);
const currentZoom = ZoomManager.getZoomForBrowser(browser); if (currentZoom.toFixed(2) == zoom.toFixed(2)) {
if (currentZoom.toFixed(2) == zoom.toFixed(2)) { return;
resolve(); }
return;
}
const zoomComplete = BrowserTestUtils.waitForEvent( const width = browser.getBoundingClientRect().width;
browser,
"FullZoomResolutionStable"
);
ZoomManager.setZoomForBrowser(browser, zoom);
// Await the zoom complete event, then reflow. ZoomManager.setZoomForBrowser(browser, zoom);
zoomComplete.then(promiseContentReflow(ui)).then(resolve);
// 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;
}); });
} }