mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
Backed out 13 changesets (bug 1501665) for failing a11y tests in accessible/tests/mochitest/relations/test_tabbrowser.xul CLOSED TREE
Backed out changeset 2fa518cb0dfc (bug 1501665) Backed out changeset afaf26d7df42 (bug 1501665) Backed out changeset 5bdf0ad9dc66 (bug 1501665) Backed out changeset 520dd24a73fc (bug 1501665) Backed out changeset 3542bf2b89dd (bug 1501665) Backed out changeset 088dc24eabc7 (bug 1501665) Backed out changeset 178210eb72ba (bug 1501665) Backed out changeset 9eebe767ef20 (bug 1501665) Backed out changeset 6a84e97d0e62 (bug 1501665) Backed out changeset cf42ea4e8443 (bug 1501665) Backed out changeset 731d7ee06d86 (bug 1501665) Backed out changeset 8e0afe4a041a (bug 1501665) Backed out changeset be1026de486b (bug 1501665)
This commit is contained in:
parent
111ff1b2e8
commit
b7de66af4f
@ -55,10 +55,8 @@ var global = this;
|
||||
}
|
||||
|
||||
// At this point, a content viewer might not be loaded for this
|
||||
// docshell. setDocumentInRDMPane and makeScrollbarsFloating will be
|
||||
// triggered by onLocationChange.
|
||||
// docshell. makeScrollbarsFloating will be triggered by onLocationChange.
|
||||
if (docShell.contentViewer) {
|
||||
setDocumentInRDMPane(true);
|
||||
makeScrollbarsFloating();
|
||||
}
|
||||
active = true;
|
||||
@ -66,23 +64,12 @@ var global = this;
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
// Send both a content-resize event and a viewport-resize event, since both
|
||||
// may have changed.
|
||||
let { width, height } = content.screen;
|
||||
debug(`EMIT CONTENTRESIZE: ${width} x ${height}`);
|
||||
const { width, height } = content.screen;
|
||||
debug(`EMIT RESIZE: ${width} x ${height}`);
|
||||
sendAsyncMessage("ResponsiveMode:OnContentResize", {
|
||||
width,
|
||||
height,
|
||||
});
|
||||
|
||||
const zoom = content.windowUtils.getResolution();
|
||||
width = content.innerWidth * zoom;
|
||||
height = content.innerHeight * zoom;
|
||||
debug(`EMIT RESIZEVIEWPORT: ${width} x ${height}`);
|
||||
sendAsyncMessage("ResponsiveMode:OnResizeViewport", {
|
||||
width,
|
||||
height,
|
||||
});
|
||||
}
|
||||
|
||||
function bindOnResize() {
|
||||
@ -122,7 +109,6 @@ var global = this;
|
||||
webProgress.removeProgressListener(WebProgressListener);
|
||||
docShell.deviceSizeIsPageSize = gDeviceSizeWasPageSize;
|
||||
restoreScrollbars();
|
||||
setDocumentInRDMPane(false);
|
||||
stopOnResize();
|
||||
sendAsyncMessage("ResponsiveMode:Stop:Done");
|
||||
}
|
||||
@ -165,11 +151,6 @@ var global = this;
|
||||
flushStyle();
|
||||
}
|
||||
|
||||
function setDocumentInRDMPane(inRDMPane) {
|
||||
// We don't propegate this property to descendent documents.
|
||||
docShell.contentViewer.DOMDocument.inRDMPane = inRDMPane;
|
||||
}
|
||||
|
||||
function flushStyle() {
|
||||
// Force presContext destruction
|
||||
const isSticky = docShell.contentViewer.sticky;
|
||||
@ -198,7 +179,6 @@ var global = this;
|
||||
if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
|
||||
return;
|
||||
}
|
||||
setDocumentInRDMPane(true);
|
||||
makeScrollbarsFloating();
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
|
||||
|
@ -71,7 +71,6 @@ class App extends PureComponent {
|
||||
this.onExit = this.onExit.bind(this);
|
||||
this.onRemoveCustomDevice = this.onRemoveCustomDevice.bind(this);
|
||||
this.onRemoveDeviceAssociation = this.onRemoveDeviceAssociation.bind(this);
|
||||
this.doResizeViewport = this.doResizeViewport.bind(this);
|
||||
this.onResizeViewport = this.onResizeViewport.bind(this);
|
||||
this.onRotateViewport = this.onRotateViewport.bind(this);
|
||||
this.onScreenshot = this.onScreenshot.bind(this);
|
||||
@ -189,20 +188,13 @@ class App extends PureComponent {
|
||||
this.props.dispatch(changeUserAgent(""));
|
||||
}
|
||||
|
||||
doResizeViewport(id, width, height) {
|
||||
// This is the setter function that we pass to Toolbar and Viewports
|
||||
// so they can modify the viewport.
|
||||
this.props.dispatch(resizeViewport(id, width, height));
|
||||
}
|
||||
|
||||
onResizeViewport({ width, height }) {
|
||||
// This is the response function that listens to changes to the size
|
||||
// and sends out a "viewport-resize" message with the new size.
|
||||
onResizeViewport(id, width, height) {
|
||||
window.postMessage({
|
||||
type: "viewport-resize",
|
||||
width,
|
||||
height,
|
||||
}, "*");
|
||||
this.props.dispatch(resizeViewport(id, width, height));
|
||||
}
|
||||
|
||||
onRotateViewport(id) {
|
||||
@ -258,7 +250,6 @@ class App extends PureComponent {
|
||||
onExit,
|
||||
onRemoveCustomDevice,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
onRotateViewport,
|
||||
onScreenshot,
|
||||
@ -298,7 +289,7 @@ class App extends PureComponent {
|
||||
onChangeUserAgent,
|
||||
onExit,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
onRotateViewport,
|
||||
onScreenshot,
|
||||
onToggleLeftAlignment,
|
||||
@ -313,7 +304,6 @@ class App extends PureComponent {
|
||||
onBrowserMounted,
|
||||
onContentResize,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
}),
|
||||
devices.isModalOpen ?
|
||||
|
@ -28,7 +28,6 @@ class Browser extends PureComponent {
|
||||
return {
|
||||
onBrowserMounted: PropTypes.func.isRequired,
|
||||
onContentResize: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
swapAfterMount: PropTypes.bool.isRequired,
|
||||
userContextId: PropTypes.number.isRequired,
|
||||
};
|
||||
@ -37,7 +36,6 @@ class Browser extends PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onContentResize = this.onContentResize.bind(this);
|
||||
this.onResizeViewport = this.onResizeViewport.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,20 +97,10 @@ class Browser extends PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
onResizeViewport(msg) {
|
||||
const { onResizeViewport } = this.props;
|
||||
const { width, height } = msg.data;
|
||||
onResizeViewport({
|
||||
width,
|
||||
height,
|
||||
});
|
||||
}
|
||||
|
||||
async startFrameScript() {
|
||||
const {
|
||||
browser,
|
||||
onContentResize,
|
||||
onResizeViewport,
|
||||
} = this;
|
||||
const mm = browser.frameLoader.messageManager;
|
||||
|
||||
@ -121,7 +109,6 @@ class Browser extends PureComponent {
|
||||
// since it still needs to do async work before the content is actually
|
||||
// resized to match.
|
||||
e10s.on(mm, "OnContentResize", onContentResize);
|
||||
e10s.on(mm, "OnResizeViewport", onResizeViewport);
|
||||
|
||||
const ready = e10s.once(mm, "ChildScriptReady");
|
||||
mm.loadFrameScript(FRAME_SCRIPT, true);
|
||||
@ -142,12 +129,10 @@ class Browser extends PureComponent {
|
||||
const {
|
||||
browser,
|
||||
onContentResize,
|
||||
onResizeViewport,
|
||||
} = this;
|
||||
const mm = browser.frameLoader.messageManager;
|
||||
|
||||
e10s.off(mm, "OnContentResize", onContentResize);
|
||||
e10s.off(mm, "OnResizeViewport", onResizeViewport);
|
||||
await e10s.request(mm, "Stop");
|
||||
message.post(window, "stop-frame-script:done");
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class DeviceAdder extends PureComponent {
|
||||
width,
|
||||
height,
|
||||
},
|
||||
doResizeViewport: this.onChangeSize,
|
||||
onResizeViewport: this.onChangeSize,
|
||||
onRemoveDeviceAssociation: () => {},
|
||||
})
|
||||
),
|
||||
|
@ -18,7 +18,7 @@ class DeviceSelector extends PureComponent {
|
||||
return {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
onChangeDevice: PropTypes.func.isRequired,
|
||||
doResizeViewport: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
onUpdateDeviceModal: PropTypes.func.isRequired,
|
||||
selectedDevice: PropTypes.string.isRequired,
|
||||
viewportId: PropTypes.number.isRequired,
|
||||
@ -34,7 +34,7 @@ class DeviceSelector extends PureComponent {
|
||||
const {
|
||||
devices,
|
||||
onChangeDevice,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
onUpdateDeviceModal,
|
||||
selectedDevice,
|
||||
viewportId,
|
||||
@ -50,7 +50,7 @@ class DeviceSelector extends PureComponent {
|
||||
type: "checkbox",
|
||||
checked: selectedDevice === device.name,
|
||||
click: () => {
|
||||
doResizeViewport(viewportId, device.width, device.height);
|
||||
onResizeViewport(viewportId, device.width, device.height);
|
||||
onChangeDevice(viewportId, device, type);
|
||||
},
|
||||
});
|
||||
|
@ -25,7 +25,6 @@ class ResizableViewport extends PureComponent {
|
||||
onBrowserMounted: PropTypes.func.isRequired,
|
||||
onContentResize: PropTypes.func.isRequired,
|
||||
onRemoveDeviceAssociation: PropTypes.func.isRequired,
|
||||
doResizeViewport: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
screenshot: PropTypes.shape(Types.screenshot).isRequired,
|
||||
swapAfterMount: PropTypes.bool.isRequired,
|
||||
@ -48,6 +47,7 @@ class ResizableViewport extends PureComponent {
|
||||
this.onResizeDrag = this.onResizeDrag.bind(this);
|
||||
this.onResizeStart = this.onResizeStart.bind(this);
|
||||
this.onResizeStop = this.onResizeStop.bind(this);
|
||||
this.onResizeViewport = this.onResizeViewport.bind(this);
|
||||
}
|
||||
|
||||
onRemoveDeviceAssociation() {
|
||||
@ -97,11 +97,7 @@ class ResizableViewport extends PureComponent {
|
||||
}
|
||||
|
||||
// Update the viewport store with the new width and height.
|
||||
const {
|
||||
doResizeViewport,
|
||||
viewport,
|
||||
} = this.props;
|
||||
doResizeViewport(viewport.id, width, height);
|
||||
this.onResizeViewport(width, height);
|
||||
// Change the device selector back to an unselected device
|
||||
// TODO: Bug 1332754: Logic like this probably belongs in the action creator.
|
||||
if (this.props.viewport.device) {
|
||||
@ -144,6 +140,15 @@ class ResizableViewport extends PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
onResizeViewport(width, height) {
|
||||
const {
|
||||
viewport,
|
||||
onResizeViewport,
|
||||
} = this.props;
|
||||
|
||||
onResizeViewport(viewport.id, width, height);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
screenshot,
|
||||
@ -151,7 +156,6 @@ class ResizableViewport extends PureComponent {
|
||||
viewport,
|
||||
onBrowserMounted,
|
||||
onContentResize,
|
||||
onResizeViewport,
|
||||
} = this.props;
|
||||
|
||||
let resizeHandleClass = "viewport-resize-handle";
|
||||
@ -180,7 +184,6 @@ class ResizableViewport extends PureComponent {
|
||||
userContextId: viewport.userContextId,
|
||||
onBrowserMounted,
|
||||
onContentResize,
|
||||
onResizeViewport,
|
||||
})
|
||||
),
|
||||
dom.div({
|
||||
|
@ -41,7 +41,7 @@ class Toolbar extends PureComponent {
|
||||
onChangeUserAgent: PropTypes.func.isRequired,
|
||||
onExit: PropTypes.func.isRequired,
|
||||
onRemoveDeviceAssociation: PropTypes.func.isRequired,
|
||||
doResizeViewport: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
onRotateViewport: PropTypes.func.isRequired,
|
||||
onScreenshot: PropTypes.func.isRequired,
|
||||
onToggleLeftAlignment: PropTypes.func.isRequired,
|
||||
@ -88,7 +88,7 @@ class Toolbar extends PureComponent {
|
||||
onChangeTouchSimulation,
|
||||
onExit,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
onRotateViewport,
|
||||
onScreenshot,
|
||||
onToggleLeftAlignment,
|
||||
@ -118,7 +118,7 @@ class Toolbar extends PureComponent {
|
||||
DeviceSelector({
|
||||
devices,
|
||||
onChangeDevice,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
onUpdateDeviceModal,
|
||||
selectedDevice,
|
||||
viewportId: viewport.id,
|
||||
@ -126,7 +126,7 @@ class Toolbar extends PureComponent {
|
||||
dom.div({ className: "devtools-separator" }),
|
||||
ViewportDimension({
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
viewport,
|
||||
}),
|
||||
dom.button({
|
||||
|
@ -15,7 +15,7 @@ const Types = require("../types");
|
||||
class ViewportDimension extends PureComponent {
|
||||
static get propTypes() {
|
||||
return {
|
||||
doResizeViewport: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
onRemoveDeviceAssociation: PropTypes.func.isRequired,
|
||||
viewport: PropTypes.shape(Types.viewport).isRequired,
|
||||
};
|
||||
@ -121,7 +121,7 @@ class ViewportDimension extends PureComponent {
|
||||
const {
|
||||
viewport,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
} = this.props;
|
||||
|
||||
if (!this.state.isWidthValid || !this.state.isHeightValid) {
|
||||
@ -143,7 +143,7 @@ class ViewportDimension extends PureComponent {
|
||||
onRemoveDeviceAssociation(viewport.id);
|
||||
}
|
||||
|
||||
doResizeViewport(viewport.id,
|
||||
onResizeViewport(viewport.id,
|
||||
parseInt(this.state.width, 10), parseInt(this.state.height, 10));
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ class Viewports extends PureComponent {
|
||||
onBrowserMounted: PropTypes.func.isRequired,
|
||||
onContentResize: PropTypes.func.isRequired,
|
||||
onRemoveDeviceAssociation: PropTypes.func.isRequired,
|
||||
doResizeViewport: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
screenshot: PropTypes.shape(Types.screenshot).isRequired,
|
||||
viewports: PropTypes.arrayOf(PropTypes.shape(Types.viewport)).isRequired,
|
||||
@ -33,7 +32,6 @@ class Viewports extends PureComponent {
|
||||
onBrowserMounted,
|
||||
onContentResize,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
screenshot,
|
||||
viewports,
|
||||
@ -73,7 +71,6 @@ class Viewports extends PureComponent {
|
||||
onBrowserMounted,
|
||||
onContentResize,
|
||||
onRemoveDeviceAssociation,
|
||||
doResizeViewport,
|
||||
onResizeViewport,
|
||||
screenshot,
|
||||
swapAfterMount: i == 0,
|
||||
|
@ -549,7 +549,7 @@ ResponsiveUI.prototype = {
|
||||
this.onRemoveDeviceAssociation();
|
||||
break;
|
||||
case "viewport-resize":
|
||||
this.onResizeViewport(event);
|
||||
this.onViewportResize(event);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -629,7 +629,7 @@ ResponsiveUI.prototype = {
|
||||
this.emit("device-association-removed");
|
||||
},
|
||||
|
||||
onResizeViewport(event) {
|
||||
onViewportResize(event) {
|
||||
const { width, height } = event.data;
|
||||
this.emit("viewport-resize", {
|
||||
width,
|
||||
|
@ -71,5 +71,4 @@ skip-if = os == "linux" || os == "mac" # Bug 1498336
|
||||
[browser_touch_simulation.js]
|
||||
[browser_user_agent_input.js]
|
||||
[browser_viewport_basics.js]
|
||||
[browser_viewport_resizing.js]
|
||||
[browser_window_close.js]
|
||||
|
@ -1,99 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test viewport resizing, with and without meta viewport support.
|
||||
|
||||
// We call this to switch between on/off support for meta viewports.
|
||||
async function setTouchAndMetaViewportSupport(ui, value) {
|
||||
const reloadNeeded = await ui.updateTouchSimulation(value);
|
||||
if (reloadNeeded) {
|
||||
info("Reload is needed -- waiting for it.");
|
||||
const reload = waitForViewportLoad(ui);
|
||||
const browser = ui.getViewportBrowser();
|
||||
browser.reload();
|
||||
await reload;
|
||||
}
|
||||
}
|
||||
|
||||
// This function check that zoom, layout viewport width and height
|
||||
// are all as expected.
|
||||
async function testViewportZoomWidthAndHeight(message, ui, zoom, width, height) {
|
||||
const resolution = await spawnViewportTask(ui, {}, function() {
|
||||
return content.windowUtils.getResolution();
|
||||
});
|
||||
is(resolution, zoom, message + " should have expected zoom.");
|
||||
|
||||
const layoutSize = await spawnViewportTask(ui, {}, function() {
|
||||
return {
|
||||
width: content.screen.width,
|
||||
height: content.screen.height,
|
||||
};
|
||||
});
|
||||
is(layoutSize.width, width, message + " should have expected layout width.");
|
||||
is(layoutSize.height, height, message + " should have expected layout height.");
|
||||
}
|
||||
|
||||
const TEST_URL = "data:text/html;charset=utf-8," +
|
||||
"<head><meta name=\"viewport\" content=\"width=300\"/></head>" +
|
||||
"<body>meta viewport width 300</body>";
|
||||
addRDMTask(TEST_URL, async function({ ui, manager }) {
|
||||
// Turn on the pref that allows meta viewport support.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["devtools.responsive.metaViewport.enabled", true]],
|
||||
});
|
||||
|
||||
const store = ui.toolWindow.store;
|
||||
|
||||
// Wait until the viewport has been added.
|
||||
await waitUntilState(store, state => state.viewports.length == 1);
|
||||
|
||||
info("--- Starting viewport test output ---");
|
||||
|
||||
// We're going to take a 600,300 viewport (before) and resize it
|
||||
// to 50,50 (after) and then resize it back. At the before and
|
||||
// after points, we'll measure zoom and the layout viewport width
|
||||
// and height.
|
||||
const expected = [
|
||||
{
|
||||
metaSupport: false,
|
||||
before: [1.0, 600, 300],
|
||||
after: [1.0, 50, 50], // Zoom is unaffected.
|
||||
},
|
||||
{
|
||||
metaSupport: true,
|
||||
before: [2.0, 300, 150],
|
||||
after: [0.25, 200, 200], // This checks that min-zoom is active.
|
||||
},
|
||||
];
|
||||
|
||||
for (const e of expected) {
|
||||
const b = e.before;
|
||||
const a = e.after;
|
||||
|
||||
const message = "Meta Viewport " + (e.metaSupport ? "ON" : "OFF");
|
||||
|
||||
// Ensure meta viewport is set.
|
||||
info(message + " setting meta viewport support.");
|
||||
await setTouchAndMetaViewportSupport(ui, e.metaSupport);
|
||||
|
||||
// Get to the initial size and check values.
|
||||
await setViewportSize(ui, manager, 600, 300);
|
||||
await testViewportZoomWidthAndHeight(
|
||||
message + " before resize",
|
||||
ui, b[0], b[1], b[2]);
|
||||
|
||||
// Move to the smaller size.
|
||||
await setViewportSize(ui, manager, 50, 50);
|
||||
await testViewportZoomWidthAndHeight(
|
||||
message + " after resize",
|
||||
ui, a[0], a[1], a[2]);
|
||||
|
||||
// Go back to the initial size and check again.
|
||||
await setViewportSize(ui, manager, 600, 300);
|
||||
await testViewportZoomWidthAndHeight(
|
||||
message + " return to initial size",
|
||||
ui, b[0], b[1], b[2]);
|
||||
}
|
||||
});
|
@ -150,33 +150,33 @@ function waitForViewportResizeTo(ui, width, height) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we'll listen to the viewport's resize event, and the
|
||||
// browser's load end; since a racing condition can happen, where the
|
||||
// viewport's listener is added after the resize, because the viewport's
|
||||
// document was reloaded; therefore the test would hang forever.
|
||||
// See bug 1302879.
|
||||
// Otherwise, we'll listen to the content's resize event, the viewport's resize event,
|
||||
// and the browser's load end; since a racing condition can happen, where the
|
||||
// content's listener is added after the resize, because the content's document was
|
||||
// reloaded; therefore the test would hang forever. See bug 1302879.
|
||||
const browser = ui.getViewportBrowser();
|
||||
|
||||
const onResizeViewport = data => {
|
||||
const onResize = data => {
|
||||
if (!isSizeMatching(data)) {
|
||||
return;
|
||||
}
|
||||
ui.off("viewport-resize", onResizeViewport);
|
||||
ui.off("viewport-resize", onResize);
|
||||
ui.off("content-resize", onResize);
|
||||
browser.removeEventListener("mozbrowserloadend", onBrowserLoadEnd);
|
||||
info(`Got viewport-resize to ${width} x ${height}`);
|
||||
info(`Got content-resize or viewport-resize to ${width} x ${height}`);
|
||||
resolve();
|
||||
};
|
||||
|
||||
const onBrowserLoadEnd = async function() {
|
||||
const data = ui.getViewportSize(ui);
|
||||
onResizeViewport(data);
|
||||
onResize(data);
|
||||
};
|
||||
|
||||
info(`Waiting for viewport-resize to ${width} x ${height}`);
|
||||
// We're changing the viewport size, which may also change the content
|
||||
// size. We wait on the viewport resize event, and check for the
|
||||
// desired size.
|
||||
ui.on("viewport-resize", onResizeViewport);
|
||||
info(`Waiting for content-resize or viewport-resize to ${width} x ${height}`);
|
||||
// Depending on whether or not the viewport is overridden, we'll either get a
|
||||
// viewport-resize event or a content-resize event.
|
||||
ui.on("viewport-resize", onResize);
|
||||
ui.on("content-resize", onResize);
|
||||
browser.addEventListener("mozbrowserloadend",
|
||||
onBrowserLoadEnd, { once: true });
|
||||
});
|
||||
|
@ -1340,8 +1340,7 @@ Document::Document(const char* aContentType)
|
||||
mSavedResolution(1.0f),
|
||||
mPendingInitialTranslation(false),
|
||||
mGeneration(0),
|
||||
mCachedTabSizeGeneration(0),
|
||||
mInRDMPane(false) {
|
||||
mCachedTabSizeGeneration(0) {
|
||||
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this));
|
||||
|
||||
SetIsInDocument();
|
||||
@ -6772,9 +6771,10 @@ nsViewportInfo Document::GetViewportInfo(const ScreenIntSize& aDisplaySize) {
|
||||
CSSCoord maxHeight = mMaxHeight;
|
||||
|
||||
// aDisplaySize is in screen pixels; convert them to CSS pixels for the
|
||||
// viewport size. We need to use this scaled size for any clamping of
|
||||
// width or height.
|
||||
CSSSize displaySize = ScreenSize(aDisplaySize) / defaultScale;
|
||||
// viewport size.
|
||||
CSSToScreenScale defaultPixelScale =
|
||||
layoutDeviceScale * LayoutDeviceToScreenScale(1.0f);
|
||||
CSSSize displaySize = ScreenSize(aDisplaySize) / defaultPixelScale;
|
||||
|
||||
// Resolve device-width and device-height first.
|
||||
if (maxWidth == nsViewportInfo::DeviceSize) {
|
||||
@ -6851,7 +6851,7 @@ nsViewportInfo Document::GetViewportInfo(const ScreenIntSize& aDisplaySize) {
|
||||
// https://drafts.csswg.org/css-device-adapt/#resolve-height
|
||||
if (height == nsViewportInfo::Auto) {
|
||||
if (aDisplaySize.width == 0) {
|
||||
height = displaySize.height;
|
||||
height = aDisplaySize.height;
|
||||
} else {
|
||||
height = width * aDisplaySize.height / aDisplaySize.width;
|
||||
}
|
||||
@ -6894,8 +6894,8 @@ nsViewportInfo Document::GetViewportInfo(const ScreenIntSize& aDisplaySize) {
|
||||
// Also recalculate the default zoom, if it wasn't specified in the
|
||||
// metadata, and the width is specified.
|
||||
if (mScaleStrEmpty && !mWidthStrEmpty) {
|
||||
CSSToScreenScale bestFitScale(float(aDisplaySize.width) / size.width);
|
||||
scaleFloat = (scaleFloat > bestFitScale) ? scaleFloat : bestFitScale;
|
||||
CSSToScreenScale defaultScale(float(aDisplaySize.width) / size.width);
|
||||
scaleFloat = (scaleFloat > defaultScale) ? scaleFloat : defaultScale;
|
||||
}
|
||||
|
||||
size.height = clamped(size.height, effectiveMinSize.height,
|
||||
|
@ -3715,9 +3715,6 @@ class Document : public nsINode,
|
||||
|
||||
void SetPrototypeDocument(nsXULPrototypeDocument* aPrototype);
|
||||
|
||||
bool InRDMPane() const { return mInRDMPane; }
|
||||
void SetInRDMPane(bool aInRDMPane) { mInRDMPane = aInRDMPane; }
|
||||
|
||||
protected:
|
||||
void DoUpdateSVGUseElementShadowTrees();
|
||||
|
||||
@ -4681,8 +4678,6 @@ class Document : public nsINode,
|
||||
int32_t mCachedTabSizeGeneration;
|
||||
nsTabSizes mCachedTabSizes;
|
||||
|
||||
bool mInRDMPane;
|
||||
|
||||
public:
|
||||
// Needs to be public because the bindings code pokes at it.
|
||||
js::ExpandoAndGeneration mExpandoAndGeneration;
|
||||
|
@ -711,7 +711,6 @@ skip-if = !e10s # Track Bug 1281415
|
||||
[test_meta_viewport_device_width.html]
|
||||
[test_meta_viewport_device_width_with_initial_scale_0_5.html]
|
||||
[test_meta_viewport_device_width_with_initial_scale_2.html]
|
||||
[test_meta_viewport_fixed_width_and_zero_display_width.html]
|
||||
[test_meta_viewport_initial_scale_0_5.html]
|
||||
[test_meta_viewport_initial_scale_2.html]
|
||||
[test_meta_viewport_maximum_scale_0.html]
|
||||
|
@ -1,30 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Fixed meta viewport width, zero display width</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/AddTask.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<meta name="viewport" content="width=100">
|
||||
<script src="viewport_helpers.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>Fixed meta viewport width, zero display width</p>
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(async function valid_width() {
|
||||
// We choose a 2.5 scaleRatio here to make clear that the later check
|
||||
// of the viewport height is getting a scaled value.
|
||||
await SpecialPowers.pushPrefEnv(scaleRatio(2.5));
|
||||
|
||||
// We request a zero-width viewport because that triggers a special
|
||||
// codepath that sets the viewport height to the scaled display height.
|
||||
let info = getViewportInfo(0, 500);
|
||||
is(info.width, 100, "width should be 100");
|
||||
is(info.height, 200, "height should be 200, since 500 / 2.5 = 200");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -567,13 +567,3 @@ partial interface Document {
|
||||
[SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
|
||||
readonly attribute Policy policy;
|
||||
};
|
||||
|
||||
/**
|
||||
* Document extensions to support devtools.
|
||||
*/
|
||||
partial interface Document {
|
||||
// Is the Document embedded in a Responsive Design Mode pane. This property
|
||||
// is not propegated to descendant Documents upon settting.
|
||||
[ChromeOnly]
|
||||
attribute boolean inRDMPane;
|
||||
};
|
||||
|
@ -64,8 +64,6 @@ nsEventStatus APZInputBridge::ReceiveInputEvent(
|
||||
// mouse event undergoes (in PositionedEventTargeting.cpp) uses
|
||||
// the IGNORE_ROOT_SCROLL_FRAME flag, which is needed for correct
|
||||
// hit testing in a zoomed-in or zoomed-out state.
|
||||
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
|
||||
// per-document basis.
|
||||
if (gfxPrefs::APZAllowZooming()) {
|
||||
mouseEvent.mIgnoreRootScrollFrame = true;
|
||||
}
|
||||
|
@ -1525,8 +1525,6 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(
|
||||
|
||||
// For platforms that don't support APZ zooming, dispatch a message to the
|
||||
// content controller, it may want to do something else with this gesture.
|
||||
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
|
||||
// per-document basis.
|
||||
if (!gfxPrefs::APZAllowZooming()) {
|
||||
if (RefPtr<GeckoContentController> controller =
|
||||
GetGeckoContentController()) {
|
||||
@ -1571,8 +1569,6 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
||||
mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, aEvent.mTime);
|
||||
}
|
||||
|
||||
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
|
||||
// per-document basis.
|
||||
if (!gfxPrefs::APZAllowZooming()) {
|
||||
if (RefPtr<GeckoContentController> controller =
|
||||
GetGeckoContentController()) {
|
||||
@ -1706,8 +1702,6 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
|
||||
// per-document basis.
|
||||
if (!gfxPrefs::APZAllowZooming()) {
|
||||
if (RefPtr<GeckoContentController> controller =
|
||||
GetGeckoContentController()) {
|
||||
@ -4080,8 +4074,6 @@ AsyncPanZoomController::GetCurrentAsyncTransformForFixedAdjustment(
|
||||
// Use the layout viewport to adjust fixed position elements if and only if
|
||||
// it's larger than the visual viewport (assuming we're scrolling the RCD-RSF
|
||||
// with apz.allow_zooming enabled).
|
||||
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
|
||||
// per-document basis.
|
||||
return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
|
||||
Metrics().GetVisualViewport().Size() <=
|
||||
Metrics().GetLayoutViewport().Size())
|
||||
|
@ -307,8 +307,7 @@ void APZCCallbackHelper::UpdateRootFrame(const RepaintRequest& aRequest) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) &&
|
||||
aRequest.GetScrollOffsetUpdated()) {
|
||||
if (gfxPrefs::APZAllowZooming() && aRequest.GetScrollOffsetUpdated()) {
|
||||
// If zooming is disabled then we don't really want to let APZ fiddle
|
||||
// with these things. In theory setting the resolution here should be a
|
||||
// no-op, but setting the visual viewport size is bad because it can cause a
|
||||
@ -672,8 +671,7 @@ static bool PrepareForSetTargetAPZCNotification(
|
||||
nsPoint point = nsLayoutUtils::GetEventCoordinatesRelativeTo(
|
||||
aWidget, aRefPoint, aRootFrame);
|
||||
EnumSet<FrameForPointOption> options;
|
||||
if (nsLayoutUtils::AllowZoomingForDocument(
|
||||
aRootFrame->PresShell()->GetDocument())) {
|
||||
if (gfxPrefs::APZAllowZooming()) {
|
||||
// If zooming is enabled, we need IgnoreRootScrollFrame for correct
|
||||
// hit testing. Otherwise, don't use it because it interferes with
|
||||
// hit testing for some purposes such as scrollbar dragging (this will
|
||||
|
@ -121,10 +121,9 @@ mozilla::CSSToScreenScale MobileViewportManager::ComputeIntrinsicScale(
|
||||
return ClampZoom(intrinsicScale, aViewportInfo);
|
||||
}
|
||||
|
||||
void MobileViewportManager::RequestReflow(bool aForceAdjustResolution) {
|
||||
MVM_LOG("%p: got a reflow request with force resolution: %d\n", this,
|
||||
aForceAdjustResolution);
|
||||
RefreshViewportSize(aForceAdjustResolution);
|
||||
void MobileViewportManager::RequestReflow() {
|
||||
MVM_LOG("%p: got a reflow request\n", this);
|
||||
RefreshViewportSize(false);
|
||||
}
|
||||
|
||||
void MobileViewportManager::ResolutionUpdated() {
|
||||
@ -316,73 +315,9 @@ void MobileViewportManager::UpdateResolution(
|
||||
// viewport tag is added or removed)
|
||||
// 4. neither screen size nor CSS viewport changes
|
||||
if (aDisplayWidthChangeRatio) {
|
||||
// One more complication is that our current zoom level may be the
|
||||
// result of clamping to either the minimum or maximum zoom level
|
||||
// allowed by the viewport. If we naively scale the zoom level with
|
||||
// the change in the display width, we might be scaling one of these
|
||||
// clamped values. What we really want to do is to make scaling of the
|
||||
// zoom aware of these minimum and maximum clamping points, so that we
|
||||
// keep display width changes completely reversible.
|
||||
|
||||
// Because of the behavior of ShrinkToDisplaySizeIfNeeded, we are
|
||||
// choosing zoom clamping points based on the content size of the
|
||||
// scrollable rect, which might different from aViewportOrContentSize.
|
||||
CSSSize contentSize = aViewportOrContentSize;
|
||||
nsIScrollableFrame* rootScrollableFrame =
|
||||
mPresShell->GetRootScrollFrameAsScrollable();
|
||||
if (rootScrollableFrame) {
|
||||
nsRect scrollableRect =
|
||||
nsLayoutUtils::CalculateScrollableRectForFrame(
|
||||
rootScrollableFrame, nullptr);
|
||||
contentSize = CSSSize::FromAppUnits(scrollableRect.Size());
|
||||
}
|
||||
|
||||
// We scale the sizes, though we only care about the scaled widths.
|
||||
ScreenSize minZoomDisplaySize =
|
||||
contentSize * aViewportInfo.GetMinZoom();
|
||||
ScreenSize maxZoomDisplaySize =
|
||||
contentSize * aViewportInfo.GetMaxZoom();
|
||||
|
||||
float ratio = aDisplayWidthChangeRatio.value();
|
||||
ScreenSize newDisplaySize(aDisplaySize);
|
||||
ScreenSize oldDisplaySize = newDisplaySize / ratio;
|
||||
|
||||
// To calculate an adjusted ratio, we use some combination of these
|
||||
// four values:
|
||||
float a(minZoomDisplaySize.width);
|
||||
float b(maxZoomDisplaySize.width);
|
||||
float c(oldDisplaySize.width);
|
||||
float d(newDisplaySize.width);
|
||||
|
||||
// For both oldDisplaySize and aDisplaySize, the values are in one of
|
||||
// three "zones":
|
||||
// 1) Less than or equal to minZoomDisplaySize.
|
||||
// 2) Between minZoomDisplaySize and maxZoomDisplaySize.
|
||||
// 3) Greater than or equal to maxZoomDisplaySize.
|
||||
|
||||
// Depending on which zone each are in, the adjusted ratio is shown in
|
||||
// the table below (using the a-b-c-d coding from above):
|
||||
|
||||
// d | 1 | 2 | 3 |
|
||||
// c +---+---+---+
|
||||
// | a | d | b |
|
||||
// 1 | a | a | a |
|
||||
// +---+---+---+
|
||||
// | a | d | b |
|
||||
// 2 | c | c | c |
|
||||
// +---+---+---+
|
||||
// | a | d | b |
|
||||
// 3 | b | b | b |
|
||||
// +---+---+---+
|
||||
|
||||
// Conveniently, the numerator is just d clamped to a..b, and the
|
||||
// denominator is c clamped to a..b.
|
||||
float numerator = clamped(d, a, b);
|
||||
float denominator = clamped(c, a, b);
|
||||
|
||||
float adjustedRatio = numerator / denominator;
|
||||
newZoom = Some(ScaleZoomWithDisplayWidth(
|
||||
zoom, adjustedRatio, viewportSize, mMobileViewportSize));
|
||||
newZoom = Some(
|
||||
ScaleZoomWithDisplayWidth(zoom, aDisplayWidthChangeRatio.value(),
|
||||
viewportSize, mMobileViewportSize));
|
||||
}
|
||||
}
|
||||
} else { // aType == UpdateType::ContentSize
|
||||
@ -408,8 +343,6 @@ void MobileViewportManager::UpdateResolution(
|
||||
}
|
||||
|
||||
// If the zoom has changed, update the pres shell resolution accordingly.
|
||||
// This will also call UpdateVisualViewportSize, which means we can early
|
||||
// exit afterwards.
|
||||
if (newZoom) {
|
||||
LayoutDeviceToLayerScale resolution = ZoomToResolution(*newZoom, cssToDev);
|
||||
MVM_LOG("%p: setting resolution %f\n", this, resolution.scale);
|
||||
@ -417,12 +350,11 @@ void MobileViewportManager::UpdateResolution(
|
||||
resolution.scale, nsIPresShell::ChangeOrigin::eMainThread);
|
||||
|
||||
MVM_LOG("%p: New zoom is %f\n", this, newZoom->scale);
|
||||
return;
|
||||
}
|
||||
|
||||
// The visual viewport size also depends on the display size, and needs
|
||||
// to be updated if if we didn't already update due to a zoom change.
|
||||
if (aType == UpdateType::ViewportSize) {
|
||||
// The visual viewport size depends on both the zoom and the display size,
|
||||
// and needs to be updated if either might have changed.
|
||||
if (newZoom || aType == UpdateType::ViewportSize) {
|
||||
UpdateVisualViewportSize(aDisplaySize, newZoom ? *newZoom : zoom);
|
||||
}
|
||||
}
|
||||
@ -574,8 +506,7 @@ void MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) {
|
||||
MVM_LOG("%p: Updating properties because %d || %d\n", this, mIsFirstPaint,
|
||||
mMobileViewportSize != viewport);
|
||||
|
||||
if (aForceAdjustResolution ||
|
||||
nsLayoutUtils::AllowZoomingForDocument(mDocument)) {
|
||||
if (gfxPrefs::APZAllowZooming()) {
|
||||
UpdateResolution(viewportInfo, displaySize, viewport,
|
||||
displayWidthChangeRatio, UpdateType::ViewportSize);
|
||||
} else {
|
||||
@ -614,8 +545,8 @@ void MobileViewportManager::ShrinkToDisplaySizeIfNeeded(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nsLayoutUtils::AllowZoomingForDocument(mDocument)) {
|
||||
// If zoom is disabled, we don't scale down wider contents to fit them
|
||||
if (!gfxPrefs::APZAllowZooming()) {
|
||||
// If the APZ is disabled, we don't scale down wider contents to fit them
|
||||
// into device screen because users won't be able to zoom out the tiny
|
||||
// contents.
|
||||
return;
|
||||
|
@ -60,7 +60,7 @@ class MobileViewportManager final : public nsIDOMEventListener,
|
||||
public:
|
||||
/* Notify the MobileViewportManager that a reflow was requested in the
|
||||
* presShell.*/
|
||||
void RequestReflow(bool aForceAdjustResolution);
|
||||
void RequestReflow();
|
||||
|
||||
/* Notify the MobileViewportManager that the resolution on the presShell was
|
||||
* updated, and the visual viewport size needs to be updated. */
|
||||
|
@ -1839,10 +1839,8 @@ nsresult PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight,
|
||||
if (mMobileViewportManager) {
|
||||
// If we have a mobile viewport manager, request a reflow from it. It can
|
||||
// recompute the final CSS viewport and trigger a call to
|
||||
// ResizeReflowIgnoreOverride if it changed. We don't force adjusting
|
||||
// of resolution, because that is only necessary when we are destroying
|
||||
// the MVM.
|
||||
mMobileViewportManager->RequestReflow(false);
|
||||
// ResizeReflowIgnoreOverride if it changed.
|
||||
mMobileViewportManager->RequestReflow();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -10504,10 +10502,9 @@ nsresult PresShell::SetIsActive(bool aIsActive) {
|
||||
}
|
||||
|
||||
void PresShell::UpdateViewportOverridden(bool aAfterInitialization) {
|
||||
// Determine if we require a MobileViewportManager. This logic is
|
||||
// equivalent to ShouldHandleMetaViewport, which will check gfxPrefs if
|
||||
// there are not meta viewport overrides.
|
||||
bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument);
|
||||
// Determine if we require a MobileViewportManager.
|
||||
bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument) ||
|
||||
gfxPrefs::APZAllowZooming();
|
||||
|
||||
if (needMVM == !!mMobileViewportManager) {
|
||||
// Either we've need one and we've already got it, or we don't need one
|
||||
@ -10529,19 +10526,8 @@ void PresShell::UpdateViewportOverridden(bool aAfterInitialization) {
|
||||
|
||||
MOZ_ASSERT(mMobileViewportManager,
|
||||
"Shouldn't reach this without a MobileViewportManager.");
|
||||
// Before we get rid of our MVM, ask it to update the viewport while
|
||||
// forcing resolution, which will undo any scaling it might have imposed.
|
||||
// To do this correctly, we need to first null out mMobileViewportManager,
|
||||
// because during reflow we will check PresShell::GetIsViewportOverriden(),
|
||||
// which uses that value as a signifier.
|
||||
RefPtr<MobileViewportManager> oldMVM;
|
||||
mMobileViewportManager.swap(oldMVM);
|
||||
|
||||
oldMVM->RequestReflow(true);
|
||||
ResetVisualViewportSize();
|
||||
|
||||
oldMVM->Destroy();
|
||||
oldMVM = nullptr;
|
||||
mMobileViewportManager->Destroy();
|
||||
mMobileViewportManager = nullptr;
|
||||
|
||||
if (aAfterInitialization) {
|
||||
// Force a reflow to our correct size by going back to the docShell
|
||||
@ -10640,22 +10626,6 @@ void nsIPresShell::MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty) {
|
||||
}
|
||||
}
|
||||
|
||||
void nsIPresShell::CompleteChangeToVisualViewportSize() {
|
||||
if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
|
||||
rootScrollFrame->MarkScrollbarsDirtyForReflow();
|
||||
}
|
||||
MarkFixedFramesForReflow(nsIPresShell::eResize);
|
||||
|
||||
if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {
|
||||
window->VisualViewport()->PostResizeEvent();
|
||||
}
|
||||
|
||||
if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
|
||||
ScrollAnchorContainer* container = rootScrollFrame->Anchor();
|
||||
container->UserScrolled();
|
||||
}
|
||||
}
|
||||
|
||||
void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
|
||||
if (!mVisualViewportSizeSet || mVisualViewportSize.width != aWidth ||
|
||||
mVisualViewportSize.height != aHeight) {
|
||||
@ -10663,17 +10633,21 @@ void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
|
||||
mVisualViewportSize.width = aWidth;
|
||||
mVisualViewportSize.height = aHeight;
|
||||
|
||||
CompleteChangeToVisualViewportSize();
|
||||
}
|
||||
}
|
||||
if (nsIScrollableFrame* rootScrollFrame =
|
||||
GetRootScrollFrameAsScrollable()) {
|
||||
rootScrollFrame->MarkScrollbarsDirtyForReflow();
|
||||
}
|
||||
MarkFixedFramesForReflow(nsIPresShell::eResize);
|
||||
|
||||
void nsIPresShell::ResetVisualViewportSize() {
|
||||
if (mVisualViewportSizeSet) {
|
||||
mVisualViewportSizeSet = false;
|
||||
mVisualViewportSize.width = 0;
|
||||
mVisualViewportSize.height = 0;
|
||||
if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {
|
||||
window->VisualViewport()->PostResizeEvent();
|
||||
}
|
||||
|
||||
CompleteChangeToVisualViewportSize();
|
||||
if (nsIScrollableFrame* rootScrollFrame =
|
||||
GetRootScrollFrameAsScrollable()) {
|
||||
ScrollAnchorContainer* container = rootScrollFrame->Anchor();
|
||||
container->UserScrolled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,8 +114,7 @@ nsIFrame* TouchManager::SetupTarget(WidgetTouchEvent* aEvent,
|
||||
// Setting this flag will skip the scrollbars on the root frame from
|
||||
// participating in hit-testing, and we only want that to happen on
|
||||
// zoomable platforms (for now).
|
||||
dom::Document* doc = aFrame->PresContext()->Document();
|
||||
if (nsLayoutUtils::AllowZoomingForDocument(doc)) {
|
||||
if (gfxPrefs::APZAllowZooming()) {
|
||||
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
|
||||
}
|
||||
|
||||
|
@ -168,10 +168,10 @@ void ZoomConstraintsClient::ScreenSizeChanged() {
|
||||
}
|
||||
|
||||
static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(
|
||||
const nsViewportInfo& aViewportInfo, Document* aDocument) {
|
||||
const nsViewportInfo& aViewportInfo) {
|
||||
mozilla::layers::ZoomConstraints constraints;
|
||||
constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() &&
|
||||
nsLayoutUtils::AllowZoomingForDocument(aDocument);
|
||||
constraints.mAllowZoom =
|
||||
aViewportInfo.IsZoomAllowed() && gfxPrefs::APZAllowZooming();
|
||||
constraints.mAllowDoubleTapZoom =
|
||||
constraints.mAllowZoom && gfxPrefs::APZAllowDoubleTapZooming();
|
||||
if (constraints.mAllowZoom) {
|
||||
@ -209,7 +209,7 @@ void ZoomConstraintsClient::RefreshZoomConstraints() {
|
||||
screenSize, PixelCastJustification::LayoutDeviceIsScreenForBounds));
|
||||
|
||||
mozilla::layers::ZoomConstraints zoomConstraints =
|
||||
ComputeZoomConstraintsFromViewportInfo(viewportInfo, mDocument);
|
||||
ComputeZoomConstraintsFromViewportInfo(viewportInfo);
|
||||
|
||||
if (mDocument->Fullscreen()) {
|
||||
ZCC_LOG("%p is in fullscreen, disallowing zooming\n", this);
|
||||
|
@ -1654,7 +1654,6 @@ class nsIPresShell : public nsStubDocumentObserver {
|
||||
static void ClearMouseCapture(nsIFrame* aFrame);
|
||||
|
||||
void SetVisualViewportSize(nscoord aWidth, nscoord aHeight);
|
||||
void ResetVisualViewportSize();
|
||||
bool IsVisualViewportSizeSet() { return mVisualViewportSizeSet; }
|
||||
nsSize GetVisualViewportSize() {
|
||||
NS_ASSERTION(mVisualViewportSizeSet,
|
||||
@ -1662,10 +1661,6 @@ class nsIPresShell : public nsStubDocumentObserver {
|
||||
return mVisualViewportSize;
|
||||
}
|
||||
|
||||
// This function handles all the work after VisualViewportSize is set
|
||||
// or reset.
|
||||
void CompleteChangeToVisualViewportSize();
|
||||
|
||||
/**
|
||||
* The return value indicates whether the offset actually changed.
|
||||
*/
|
||||
|
@ -667,16 +667,6 @@ bool nsLayoutUtils::AsyncPanZoomEnabled(nsIFrame* aFrame) {
|
||||
return widget->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
bool nsLayoutUtils::AllowZoomingForDocument(
|
||||
const mozilla::dom::Document* aDocument) {
|
||||
// True if we allow zooming for all documents on this platform, or if we are
|
||||
// in RDM and handling meta viewports, which force zoom under some
|
||||
// circumstances.
|
||||
return gfxPrefs::APZAllowZooming() ||
|
||||
(aDocument && aDocument->InRDMPane() &&
|
||||
nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
|
||||
}
|
||||
|
||||
float nsLayoutUtils::GetCurrentAPZResolutionScale(nsIPresShell* aShell) {
|
||||
return aShell ? aShell->GetCumulativeNonRootScaleResolution() : 1.0;
|
||||
}
|
||||
@ -9351,8 +9341,7 @@ static void UpdateDisplayPortMarginsForPendingMetrics(
|
||||
return;
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) &&
|
||||
aMetrics.IsRootContent()) {
|
||||
if (gfxPrefs::APZAllowZooming() && aMetrics.IsRootContent()) {
|
||||
// See APZCCallbackHelper::UpdateRootFrame for details.
|
||||
float presShellResolution = shell->GetResolution();
|
||||
if (presShellResolution != aMetrics.GetPresShellResolution()) {
|
||||
@ -9794,7 +9783,7 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsLayoutUtils::ShouldHandleMetaViewport(const Document* aDocument) {
|
||||
bool nsLayoutUtils::ShouldHandleMetaViewport(Document* aDocument) {
|
||||
auto metaViewportOverride = nsIDocShell::META_VIEWPORT_OVERRIDE_NONE;
|
||||
if (aDocument) {
|
||||
if (nsIDocShell* docShell = aDocument->GetDocShell()) {
|
||||
|
@ -2703,12 +2703,6 @@ class nsLayoutUtils {
|
||||
*/
|
||||
static float GetCurrentAPZResolutionScale(nsIPresShell* aShell);
|
||||
|
||||
/**
|
||||
* Returns true if aDocument should be allowed to use resolution
|
||||
* zooming.
|
||||
*/
|
||||
static bool AllowZoomingForDocument(const mozilla::dom::Document* aDocument);
|
||||
|
||||
/**
|
||||
* Returns true if we need to disable async scrolling for this particular
|
||||
* element. Note that this does a partial disabling - the displayport still
|
||||
@ -3001,7 +2995,7 @@ class nsLayoutUtils {
|
||||
* Returns true if there are any preferences or overrides that indicate a
|
||||
* need to create a MobileViewportManager.
|
||||
*/
|
||||
static bool ShouldHandleMetaViewport(const mozilla::dom::Document*);
|
||||
static bool ShouldHandleMetaViewport(mozilla::dom::Document*);
|
||||
|
||||
/**
|
||||
* Resolve a CSS <length-percentage> value to a definite size.
|
||||
|
@ -5921,11 +5921,10 @@ void ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
|
||||
bool hasResizer = HasResizer();
|
||||
bool scrollbarOnLeft = !IsScrollbarOnRight();
|
||||
bool overlayScrollBars =
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) ||
|
||||
presShell->GetDocument()->InRDMPane();
|
||||
bool overlayScrollBarsWithZoom =
|
||||
overlayScrollBars && mIsRoot && presShell->IsVisualViewportSizeSet();
|
||||
mIsRoot &&
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) &&
|
||||
presShell->IsVisualViewportSizeSet();
|
||||
|
||||
nsSize scrollPortClampingSize = mScrollPort.Size();
|
||||
double res = 1.0;
|
||||
|
@ -1261,8 +1261,7 @@ AnimatedGeometryRoot* nsDisplayListBuilder::FindAnimatedGeometryRootFor(
|
||||
}
|
||||
|
||||
void nsDisplayListBuilder::UpdateShouldBuildAsyncZoomContainer() {
|
||||
Document* document = mReferenceFrame->PresContext()->Document();
|
||||
mBuildAsyncZoomContainer = nsLayoutUtils::AllowZoomingForDocument(document) &&
|
||||
mBuildAsyncZoomContainer = gfxPrefs::APZAllowZooming() &&
|
||||
!gfxPrefs::LayoutUseContainersForRootFrames();
|
||||
}
|
||||
|
||||
|
@ -3678,7 +3678,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: bug 1525793 -- this may need to handle zooming or not on a per-document basis.
|
||||
if (gfxPrefs::APZAllowZooming()) {
|
||||
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]);
|
||||
ScreenPoint position =
|
||||
|
Loading…
x
Reference in New Issue
Block a user