--- a/dom/base/Makefile.in
+++ b/dom/base/Makefile.in
@@ -101,17 +101,16 @@ EXPORTS = \
nsStructuredCloneContainer.h \
nsDOMMemoryReporter.h \
$(NULL)
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
DOMError.h \
StructuredCloneTags.h \
- ScreenOrientation.h \
$(NULL)
CPPSRCS = \
nsBarProps.cpp \
nsDOMException.cpp \
nsDOMWindowUtils.cpp \
nsJSEnvironment.cpp \
nsJSTimeoutHandler.cpp \
deleted file mode 100644
--- 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<T> 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<mozilla::dom::ScreenOrientation>
- : public EnumSerializer<mozilla::dom::ScreenOrientation,
- mozilla::dom::eScreenOrientation_Current,
- mozilla::dom::eScreenOrientation_EndGuard>
-{};
-
-} // namespace IPC
-
-#endif // mozilla_dom_ScreenOrientation_h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -2461,17 +2461,16 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Performance, nsIDOMPerformance,
!nsGlobalWindow::HasPerformanceSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformance)
DOM_CLASSINFO_MAP_END
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)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(DOMConstructor, nsIDOMDOMConstructor)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1307,21 +1307,16 @@ nsGlobalWindow::FreeInnerObjects(bool aC
mLocation = nsnull;
mHistory = nsnull;
if (mNavigator) {
mNavigator->Invalidate();
mNavigator = nsnull;
}
- if (mScreen) {
- mScreen->Invalidate();
- mScreen = nsnull;
- }
-
if (mDocument) {
NS_ASSERTION(mDoc, "Why is mDoc null?");
// Remember the document's principal.
mDocumentPrincipal = mDoc->NodePrincipal();
}
#ifdef DEBUG
@@ -2492,16 +2487,18 @@ nsGlobalWindow::SetDocShell(nsIDocShell*
}
mDocShell = aDocShell; // Weak Reference
NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");
if (mFrames)
mFrames->SetDocShell(aDocShell);
+ if (mScreen)
+ mScreen->SetDocShell(aDocShell);
if (!mDocShell) {
MaybeForgiveSpamCount();
CleanUp(false);
} else {
// Get our enclosing chrome shell and retrieve its global window impl, so
// that we can do some forwarding to the chrome document.
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
@@ -2999,24 +2996,24 @@ nsGlobalWindow::GetNavigator(nsIDOMNavig
NS_ADDREF(*aNavigator = mNavigator);
return NS_OK;
}
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;
}
}
NS_IF_ADDREF(*aScreen = mScreen);
return NS_OK;
}
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -41,122 +41,70 @@
#include "nsIDocShell.h"
#include "nsPresContext.h"
#include "nsCOMPtr.h"
#include "nsDOMClassInfoID.h"
#include "nsIInterfaceRequestorUtils.h"
#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<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell);
- if (!ds) {
- return false;
- }
-
- PRInt32 itemType;
- ds->GetItemType(&itemType);
- return itemType == nsIDocShellTreeItem::typeChrome;
-}
-
-} // anonymous namespace
-
/* static */ void
nsScreen::Initialize()
{
MOZ_ASSERT(!sInitialized);
sInitialized = true;
Preferences::AddBoolVarCache(&sAllowScreenEnabledProperty,
"dom.screenEnabledProperty.enabled");
Preferences::AddBoolVarCache(&sAllowScreenBrightnessProperty,
"dom.screenBrightnessProperty.enabled");
}
-void
-nsScreen::Invalidate()
-{
- hal::UnregisterScreenOrientationObserver(this);
-}
-
-/* static */ already_AddRefed<nsScreen>
-nsScreen::Create(nsPIDOMWindow* aWindow)
+//
+// Screen class implementation
+//
+nsScreen::nsScreen(nsIDocShell* aDocShell)
+ : mDocShell(aDocShell)
{
if (!sInitialized) {
Initialize();
}
-
- if (!aWindow->GetDocShell()) {
- return nsnull;
- }
-
- nsRefPtr<nsScreen> screen = new nsScreen();
-
- nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aWindow);
- NS_ENSURE_TRUE(sgo, nsnull);
-
- nsCOMPtr<nsIScriptContext> 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)
+// QueryInterface implementation for nsScreen
+NS_INTERFACE_MAP_BEGIN(nsScreen)
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+ NS_INTERFACE_MAP_ENTRY(nsIDOMScreen)
+ NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Screen)
+NS_INTERFACE_MAP_END
-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_ENTRY(nsIDOMScreen)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMScreen)
- NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Screen)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
+NS_IMPL_ADDREF(nsScreen)
+NS_IMPL_RELEASE(nsScreen)
+
-NS_IMPL_ADDREF_INHERITED(nsScreen, nsDOMEventTargetWrapperCache)
-NS_IMPL_RELEASE_INHERITED(nsScreen, nsDOMEventTargetWrapperCache)
-
-NS_IMPL_EVENT_HANDLER(nsScreen, mozorientationchange)
+NS_IMETHODIMP
+nsScreen::SetDocShell(nsIDocShell* aDocShell)
+{
+ mDocShell = aDocShell; // Weak Reference
+ return NS_OK;
+}
NS_IMETHODIMP
nsScreen::GetTop(PRInt32* aTop)
{
nsRect rect;
nsresult rv = GetRect(rect);
*aTop = rect.y;
@@ -266,17 +214,17 @@ nsScreen::GetAvailTop(PRInt32* aAvailTop
*aAvailTop = rect.y;
return rv;
}
nsDeviceContext*
nsScreen::GetDeviceContext()
{
- return nsLayoutUtils::GetDeviceContextForScreenInfo(mOwner);
+ return nsLayoutUtils::GetDeviceContextForScreenInfo(mDocShell);
}
nsresult
nsScreen::GetRect(nsRect& aRect)
{
nsDeviceContext *context = GetDeviceContext();
if (!context) {
@@ -307,116 +255,73 @@ nsScreen::GetAvailRect(nsRect& aRect)
aRect.x = nsPresContext::AppUnitsToIntCSSPixels(aRect.x);
aRect.y = nsPresContext::AppUnitsToIntCSSPixels(aRect.y);
aRect.height = nsPresContext::AppUnitsToIntCSSPixels(aRect.height);
aRect.width = nsPresContext::AppUnitsToIntCSSPixels(aRect.width);
return NS_OK;
}
+namespace {
+
+bool
+IsChromeType(nsIDocShell *aDocShell)
+{
+ nsCOMPtr<nsIDocShellTreeItem> 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;
}
*aEnabled = hal::GetScreenEnabled();
return NS_OK;
}
nsresult
nsScreen::SetMozEnabled(bool aEnabled)
{
- if (!sAllowScreenEnabledProperty || mIsChrome) {
+ if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) {
return NS_OK;
}
// TODO bug 707589: When the screen's state changes, all visible windows
// should fire a visibility change event.
hal::SetScreenEnabled(aEnabled);
return NS_OK;
}
nsresult
nsScreen::GetMozBrightness(double *aBrightness)
{
- if (!sAllowScreenBrightnessProperty || mIsChrome) {
+ if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) {
*aBrightness = 1;
return NS_OK;
}
*aBrightness = hal::GetScreenBrightness();
return NS_OK;
}
nsresult
nsScreen::SetMozBrightness(double aBrightness)
{
- if (!sAllowScreenBrightnessProperty || mIsChrome) {
+ if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) {
return NS_OK;
}
NS_ENSURE_TRUE(0 <= aBrightness && aBrightness <= 1, NS_ERROR_INVALID_ARG);
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<nsDOMEvent> 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;
-}
--- a/dom/base/nsScreen.h
+++ b/dom/base/nsScreen.h
@@ -32,63 +32,45 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#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<nsScreen> 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___ */
--- a/dom/interfaces/base/Makefile.in
+++ b/dom/interfaces/base/Makefile.in
@@ -86,10 +86,8 @@ XPIDLSRCS = \
nsIDOMGlobalPropertyInitializer.idl \
nsIStructuredCloneContainer.idl \
nsIDOMPerformance.idl \
nsIDOMPerformanceTiming.idl \
nsIDOMPerformanceNavigation.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk
-
-XPIDL_FLAGS += -I$(topsrcdir)/dom/interfaces/events/
--- a/dom/interfaces/base/nsIDOMScreen.idl
+++ b/dom/interfaces/base/nsIDOMScreen.idl
@@ -32,20 +32,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** 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;
readonly attribute long width;
readonly attribute long height;
readonly attribute long pixelDepth;
readonly attribute long colorDepth;
readonly attribute long availWidth;
@@ -70,18 +70,9 @@ interface nsIDOMScreen : nsIDOMEventTarg
* If you write a value of X into this attribute, the attribute may not have
* the same value X when you later read it. Most screens don't support as
* many different brightness levels as there are doubles between 0 and 1, so
* we may reduce the value's precision before storing it.
*
* @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;
};
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -507,17 +507,16 @@ abstract public class GeckoApp
// Whatever we do here should be fast, because we're blocking
// the next activity from showing up until we finish.
// onPause will be followed by either onResume or onStop.
super.onPause();
unregisterReceiver(mConnectivityReceiver);
GeckoNetworkManager.getInstance().stop();
- GeckoScreenOrientationListener.getInstance().stop();
}
@Override
public void onResume()
{
Log.i(LOG_FILE_NAME, "resume");
if (checkLaunchState(LaunchState.GeckoRunning))
GeckoAppShell.onResume();
@@ -527,17 +526,16 @@ abstract public class GeckoApp
// Just in case. Normally we start in onNewIntent
if (checkLaunchState(LaunchState.PreLaunch) ||
checkLaunchState(LaunchState.Launching))
onNewIntent(getIntent());
registerReceiver(mConnectivityReceiver, mConnectivityFilter);
GeckoNetworkManager.getInstance().start();
- GeckoScreenOrientationListener.getInstance().start();
}
@Override
public void onStop()
{
Log.i(LOG_FILE_NAME, "stop");
// We're about to be stopped, potentially in preparation for
// being destroyed. We're killable after this point -- as I
@@ -583,17 +581,16 @@ abstract public class GeckoApp
if (SmsManager.getInstance() != null) {
SmsManager.getInstance().stop();
if (isFinishing())
SmsManager.getInstance().shutdown();
}
GeckoNetworkManager.getInstance().stop();
- GeckoScreenOrientationListener.getInstance().stop();
super.onDestroy();
unregisterReceiver(mBatteryReceiver);
}
@Override
public void onConfigurationChanged(android.content.res.Configuration newConfig)
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -1824,21 +1824,9 @@ public class GeckoAppShell
}
public static void disableNetworkNotifications() {
GeckoNetworkManager.getInstance().disableNotifications();
}
// 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();
- }
}
--- a/embedding/android/GeckoEvent.java
+++ b/embedding/android/GeckoEvent.java
@@ -75,17 +75,16 @@ public class GeckoEvent {
public static final int GECKO_EVENT_SYNC = 15;
public static final int ACTIVITY_START = 17;
public static final int SAVE_STATE = 18;
public static final int BROADCAST = 19;
public static final int VIEWPORT = 20;
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;
public static final int IME_SET_TEXT = 2;
public static final int IME_GET_TEXT = 3;
public static final int IME_DELETE_TEXT = 4;
public static final int IME_SET_SELECTION = 5;
public static final int IME_GET_SELECTION = 6;
@@ -122,18 +121,16 @@ public class GeckoEvent {
public int mRangeType, mRangeStyles;
public int mRangeForeColor, mRangeBackColor;
public Location mLocation;
public Address mAddress;
public double mBandwidth;
public boolean mCanBeMetered;
- public short mScreenOrientation;
-
public int mNativeWindow;
public GeckoEvent() {
mType = NATIVE_POKE;
}
public GeckoEvent(int evType) {
mType = evType;
@@ -332,14 +329,9 @@ public class GeckoEvent {
mCharacters = uri;
}
public GeckoEvent(double bandwidth, boolean canBeMetered) {
mType = NETWORK_CHANGED;
mBandwidth = bandwidth;
mCanBeMetered = canBeMetered;
}
-
- public GeckoEvent(short aScreenOrientation) {
- mType = SCREENORIENTATION_CHANGED;
- mScreenOrientation = aScreenOrientation;
- }
}
deleted file mode 100644
--- 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;
- }
-}
--- a/embedding/android/Makefile.in
+++ b/embedding/android/Makefile.in
@@ -52,17 +52,16 @@ JAVAFILES = \
GeckoEvent.java \
GeckoSurfaceView.java \
GeckoInputConnection.java \
AlertNotification.java \
SurfaceInfo.java \
GeckoBatteryManager.java \
VideoPlayer.java \
GeckoNetworkManager.java \
- GeckoScreenOrientationListener.java \
$(NULL)
ifdef MOZ_WEBSMS_BACKEND
JAVAFILES += GeckoSmsManager.java
endif
PROCESSEDJAVAFILES = \
App.java \
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -20,17 +20,16 @@
#include "nsIDOMDocument.h"
#include "nsIDOMWindow.h"
#include "mozilla/Services.h"
#include "nsIWebNavigation.h"
#include "nsITabChild.h"
#include "nsIDocShell.h"
#include "mozilla/ClearOnShutdown.h"
#include "WindowIdentifier.h"
-#include "mozilla/dom/ScreenOrientation.h"
using namespace mozilla::services;
#define PROXY_IF_SANDBOXED(_call) \
do { \
if (InSandbox()) { \
hal_sandbox::_call; \
} else { \
@@ -260,34 +259,16 @@ protected:
void GetCurrentInformationInternal(NetworkInformation* aInfo) {
PROXY_IF_SANDBOXED(GetCurrentNetworkInformation(aInfo));
}
};
static NetworkObserversManager sNetworkObservers;
-class ScreenOrientationObserversManager : public ObserversManager<dom::ScreenOrientationWrapper>
-{
-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)
{
AssertMainThread();
sBatteryObservers.AddObserver(aObserver);
}
void
@@ -440,38 +421,10 @@ void Reboot()
}
void PowerOff()
{
AssertMainThread();
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
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -16,17 +16,16 @@
#include "mozilla/hal_sandbox/PHal.h"
#include "base/basictypes.h"
#include "mozilla/Types.h"
#include "nsTArray.h"
#include "prlog.h"
#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.
*
* By default, this file defines its functions in the hal namespace, but if
* MOZ_HAL_NAMESPACE is defined, we'll define our functions in that namespace.
*
* This is used by HalImpl.h and HalSandbox.h, which define copies of all the
@@ -37,27 +36,18 @@ class nsIDOMWindow;
#ifndef MOZ_HAL_NAMESPACE
# define MOZ_HAL_NAMESPACE hal
# define MOZ_DEFINED_HAL_NAMESPACE 1
#endif
namespace mozilla {
-template <class T>
-class Observer;
-
-namespace dom {
-class ScreenOrientationWrapper;
-}
-
namespace hal {
-typedef Observer<dom::ScreenOrientationWrapper> ScreenOrientationObserver;
-
class WindowIdentifier;
extern PRLogModuleInfo *sHalLog;
#define HAL_LOG(msg) PR_LOG(mozilla::hal::sHalLog, PR_LOG_DEBUG, msg)
} // namespace hal
namespace MOZ_HAL_NAMESPACE {
@@ -238,39 +228,16 @@ void NotifyNetworkChange(const hal::Netw
*/
void Reboot();
/**
* Power off the device.
*/
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
#ifdef MOZ_DEFINED_HAL_NAMESPACE
# undef MOZ_DEFINED_HAL_NAMESPACE
# undef MOZ_HAL_NAMESPACE
#endif
--- a/hal/HalInternal.h
+++ b/hal/HalInternal.h
@@ -72,22 +72,12 @@ void DisableBatteryNotifications();
*/
void EnableNetworkNotifications();
/**
* Disables network notifications from the backend.
*/
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
#endif // mozilla_HalInternal_h
--- a/hal/Makefile.in
+++ b/hal/Makefile.in
@@ -103,19 +103,14 @@ CPPSRCS += \
FallbackSensor.cpp \
$(NULL)
endif
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
CFLAGS += $(MOZ_DBUS_GLIB_CFLAGS)
CXXFLAGS += $(MOZ_DBUS_GLIB_CFLAGS) -DHAVE_PTHREADS
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -35,17 +35,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "Hal.h"
#include "HalImpl.h"
#include "WindowIdentifier.h"
#include "AndroidBridge.h"
#include "mozilla/dom/network/Constants.h"
-#include "mozilla/dom/ScreenOrientation.h"
using mozilla::hal::WindowIdentifier;
namespace mozilla {
namespace hal_impl {
void
Vibrate(const nsTArray<uint32> &pattern, const WindowIdentifier &)
@@ -177,46 +176,11 @@ GetCurrentNetworkInformation(hal::Networ
void
Reboot()
{}
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
deleted file mode 100644
--- 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<nsIScreenManager> 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<nsIScreen> screen;
-
- screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
- screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
-
- *aScreenOrientation = screenWidth >= screenHeight
- ? dom::eScreenOrientation_LandscapePrimary
- : dom::eScreenOrientation_PortraitPrimary;
-}
-
-} // hal_impl
-} // mozilla
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -37,24 +37,22 @@
*
* ***** END LICENSE BLOCK ***** */
include protocol PContent;
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 {
namespace hal {
struct BatteryInformation {
double level;
bool charging;
double remainingTime;
@@ -69,32 +67,33 @@ namespace hal {
uint32_t color;
};
struct SensorData {
SensorType sensor;
PRTime timestamp;
float[] values;
};
+}
+namespace hal {
struct NetworkInformation {
double bandwidth;
bool canBeMetered;
};
}
namespace hal_sandbox {
sync protocol PHal {
manager PContent;
child:
NotifyBatteryChange(BatteryInformation aBatteryInfo);
NotifyNetworkChange(NetworkInformation aNetworkInfo);
- NotifyScreenOrientationChange(ScreenOrientation aScreenOrientation);
parent:
Vibrate(uint32[] pattern, uint64[] id, PBrowser browser);
CancelVibrate(uint64[] id, PBrowser browser);
EnableBatteryNotifications();
DisableBatteryNotifications();
sync GetCurrentBatteryInformation()
@@ -114,21 +113,16 @@ parent:
sync SetLight(LightType light, LightConfiguration aConfig)
returns (bool status);
sync GetLight(LightType light)
returns (LightConfiguration aConfig, bool status);
Reboot();
PowerOff();
- EnableScreenOrientationNotifications();
- DisableScreenOrientationNotifications();
- sync GetCurrentScreenOrientation()
- returns (ScreenOrientation aScreenOrientation);
-
child:
NotifySensorChange(SensorData aSensorData);
parent:
EnableSensorNotifications(SensorType aSensor);
DisableSensorNotifications(SensorType aSensor);
__delete__();
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -13,17 +13,16 @@
#include "Hal.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/hal_sandbox/PHalChild.h"
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/dom/TabParent.h"
#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"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
@@ -93,34 +92,16 @@ DisableNetworkNotifications()
}
void
GetCurrentNetworkInformation(NetworkInformation* aNetworkInfo)
{
Hal()->SendGetCurrentNetworkInformation(aNetworkInfo);
}
-void
-EnableScreenOrientationNotifications()
-{
- Hal()->SendEnableScreenOrientationNotifications();
-}
-
-void
-DisableScreenOrientationNotifications()
-{
- Hal()->SendDisableScreenOrientationNotifications();
-}
-
-void
-GetCurrentScreenOrientation(ScreenOrientation* aScreenOrientation)
-{
- Hal()->SendGetCurrentScreenOrientation(aScreenOrientation);
-}
-
bool
GetScreenEnabled()
{
bool enabled = false;
Hal()->SendGetScreenEnabled(&enabled);
return enabled;
}
@@ -181,17 +162,16 @@ void
DisableSensorNotifications(SensorType aSensor) {
Hal()->SendDisableSensorNotifications(aSensor);
}
class HalParent : public PHalParent
, public BatteryObserver
, public NetworkObserver
, public ISensorObserver
- , public ScreenOrientationObserver
{
public:
NS_OVERRIDE virtual bool
RecvVibrate(const InfallibleTArray<unsigned int>& pattern,
const InfallibleTArray<uint64> &id,
PBrowserParent *browserParent)
{
// Check whether browserParent is active. We should have already
@@ -268,38 +248,16 @@ public:
return true;
}
void Notify(const NetworkInformation& aNetworkInfo) {
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)
{
*enabled = hal::GetScreenEnabled();
return true;
}
NS_OVERRIDE virtual bool
RecvSetScreenEnabled(const bool &enabled)
@@ -378,22 +336,16 @@ public:
NS_OVERRIDE virtual bool
RecvNotifySensorChange(const hal::SensorData &aSensorData);
NS_OVERRIDE virtual bool
RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo) {
hal::NotifyNetworkChange(aNetworkInfo);
return true;
}
-
- NS_OVERRIDE virtual bool
- RecvNotifyScreenOrientationChange(const ScreenOrientation& aScreenOrientation) {
- hal::NotifyScreenOrientationChange(aScreenOrientation);
- return true;
- }
};
bool
HalChild::RecvNotifySensorChange(const hal::SensorData &aSensorData) {
hal::NotifySensorChange(aSensorData);
return true;
}
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4000,19 +4000,19 @@ nsLayoutUtils::GetRectDifferenceStrips(c
aVStrip->x += VStripStart;
aVStrip->width -= VStripStart;
*aHStrip = unionRect;
aHStrip->y += HStripStart;
aHStrip->height -= HStripStart;
}
nsDeviceContext*
-nsLayoutUtils::GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow)
+nsLayoutUtils::GetDeviceContextForScreenInfo(nsIDocShell* aDocShell)
{
- nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
+ nsCOMPtr<nsIDocShell> 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
// the caller. It will also make sure that our prescontext has been created,
// if we're supposed to have one.
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(docShell);
if (!win) {
// No reason to go on
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1325,21 +1325,21 @@ public:
* rectangles. (This difference is a superset of the difference
* between the two rectangles.)
*/
static void GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2,
nsRect* aHStrip, nsRect* aVStrip);
/**
* 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 ==
* NS_STYLE_POSITION_FIXED) are not really fixed positioned, since
* they're inside an element with -moz-transform. This function says
* whether such an element is a real fixed-pos element.
*/
static bool IsReallyFixedPos(nsIFrame* aFrame);
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -2055,17 +2055,16 @@ abstract public class GeckoApp
// Whatever we do here should be fast, because we're blocking
// the next activity from showing up until we finish.
// onPause will be followed by either onResume or onStop.
super.onPause();
unregisterReceiver(mConnectivityReceiver);
GeckoNetworkManager.getInstance().stop();
- GeckoScreenOrientationListener.getInstance().stop();
}
@Override
public void onResume()
{
Log.i(LOGTAG, "resume");
if (checkLaunchState(LaunchState.GeckoRunning))
GeckoAppShell.onResume();
@@ -2081,17 +2080,16 @@ abstract public class GeckoApp
}
// Just in case. Normally we start in onNewIntent
if (checkLaunchState(LaunchState.Launching))
onNewIntent(getIntent());
registerReceiver(mConnectivityReceiver, mConnectivityFilter);
GeckoNetworkManager.getInstance().start();
- GeckoScreenOrientationListener.getInstance().start();
if (mOwnActivityDepth > 0)
mOwnActivityDepth--;
}
@Override
public void onStop()
{
@@ -2166,17 +2164,16 @@ abstract public class GeckoApp
if (SmsManager.getInstance() != null) {
SmsManager.getInstance().stop();
if (isFinishing())
SmsManager.getInstance().shutdown();
}
GeckoNetworkManager.getInstance().stop();
- GeckoScreenOrientationListener.getInstance().stop();
super.onDestroy();
unregisterReceiver(mBatteryReceiver);
}
@Override
public void onContentChanged() {
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -1971,21 +1971,9 @@ public class GeckoAppShell
if (op<oLen) out[op++] = (byte)o1;
if (op<oLen) out[op++] = (byte)o2; }
return out;
}
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();
- }
}
--- a/mobile/android/base/GeckoEvent.java
+++ b/mobile/android/base/GeckoEvent.java
@@ -82,17 +82,16 @@ public class GeckoEvent {
public static final int SURFACE_DESTROYED = 14;
public static final int GECKO_EVENT_SYNC = 15;
public static final int ACTIVITY_START = 17;
public static final int BROADCAST = 19;
public static final int VIEWPORT = 20;
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;
public static final int IME_SET_TEXT = 2;
public static final int IME_GET_TEXT = 3;
public static final int IME_DELETE_TEXT = 4;
public static final int IME_SET_SELECTION = 5;
public static final int IME_GET_SELECTION = 6;
@@ -129,18 +128,16 @@ public class GeckoEvent {
public int mRangeType, mRangeStyles;
public int mRangeForeColor, mRangeBackColor;
public Location mLocation;
public Address mAddress;
public double mBandwidth;
public boolean mCanBeMetered;
- public short mScreenOrientation;
-
public int mNativeWindow;
public GeckoEvent() {
mType = NATIVE_POKE;
}
public GeckoEvent(int evType) {
mType = evType;
@@ -357,14 +354,9 @@ public class GeckoEvent {
mCharacters = data;
}
public GeckoEvent(double bandwidth, boolean canBeMetered) {
mType = NETWORK_CHANGED;
mBandwidth = bandwidth;
mCanBeMetered = canBeMetered;
}
-
- public GeckoEvent(short aScreenOrientation) {
- mType = SCREENORIENTATION_CHANGED;
- mScreenOrientation = aScreenOrientation;
- }
}
deleted file mode 100644
--- 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;
- }
-}
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -131,17 +131,16 @@ FENNEC_JAVA_FILES = \
gfx/TileLayer.java \
gfx/ViewportMetrics.java \
gfx/WidgetTileLayer.java \
ui/Axis.java \
ui/PanZoomController.java \
ui/SimpleScaleGestureDetector.java \
ui/SubdocumentScrollHelper.java \
GeckoNetworkManager.java \
- GeckoScreenOrientationListener.java \
$(NULL)
ifdef MOZ_WEBSMS_BACKEND
FENNEC_JAVA_FILES += GeckoSmsManager.java
endif
FENNEC_PP_JAVA_FILES = \
App.java \
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -46,17 +46,16 @@
#include "AndroidBridge.h"
#include "nsAppShell.h"
#include "nsOSHelperAppService.h"
#include "nsWindow.h"
#include "mozilla/Preferences.h"
#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)
#else
#define ALOG_BRIDGE(args...)
#endif
#define IME_FULLSCREEN_PREF "widget.ime.android.landscape_fullscreen"
@@ -169,20 +168,16 @@ AndroidBridge::Init(JNIEnv *jEnv,
jCreateMessageList = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "createMessageList", "(JJ[Ljava/lang/String;IIZIJ)V");
jGetNextMessageinList = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getNextMessageInList", "(IIJ)V");
jClearMessageList = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "clearMessageList", "(I)V");
jGetCurrentNetworkInformation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getCurrentNetworkInformation", "()[D");
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"));
jEGLContextImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLContextImpl"));
jEGLConfigImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLConfigImpl"));
jEGLDisplayImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLDisplayImpl"));
InitAndroidJavaWrappers(jEnv);
@@ -1959,29 +1954,8 @@ AndroidBridge::HideSurface(jobject surfa
jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
jmethodID method = env->GetStaticMethodID(cls,
"hideSurface",
"(Landroid/view/Surface;)V");
env->CallStaticVoidMethod(cls, method, surface);
#endif
}
-
-void
-AndroidBridge::GetScreenOrientation(dom::ScreenOrientationWrapper& aOrientation)
-{
- ALOG_BRIDGE("AndroidBridge::GetScreenOrientation");
- aOrientation.orientation = static_cast<dom::ScreenOrientation>(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);
-}
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -74,17 +74,16 @@ extern jclass GetGeckoAppShellClass();
namespace mozilla {
namespace hal {
class BatteryInformation;
class NetworkInformation;
} // namespace hal
namespace dom {
-class ScreenOrientationWrapper;
namespace sms {
struct SmsFilterData;
} // namespace sms
} // namespace dom
// The order and number of the members in this structure must correspond
// to the attrsAppearance array in GeckoAppShell.getSystemColors()
typedef struct AndroidSystemColors {
@@ -384,24 +383,16 @@ public:
void EnableNetworkNotifications();
void DisableNetworkNotifications();
jobject CreateSurface();
void DestroySurface(jobject surface);
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;
// the global JavaVM
JavaVM *mJavaVM;
// the JNIEnv for the main thread
JNIEnv *mJNIEnv;
@@ -491,20 +482,16 @@ protected:
jmethodID jCreateMessageList;
jmethodID jGetNextMessageinList;
jmethodID jClearMessageList;
jmethodID jGetCurrentNetworkInformation;
jmethodID jEnableNetworkNotifications;
jmethodID jDisableNetworkNotifications;
- jmethodID jGetScreenOrientation;
- jmethodID jEnableScreenOrientationNotifications;
- jmethodID jDisableScreenOrientationNotifications;
-
// stuff we need for CallEglCreateWindowSurface
jclass jEGLSurfaceImplClass;
jclass jEGLContextImplClass;
jclass jEGLConfigImplClass;
jclass jEGLDisplayImplClass;
jclass jEGLContextClass;
jclass jEGL10Class;
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -71,17 +71,16 @@ jfieldID AndroidGeckoEvent::jPointerInde
jfieldID AndroidGeckoEvent::jRangeTypeField = 0;
jfieldID AndroidGeckoEvent::jRangeStylesField = 0;
jfieldID AndroidGeckoEvent::jRangeForeColorField = 0;
jfieldID AndroidGeckoEvent::jRangeBackColorField = 0;
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;
jfieldID AndroidPoint::jYField = 0;
jclass AndroidRect::jRectClass = 0;
jfieldID AndroidRect::jBottomField = 0;
jfieldID AndroidRect::jLeftField = 0;
@@ -185,17 +184,16 @@ AndroidGeckoEvent::InitGeckoEventClass(J
jRangeTypeField = getField("mRangeType", "I");
jRangeStylesField = getField("mRangeStyles", "I");
jRangeForeColorField = getField("mRangeForeColor", "I");
jRangeBackColorField = getField("mRangeBackColor", "I");
jLocationField = getField("mLocation", "Landroid/location/Location;");
jAddressField = getField("mAddress", "Landroid/location/Address;");
jBandwidthField = getField("mBandwidth", "D");
jCanBeMeteredField = getField("mCanBeMetered", "Z");
- jScreenOrientationField = getField("mScreenOrientation", "S");
}
void
AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(JNIEnv *jEnv)
{
#ifndef MOZ_JAVA_COMPOSITOR
initInit();
@@ -544,21 +542,16 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
break;
}
case PROXIMITY_EVENT: {
mDistance = jenv->GetDoubleField(jobj, jDistanceField);
break;
}
- case SCREENORIENTATION_CHANGED: {
- mScreenOrientation = jenv->GetShortField(jobj, jScreenOrientationField);
- break;
- }
-
default:
break;
}
#ifndef DEBUG_ANDROID_EVENTS
ALOG("AndroidGeckoEvent: %p : %d", (void*)jobj, mType);
#endif
}
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -457,17 +457,16 @@ public:
int RangeType() { return mRangeType; }
int RangeStyles() { return mRangeStyles; }
int RangeForeColor() { return mRangeForeColor; }
int RangeBackColor() { return mRangeBackColor; }
nsGeoPosition* GeoPosition() { return mGeoPosition; }
nsGeoPositionAddress* GeoAddress() { return mGeoAddress; }
double Bandwidth() { return mBandwidth; }
bool CanBeMetered() { return mCanBeMetered; }
- short ScreenOrientation() { return mScreenOrientation; }
protected:
int mAction;
int mType;
int64_t mTime;
nsTArray<nsIntPoint> mPoints;
nsTArray<nsIntPoint> mPointRadii;
nsTArray<int> mPointIndicies;
@@ -483,17 +482,16 @@ protected:
double mX, mY, mZ;
double mDistance;
int mPointerIndex;
nsString mCharacters, mCharactersExtra;
nsRefPtr<nsGeoPosition> mGeoPosition;
nsRefPtr<nsGeoPositionAddress> mGeoAddress;
double mBandwidth;
bool mCanBeMetered;
- short mScreenOrientation;
void ReadIntArray(nsTArray<int> &aVals,
JNIEnv *jenv,
jfieldID field,
PRUint32 count);
void ReadFloatArray(nsTArray<float> &aVals,
JNIEnv *jenv,
jfieldID field,
@@ -539,18 +537,16 @@ protected:
static jfieldID jRangeForeColorField;
static jfieldID jRangeBackColorField;
static jfieldID jLocationField;
static jfieldID jAddressField;
static jfieldID jBandwidthField;
static jfieldID jCanBeMeteredField;
- static jfieldID jScreenOrientationField;
-
public:
enum {
NATIVE_POKE = 0,
KEY_EVENT = 1,
MOTION_EVENT = 2,
ORIENTATION_EVENT = 3,
ACCELERATION_EVENT = 4,
LOCATION_EVENT = 5,
@@ -566,17 +562,16 @@ public:
GECKO_EVENT_SYNC = 15,
FORCED_RESIZE = 16,
ACTIVITY_START = 17,
BROADCAST = 19,
VIEWPORT = 20,
VISITED = 21,
NETWORK_CHANGED = 22,
PROXIMITY_EVENT = 23,
- SCREENORIENTATION_CHANGED = 24,
dummy_java_enum_list_end
};
enum {
IME_COMPOSITION_END = 0,
IME_COMPOSITION_BEGIN = 1,
IME_SET_TEXT = 2,
IME_GET_TEXT = 3,
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -56,18 +56,16 @@
#include "prenv.h"
#include "AndroidBridge.h"
#include "nsDeviceMotionSystem.h"
#include <android/log.h>
#include <pthread.h>
#include <wchar.h>
-#include "mozilla/dom/ScreenOrientation.h"
-
#ifdef MOZ_ANDROID_HISTORY
#include "nsAndroidHistory.h"
#endif
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG
#include "prlog.h"
#endif
@@ -480,21 +478,16 @@ nsAppShell::ProcessNextNativeEvent(bool
}
case AndroidGeckoEvent::NETWORK_CHANGED: {
hal::NotifyNetworkChange(hal::NetworkInformation(curEvent->Bandwidth(),
curEvent->CanBeMetered()));
break;
}
- case AndroidGeckoEvent::SCREENORIENTATION_CHANGED: {
- hal::NotifyScreenOrientationChange(static_cast<dom::ScreenOrientation>(curEvent->ScreenOrientation()));
- break;
- }
-
default:
nsWindow::OnGlobalAndroidEvent(curEvent);
}
EVLOG("nsAppShell: -- done event %p %d", (void*)curEvent.get(), curEvent->Type());
return true;
}