Bug 1286925 - Remove screen orientation event from GeckoEvent; r=snorp
authorJim Chen <nchen@mozilla.com>
Wed, 20 Jul 2016 21:44:48 -0400
changeset 305923 f689b7b832afd0b8e98f6bf0ce265ea4415db9dd
parent 305922 8f94a06c6c7f1e43b85d6beafea1245517acae5e
child 305924 f4ffff32d7f46eb78bdaac0c2fd871f2dc1a26ad
push id79711
push usernchen@mozilla.com
push dateThu, 21 Jul 2016 01:44:59 +0000
treeherdermozilla-inbound@f689b7b832af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1286925
milestone50.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 1286925 - Remove screen orientation event from GeckoEvent; r=snorp Remove the now-obsolete SCREENORIENTATION_CHANGED event from GeckoEvent.
mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsAppShell.cpp
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
@@ -64,17 +64,16 @@ public class GeckoEvent {
     // AndroidGeckoEvent in widget/android/AndroidJavaWrappers.h
     @JNITarget
     public enum NativeGeckoEvent {
         NATIVE_POKE(0),
         MOTION_EVENT(2),
         NOOP(15),
         VIEWPORT(20),
         THUMBNAIL(25),
-        SCREENORIENTATION_CHANGED(27),
         NATIVE_GESTURE_EVENT(31),
         CALL_OBSERVER(33),
         REMOVE_OBSERVER(34),
         LOW_MEMORY(35),
         TELEMETRY_HISTOGRAM_ADD(37),
         TELEMETRY_UI_SESSION_START(42),
         TELEMETRY_UI_SESSION_STOP(43),
         TELEMETRY_UI_EVENT(44),
@@ -118,19 +117,16 @@ public class GeckoEvent {
 
     private int mMetaState;
     private int mFlags;
     private int mCount;
     private String mCharacters;
     private String mCharactersExtra;
     private String mData;
 
-    private short mScreenOrientation;
-    private short mScreenAngle;
-
     private ByteBuffer mBuffer;
 
     private int mWidth;
     private int mHeight;
 
     private int mID;
     private int mGamepadButton;
     private boolean mGamepadButtonPressed;
@@ -359,23 +355,16 @@ public class GeckoEvent {
         event.mPoints[0] = new Point(x, y);
         event.mPoints[1] = new Point(bufw, bufh);
         event.mX = (double) scaleFactor;
         event.mMetaState = tabId;
         event.mBuffer = buffer;
         return event;
     }
 
-    public static GeckoEvent createScreenOrientationEvent(short aScreenOrientation, short aScreenAngle) {
-        GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.SCREENORIENTATION_CHANGED);
-        event.mScreenOrientation = aScreenOrientation;
-        event.mScreenAngle = aScreenAngle;
-        return event;
-    }
-
     public static GeckoEvent createCallObserverEvent(String observerKey, String topic, String data) {
         GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.CALL_OBSERVER);
         event.mCharacters = observerKey;
         event.mCharactersExtra = topic;
         event.mData = data;
         return event;
     }
 
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -34,18 +34,16 @@ jfieldID AndroidGeckoEvent::jRectField =
 
 jfieldID AndroidGeckoEvent::jCharactersField = 0;
 jfieldID AndroidGeckoEvent::jCharactersExtraField = 0;
 jfieldID AndroidGeckoEvent::jDataField = 0;
 jfieldID AndroidGeckoEvent::jMetaStateField = 0;
 jfieldID AndroidGeckoEvent::jFlagsField = 0;
 jfieldID AndroidGeckoEvent::jCountField = 0;
 jfieldID AndroidGeckoEvent::jPointerIndexField = 0;
-jfieldID AndroidGeckoEvent::jScreenOrientationField = 0;
-jfieldID AndroidGeckoEvent::jScreenAngleField = 0;
 jfieldID AndroidGeckoEvent::jByteBufferField = 0;
 jfieldID AndroidGeckoEvent::jWidthField = 0;
 jfieldID AndroidGeckoEvent::jHeightField = 0;
 jfieldID AndroidGeckoEvent::jIDField = 0;
 jfieldID AndroidGeckoEvent::jGamepadButtonField = 0;
 jfieldID AndroidGeckoEvent::jGamepadButtonPressedField = 0;
 jfieldID AndroidGeckoEvent::jGamepadButtonValueField = 0;
 jfieldID AndroidGeckoEvent::jGamepadValuesField = 0;
@@ -104,18 +102,16 @@ AndroidGeckoEvent::InitGeckoEventClass(J
 
     jCharactersField = geckoEvent.getField("mCharacters", "Ljava/lang/String;");
     jCharactersExtraField = geckoEvent.getField("mCharactersExtra", "Ljava/lang/String;");
     jDataField = geckoEvent.getField("mData", "Ljava/lang/String;");
     jMetaStateField = geckoEvent.getField("mMetaState", "I");
     jFlagsField = geckoEvent.getField("mFlags", "I");
     jCountField = geckoEvent.getField("mCount", "I");
     jPointerIndexField = geckoEvent.getField("mPointerIndex", "I");
-    jScreenOrientationField = geckoEvent.getField("mScreenOrientation", "S");
-    jScreenAngleField = geckoEvent.getField("mScreenAngle", "S");
     jByteBufferField = geckoEvent.getField("mBuffer", "Ljava/nio/ByteBuffer;");
     jWidthField = geckoEvent.getField("mWidth", "I");
     jHeightField = geckoEvent.getField("mHeight", "I");
     jIDField = geckoEvent.getField("mID", "I");
     jGamepadButtonField = geckoEvent.getField("mGamepadButton", "I");
     jGamepadButtonPressedField = geckoEvent.getField("mGamepadButtonPressed", "Z");
     jGamepadButtonValueField = geckoEvent.getField("mGamepadButtonValue", "F");
     jGamepadValuesField = geckoEvent.getField("mGamepadValues", "[F");
@@ -324,22 +320,16 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
         case ZOOMEDVIEW: {
             mX = jenv->GetDoubleField(jobj, jXField);
             mMetaState = jenv->GetIntField(jobj, jMetaStateField);
             ReadPointArray(mPoints, jenv, jPoints, 2);
             mByteBuffer = new RefCountedJavaObject(jenv, jenv->GetObjectField(jobj, jByteBufferField));
             break;
         }
 
-        case SCREENORIENTATION_CHANGED: {
-            mScreenOrientation = jenv->GetShortField(jobj, jScreenOrientationField);
-            mScreenAngle = jenv->GetShortField(jobj, jScreenAngleField);
-            break;
-        }
-
         case CALL_OBSERVER: {
             ReadCharactersField(jenv);
             ReadCharactersExtraField(jenv);
             ReadDataField(jenv);
             break;
         }
 
         case REMOVE_OBSERVER: {
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -474,18 +474,16 @@ public:
     Modifiers DOMModifiers() const;
     bool IsAltPressed() const { return (mMetaState & AMETA_ALT_MASK) != 0; }
     bool IsShiftPressed() const { return (mMetaState & AMETA_SHIFT_MASK) != 0; }
     bool IsCtrlPressed() const { return (mMetaState & AMETA_CTRL_MASK) != 0; }
     bool IsMetaPressed() const { return (mMetaState & AMETA_META_MASK) != 0; }
     int Flags() { return mFlags; }
     int Count() { return mCount; }
     int PointerIndex() { return mPointerIndex; }
-    short ScreenOrientation() { return mScreenOrientation; }
-    short ScreenAngle() { return mScreenAngle; }
     RefCountedJavaObject* ByteBuffer() { return mByteBuffer; }
     int Width() { return mWidth; }
     int Height() { return mHeight; }
     int ID() { return mID; }
     int GamepadButton() { return mGamepadButton; }
     bool GamepadButtonPressed() { return mGamepadButtonPressed; }
     float GamepadButtonValue() { return mGamepadButtonValue; }
     const nsTArray<float>& GamepadValues() { return mGamepadValues; }
@@ -511,18 +509,16 @@ protected:
     nsTArray<float> mPressures;
     nsTArray<int> mToolTypes;
     nsIntRect mRect;
     int mFlags, mMetaState;
     int mCount;
     double mX, mY, mZ, mW;
     int mPointerIndex;
     nsString mCharacters, mCharactersExtra, mData;
-    short mScreenOrientation;
-    short mScreenAngle;
     RefPtr<RefCountedJavaObject> mByteBuffer;
     int mWidth, mHeight;
     int mID;
     int mGamepadButton;
     bool mGamepadButtonPressed;
     float mGamepadButtonValue;
     nsTArray<float> mGamepadValues;
     nsCOMPtr<nsIObserver> mObserver;
@@ -572,18 +568,16 @@ protected:
     static jfieldID jCharactersField;
     static jfieldID jCharactersExtraField;
     static jfieldID jDataField;
     static jfieldID jMetaStateField;
     static jfieldID jFlagsField;
     static jfieldID jCountField;
     static jfieldID jPointerIndexField;
 
-    static jfieldID jScreenOrientationField;
-    static jfieldID jScreenAngleField;
     static jfieldID jByteBufferField;
 
     static jfieldID jWidthField;
     static jfieldID jHeightField;
 
     static jfieldID jIDField;
     static jfieldID jGamepadButtonField;
     static jfieldID jGamepadButtonPressedField;
@@ -593,17 +587,16 @@ protected:
 public:
     enum {
         NATIVE_POKE = 0,
         MOTION_EVENT = 2,
         NOOP = 15,
         APZ_INPUT_EVENT = 17, // used internally in AndroidJNI/nsAppShell/nsWindow
         VIEWPORT = 20,
         THUMBNAIL = 25,
-        SCREENORIENTATION_CHANGED = 27,
         NATIVE_GESTURE_EVENT = 31,
         CALL_OBSERVER = 33,
         REMOVE_OBSERVER = 34,
         LOW_MEMORY = 35,
         TELEMETRY_HISTOGRAM_ADD = 37,
         ADD_OBSERVER = 38,
         TELEMETRY_UI_SESSION_START = 42,
         TELEMETRY_UI_SESSION_STOP = 43,
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -37,17 +37,16 @@
 
 #include "AndroidBridge.h"
 #include "AndroidBridgeUtilities.h"
 #include "GeneratedJNINatives.h"
 #include <android/log.h>
 #include <pthread.h>
 #include <wchar.h>
 
-#include "mozilla/dom/ScreenOrientation.h"
 #ifdef MOZ_GAMEPAD
 #include "mozilla/dom/GamepadPlatformService.h"
 #include "mozilla/dom/Gamepad.h"
 #endif
 
 #include "GeckoProfiler.h"
 #ifdef MOZ_ANDROID_HISTORY
 #include "nsNetUtil.h"
@@ -800,44 +799,16 @@ nsAppShell::LegacyGeckoEvent::Run()
                 curEvent->Data().get(),
                 curEvent->Characters().get(),
                 curEvent->Time(),
                 curEvent->CharactersExtra().get()
                 );
         break;
     }
 
-    case AndroidGeckoEvent::SCREENORIENTATION_CHANGED: {
-        nsresult rv;
-        nsCOMPtr<nsIScreenManager> screenMgr =
-            do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
-        if (NS_FAILED(rv)) {
-            NS_ERROR("Can't find nsIScreenManager!");
-            break;
-        }
-
-        nsIntRect rect;
-        int32_t colorDepth, pixelDepth;
-        int16_t angle;
-        dom::ScreenOrientationInternal orientation;
-        nsCOMPtr<nsIScreen> screen;
-
-        screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
-        screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
-        screen->GetColorDepth(&colorDepth);
-        screen->GetPixelDepth(&pixelDepth);
-        orientation =
-            static_cast<dom::ScreenOrientationInternal>(curEvent->ScreenOrientation());
-        angle = curEvent->ScreenAngle();
-
-        hal::NotifyScreenConfigurationChange(
-            hal::ScreenConfiguration(rect, orientation, angle, colorDepth, pixelDepth));
-        break;
-    }
-
     case AndroidGeckoEvent::CALL_OBSERVER:
     {
         nsCOMPtr<nsIObserver> observer;
         nsAppShell::Get()->mObserversHash.Get(curEvent->Characters(), getter_AddRefs(observer));
 
         if (observer) {
             observer->Observe(nullptr, NS_ConvertUTF16toUTF8(curEvent->CharactersExtra()).get(),
                               curEvent->Data().get());