From a952ee50620f5c2eb32627e6657f3f298689d7ec Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 9 Feb 2012 12:06:50 +0000 Subject: [PATCH] Backout 79121553f728 (bug 720799), 4a763183482f (bug 720795), e965486f4b50 & 4a7c7c6b9b11 (bug 720794) for failing to build on any platform --- dom/base/Makefile.in | 1 - dom/base/ScreenOrientation.h | 62 ------ dom/base/nsDOMClassInfo.cpp | 1 - dom/base/nsGlobalWindow.cpp | 15 +- dom/base/nsScreen.cpp | 177 ++++-------------- dom/base/nsScreen.h | 28 +-- dom/interfaces/base/Makefile.in | 2 - dom/interfaces/base/nsIDOMScreen.idl | 15 +- embedding/android/GeckoApp.java | 3 - embedding/android/GeckoAppShell.java | 12 -- embedding/android/GeckoEvent.java | 8 - .../GeckoScreenOrientationListener.java | 122 ------------ embedding/android/Makefile.in | 1 - hal/Hal.cpp | 47 ----- hal/Hal.h | 33 ---- hal/HalInternal.h | 10 - hal/Makefile.in | 5 - hal/android/AndroidHal.cpp | 36 ---- hal/fallback/ScreenOrientationFallback.cpp | 45 ----- hal/sandbox/PHal.ipdl | 10 +- hal/sandbox/SandboxHal.cpp | 48 ----- layout/base/nsLayoutUtils.cpp | 4 +- layout/base/nsLayoutUtils.h | 4 +- mobile/android/base/GeckoApp.java | 3 - mobile/android/base/GeckoAppShell.java | 12 -- mobile/android/base/GeckoEvent.java | 8 - .../base/GeckoScreenOrientationListener.java | 122 ------------ mobile/android/base/Makefile.in | 1 - widget/android/AndroidBridge.cpp | 26 --- widget/android/AndroidBridge.h | 13 -- widget/android/AndroidJavaWrappers.cpp | 7 - widget/android/AndroidJavaWrappers.h | 5 - widget/android/nsAppShell.cpp | 7 - 33 files changed, 61 insertions(+), 832 deletions(-) delete mode 100644 dom/base/ScreenOrientation.h delete mode 100644 embedding/android/GeckoScreenOrientationListener.java delete mode 100644 hal/fallback/ScreenOrientationFallback.cpp delete mode 100644 mobile/android/base/GeckoScreenOrientationListener.java diff --git a/dom/base/Makefile.in b/dom/base/Makefile.in index 5ff5a8b85bd..74867bd35a4 100644 --- a/dom/base/Makefile.in +++ b/dom/base/Makefile.in @@ -106,7 +106,6 @@ EXPORTS_NAMESPACES = mozilla/dom EXPORTS_mozilla/dom = \ DOMError.h \ StructuredCloneTags.h \ - ScreenOrientation.h \ $(NULL) CPPSRCS = \ diff --git a/dom/base/ScreenOrientation.h b/dom/base/ScreenOrientation.h deleted file mode 100644 index 938d171a6d6..00000000000 --- a/dom/base/ScreenOrientation.h +++ /dev/null @@ -1,62 +0,0 @@ -/* 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/. */ - -#ifndef mozilla_dom_ScreenOrientation_h -#define mozilla_dom_ScreenOrientation_h - -namespace mozilla { -namespace dom { - -// Make sure that any change here is also made in -// * mobile/android/base/GeckoScreenOrientationListener.java -// * embedding/android/GeckoScreenOrientationListener.java -enum ScreenOrientation { - eScreenOrientation_Current = 0, - eScreenOrientation_PortraitPrimary = 1, // 00000001 - eScreenOrientation_PortraitSecondary = 2, // 00000010 - eScreenOrientation_Portrait = 3, // 00000011 - eScreenOrientation_LandscapePrimary = 4, // 00000100 - eScreenOrientation_LandscapeSecondary = 8, // 00001000 - eScreenOrientation_Landscape = 12, // 00001100 - eScreenOrientation_EndGuard -}; - -/** - * ScreenOrientationWrapper is a class wrapping ScreenOrientation so it can be - * used with Observer which is taking a class, not an enum. - * C++11 should make this useless. - */ -class ScreenOrientationWrapper { -public: - ScreenOrientationWrapper() - : orientation(eScreenOrientation_Current) - {} - - ScreenOrientationWrapper(ScreenOrientation aOrientation) - : orientation(aOrientation) - {} - - ScreenOrientation orientation; -}; - -} // namespace dom -} // namespace mozilla - -namespace IPC { - -/** - * Screen orientation serializer. - * Note that technically, 5, 6, 7, 9, 10 and 11 are illegal values but will - * not make the serializer to fail. We might want to write our own serializer. - */ -template <> -struct ParamTraits - : public EnumSerializer -{}; - -} // namespace IPC - -#endif // mozilla_dom_ScreenOrientation_h diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 5bc00336d2b..d0a57442623 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2466,7 +2466,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen) DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index e91f1c085a1..3979a866b15 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1312,11 +1312,6 @@ nsGlobalWindow::FreeInnerObjects(bool aClearScope) mNavigator = nsnull; } - if (mScreen) { - mScreen->Invalidate(); - mScreen = nsnull; - } - if (mDocument) { NS_ASSERTION(mDoc, "Why is mDoc null?"); @@ -2497,6 +2492,8 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell) if (mFrames) mFrames->SetDocShell(aDocShell); + if (mScreen) + mScreen->SetDocShell(aDocShell); if (!mDocShell) { MaybeForgiveSpamCount(); @@ -3004,14 +3001,14 @@ nsGlobalWindow::GetNavigator(nsIDOMNavigator** aNavigator) NS_IMETHODIMP nsGlobalWindow::GetScreen(nsIDOMScreen** aScreen) { - FORWARD_TO_INNER(GetScreen, (aScreen), NS_ERROR_NOT_INITIALIZED); + FORWARD_TO_OUTER(GetScreen, (aScreen), NS_ERROR_NOT_INITIALIZED); *aScreen = nsnull; - if (!mScreen) { - mScreen = nsScreen::Create(this); + if (!mScreen && mDocShell) { + mScreen = new nsScreen(mDocShell); if (!mScreen) { - return NS_ERROR_UNEXPECTED; + return NS_ERROR_OUT_OF_MEMORY; } } diff --git a/dom/base/nsScreen.cpp b/dom/base/nsScreen.cpp index 68a88af8788..cb7560fd8c7 100644 --- a/dom/base/nsScreen.cpp +++ b/dom/base/nsScreen.cpp @@ -46,32 +46,13 @@ #include "nsIDocShellTreeItem.h" #include "nsLayoutUtils.h" #include "mozilla/Preferences.h" -#include "nsDOMEvent.h" using namespace mozilla; -using namespace mozilla::dom; /* static */ bool nsScreen::sInitialized = false; /* static */ bool nsScreen::sAllowScreenEnabledProperty = false; /* static */ bool nsScreen::sAllowScreenBrightnessProperty = false; -namespace { - -bool -IsChromeType(nsIDocShell *aDocShell) -{ - nsCOMPtr ds = do_QueryInterface(aDocShell); - if (!ds) { - return false; - } - - PRInt32 itemType; - ds->GetItemType(&itemType); - return itemType == nsIDocShellTreeItem::typeChrome; -} - -} // anonymous namespace - /* static */ void nsScreen::Initialize() { @@ -83,75 +64,42 @@ nsScreen::Initialize() "dom.screenBrightnessProperty.enabled"); } -void -nsScreen::Invalidate() -{ - hal::UnregisterScreenOrientationObserver(this); -} - -/* static */ already_AddRefed -nsScreen::Create(nsPIDOMWindow* aWindow) +// +// Screen class implementation +// +nsScreen::nsScreen(nsIDocShell* aDocShell) + : mDocShell(aDocShell) { if (!sInitialized) { Initialize(); } - - if (!aWindow->GetDocShell()) { - return nsnull; - } - - nsRefPtr screen = new nsScreen(); - - nsCOMPtr sgo = do_QueryInterface(aWindow); - NS_ENSURE_TRUE(sgo, nsnull); - - nsCOMPtr scriptContext = sgo->GetContext(); - NS_ENSURE_TRUE(scriptContext, nsnull); - - screen->mOwner = aWindow; - screen->mScriptContext.swap(scriptContext); - screen->mIsChrome = IsChromeType(aWindow->GetDocShell()); - - hal::RegisterScreenOrientationObserver(screen); - hal::GetCurrentScreenOrientation(&(screen->mOrientation)); - - return screen.forget(); -} - -nsScreen::nsScreen() -{ } nsScreen::~nsScreen() { - Invalidate(); } + DOMCI_DATA(Screen, nsScreen) -NS_IMPL_CYCLE_COLLECTION_CLASS(nsScreen) - -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsScreen, - nsDOMEventTargetWrapperCache) - NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(mozorientationchange) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END - -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsScreen, - nsDOMEventTargetWrapperCache) - NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(mozorientationchange) -NS_IMPL_CYCLE_COLLECTION_UNLINK_END - // QueryInterface implementation for nsScreen -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsScreen) +NS_INTERFACE_MAP_BEGIN(nsScreen) + NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsIDOMScreen) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMScreen) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Screen) -NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache) +NS_INTERFACE_MAP_END -NS_IMPL_ADDREF_INHERITED(nsScreen, nsDOMEventTargetWrapperCache) -NS_IMPL_RELEASE_INHERITED(nsScreen, nsDOMEventTargetWrapperCache) -NS_IMPL_EVENT_HANDLER(nsScreen, mozorientationchange) +NS_IMPL_ADDREF(nsScreen) +NS_IMPL_RELEASE(nsScreen) + + +NS_IMETHODIMP +nsScreen::SetDocShell(nsIDocShell* aDocShell) +{ + mDocShell = aDocShell; // Weak Reference + return NS_OK; +} NS_IMETHODIMP nsScreen::GetTop(PRInt32* aTop) @@ -271,7 +219,7 @@ nsScreen::GetAvailTop(PRInt32* aAvailTop) nsDeviceContext* nsScreen::GetDeviceContext() { - return nsLayoutUtils::GetDeviceContextForScreenInfo(mOwner); + return nsLayoutUtils::GetDeviceContextForScreenInfo(mDocShell); } nsresult @@ -312,10 +260,27 @@ nsScreen::GetAvailRect(nsRect& aRect) return NS_OK; } +namespace { + +bool +IsChromeType(nsIDocShell *aDocShell) +{ + nsCOMPtr ds = do_QueryInterface(aDocShell); + if (!ds) { + return false; + } + + PRInt32 itemType; + ds->GetItemType(&itemType); + return itemType == nsIDocShellTreeItem::typeChrome; +} + +} // anonymous namespace + nsresult nsScreen::GetMozEnabled(bool *aEnabled) { - if (!sAllowScreenEnabledProperty || mIsChrome) { + if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) { *aEnabled = true; return NS_OK; } @@ -327,7 +292,7 @@ nsScreen::GetMozEnabled(bool *aEnabled) nsresult nsScreen::SetMozEnabled(bool aEnabled) { - if (!sAllowScreenEnabledProperty || mIsChrome) { + if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) { return NS_OK; } @@ -340,7 +305,7 @@ nsScreen::SetMozEnabled(bool aEnabled) nsresult nsScreen::GetMozBrightness(double *aBrightness) { - if (!sAllowScreenBrightnessProperty || mIsChrome) { + if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) { *aBrightness = 1; return NS_OK; } @@ -352,7 +317,7 @@ nsScreen::GetMozBrightness(double *aBrightness) nsresult nsScreen::SetMozBrightness(double aBrightness) { - if (!sAllowScreenBrightnessProperty || mIsChrome) { + if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) { return NS_OK; } @@ -360,63 +325,3 @@ nsScreen::SetMozBrightness(double aBrightness) hal::SetScreenBrightness(aBrightness); return NS_OK; } - -void -nsScreen::Notify(const ScreenOrientationWrapper& aOrientation) -{ - ScreenOrientation previousOrientation = mOrientation; - mOrientation = aOrientation.orientation; - - NS_ASSERTION(mOrientation != eScreenOrientation_Current && - mOrientation != eScreenOrientation_EndGuard && - mOrientation != eScreenOrientation_Portrait && - mOrientation != eScreenOrientation_Landscape, - "Invalid orientation value passed to notify method!"); - - if (mOrientation != previousOrientation) { - // TODO: use an helper method, see bug 720768. - nsRefPtr event = new nsDOMEvent(nsnull, nsnull); - nsresult rv = event->InitEvent(NS_LITERAL_STRING("mozorientationchange"), false, false); - if (NS_FAILED(rv)) { - return; - } - - rv = event->SetTrusted(true); - if (NS_FAILED(rv)) { - return; - } - - bool dummy; - rv = DispatchEvent(event, &dummy); - if (NS_FAILED(rv)) { - return; - } - } -} - -NS_IMETHODIMP -nsScreen::GetMozOrientation(nsAString& aOrientation) -{ - switch (mOrientation) { - case eScreenOrientation_Current: - case eScreenOrientation_EndGuard: - case eScreenOrientation_Portrait: - case eScreenOrientation_Landscape: - NS_ASSERTION(false, "Shouldn't be used when getting value!"); - return NS_ERROR_FAILURE; - case eScreenOrientation_PortraitPrimary: - aOrientation.AssignLiteral("portrait-primary"); - break; - case eScreenOrientation_PortraitSecondary: - aOrientation.AssignLiteral("portrait-secondary"); - break; - case eScreenOrientation_LandscapePrimary: - aOrientation.AssignLiteral("landscape-primary"); - break; - case eScreenOrientation_LandscapeSecondary: - aOrientation.AssignLiteral("landscape-secondary"); - break; - } - - return NS_OK; -} diff --git a/dom/base/nsScreen.h b/dom/base/nsScreen.h index 8dc79dcd482..288ab7cfc21 100644 --- a/dom/base/nsScreen.h +++ b/dom/base/nsScreen.h @@ -37,58 +37,40 @@ #ifndef nsScreen_h___ #define nsScreen_h___ -#include "mozilla/Hal.h" #include "nsIDOMScreen.h" #include "nsISupports.h" #include "nsIScriptContext.h" #include "nsCOMPtr.h" -#include "mozilla/dom/ScreenOrientation.h" -#include "nsDOMEventTargetWrapperCache.h" -#include "mozilla/Observer.h" class nsIDocShell; class nsDeviceContext; struct nsRect; // Script "screen" object -class nsScreen : public nsDOMEventTargetWrapperCache - , public nsIDOMScreen - , public mozilla::hal::ScreenOrientationObserver +class nsScreen : public nsIDOMScreen { public: - static already_AddRefed Create(nsPIDOMWindow* aWindow); + nsScreen(nsIDocShell* aDocShell); + virtual ~nsScreen(); - void Invalidate(); + NS_IMETHOD SetDocShell(nsIDocShell* aDocShell); NS_DECL_ISUPPORTS NS_DECL_NSIDOMSCREEN - NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::) - - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsScreen, - nsDOMEventTargetWrapperCache) - - void Notify(const mozilla::dom::ScreenOrientationWrapper& aOrientation); protected: nsDeviceContext* GetDeviceContext(); nsresult GetRect(nsRect& aRect); nsresult GetAvailRect(nsRect& aRect); - bool mIsChrome; - - mozilla::dom::ScreenOrientation mOrientation; + nsIDocShell* mDocShell; // Weak Reference private: - nsScreen(); - virtual ~nsScreen(); - static bool sInitialized; static bool sAllowScreenEnabledProperty; static bool sAllowScreenBrightnessProperty; static void Initialize(); - - NS_DECL_EVENT_HANDLER(mozorientationchange) }; #endif /* nsScreen_h___ */ diff --git a/dom/interfaces/base/Makefile.in b/dom/interfaces/base/Makefile.in index b15eb6e987c..6db3e981e18 100644 --- a/dom/interfaces/base/Makefile.in +++ b/dom/interfaces/base/Makefile.in @@ -91,5 +91,3 @@ XPIDLSRCS = \ $(NULL) include $(topsrcdir)/config/rules.mk - -XPIDL_FLAGS += -I$(topsrcdir)/dom/interfaces/events/ diff --git a/dom/interfaces/base/nsIDOMScreen.idl b/dom/interfaces/base/nsIDOMScreen.idl index cb158ffc772..14cd6d1e184 100644 --- a/dom/interfaces/base/nsIDOMScreen.idl +++ b/dom/interfaces/base/nsIDOMScreen.idl @@ -37,10 +37,10 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMEventTarget.idl" +#include "domstubs.idl" -[scriptable, uuid(6366afc9-0072-4231-a4ec-98cd65f350ef)] -interface nsIDOMScreen : nsIDOMEventTarget +[scriptable, uuid(4507e43f-097c-452a-bfc4-dbb99748f6fd)] +interface nsIDOMScreen : nsISupports { readonly attribute long top; readonly attribute long left; @@ -75,13 +75,4 @@ interface nsIDOMScreen : nsIDOMEventTarget * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1]. */ attribute double mozBrightness; - - /** - * Returns the current screen orientation. - * Can be: landscape-primary, landscape-secondary, - * portrait-primary or portrait-secondary. - */ - readonly attribute DOMString mozOrientation; - - attribute nsIDOMEventListener onmozorientationchange; }; diff --git a/embedding/android/GeckoApp.java b/embedding/android/GeckoApp.java index 6af74e62b9a..6761b905b6d 100644 --- a/embedding/android/GeckoApp.java +++ b/embedding/android/GeckoApp.java @@ -512,7 +512,6 @@ abstract public class GeckoApp unregisterReceiver(mConnectivityReceiver); GeckoNetworkManager.getInstance().stop(); - GeckoScreenOrientationListener.getInstance().stop(); } @Override @@ -532,7 +531,6 @@ abstract public class GeckoApp registerReceiver(mConnectivityReceiver, mConnectivityFilter); GeckoNetworkManager.getInstance().start(); - GeckoScreenOrientationListener.getInstance().start(); } @Override @@ -588,7 +586,6 @@ abstract public class GeckoApp } GeckoNetworkManager.getInstance().stop(); - GeckoScreenOrientationListener.getInstance().stop(); super.onDestroy(); diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index f6fb96e0182..5561f8f196f 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -1829,16 +1829,4 @@ public class GeckoAppShell // This is only used in Native Fennec. public static void setPreventPanning(final boolean aPreventPanning) { } - - public static short getScreenOrientation() { - return GeckoScreenOrientationListener.getInstance().getScreenOrientation(); - } - - public static void enableScreenOrientationNotifications() { - GeckoScreenOrientationListener.getInstance().enableNotifications(); - } - - public static void disableScreenOrientationNotifications() { - GeckoScreenOrientationListener.getInstance().disableNotifications(); - } } diff --git a/embedding/android/GeckoEvent.java b/embedding/android/GeckoEvent.java index 7a92b9079bd..c3f4e892b51 100644 --- a/embedding/android/GeckoEvent.java +++ b/embedding/android/GeckoEvent.java @@ -80,7 +80,6 @@ public class GeckoEvent { public static final int VISITED = 21; public static final int NETWORK_CHANGED = 22; public static final int PROXIMITY_EVENT = 23; - public static final int SCREENORIENTATION_CHANGED = 24; public static final int IME_COMPOSITION_END = 0; public static final int IME_COMPOSITION_BEGIN = 1; @@ -127,8 +126,6 @@ public class GeckoEvent { public double mBandwidth; public boolean mCanBeMetered; - public short mScreenOrientation; - public int mNativeWindow; public GeckoEvent() { @@ -337,9 +334,4 @@ public class GeckoEvent { mBandwidth = bandwidth; mCanBeMetered = canBeMetered; } - - public GeckoEvent(short aScreenOrientation) { - mType = SCREENORIENTATION_CHANGED; - mScreenOrientation = aScreenOrientation; - } } diff --git a/embedding/android/GeckoScreenOrientationListener.java b/embedding/android/GeckoScreenOrientationListener.java deleted file mode 100644 index 440833db7d7..00000000000 --- a/embedding/android/GeckoScreenOrientationListener.java +++ /dev/null @@ -1,122 +0,0 @@ -/* 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/. */ - -package org.mozilla.gecko; - -import android.content.Context; -import android.util.Log; -import android.view.OrientationEventListener; -import android.view.Surface; - -public class GeckoScreenOrientationListener -{ - static class OrientationEventListenerImpl extends OrientationEventListener { - public OrientationEventListenerImpl(Context c) { - super(c); - } - - @Override - public void onOrientationChanged(int aOrientation) { - GeckoScreenOrientationListener.getInstance().updateScreenOrientation(); - } - } - - static private GeckoScreenOrientationListener sInstance = null; - - // Make sure that any change in dom/base/ScreenOrientation.h happens here too. - static public final short eScreenOrientation_PortraitPrimary = 1; - static public final short eScreenOrientation_PortraitSecondary = 2; - static public final short eScreenOrientation_LandscapePrimary = 4; - static public final short eScreenOrientation_LandscapeSecondary = 8; - - private short mOrientation; - private OrientationEventListenerImpl mListener = null; - - // Whether the listener should be listening to changes. - private boolean mShouldBeListening = false; - // Whether the listener should notify Gecko that a change happened. - private boolean mShouldNotify = false; - - private GeckoScreenOrientationListener() { - mListener = new OrientationEventListenerImpl(GeckoApp.mAppContext); - } - - public static GeckoScreenOrientationListener getInstance() { - if (sInstance == null) { - sInstance = new GeckoScreenOrientationListener(); - } - - return sInstance; - } - - public void start() { - mShouldBeListening = true; - updateScreenOrientation(); - - if (mShouldNotify) { - startListening(); - } - } - - public void stop() { - mShouldBeListening = false; - - if (mShouldNotify) { - stopListening(); - } - } - - public void enableNotifications() { - updateScreenOrientation(); - mShouldNotify = true; - - if (mShouldBeListening) { - startListening(); - } - } - - public void disableNotifications() { - mShouldNotify = false; - - if (mShouldBeListening) { - stopListening(); - } - } - - private void startListening() { - mListener.enable(); - } - - private void stopListening() { - mListener.disable(); - } - - // NOTE: this is public so OrientationEventListenerImpl can access it. - // Unfortunately, Java doesn't know about friendship. - public void updateScreenOrientation() { - int rotation = GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getRotation(); - short previousOrientation = mOrientation; - - if (rotation == Surface.ROTATION_0) { - mOrientation = eScreenOrientation_PortraitPrimary; - } else if (rotation == Surface.ROTATION_180) { - mOrientation = eScreenOrientation_PortraitSecondary; - } else if (rotation == Surface.ROTATION_270) { - mOrientation = eScreenOrientation_LandscapeSecondary; - } else if (rotation == Surface.ROTATION_90) { - mOrientation = eScreenOrientation_LandscapePrimary; - } else { - Log.e("GeckoScreenOrientationListener", "Unexpected value received! (" + rotation + ")"); - return; - } - - if (mShouldNotify && mOrientation != previousOrientation) { - GeckoAppShell.sendEventToGecko(new GeckoEvent(mOrientation)); - } - } - - public short getScreenOrientation() { - return mOrientation; - } -} diff --git a/embedding/android/Makefile.in b/embedding/android/Makefile.in index b5b8c58d447..27dd67bbfd0 100644 --- a/embedding/android/Makefile.in +++ b/embedding/android/Makefile.in @@ -57,7 +57,6 @@ JAVAFILES = \ GeckoBatteryManager.java \ VideoPlayer.java \ GeckoNetworkManager.java \ - GeckoScreenOrientationListener.java \ $(NULL) ifdef MOZ_WEBSMS_BACKEND diff --git a/hal/Hal.cpp b/hal/Hal.cpp index 6166e7fae8b..de985bc9d09 100644 --- a/hal/Hal.cpp +++ b/hal/Hal.cpp @@ -25,7 +25,6 @@ #include "nsIDocShell.h" #include "mozilla/ClearOnShutdown.h" #include "WindowIdentifier.h" -#include "mozilla/dom/ScreenOrientation.h" using namespace mozilla::services; @@ -265,24 +264,6 @@ protected: static NetworkObserversManager sNetworkObservers; -class ScreenOrientationObserversManager : public ObserversManager -{ -protected: - void EnableNotifications() { - PROXY_IF_SANDBOXED(EnableScreenOrientationNotifications()); - } - - void DisableNotifications() { - PROXY_IF_SANDBOXED(DisableScreenOrientationNotifications()); - } - - void GetCurrentInformationInternal(dom::ScreenOrientationWrapper* aInfo) { - PROXY_IF_SANDBOXED(GetCurrentScreenOrientation(&(aInfo->orientation))); - } -}; - -static ScreenOrientationObserversManager sScreenOrientationObservers; - void RegisterBatteryObserver(BatteryObserver* aObserver) { @@ -445,33 +426,5 @@ void PowerOff() PROXY_IF_SANDBOXED(PowerOff()); } -void -RegisterScreenOrientationObserver(hal::ScreenOrientationObserver* aObserver) -{ - AssertMainThread(); - sScreenOrientationObservers.AddObserver(aObserver); -} - -void -UnregisterScreenOrientationObserver(hal::ScreenOrientationObserver* aObserver) -{ - AssertMainThread(); - sScreenOrientationObservers.RemoveObserver(aObserver); -} - -void -GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation) -{ - AssertMainThread(); - *aScreenOrientation = sScreenOrientationObservers.GetCurrentInformation().orientation; -} - -void -NotifyScreenOrientationChange(const dom::ScreenOrientation& aScreenOrientation) -{ - sScreenOrientationObservers.CacheInformation(dom::ScreenOrientationWrapper(aScreenOrientation)); - sScreenOrientationObservers.BroadcastCachedInformation(); -} - } // namespace hal } // namespace mozilla diff --git a/hal/Hal.h b/hal/Hal.h index 11149af3ef0..15e859f0999 100644 --- a/hal/Hal.h +++ b/hal/Hal.h @@ -21,7 +21,6 @@ #include "mozilla/dom/battery/Types.h" #include "mozilla/dom/network/Types.h" #include "mozilla/hal_sandbox/PHal.h" -#include "mozilla/dom/ScreenOrientation.h" /* * Hal.h contains the public Hal API. @@ -42,17 +41,8 @@ class nsIDOMWindow; namespace mozilla { -template -class Observer; - -namespace dom { -class ScreenOrientationWrapper; -} - namespace hal { -typedef Observer ScreenOrientationObserver; - class WindowIdentifier; extern PRLogModuleInfo *sHalLog; @@ -243,29 +233,6 @@ void Reboot(); */ void PowerOff(); -/** - * Inform the backend there is a new screen orientation observer. - * @param aScreenOrientationObserver The observer that should be added. - */ -void RegisterScreenOrientationObserver(hal::ScreenOrientationObserver* aScreenOrientationObserver); - -/** - * Inform the backend a screen orientation observer unregistered. - * @param aScreenOrientationObserver The observer that should be removed. - */ -void UnregisterScreenOrientationObserver(hal::ScreenOrientationObserver* aScreenOrientationObserver); - -/** - * Returns the current screen orientation. - */ -void GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation); - -/** - * Notify of a change in the screen orientation. - * @param aScreenOrientation The new screen orientation. - */ -void NotifyScreenOrientationChange(const dom::ScreenOrientation& aScreenOrientation); - } // namespace MOZ_HAL_NAMESPACE } // namespace mozilla diff --git a/hal/HalInternal.h b/hal/HalInternal.h index ca7c544f705..390e5f42dad 100644 --- a/hal/HalInternal.h +++ b/hal/HalInternal.h @@ -77,16 +77,6 @@ void EnableNetworkNotifications(); */ void DisableNetworkNotifications(); -/** - * Enables screen orientation notifications from the backend. - */ -void EnableScreenOrientationNotifications(); - -/** - * Disables screen orientation notifications from the backend. - */ -void DisableScreenOrientationNotifications(); - } // namespace MOZ_HAL_NAMESPACE } // namespace mozilla diff --git a/hal/Makefile.in b/hal/Makefile.in index 637c62f80f7..11194a24b52 100644 --- a/hal/Makefile.in +++ b/hal/Makefile.in @@ -108,11 +108,6 @@ ifneq (gonk,$(MOZ_WIDGET_TOOLKIT)) #{ CPPSRCS += FallbackLights.cpp endif #} -# Screen Orientation backend -ifneq (android,$(MOZ_WIDGET_TOOLKIT)) -CPPSRCS += ScreenOrientationFallback.cpp -endif - include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk include $(topsrcdir)/config/rules.mk diff --git a/hal/android/AndroidHal.cpp b/hal/android/AndroidHal.cpp index 17d6258505f..42f3125d129 100644 --- a/hal/android/AndroidHal.cpp +++ b/hal/android/AndroidHal.cpp @@ -40,7 +40,6 @@ #include "WindowIdentifier.h" #include "AndroidBridge.h" #include "mozilla/dom/network/Constants.h" -#include "mozilla/dom/ScreenOrientation.h" using mozilla::hal::WindowIdentifier; @@ -182,41 +181,6 @@ void PowerOff() {} -void -EnableScreenOrientationNotifications() -{ - AndroidBridge* bridge = AndroidBridge::Bridge(); - if (!bridge) { - return; - } - - bridge->EnableScreenOrientationNotifications(); -} - -void -DisableScreenOrientationNotifications() -{ - AndroidBridge* bridge = AndroidBridge::Bridge(); - if (!bridge) { - return; - } - - bridge->DisableScreenOrientationNotifications(); -} - -void -GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation) -{ - AndroidBridge* bridge = AndroidBridge::Bridge(); - if (!bridge) { - return; - } - - dom::ScreenOrientationWrapper orientationWrapper; - bridge->GetScreenOrientation(orientationWrapper); - *aScreenOrientation = orientationWrapper.orientation; -} - } // hal_impl } // mozilla diff --git a/hal/fallback/ScreenOrientationFallback.cpp b/hal/fallback/ScreenOrientationFallback.cpp deleted file mode 100644 index c1009946401..00000000000 --- a/hal/fallback/ScreenOrientationFallback.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* 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/. */ - -#include "Hal.h" -#include "mozilla/dom/ScreenOrientation.h" -#include "nsIScreenManager.h" - -namespace mozilla { -namespace hal_impl { - -void -EnableScreenOrientationNotifications() -{ -} - -void -DisableScreenOrientationNotifications() -{ -} - -void -GetCurrentScreenOrientation(dom::ScreenOrientation* aScreenOrientation) -{ - nsresult result; - nsCOMPtr screenMgr = - do_GetService("@mozilla.org/gfx/screenmanager;1", &result); - if (NS_FAILED(result)) { - NS_ERROR("Can't find nsIScreenManager!"); - return; - } - - PRInt32 screenLeft, screenTop, screenWidth, screenHeight; - nsCOMPtr screen; - - screenMgr->GetPrimaryScreen(getter_AddRefs(screen)); - screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight); - - *aScreenOrientation = screenWidth >= screenHeight - ? dom::eScreenOrientation_LandscapePrimary - : dom::eScreenOrientation_PortraitPrimary; -} - -} // hal_impl -} // mozilla diff --git a/hal/sandbox/PHal.ipdl b/hal/sandbox/PHal.ipdl index 090b27c76a9..5cabfab9481 100644 --- a/hal/sandbox/PHal.ipdl +++ b/hal/sandbox/PHal.ipdl @@ -42,14 +42,12 @@ include protocol PBrowser; include "nspr/prtime.h"; include "mozilla/HalSensor.h"; include "mozilla/HalTypes.h"; -include "mozilla/dom/ScreenOrientation.h"; using PRTime; using mozilla::hal::FlashMode; using mozilla::hal::LightType; using mozilla::hal::LightMode; using mozilla::hal::SensorType; -using mozilla::dom::ScreenOrientation; namespace mozilla { @@ -74,7 +72,9 @@ namespace hal { PRTime timestamp; float[] values; }; +} +namespace hal { struct NetworkInformation { double bandwidth; bool canBeMetered; @@ -89,7 +89,6 @@ sync protocol PHal { child: NotifyBatteryChange(BatteryInformation aBatteryInfo); NotifyNetworkChange(NetworkInformation aNetworkInfo); - NotifyScreenOrientationChange(ScreenOrientation aScreenOrientation); parent: Vibrate(uint32[] pattern, uint64[] id, PBrowser browser); @@ -119,11 +118,6 @@ parent: Reboot(); PowerOff(); - EnableScreenOrientationNotifications(); - DisableScreenOrientationNotifications(); - sync GetCurrentScreenOrientation() - returns (ScreenOrientation aScreenOrientation); - child: NotifySensorChange(SensorData aSensorData); diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp index d59b6be1485..9e121332b5e 100644 --- a/hal/sandbox/SandboxHal.cpp +++ b/hal/sandbox/SandboxHal.cpp @@ -18,7 +18,6 @@ #include "mozilla/dom/TabChild.h" #include "mozilla/dom/battery/Types.h" #include "mozilla/dom/network/Types.h" -#include "mozilla/dom/ScreenOrientation.h" #include "mozilla/Observer.h" #include "mozilla/unused.h" #include "WindowIdentifier.h" @@ -98,24 +97,6 @@ GetCurrentNetworkInformation(NetworkInformation* aNetworkInfo) Hal()->SendGetCurrentNetworkInformation(aNetworkInfo); } -void -EnableScreenOrientationNotifications() -{ - Hal()->SendEnableScreenOrientationNotifications(); -} - -void -DisableScreenOrientationNotifications() -{ - Hal()->SendDisableScreenOrientationNotifications(); -} - -void -GetCurrentScreenOrientation(ScreenOrientation* aScreenOrientation) -{ - Hal()->SendGetCurrentScreenOrientation(aScreenOrientation); -} - bool GetScreenEnabled() { @@ -186,7 +167,6 @@ class HalParent : public PHalParent , public BatteryObserver , public NetworkObserver , public ISensorObserver - , public ScreenOrientationObserver { public: NS_OVERRIDE virtual bool @@ -272,28 +252,6 @@ public: unused << SendNotifyNetworkChange(aNetworkInfo); } - NS_OVERRIDE virtual bool - RecvEnableScreenOrientationNotifications() { - hal::RegisterScreenOrientationObserver(this); - return true; - } - - NS_OVERRIDE virtual bool - RecvDisableScreenOrientationNotifications() { - hal::UnregisterScreenOrientationObserver(this); - return true; - } - - NS_OVERRIDE virtual bool - RecvGetCurrentScreenOrientation(ScreenOrientation* aScreenOrientation) { - hal::GetCurrentScreenOrientation(aScreenOrientation); - return true; - } - - void Notify(const ScreenOrientationWrapper& aScreenOrientation) { - unused << SendNotifyScreenOrientationChange(aScreenOrientation.orientation); - } - NS_OVERRIDE virtual bool RecvGetScreenEnabled(bool *enabled) { @@ -383,12 +341,6 @@ public: hal::NotifyNetworkChange(aNetworkInfo); return true; } - - NS_OVERRIDE virtual bool - RecvNotifyScreenOrientationChange(const ScreenOrientation& aScreenOrientation) { - hal::NotifyScreenOrientationChange(aScreenOrientation); - return true; - } }; bool diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index edb38aba4b6..384458b20c4 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -4005,9 +4005,9 @@ nsLayoutUtils::GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2, } nsDeviceContext* -nsLayoutUtils::GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow) +nsLayoutUtils::GetDeviceContextForScreenInfo(nsIDocShell* aDocShell) { - nsCOMPtr docShell = aWindow->GetDocShell(); + nsCOMPtr docShell = aDocShell; while (docShell) { // Now make sure our size is up to date. That will mean that the device // context does the right thing on multi-monitor systems when we return it to diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 737be3a6548..76621a2c82d 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1330,11 +1330,11 @@ public: /** * Get a device context that can be used to get up-to-date device - * dimensions for the given window. For some reason, this is more + * dimensions for the given docshell. For some reason, this is more * complicated than it ought to be in multi-monitor situations. */ static nsDeviceContext* - GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow); + GetDeviceContextForScreenInfo(nsIDocShell* aDocShell); /** * Some frames with 'position: fixed' (nsStylePosition::mDisplay == diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index dffdd4e4d19..ca8ad2775fb 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -2060,7 +2060,6 @@ abstract public class GeckoApp unregisterReceiver(mConnectivityReceiver); GeckoNetworkManager.getInstance().stop(); - GeckoScreenOrientationListener.getInstance().stop(); } @Override @@ -2086,7 +2085,6 @@ abstract public class GeckoApp registerReceiver(mConnectivityReceiver, mConnectivityFilter); GeckoNetworkManager.getInstance().start(); - GeckoScreenOrientationListener.getInstance().start(); if (mOwnActivityDepth > 0) mOwnActivityDepth--; @@ -2171,7 +2169,6 @@ abstract public class GeckoApp } GeckoNetworkManager.getInstance().stop(); - GeckoScreenOrientationListener.getInstance().stop(); super.onDestroy(); diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 204d3c6a5fc..1ac7748ad7f 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -1976,16 +1976,4 @@ public class GeckoAppShell public static byte[] decodeBase64(String s, int flags) { return decodeBase64(s.getBytes(), flags); } - - public static short getScreenOrientation() { - return GeckoScreenOrientationListener.getInstance().getScreenOrientation(); - } - - public static void enableScreenOrientationNotifications() { - GeckoScreenOrientationListener.getInstance().enableNotifications(); - } - - public static void disableScreenOrientationNotifications() { - GeckoScreenOrientationListener.getInstance().disableNotifications(); - } } diff --git a/mobile/android/base/GeckoEvent.java b/mobile/android/base/GeckoEvent.java index cff45e8f07b..9643da4181d 100644 --- a/mobile/android/base/GeckoEvent.java +++ b/mobile/android/base/GeckoEvent.java @@ -87,7 +87,6 @@ public class GeckoEvent { public static final int VISITED = 21; public static final int NETWORK_CHANGED = 22; public static final int PROXIMITY_EVENT = 23; - public static final int SCREENORIENTATION_CHANGED = 24; public static final int IME_COMPOSITION_END = 0; public static final int IME_COMPOSITION_BEGIN = 1; @@ -134,8 +133,6 @@ public class GeckoEvent { public double mBandwidth; public boolean mCanBeMetered; - public short mScreenOrientation; - public int mNativeWindow; public GeckoEvent() { @@ -362,9 +359,4 @@ public class GeckoEvent { mBandwidth = bandwidth; mCanBeMetered = canBeMetered; } - - public GeckoEvent(short aScreenOrientation) { - mType = SCREENORIENTATION_CHANGED; - mScreenOrientation = aScreenOrientation; - } } diff --git a/mobile/android/base/GeckoScreenOrientationListener.java b/mobile/android/base/GeckoScreenOrientationListener.java deleted file mode 100644 index 440833db7d7..00000000000 --- a/mobile/android/base/GeckoScreenOrientationListener.java +++ /dev/null @@ -1,122 +0,0 @@ -/* 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/. */ - -package org.mozilla.gecko; - -import android.content.Context; -import android.util.Log; -import android.view.OrientationEventListener; -import android.view.Surface; - -public class GeckoScreenOrientationListener -{ - static class OrientationEventListenerImpl extends OrientationEventListener { - public OrientationEventListenerImpl(Context c) { - super(c); - } - - @Override - public void onOrientationChanged(int aOrientation) { - GeckoScreenOrientationListener.getInstance().updateScreenOrientation(); - } - } - - static private GeckoScreenOrientationListener sInstance = null; - - // Make sure that any change in dom/base/ScreenOrientation.h happens here too. - static public final short eScreenOrientation_PortraitPrimary = 1; - static public final short eScreenOrientation_PortraitSecondary = 2; - static public final short eScreenOrientation_LandscapePrimary = 4; - static public final short eScreenOrientation_LandscapeSecondary = 8; - - private short mOrientation; - private OrientationEventListenerImpl mListener = null; - - // Whether the listener should be listening to changes. - private boolean mShouldBeListening = false; - // Whether the listener should notify Gecko that a change happened. - private boolean mShouldNotify = false; - - private GeckoScreenOrientationListener() { - mListener = new OrientationEventListenerImpl(GeckoApp.mAppContext); - } - - public static GeckoScreenOrientationListener getInstance() { - if (sInstance == null) { - sInstance = new GeckoScreenOrientationListener(); - } - - return sInstance; - } - - public void start() { - mShouldBeListening = true; - updateScreenOrientation(); - - if (mShouldNotify) { - startListening(); - } - } - - public void stop() { - mShouldBeListening = false; - - if (mShouldNotify) { - stopListening(); - } - } - - public void enableNotifications() { - updateScreenOrientation(); - mShouldNotify = true; - - if (mShouldBeListening) { - startListening(); - } - } - - public void disableNotifications() { - mShouldNotify = false; - - if (mShouldBeListening) { - stopListening(); - } - } - - private void startListening() { - mListener.enable(); - } - - private void stopListening() { - mListener.disable(); - } - - // NOTE: this is public so OrientationEventListenerImpl can access it. - // Unfortunately, Java doesn't know about friendship. - public void updateScreenOrientation() { - int rotation = GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getRotation(); - short previousOrientation = mOrientation; - - if (rotation == Surface.ROTATION_0) { - mOrientation = eScreenOrientation_PortraitPrimary; - } else if (rotation == Surface.ROTATION_180) { - mOrientation = eScreenOrientation_PortraitSecondary; - } else if (rotation == Surface.ROTATION_270) { - mOrientation = eScreenOrientation_LandscapeSecondary; - } else if (rotation == Surface.ROTATION_90) { - mOrientation = eScreenOrientation_LandscapePrimary; - } else { - Log.e("GeckoScreenOrientationListener", "Unexpected value received! (" + rotation + ")"); - return; - } - - if (mShouldNotify && mOrientation != previousOrientation) { - GeckoAppShell.sendEventToGecko(new GeckoEvent(mOrientation)); - } - } - - public short getScreenOrientation() { - return mOrientation; - } -} diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index 1376b98e047..ae744bd52bf 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -136,7 +136,6 @@ FENNEC_JAVA_FILES = \ ui/SimpleScaleGestureDetector.java \ ui/SubdocumentScrollHelper.java \ GeckoNetworkManager.java \ - GeckoScreenOrientationListener.java \ $(NULL) ifdef MOZ_WEBSMS_BACKEND diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 1713348a8b7..c23928bb73d 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -51,7 +51,6 @@ #include "nsThreadUtils.h" #include "nsIThreadManager.h" #include "mozilla/dom/sms/PSms.h" -#include "mozilla/dom/ScreenOrientation.h" #ifdef DEBUG #define ALOG_BRIDGE(args...) ALOG(args) @@ -174,10 +173,6 @@ AndroidBridge::Init(JNIEnv *jEnv, jEnableNetworkNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableNetworkNotifications", "()V"); jDisableNetworkNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableNetworkNotifications", "()V"); - jGetScreenOrientation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getScreenOrientation", "()S"); - jEnableScreenOrientationNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableScreenOrientationNotifications", "()V"); - jDisableScreenOrientationNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableScreenOrientationNotifications", "()V"); - jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext")); jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10")); jEGLSurfaceImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLSurfaceImpl")); @@ -1964,24 +1959,3 @@ AndroidBridge::HideSurface(jobject surface) env->CallStaticVoidMethod(cls, method, surface); #endif } - -void -AndroidBridge::GetScreenOrientation(dom::ScreenOrientationWrapper& aOrientation) -{ - ALOG_BRIDGE("AndroidBridge::GetScreenOrientation"); - aOrientation.orientation = static_cast(mJNIEnv->CallStaticShortMethod(mGeckoAppShellClass, jGetScreenOrientation)); -} - -void -AndroidBridge::EnableScreenOrientationNotifications() -{ - ALOG_BRIDGE("AndroidBridge::EnableScreenOrientationNotifications"); - mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEnableScreenOrientationNotifications); -} - -void -AndroidBridge::DisableScreenOrientationNotifications() -{ - ALOG_BRIDGE("AndroidBridge::DisableScreenOrientationNotifications"); - mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jDisableScreenOrientationNotifications); -} diff --git a/widget/android/AndroidBridge.h b/widget/android/AndroidBridge.h index 39e987c09c0..faafc718419 100644 --- a/widget/android/AndroidBridge.h +++ b/widget/android/AndroidBridge.h @@ -79,7 +79,6 @@ class NetworkInformation; } // namespace hal namespace dom { -class ScreenOrientationWrapper; namespace sms { struct SmsFilterData; } // namespace sms @@ -389,14 +388,6 @@ public: void ShowSurface(jobject surface, const gfxRect& aRect, bool aInverted, bool aBlend); void HideSurface(jobject surface); - // This method doesn't take a ScreenOrientation because it's an enum and - // that would require including the header which requires include IPC - // headers which requires including basictypes.h which requires a lot of - // changes... - void GetScreenOrientation(dom::ScreenOrientationWrapper& aOrientation); - void EnableScreenOrientationNotifications(); - void DisableScreenOrientationNotifications(); - protected: static AndroidBridge *sBridge; @@ -496,10 +487,6 @@ protected: jmethodID jEnableNetworkNotifications; jmethodID jDisableNetworkNotifications; - jmethodID jGetScreenOrientation; - jmethodID jEnableScreenOrientationNotifications; - jmethodID jDisableScreenOrientationNotifications; - // stuff we need for CallEglCreateWindowSurface jclass jEGLSurfaceImplClass; jclass jEGLContextImplClass; diff --git a/widget/android/AndroidJavaWrappers.cpp b/widget/android/AndroidJavaWrappers.cpp index 03854717f3f..b56631b7b74 100644 --- a/widget/android/AndroidJavaWrappers.cpp +++ b/widget/android/AndroidJavaWrappers.cpp @@ -76,7 +76,6 @@ jfieldID AndroidGeckoEvent::jLocationField = 0; jfieldID AndroidGeckoEvent::jAddressField = 0; jfieldID AndroidGeckoEvent::jBandwidthField = 0; jfieldID AndroidGeckoEvent::jCanBeMeteredField = 0; -jfieldID AndroidGeckoEvent::jScreenOrientationField = 0; jclass AndroidPoint::jPointClass = 0; jfieldID AndroidPoint::jXField = 0; @@ -190,7 +189,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv) jAddressField = getField("mAddress", "Landroid/location/Address;"); jBandwidthField = getField("mBandwidth", "D"); jCanBeMeteredField = getField("mCanBeMetered", "Z"); - jScreenOrientationField = getField("mScreenOrientation", "S"); } void @@ -549,11 +547,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj) break; } - case SCREENORIENTATION_CHANGED: { - mScreenOrientation = jenv->GetShortField(jobj, jScreenOrientationField); - break; - } - default: break; } diff --git a/widget/android/AndroidJavaWrappers.h b/widget/android/AndroidJavaWrappers.h index 5d9cca38b1b..25fb45768c4 100644 --- a/widget/android/AndroidJavaWrappers.h +++ b/widget/android/AndroidJavaWrappers.h @@ -462,7 +462,6 @@ public: nsGeoPositionAddress* GeoAddress() { return mGeoAddress; } double Bandwidth() { return mBandwidth; } bool CanBeMetered() { return mCanBeMetered; } - short ScreenOrientation() { return mScreenOrientation; } protected: int mAction; @@ -488,7 +487,6 @@ protected: nsRefPtr mGeoAddress; double mBandwidth; bool mCanBeMetered; - short mScreenOrientation; void ReadIntArray(nsTArray &aVals, JNIEnv *jenv, @@ -544,8 +542,6 @@ protected: static jfieldID jBandwidthField; static jfieldID jCanBeMeteredField; - static jfieldID jScreenOrientationField; - public: enum { NATIVE_POKE = 0, @@ -571,7 +567,6 @@ public: VISITED = 21, NETWORK_CHANGED = 22, PROXIMITY_EVENT = 23, - SCREENORIENTATION_CHANGED = 24, dummy_java_enum_list_end }; diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 04635048691..581c21b9272 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -61,8 +61,6 @@ #include #include -#include "mozilla/dom/ScreenOrientation.h" - #ifdef MOZ_ANDROID_HISTORY #include "nsAndroidHistory.h" #endif @@ -485,11 +483,6 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) break; } - case AndroidGeckoEvent::SCREENORIENTATION_CHANGED: { - hal::NotifyScreenOrientationChange(static_cast(curEvent->ScreenOrientation())); - break; - } - default: nsWindow::OnGlobalAndroidEvent(curEvent); }