forked from mirrors/gecko-dev
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
This commit is contained in:
parent
e7d0893a1f
commit
f697388960
4 changed files with 19 additions and 7 deletions
|
|
@ -1975,6 +1975,12 @@ class Document : public nsINode,
|
||||||
return mOrientationPendingPromise;
|
return mOrientationPendingPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle) {
|
||||||
|
if (mInRDMPane) {
|
||||||
|
SetCurrentOrientation(aType, aAngle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
// Document notification API's
|
// Document notification API's
|
||||||
|
|
|
||||||
|
|
@ -584,4 +584,8 @@ partial interface Document {
|
||||||
// is not propegated to descendant Documents upon settting.
|
// is not propegated to descendant Documents upon settting.
|
||||||
[ChromeOnly]
|
[ChromeOnly]
|
||||||
attribute boolean inRDMPane;
|
attribute boolean inRDMPane;
|
||||||
|
// Extension to give chrome JS the ability to set the window screen
|
||||||
|
// orientation while in RDM.
|
||||||
|
[ChromeOnly]
|
||||||
|
void setRDMPaneOrientation(OrientationType type, float rotationAngle);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
|
||||||
|
|
||||||
int32_t colorDepth, pixelDepth;
|
int32_t colorDepth, pixelDepth;
|
||||||
int16_t angle;
|
int16_t angle;
|
||||||
ScreenOrientation orientation;
|
hal::ScreenOrientation orientation;
|
||||||
nsCOMPtr<nsIScreen> screen;
|
nsCOMPtr<nsIScreen> screen;
|
||||||
|
|
||||||
int32_t rectX, rectY, rectWidth, rectHeight;
|
int32_t rectX, rectY, rectWidth, rectHeight;
|
||||||
|
|
@ -113,7 +113,8 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
|
||||||
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
|
screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
|
||||||
screen->GetColorDepth(&colorDepth);
|
screen->GetColorDepth(&colorDepth);
|
||||||
screen->GetPixelDepth(&pixelDepth);
|
screen->GetPixelDepth(&pixelDepth);
|
||||||
orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
|
orientation =
|
||||||
|
static_cast<hal::ScreenOrientation>(bridge->GetScreenOrientation());
|
||||||
angle = bridge->GetScreenAngle();
|
angle = bridge->GetScreenAngle();
|
||||||
|
|
||||||
*aScreenConfiguration =
|
*aScreenConfiguration =
|
||||||
|
|
@ -121,11 +122,12 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
|
||||||
orientation, angle, colorDepth, pixelDepth);
|
orientation, angle, colorDepth, pixelDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LockScreenOrientation(const ScreenOrientation& aOrientation) {
|
bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation) {
|
||||||
// Force the default orientation to be portrait-primary.
|
// Force the default orientation to be portrait-primary.
|
||||||
ScreenOrientation orientation = aOrientation == eScreenOrientation_Default
|
hal::ScreenOrientation orientation =
|
||||||
? eScreenOrientation_PortraitPrimary
|
aOrientation == eScreenOrientation_Default
|
||||||
: aOrientation;
|
? eScreenOrientation_PortraitPrimary
|
||||||
|
: aOrientation;
|
||||||
|
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
// The Android backend only supports these orientations.
|
// The Android backend only supports these orientations.
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
|
||||||
fallback::GetCurrentScreenConfiguration(aScreenConfiguration);
|
fallback::GetCurrentScreenConfiguration(aScreenConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LockScreenOrientation(const ScreenOrientation& aOrientation) {
|
bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation) {
|
||||||
bool allowed;
|
bool allowed;
|
||||||
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
|
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
|
||||||
return allowed;
|
return allowed;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue