Backed out 8 changesets (bug 1561227) for causing browser_viewport_resizing_scrollbar.js to permafail CLOSED TREE

Backed out changeset aa00b1b62ea7 (bug 1561227)
Backed out changeset b22440a67078 (bug 1561227)
Backed out changeset 4776cec83ae8 (bug 1561227)
Backed out changeset ac88bbefb95f (bug 1561227)
Backed out changeset aef3cfa2f539 (bug 1561227)
Backed out changeset a3759e1a04e2 (bug 1561227)
Backed out changeset cfcf79794049 (bug 1561227)
Backed out changeset 97be65338edf (bug 1561227)

--HG--
rename : devtools/client/responsive/test/browser/browser_viewport_zoom_toggle.js => devtools/client/responsive/test/browser/browser_toggle_zoom.js
This commit is contained in:
Ciure Andrei 2019-10-26 00:00:48 +03:00
Родитель c088fd2a96
Коммит 706c89437b
10 изменённых файлов: 22 добавлений и 191 удалений

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

@ -28,9 +28,6 @@ var global = this;
addMessageListener("ResponsiveMode:Stop", stopResponsiveMode);
addMessageListener("ResponsiveMode:IsActive", isActive);
// Track the resolution and re-apply it after a full zoom change.
let resolutionBeforeFullZoom = 0;
function debug(msg) {
// dump(`RDM CHILD: ${msg}\n`);
}
@ -63,16 +60,6 @@ var global = this;
startOnResize();
}
addEventListener("PreFullZoomChange", onPreFullZoomChange);
addEventListener(
"mozupdatedremoteframedimensions",
onUpdatedRemoteFrameDimensions,
{
capture: true,
mozSystemGroup: true,
}
);
// At this point, a content viewer might not be loaded for this
// docshell. setDocumentInRDMPane and makeScrollbarsFloating will be
// triggered by onLocationChange.
@ -84,20 +71,6 @@ var global = this;
sendAsyncMessage("ResponsiveMode:Start:Done");
}
function onPreFullZoomChange(event) {
if (event.originalTarget == content.document) {
resolutionBeforeFullZoom = content.windowUtils.getResolution();
}
}
function onUpdatedRemoteFrameDimensions(event) {
if (event.originalTarget == content.document) {
content.windowUtils.setResolutionAndScaleTo(resolutionBeforeFullZoom);
const e = new CustomEvent("ZoomComplete", { bubbles: true });
content.dispatchEvent(e);
}
}
function onResize() {
// Send both a content-resize event and a viewport-resize event, since both
// may have changed.
@ -163,11 +136,6 @@ var global = this;
restoreScrollbars();
setDocumentInRDMPane(false);
stopOnResize();
removeEventListener("PreFullZoomChange", onPreFullZoomChange);
removeEventListener(
"mozupdatedremoteframedimensions",
onUpdatedRemoteFrameDimensions
);
sendAsyncMessage("ResponsiveMode:Stop:Done");
}

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

@ -72,6 +72,7 @@ skip-if = fission
fail-if = fission #Bug 1585437
[browser_target_blank.js]
[browser_telemetry_activate_rdm.js]
[browser_toggle_zoom.js]
[browser_toolbox_computed_view.js]
[browser_toolbox_rule_view.js]
[browser_toolbox_rule_view_reload.js]
@ -92,8 +93,6 @@ fail-if = true # Bug 1547783
[browser_viewport_resizing_fixed_width_and_zoom.js]
[browser_viewport_resizing_minimum_scale.js]
[browser_viewport_resizing_scrollbar.js]
[browser_viewport_zoom_resolution_invariant.js]
[browser_viewport_zoom_toggle.js]
skip-if = fission && debug # Crashes: @ xpc::WrapperFactory::PrepareForWrapping(JSContext*, JS::Handle<JSObject*>, JS::Handle<JSObject*>, JS::Handle<JSObject*>, JS::MutableHandle<JSObject*>)
fail-if = true # Bug 1547101
[browser_window_close.js]

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

@ -87,7 +87,7 @@ addRDMTask(TEST_URL, async function({ ui, manager }) {
// Get to the initial size and snapshot the window.
await setViewportSize(ui, manager, 300, 600);
const initialSnapshot = await snapshotWindow(browser.contentWindow);
const initialSnapshot = snapshotWindow(browser.contentWindow);
// Move to the rotated size.
await setViewportSize(ui, manager, 600, 300);
@ -99,7 +99,7 @@ addRDMTask(TEST_URL, async function({ ui, manager }) {
// Go back to the initial size and take another snapshot.
await setViewportSize(ui, manager, 300, 600);
const finalSnapshot = await snapshotWindow(browser.contentWindow);
const finalSnapshot = snapshotWindow(browser.contentWindow);
const result = compareSnapshots(initialSnapshot, finalSnapshot, true);
is(result[2], result[1], "Window snapshots should match.");

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

@ -1,95 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that resolution is as expected for different types of meta viewport
// settings, as the RDM pane is zoomed to different values.
add_task(async function() {
// Turn on the pref that allows meta viewport support.
await SpecialPowers.pushPrefEnv({
set: [["devtools.responsive.metaViewport.enabled", true]],
});
const RESOLUTION_FACTOR_MIN = 0.96;
const RESOLUTION_FACTOR_MAX = 1.04;
const ZOOM_LEVELS = [
0.3,
0.5,
0.67,
0.8,
0.9,
1.0,
1.1,
1.2,
1.33,
1.5,
1.7,
2.0,
2.4,
3.0,
];
info("--- Starting viewport test output ---");
const WIDTH = 200;
const HEIGHT = 200;
const TESTS = [
{ content: "width=600", res_target: 0.333 },
{ content: "width=600, initial-scale=1.0", res_target: 1.0 },
{ content: "width=device-width", res_target: 1.0 },
{ content: "width=device-width, initial-scale=2.0", res_target: 2.0 },
];
for (const { content, res_target } of TESTS) {
info(`Using meta viewport content "${content}".`);
const TEST_URL =
`data:text/html;charset=utf-8,` +
`<html><head><meta name="viewport" content="${content}"></head>` +
`<body><div style="width:100%;background-color:green">${content}</div>` +
`</body></html>`;
const tab = await addTab(TEST_URL);
const browser = tab.linkedBrowser;
const { ui, manager } = await openRDM(tab);
const store = ui.toolWindow.store;
// Wait until the viewport has been added.
await waitUntilState(store, state => state.viewports.length == 1);
await setViewportSize(ui, manager, WIDTH, HEIGHT);
await setTouchAndMetaViewportSupport(ui, true);
// Randomize the order that we'll check the zoom levels.
const random_zoom_levels = ZOOM_LEVELS.slice();
const l = random_zoom_levels.length;
for (let i = l - 1; i > 0; i--) {
const j = Math.floor(Math.random() * l);
const temp = random_zoom_levels[i];
random_zoom_levels[i] = random_zoom_levels[j];
random_zoom_levels[j] = temp;
}
for (const zoom of random_zoom_levels) {
info(`Set zoom to ${zoom}.`);
await promiseRDMZoom(ui, browser, zoom);
const resolution = await spawnViewportTask(ui, {}, () => {
return content.windowUtils.getResolution();
});
const res_min = res_target * RESOLUTION_FACTOR_MIN;
const res_max = res_target * RESOLUTION_FACTOR_MAX;
ok(
res_min <= resolution && res_max >= resolution,
`${content} zoom ${zoom} resolution should be near ${res_target}, and we got ${resolution}.`
);
}
await closeRDM(tab);
await removeTab(tab);
}
});

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

@ -12,6 +12,14 @@ const WIDTH = 375;
const HEIGHT = 450;
const ZOOM_LEVELS = [0.3, 0.5, 0.9, 1, 1.5, 2, 2.4];
function promiseContentReflow(ui) {
return ContentTask.spawn(ui.getViewportBrowser(), {}, async function() {
return new Promise(resolve => {
content.window.requestAnimationFrame(resolve);
});
});
}
add_task(async function() {
const tab = await addTab(TEST_URL);
const browser = tab.linkedBrowser;
@ -22,7 +30,17 @@ add_task(async function() {
info("Ensure outer size values are unchanged at different zoom levels.");
for (let i = 0; i < ZOOM_LEVELS.length; i++) {
info(`Setting zoom level to ${ZOOM_LEVELS[i]}`);
await promiseRDMZoom(ui, browser, ZOOM_LEVELS[i]);
ZoomManager.setZoomForBrowser(browser, ZOOM_LEVELS[i]);
// We need to ensure that the RDM pane has had time to both change size and
// change the zoom level. This is currently not an atomic operation. The event
// timing is this:
// 1) Pane changes size, content reflows.
// 2) Pane changes zoom, content reflows.
// So to wait for the post-zoom reflow to be complete, we have two wait on TWO
// reflows.
await promiseContentReflow(ui);
await promiseContentReflow(ui);
await checkWindowOuterSize(ui, ZOOM_LEVELS[i]);
await checkWindowScreenSize(ui, ZOOM_LEVELS[i]);

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

@ -749,34 +749,3 @@ async function testViewportZoomWidthAndHeight(
}
}
}
function promiseContentReflow(ui) {
return ContentTask.spawn(ui.getViewportBrowser(), {}, async function() {
return new Promise(resolve => {
content.window.requestAnimationFrame(resolve);
});
});
}
// 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 == zoom) {
resolve();
return;
}
ZoomManager.setZoomForBrowser(browser, zoom);
// Await the zoom complete event, then reflow.
BrowserTestUtils.waitForContentEvent(
ui.getViewportBrowser(),
"ZoomComplete"
)
.then(promiseContentReflow(ui))
.then(resolve);
});
}

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

@ -208,13 +208,6 @@ class ResponsiveUI {
await this.restoreState();
if (!this.isBrowserUIEnabled) {
// Force the newly created Zoom actor to cache its 1.0 zoom level. This
// prevents it from sending out FullZoomChange events when the content
// full zoom level is changed the first time.
const bc = this.toolWindow.docShell.browsingContext;
const zoomActor = bc.currentWindowGlobal.getActor("Zoom");
zoomActor.sendAsyncMessage("FullZoom", { value: 1.0 });
// Re-apply our cached zoom levels. Other Zoom UI update events have finished
// by now.
rdmContent.fullZoom = fullZoom;

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

@ -16,7 +16,6 @@
#include "BrowserParent.h"
#include "js/JSON.h"
#include "mozilla/Preferences.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BrowserElementParent.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/EventListenerManager.h"
@ -1263,18 +1262,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvUpdateDimensions(
screenRect.y + mClientOffset.y + mChromeOffset.y,
screenSize.width, screenSize.height, true);
// For our devtools Responsive Design Mode, we need to send a special
// event to indicate that we've finished processing a frame size change.
// This is used by RDM to respond correctly to changes to full zoom,
// which also change the window size.
RefPtr<Document> doc = GetTopLevelDocument();
if (doc && doc->InRDMPane()) {
RefPtr<AsyncEventDispatcher> dispatcher = new AsyncEventDispatcher(
doc, NS_LITERAL_STRING("mozupdatedremoteframedimensions"),
CanBubble::eYes, ChromeOnlyDispatch::eYes);
dispatcher->PostDOMEvent();
}
return IPC_OK();
}

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

@ -2826,14 +2826,6 @@ nsDocumentViewer::SetFullZoom(float aFullZoom) {
}
bool fullZoomChange = (mPageZoom != aFullZoom);
// Dispatch PreFullZoomChange event only if fullzoom value really has changed.
if (fullZoomChange) {
nsContentUtils::DispatchChromeEvent(mDocument, ToSupports(mDocument),
NS_LITERAL_STRING("PreFullZoomChange"),
CanBubble::eYes, Cancelable::eYes);
}
mPageZoom = aFullZoom;
PropagateToPresContextsHelper(