Bug 1578008 - Remove various hacks to restore resolution only after a full zoom change. r=bradwerth

This is no longer needed now that MVM doesn't restore the zoom.

Differential Revision: https://phabricator.services.mozilla.com/D72551
This commit is contained in:
Emilio Cobos Álvarez 2020-04-29 21:44:01 +00:00
parent 1b7be4fbeb
commit 0169492da2
7 changed files with 9 additions and 72 deletions

View File

@ -23,6 +23,9 @@ const ZOOM_LEVELS = [
2.0,
2.4,
3.0,
// TODO(emilio): These should pass.
// 0.3,
// 3.0,
];
info("--- Starting viewport test output ---");
@ -31,7 +34,7 @@ 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=600, initial-scale=1.0", res_target: 0.333 },
{ content: "width=device-width", res_target: 1.0 },
{ content: "width=device-width, initial-scale=2.0", res_target: 2.0 },
];
@ -53,17 +56,11 @@ for (const { content, res_target } of TESTS) {
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;
}
// Ensure we've reflowed the page at least once so that MVM has chosen
// the initial scale.
await promiseContentReflow(ui);
for (const zoom of random_zoom_levels) {
for (const zoom of ZOOM_LEVELS.concat([...ZOOM_LEVELS].reverse())) {
info(`Set zoom to ${zoom}.`);
await promiseRDMZoom(ui, browser, zoom);

View File

@ -2108,12 +2108,6 @@ void BrowsingContext::DidSet(FieldIndex<IDX_FullZoom>, float aOldValue) {
doc = win->GetExtantDoc();
}
if (doc) {
nsContentUtils::DispatchChromeEvent(doc, ToSupports(doc),
NS_LITERAL_STRING("PreFullZoomChange"),
CanBubble::eYes, Cancelable::eYes);
}
if (nsIDocShell* shell = GetDocShell()) {
if (nsPresContext* pc = shell->GetPresContext()) {
pc->RecomputeBrowsingContextDependentData();

View File

@ -3867,7 +3867,7 @@ Maybe<CSSIntSize> nsGlobalWindowOuter::GetRDMDeviceSize(
// be independent of any full zoom or resolution zoom applied to the
// content. To get this value, we get the "unscaled" browser child size,
// and divide by the full zoom. "Unscaled" in this case means unscaled
// from device to screen but it has been affected (multipled) by the
// from device to screen but it has been affected (multiplied) by the
// full zoom and we need to compensate for that.
MOZ_RELEASE_ASSERT(NS_IsMainThread());

View File

@ -1187,19 +1187,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();
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (bc && bc->InRDMPane()) {
RefPtr<AsyncEventDispatcher> dispatcher = new AsyncEventDispatcher(
doc, NS_LITERAL_STRING("mozupdatedremoteframedimensions"),
CanBubble::eYes, ChromeOnlyDispatch::eYes);
dispatcher->PostDOMEvent();
}
RecvSafeAreaInsetsChanged(mPuppetWidget->GetSafeAreaInsets());
return IPC_OK();

View File

@ -18,8 +18,6 @@ class ZoomChild extends JSWindowActorChild {
fullZoom: NaN,
textZoom: NaN,
};
this._resolutionBeforeFullZoomChange = 0;
}
get fullZoom() {
@ -91,16 +89,6 @@ class ZoomChild extends JSWindowActorChild {
return;
}
if (event.type == "PreFullZoomChange") {
// Check if we're in the middle of a full zoom change. If we are,
// don't capture the resolution again, because it hasn't yet been
// restored and may be in an indeterminate state.
if (this._resolutionBeforeFullZoomChange == 0) {
this._resolutionBeforeFullZoomChange = this.contentWindow.windowUtils.getResolution();
}
return;
}
if (event.type == "FullZoomChange") {
if (this.refreshFullZoom()) {
this.sendAsyncMessage("FullZoomChange", {});
@ -108,20 +96,6 @@ class ZoomChild extends JSWindowActorChild {
return;
}
if (event.type == "mozupdatedremoteframedimensions") {
// Check to see if we've already restored resolution, in which case
// there's no need to do it again.
if (this._resolutionBeforeFullZoomChange != 0) {
this.contentWindow.windowUtils.setResolutionAndScaleTo(
this._resolutionBeforeFullZoomChange
);
this._resolutionBeforeFullZoomChange = 0;
}
this.sendAsyncMessage("FullZoomResolutionStable", {});
return;
}
if (event.type == "TextZoomChange") {
if (this.refreshTextZoom()) {
this.sendAsyncMessage("TextZoomChange", {});

View File

@ -25,9 +25,6 @@ class ZoomParent extends JSWindowActorParent {
* events for other listeners so that they can also update state.
* These messages will not be sent by the ZoomChild if the zoom change
* originated in the ZoomParent actor.
* 3) FullZoomResolutionStable. This is received after zoom is applied to
* a Responsive Design Mode frame and it has reached a stable
* resolution. We fire an event that is used by tests.
**/
switch (message.name) {
@ -38,13 +35,6 @@ class ZoomParent extends JSWindowActorParent {
break;
}
case "FullZoomResolutionStable": {
let event = document.createEvent("Events");
event.initEvent("FullZoomResolutionStable", true, false);
browser.dispatchEvent(event);
break;
}
case "TextZoomChange": {
let event = document.createEvent("Events");
event.initEvent("TextZoomChange", true, false);

View File

@ -413,7 +413,6 @@ let ACTORS = {
child: {
moduleURI: "resource://gre/actors/ZoomChild.jsm",
events: {
PreFullZoomChange: {},
FullZoomChange: {},
TextZoomChange: {},
DoZoomEnlargeBy10: {
@ -424,10 +423,6 @@ let ACTORS = {
capture: true,
mozSystemGroup: true,
},
mozupdatedremoteframedimensions: {
capture: true,
mozSystemGroup: true,
},
},
},