Bug 1357774 - Part 1: Add a 'SetCurrentRDMPaneOrientation' WebIDL extension on the Document r=bradwerth,smaug
authorMicah Tigley <mtigley@mozilla.com>
Thu, 16 May 2019 20:31:13 +0000
changeset 536117 1256739720ca8dca77a035c72d8e62977d90a990
parent 536116 b38eabe183170953e88e5a91d367ca2eb044e62f
child 536118 3944c733e4179698371ea69f9c462dbc7ed226da
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbradwerth, smaug
bugs1357774
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1357774 - Part 1: Add a 'SetCurrentRDMPaneOrientation' WebIDL extension on the Document r=bradwerth,smaug Differential Revision: https://phabricator.services.mozilla.com/D29455
dom/base/Document.h
dom/webidl/Document.webidl
hal/android/AndroidHal.cpp
hal/sandbox/SandboxHal.cpp
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -1970,16 +1970,22 @@ class Document : public nsINode,
   OrientationType CurrentOrientationType() const {
     return mCurrentOrientationType;
   }
   void SetOrientationPendingPromise(Promise* aPromise);
   Promise* GetOrientationPendingPromise() const {
     return mOrientationPendingPromise;
   }
 
+  void SetRDMPaneOrientation(OrientationType aType, uint16_t aAngle) {
+    if (mInRDMPane) {
+      SetCurrentOrientation(aType, aAngle);
+    }
+  }
+
   //----------------------------------------------------------------------
 
   // Document notification API's
 
   /**
    * Add a new observer of document change notifications. Whenever
    * content is changed, appended, inserted or removed the observers are
    * informed.  An observer that is already observing the document must
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -579,9 +579,13 @@ partial interface Document {
 /**
  * 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;
+  // Extension to give chrome JS the ability to set the window screen
+  // orientation while in RDM.
+  [ChromeOnly]
+  void setRDMPaneOrientation(OrientationType type, float rotationAngle);
 };
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -98,39 +98,41 @@ void GetCurrentScreenConfiguration(Scree
       do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
   if (NS_FAILED(rv)) {
     NS_ERROR("Can't find nsIScreenManager!");
     return;
   }
 
   int32_t colorDepth, pixelDepth;
   int16_t angle;
-  ScreenOrientation orientation;
+  hal::ScreenOrientation orientation;
   nsCOMPtr<nsIScreen> screen;
 
   int32_t rectX, rectY, rectWidth, rectHeight;
 
   screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
 
   screen->GetRect(&rectX, &rectY, &rectWidth, &rectHeight);
   screen->GetColorDepth(&colorDepth);
   screen->GetPixelDepth(&pixelDepth);
-  orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
+  orientation =
+    static_cast<hal::ScreenOrientation>(bridge->GetScreenOrientation());
   angle = bridge->GetScreenAngle();
 
   *aScreenConfiguration =
       hal::ScreenConfiguration(nsIntRect(rectX, rectY, rectWidth, rectHeight),
                                orientation, angle, colorDepth, pixelDepth);
 }
 
-bool LockScreenOrientation(const ScreenOrientation& aOrientation) {
+bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation) {
   // Force the default orientation to be portrait-primary.
-  ScreenOrientation orientation = aOrientation == eScreenOrientation_Default
-                                      ? eScreenOrientation_PortraitPrimary
-                                      : aOrientation;
+  hal::ScreenOrientation orientation =
+      aOrientation == eScreenOrientation_Default
+          ? eScreenOrientation_PortraitPrimary
+          : aOrientation;
 
   switch (orientation) {
     // The Android backend only supports these orientations.
     case eScreenOrientation_PortraitPrimary:
     case eScreenOrientation_PortraitSecondary:
     case eScreenOrientation_PortraitPrimary |
         eScreenOrientation_PortraitSecondary:
     case eScreenOrientation_LandscapePrimary:
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -80,17 +80,17 @@ void EnableScreenConfigurationNotificati
 void DisableScreenConfigurationNotifications() {
   Hal()->SendDisableScreenConfigurationNotifications();
 }
 
 void GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) {
   fallback::GetCurrentScreenConfiguration(aScreenConfiguration);
 }
 
-bool LockScreenOrientation(const ScreenOrientation& aOrientation) {
+bool LockScreenOrientation(const hal::ScreenOrientation& aOrientation) {
   bool allowed;
   Hal()->SendLockScreenOrientation(aOrientation, &allowed);
   return allowed;
 }
 
 void UnlockScreenOrientation() {
   // Don't send this message from both the middleman and recording processes.
   if (!recordreplay::IsMiddleman()) {