mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
This patch gives the RDM UI the ability to update the screen orientation based on the orientation of the simulated device screen. It fixes the following issues: - Initializing the orientation state of the selected device when RDM is opened. - Updating orientation state when the rotate button in the RDM toolbar is pressed. - Updating the orientation state when a new device is selected. There are three actions creators that are responsible for notifying the ResponsiveUI manager, `changeDevice`, `restoreDeviceState`, and `rotateViewport`. In particular: - `restoreDeviceState` is dispatched when the Responsive UI has finished initializing. If a previous RDM session had a device selected, then this action creator will also dispatch the `changeDevice` action to update the RDM UI to reflect the currently selected device. - `changeDevice` is dispatched when a device is selected. - `rotateViewport` is dispatched when the rotate button is clicked in the RDM toolbar. When either of these actions is dispatched, we post a "viewport-orientation-change" message to the window that notifies the manager to update the screen orientation accordingly. Finally, when RDM is closed, we need to ensure the original physical screen orientation is restored. We do this by calling the `setRDMPaneOrientation` on the docShell's document in the content frame script. Differential Revision: https://phabricator.services.mozilla.com/D30440
165 lines
3.0 KiB
JavaScript
165 lines
3.0 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
"use strict";
|
|
|
|
const { Arg, RetVal, generateActorSpec } = require("devtools/shared/protocol");
|
|
|
|
const emulationSpec = generateActorSpec({
|
|
typeName: "emulation",
|
|
|
|
methods: {
|
|
setDPPXOverride: {
|
|
request: {
|
|
dppx: Arg(0, "number"),
|
|
},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
getDPPXOverride: {
|
|
request: {},
|
|
response: {
|
|
dppx: RetVal("number"),
|
|
},
|
|
},
|
|
|
|
clearDPPXOverride: {
|
|
request: {},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
setNetworkThrottling: {
|
|
request: {
|
|
options: Arg(0, "json"),
|
|
},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
getNetworkThrottling: {
|
|
request: {},
|
|
response: {
|
|
state: RetVal("json"),
|
|
},
|
|
},
|
|
|
|
clearNetworkThrottling: {
|
|
request: {},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
setTouchEventsOverride: {
|
|
request: {
|
|
flag: Arg(0, "number"),
|
|
},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
getTouchEventsOverride: {
|
|
request: {},
|
|
response: {
|
|
flag: RetVal("number"),
|
|
},
|
|
},
|
|
|
|
clearTouchEventsOverride: {
|
|
request: {},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
setMetaViewportOverride: {
|
|
request: {
|
|
flag: Arg(0, "number"),
|
|
},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
getMetaViewportOverride: {
|
|
request: {},
|
|
response: {
|
|
flag: RetVal("number"),
|
|
},
|
|
},
|
|
|
|
clearMetaViewportOverride: {
|
|
request: {},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
setUserAgentOverride: {
|
|
request: {
|
|
flag: Arg(0, "string"),
|
|
},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
getUserAgentOverride: {
|
|
request: {},
|
|
response: {
|
|
userAgent: RetVal("string"),
|
|
},
|
|
},
|
|
|
|
clearUserAgentOverride: {
|
|
request: {},
|
|
response: {
|
|
valueChanged: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
setElementPickerState: {
|
|
request: {
|
|
state: Arg(0, "boolean"),
|
|
},
|
|
response: {},
|
|
},
|
|
|
|
getIsPrintSimulationEnabled: {
|
|
request: {},
|
|
response: {
|
|
enabled: RetVal("boolean"),
|
|
},
|
|
},
|
|
|
|
startPrintMediaSimulation: {
|
|
request: {},
|
|
response: {},
|
|
},
|
|
|
|
stopPrintMediaSimulation: {
|
|
request: {
|
|
state: Arg(0, "boolean"),
|
|
},
|
|
response: {},
|
|
},
|
|
|
|
simulateScreenOrientationChange: {
|
|
request: {
|
|
orientation: Arg(0, "string"),
|
|
angle: Arg(1, "number"),
|
|
deviceChange: Arg(2, "boolean"),
|
|
},
|
|
response: {},
|
|
},
|
|
},
|
|
});
|
|
|
|
exports.emulationSpec = emulationSpec;
|