Skip to content

Commit f697388

Browse files
author
Micah Tigley
committed
Bug 1357774 - Part 1: Add a 'SetCurrentRDMPaneOrientation' WebIDL extension on the Document r=bradwerth,smaug
Differential Revision: https://phabricator.services.mozilla.com/D29455 --HG-- extra : moz-landing-system : lando
1 parent e7d0893 commit f697388

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

dom/base/Document.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,6 +1975,12 @@ class Document : public nsINode,
19751975
return mOrientationPendingPromise;
19761976
}
19771977

1978+
void SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle) {
1979+
if (mInRDMPane) {
1980+
SetCurrentOrientation(aType, aAngle);
1981+
}
1982+
}
1983+
19781984
//----------------------------------------------------------------------
19791985

19801986
// Document notification API's

dom/webidl/Document.webidl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,4 +584,8 @@ partial interface Document {
584584
// is not propegated to descendant Documents upon settting.
585585
[ChromeOnly]
586586
attribute boolean inRDMPane;
587+
// Extension to give chrome JS the ability to set the window screen
588+
// orientation while in RDM.
589+
[ChromeOnly]
590+
void setRDMPaneOrientation(OrientationType type, float rotationAngle);
587591
};

hal/android/AndroidHal.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
103103

104104
int32_t colorDepth, pixelDepth;
105105
int16_t angle;
106-
ScreenOrientation orientation;
106+
hal::ScreenOrientation orientation;
107107
nsCOMPtr<nsIScreen> screen;
108108

109109
int32_t rectX, rectY, rectWidth, rectHeight;
@@ -113,19 +113,21 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
113113
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
114114
screen->GetColorDepth(&colorDepth);
115115
screen->GetPixelDepth(&pixelDepth);
116-
orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
116+
orientation =
117+
static_cast<hal::ScreenOrientation>(bridge->GetScreenOrientation());
117118
angle = bridge->GetScreenAngle();
118119

119120
*aScreenConfiguration =
120121
hal::ScreenConfiguration(nsIntRect(rectX, rectY, rectWidth, rectHeight),
121122
orientation, angle, colorDepth, pixelDepth);
122123
}
123124

124-
bool LockScreenOrientation(const ScreenOrientation& aOrientation) {
125+
bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation) {
125126
// Force the default orientation to be portrait-primary.
126-
ScreenOrientation orientation = aOrientation == eScreenOrientation_Default
127-
? eScreenOrientation_PortraitPrimary
128-
: aOrientation;
127+
hal::ScreenOrientation orientation =
128+
aOrientation == eScreenOrientation_Default
129+
? eScreenOrientation_PortraitPrimary
130+
: aOrientation;
129131

130132
switch (orientation) {
131133
// The Android backend only supports these orientations.

hal/sandbox/SandboxHal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
8585
fallback::GetCurrentScreenConfiguration(aScreenConfiguration);
8686
}
8787

88-
bool LockScreenOrientation(const ScreenOrientation& aOrientation) {
88+
bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation) {
8989
bool allowed;
9090
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
9191
return allowed;

0 commit comments

Comments
 (0)