mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 11:37:43 -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
106 lines
2.9 KiB
JavaScript
106 lines
2.9 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";
|
|
|
|
// This file lists all of the actions available in responsive design. This
|
|
// central list of constants makes it easy to see all possible action names at
|
|
// a glance. Please add a comment with each new action type.
|
|
|
|
const { createEnum } = require("devtools/client/shared/enum");
|
|
|
|
const {
|
|
CHANGE_NETWORK_THROTTLING,
|
|
} = require("devtools/client/shared/components/throttling/actions");
|
|
|
|
createEnum([
|
|
|
|
// Add a new device.
|
|
"ADD_DEVICE",
|
|
|
|
// Add a new device type.
|
|
"ADD_DEVICE_TYPE",
|
|
|
|
// Add an additional viewport to display the document.
|
|
"ADD_VIEWPORT",
|
|
|
|
// Change the device displayed in the viewport.
|
|
"CHANGE_DEVICE",
|
|
|
|
// Change the location of the page. This may be triggered by the user
|
|
// directly entering a new URL, navigating with links, etc.
|
|
"CHANGE_LOCATION",
|
|
|
|
// The pixel ratio of the display has changed. This may be triggered by the user
|
|
// when changing the monitor resolution, or when the window is dragged to a different
|
|
// display with a different pixel ratio.
|
|
"CHANGE_DISPLAY_PIXEL_RATIO",
|
|
|
|
// Change the network throttling profile.
|
|
CHANGE_NETWORK_THROTTLING,
|
|
|
|
// Change the user agent of the viewport.
|
|
"CHANGE_USER_AGENT",
|
|
|
|
// The pixel ratio of the viewport has changed. This may be triggered by the user
|
|
// when changing the device displayed in the viewport, or when a pixel ratio is
|
|
// selected from the device pixel ratio dropdown.
|
|
"CHANGE_PIXEL_RATIO",
|
|
|
|
// Change the viewport angle.
|
|
"CHANGE_VIEWPORT_ANGLE",
|
|
|
|
// Edit a device.
|
|
"EDIT_DEVICE",
|
|
|
|
// Indicates that the device list is being loaded.
|
|
"LOAD_DEVICE_LIST_START",
|
|
|
|
// Indicates that the device list loading action threw an error.
|
|
"LOAD_DEVICE_LIST_ERROR",
|
|
|
|
// Indicates that the device list has been loaded successfully.
|
|
"LOAD_DEVICE_LIST_END",
|
|
|
|
// Remove a device.
|
|
"REMOVE_DEVICE",
|
|
|
|
// Remove the viewport's device assocation.
|
|
"REMOVE_DEVICE_ASSOCIATION",
|
|
|
|
// Resize the viewport.
|
|
"RESIZE_VIEWPORT",
|
|
|
|
// Rotate the viewport.
|
|
"ROTATE_VIEWPORT",
|
|
|
|
// Take a screenshot of the viewport.
|
|
"TAKE_SCREENSHOT_START",
|
|
|
|
// Indicates when the screenshot action ends.
|
|
"TAKE_SCREENSHOT_END",
|
|
|
|
// Toggles the left alignment of the viewports.
|
|
"TOGGLE_LEFT_ALIGNMENT",
|
|
|
|
// Toggles the reload on touch simulation changes.
|
|
"TOGGLE_RELOAD_ON_TOUCH_SIMULATION",
|
|
|
|
// Toggles the reload on user agent changes.
|
|
"TOGGLE_RELOAD_ON_USER_AGENT",
|
|
|
|
// Toggles the touch simulation state of the viewports.
|
|
"TOGGLE_TOUCH_SIMULATION",
|
|
|
|
// Toggles the user agent input displayed in the toolbar.
|
|
"TOGGLE_USER_AGENT_INPUT",
|
|
|
|
// Update the device display state in the device selector.
|
|
"UPDATE_DEVICE_DISPLAYED",
|
|
|
|
// Update the device modal state.
|
|
"UPDATE_DEVICE_MODAL",
|
|
|
|
], module.exports);
|