mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 787534 - Remove Portrait and Landscape special ScreenOrientation values. r=jlebar
This commit is contained in:
parent
5c6348dfef
commit
4a90f2279e
@ -16,12 +16,10 @@ namespace dom {
|
||||
typedef uint32_t ScreenOrientation;
|
||||
|
||||
static const ScreenOrientation eScreenOrientation_None = 0;
|
||||
static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1; // 00000001
|
||||
static const ScreenOrientation eScreenOrientation_PortraitSecondary = 2; // 00000010
|
||||
static const ScreenOrientation eScreenOrientation_Portrait = 3; // 00000011
|
||||
static const ScreenOrientation eScreenOrientation_LandscapePrimary = 4; // 00000100
|
||||
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 8; // 00001000
|
||||
static const ScreenOrientation eScreenOrientation_Landscape = 12; // 00001100
|
||||
static const ScreenOrientation eScreenOrientation_PortraitPrimary = PR_BIT(0);
|
||||
static const ScreenOrientation eScreenOrientation_PortraitSecondary = PR_BIT(1);
|
||||
static const ScreenOrientation eScreenOrientation_LandscapePrimary = PR_BIT(2);
|
||||
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = PR_BIT(3);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -276,9 +276,10 @@ nsScreen::Notify(const hal::ScreenConfiguration& aConfiguration)
|
||||
ScreenOrientation previousOrientation = mOrientation;
|
||||
mOrientation = aConfiguration.orientation();
|
||||
|
||||
NS_ASSERTION(mOrientation != eScreenOrientation_None &&
|
||||
mOrientation != eScreenOrientation_Portrait &&
|
||||
mOrientation != eScreenOrientation_Landscape,
|
||||
NS_ASSERTION(mOrientation == eScreenOrientation_PortraitPrimary ||
|
||||
mOrientation == eScreenOrientation_PortraitSecondary ||
|
||||
mOrientation == eScreenOrientation_LandscapePrimary ||
|
||||
mOrientation == eScreenOrientation_LandscapeSecondary,
|
||||
"Invalid orientation value passed to notify method!");
|
||||
|
||||
if (mOrientation != previousOrientation) {
|
||||
@ -306,11 +307,6 @@ NS_IMETHODIMP
|
||||
nsScreen::GetMozOrientation(nsAString& aOrientation)
|
||||
{
|
||||
switch (mOrientation) {
|
||||
case eScreenOrientation_None:
|
||||
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;
|
||||
@ -323,6 +319,10 @@ nsScreen::GetMozOrientation(nsAString& aOrientation)
|
||||
case eScreenOrientation_LandscapeSecondary:
|
||||
aOrientation.AssignLiteral("landscape-secondary");
|
||||
break;
|
||||
case eScreenOrientation_None:
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -406,13 +406,15 @@ nsScreen::MozLockOrientation(const jsval& aOrientation, JSContext* aCx, bool* aR
|
||||
nsString& item = orientations[i];
|
||||
|
||||
if (item.EqualsLiteral("portrait")) {
|
||||
orientation |= eScreenOrientation_Portrait;
|
||||
orientation |= eScreenOrientation_PortraitPrimary |
|
||||
eScreenOrientation_PortraitSecondary;
|
||||
} else if (item.EqualsLiteral("portrait-primary")) {
|
||||
orientation |= eScreenOrientation_PortraitPrimary;
|
||||
} else if (item.EqualsLiteral("portrait-secondary")) {
|
||||
orientation |= eScreenOrientation_PortraitSecondary;
|
||||
} else if (item.EqualsLiteral("landscape")) {
|
||||
orientation |= eScreenOrientation_Landscape;
|
||||
orientation |= eScreenOrientation_LandscapePrimary |
|
||||
eScreenOrientation_LandscapeSecondary;
|
||||
} else if (item.EqualsLiteral("landscape-primary")) {
|
||||
orientation |= eScreenOrientation_LandscapePrimary;
|
||||
} else if (item.EqualsLiteral("landscape-secondary")) {
|
||||
|
@ -120,10 +120,12 @@ void anp_window_requestFullScreenOrientation(NPP instance, ANPScreenOrientation
|
||||
newOrientation = eScreenOrientation_PortraitPrimary;
|
||||
break;
|
||||
case kLandscape_ANPScreenOrientation:
|
||||
newOrientation = eScreenOrientation_Landscape;
|
||||
newOrientation = eScreenOrientation_LandscapePrimary |
|
||||
eScreenOrientation_LandscapeSecondary;
|
||||
break;
|
||||
case kPortrait_ANPScreenOrientation:
|
||||
newOrientation = eScreenOrientation_Portrait;
|
||||
newOrientation = eScreenOrientation_PortraitPrimary |
|
||||
eScreenOrientation_PortraitSecondary;
|
||||
break;
|
||||
default:
|
||||
newOrientation = eScreenOrientation_None;
|
||||
|
@ -29,12 +29,10 @@ public class GeckoScreenOrientationListener
|
||||
|
||||
// Make sure that any change in dom/base/ScreenOrientation.h happens here too.
|
||||
static public final short eScreenOrientation_None = 0;
|
||||
static public final short eScreenOrientation_PortraitPrimary = 1;
|
||||
static public final short eScreenOrientation_PortraitSecondary = 2;
|
||||
static public final short eScreenOrientation_Portrait = 3;
|
||||
static public final short eScreenOrientation_LandscapePrimary = 4;
|
||||
static public final short eScreenOrientation_LandscapeSecondary = 8;
|
||||
static public final short eScreenOrientation_Landscape = 12;
|
||||
static public final short eScreenOrientation_PortraitPrimary = 1; // PR_BIT(0)
|
||||
static public final short eScreenOrientation_PortraitSecondary = 2; // PR_BIT(1)
|
||||
static public final short eScreenOrientation_LandscapePrimary = 4; // PR_BIT(2)
|
||||
static public final short eScreenOrientation_LandscapeSecondary = 8; // PR_BIT(3)
|
||||
|
||||
private short mOrientation;
|
||||
private OrientationEventListenerImpl mListener = null;
|
||||
@ -136,7 +134,7 @@ public class GeckoScreenOrientationListener
|
||||
case eScreenOrientation_PortraitSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
|
||||
break;
|
||||
case eScreenOrientation_Portrait:
|
||||
case eScreenOrientation_PortraitPrimary | eScreenOrientation_PortraitSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
break;
|
||||
case eScreenOrientation_LandscapePrimary:
|
||||
@ -145,7 +143,7 @@ public class GeckoScreenOrientationListener
|
||||
case eScreenOrientation_LandscapeSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
|
||||
break;
|
||||
case eScreenOrientation_Landscape:
|
||||
case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||
break;
|
||||
default:
|
||||
|
@ -189,10 +189,10 @@ LockScreenOrientation(const ScreenOrientation& aOrientation)
|
||||
// The Android backend only supports these orientations.
|
||||
case eScreenOrientation_PortraitPrimary:
|
||||
case eScreenOrientation_PortraitSecondary:
|
||||
case eScreenOrientation_Portrait:
|
||||
case eScreenOrientation_PortraitPrimary | eScreenOrientation_PortraitSecondary:
|
||||
case eScreenOrientation_LandscapePrimary:
|
||||
case eScreenOrientation_LandscapeSecondary:
|
||||
case eScreenOrientation_Landscape:
|
||||
case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
|
||||
bridge->LockScreenOrientation(aOrientation);
|
||||
return true;
|
||||
default:
|
||||
|
@ -31,12 +31,10 @@ public class GeckoScreenOrientationListener {
|
||||
|
||||
// Make sure that any change in dom/base/ScreenOrientation.h happens here too.
|
||||
static public final short eScreenOrientation_None = 0;
|
||||
static public final short eScreenOrientation_PortraitPrimary = 1;
|
||||
static public final short eScreenOrientation_PortraitSecondary = 2;
|
||||
static public final short eScreenOrientation_Portrait = 3;
|
||||
static public final short eScreenOrientation_LandscapePrimary = 4;
|
||||
static public final short eScreenOrientation_LandscapeSecondary = 8;
|
||||
static public final short eScreenOrientation_Landscape = 12;
|
||||
static public final short eScreenOrientation_PortraitPrimary = 1; // PR_BIT(0)
|
||||
static public final short eScreenOrientation_PortraitSecondary = 2; // PR_BIT(1)
|
||||
static public final short eScreenOrientation_LandscapePrimary = 4; // PR_BIT(2)
|
||||
static public final short eScreenOrientation_LandscapeSecondary = 8; // PR_BIT(3)
|
||||
|
||||
static private final short DEFAULT_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
|
||||
@ -178,7 +176,7 @@ public class GeckoScreenOrientationListener {
|
||||
case eScreenOrientation_PortraitSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
|
||||
break;
|
||||
case eScreenOrientation_Portrait:
|
||||
case eScreenOrientation_PortraitPrimary | eScreenOrientation_PortraitSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
break;
|
||||
case eScreenOrientation_LandscapePrimary:
|
||||
@ -187,7 +185,7 @@ public class GeckoScreenOrientationListener {
|
||||
case eScreenOrientation_LandscapeSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
|
||||
break;
|
||||
case eScreenOrientation_Landscape:
|
||||
case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary:
|
||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||
break;
|
||||
default:
|
||||
|
@ -37,10 +37,10 @@ struct OrientationMapping {
|
||||
static OrientationMapping sOrientationMappings[] = {
|
||||
{nsIScreen::ROTATION_0_DEG, eScreenOrientation_PortraitPrimary},
|
||||
{nsIScreen::ROTATION_180_DEG, eScreenOrientation_PortraitSecondary},
|
||||
{nsIScreen::ROTATION_0_DEG, eScreenOrientation_Portrait},
|
||||
{nsIScreen::ROTATION_0_DEG, eScreenOrientation_PortraitPrimary | eScreenOrientation_PortraitSecondary},
|
||||
{nsIScreen::ROTATION_90_DEG, eScreenOrientation_LandscapePrimary},
|
||||
{nsIScreen::ROTATION_270_DEG, eScreenOrientation_LandscapeSecondary},
|
||||
{nsIScreen::ROTATION_90_DEG, eScreenOrientation_Landscape}
|
||||
{nsIScreen::ROTATION_90_DEG, eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary}
|
||||
};
|
||||
|
||||
const static int sDefaultLandscape = 3;
|
||||
@ -290,8 +290,10 @@ OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
|
||||
|
||||
// Enable/disable the observer depending on 1. multiple orientations
|
||||
// allowed, and 2. observer enabled.
|
||||
if (aOrientation == eScreenOrientation_Landscape ||
|
||||
aOrientation == eScreenOrientation_Portrait) {
|
||||
if (aOrientation == (eScreenOrientation_LandscapePrimary |
|
||||
eScreenOrientation_LandscapeSecondary) ||
|
||||
aOrientation == (eScreenOrientation_PortraitPrimary |
|
||||
eScreenOrientation_PortraitSecondary)) {
|
||||
if (!mAutoOrientationEnabled) {
|
||||
EnableAutoOrientation();
|
||||
}
|
||||
|
@ -62,8 +62,10 @@ private:
|
||||
// 200 ms, the latency which is barely perceptible by human.
|
||||
static const PRTime sMinUpdateInterval = 200 * PR_USEC_PER_MSEC;
|
||||
static const uint32_t sDefaultOrientations =
|
||||
mozilla::dom::eScreenOrientation_Portrait |
|
||||
mozilla::dom::eScreenOrientation_Landscape;
|
||||
mozilla::dom::eScreenOrientation_PortraitPrimary |
|
||||
mozilla::dom::eScreenOrientation_PortraitSecondary |
|
||||
mozilla::dom::eScreenOrientation_LandscapePrimary |
|
||||
mozilla::dom::eScreenOrientation_LandscapeSecondary;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user