Bug 1131470 - Part 1: Rename existing use of ScreenOrientation to ScreenOrientationInternal. r=baku

This commit is contained in:
William Chen 2015-08-18 14:55:09 -07:00
parent 72e7af901d
commit cb7d38cf1d
28 changed files with 71 additions and 70 deletions

View File

@ -10,18 +10,18 @@
namespace mozilla {
namespace dom {
// Make sure that any change here is also made in
// * mobile/android/base/GeckoScreenOrientationListener.java
typedef uint32_t ScreenOrientation;
// Make sure that any change to ScreenOrientationInternal values are
// also made in mobile/android/base/GeckoScreenOrientation.java
typedef uint32_t ScreenOrientationInternal;
static const ScreenOrientation eScreenOrientation_None = 0;
static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientation eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientation eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
static const ScreenOrientationInternal eScreenOrientation_None = 0;
static const ScreenOrientationInternal eScreenOrientation_PortraitPrimary = 1u << 0;
static const ScreenOrientationInternal eScreenOrientation_PortraitSecondary = 1u << 1;
static const ScreenOrientationInternal eScreenOrientation_LandscapePrimary = 1u << 2;
static const ScreenOrientationInternal eScreenOrientation_LandscapeSecondary = 1u << 3;
//eScreenOrientation_Default will use the natural orientation for the deivce,
//it could be PortraitPrimary or LandscapePrimary depends on display resolution
static const ScreenOrientation eScreenOrientation_Default = 1u << 4;
static const ScreenOrientationInternal eScreenOrientation_Default = 1u << 4;
} // namespace dom
} // namespace mozilla

View File

@ -40,7 +40,7 @@ nsScreen::Create(nsPIDOMWindow* aWindow)
hal::RegisterScreenConfigurationObserver(screen);
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
screen->mOrientation = config.orientation();
screen->mOrientationInternal = config.orientation();
return screen.forget();
}
@ -165,16 +165,16 @@ nsScreen::GetAvailRect(nsRect& aRect)
void
nsScreen::Notify(const hal::ScreenConfiguration& aConfiguration)
{
ScreenOrientation previousOrientation = mOrientation;
mOrientation = aConfiguration.orientation();
ScreenOrientationInternal previousOrientation = mOrientationInternal;
mOrientationInternal = aConfiguration.orientation();
NS_ASSERTION(mOrientation == eScreenOrientation_PortraitPrimary ||
mOrientation == eScreenOrientation_PortraitSecondary ||
mOrientation == eScreenOrientation_LandscapePrimary ||
mOrientation == eScreenOrientation_LandscapeSecondary,
NS_ASSERTION(mOrientationInternal == eScreenOrientation_PortraitPrimary ||
mOrientationInternal == eScreenOrientation_PortraitSecondary ||
mOrientationInternal == eScreenOrientation_LandscapePrimary ||
mOrientationInternal == eScreenOrientation_LandscapeSecondary,
"Invalid orientation value passed to notify method!");
if (mOrientation != previousOrientation) {
if (mOrientationInternal != previousOrientation) {
DispatchTrustedEvent(NS_LITERAL_STRING("mozorientationchange"));
}
}
@ -185,7 +185,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation)
if (ShouldResistFingerprinting()) {
aOrientation.AssignLiteral("landscape-primary");
} else {
switch (mOrientation) {
switch (mOrientationInternal) {
case eScreenOrientation_PortraitPrimary:
aOrientation.AssignLiteral("portrait-primary");
break;
@ -200,7 +200,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation)
break;
case eScreenOrientation_None:
default:
MOZ_CRASH("Unacceptable mOrientation value");
MOZ_CRASH("Unacceptable mOrientationInternal value");
}
}
}
@ -259,7 +259,7 @@ bool
nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
ErrorResult& aRv)
{
ScreenOrientation orientation = eScreenOrientation_None;
ScreenOrientationInternal orientation = eScreenOrientation_None;
for (uint32_t i = 0; i < aOrientations.Length(); ++i) {
const nsString& item = aOrientations[i];

View File

@ -133,7 +133,7 @@ protected:
nsresult GetAvailRect(nsRect& aRect);
nsresult GetWindowInnerRect(nsRect& aRect);
mozilla::dom::ScreenOrientation mOrientation;
mozilla::dom::ScreenOrientationInternal mOrientationInternal;
private:
class FullScreenEventListener final : public nsIDOMEventListener

View File

@ -53,7 +53,7 @@ using struct nsRect from "nsRect.h";
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::CSSPoint from "Units.h";
using mozilla::CSSToScreenScale from "Units.h";
@ -578,7 +578,8 @@ child:
CacheFileDescriptor(nsString path, FileDescriptor fd);
UpdateDimensions(CSSRect rect, CSSSize size, ScreenOrientation orientation,
UpdateDimensions(CSSRect rect, CSSSize size,
ScreenOrientationInternal orientation,
LayoutDeviceIntPoint chromeDisp) compressall;
UpdateFrame(FrameMetrics frame);

View File

@ -1654,7 +1654,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
bool
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
const ScreenOrientation& orientation,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp)
{
if (!mRemoteFrame) {

View File

@ -303,7 +303,7 @@ public:
const bool& aParentIsActive) override;
virtual bool RecvUpdateDimensions(const CSSRect& rect,
const CSSSize& size,
const ScreenOrientation& orientation,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp) override;
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
virtual bool RecvRequestFlingSnap(const ViewID& aScrollId,
@ -419,7 +419,7 @@ public:
void GetMaxTouchPoints(uint32_t* aTouchPoints);
ScreenOrientation GetOrientation() { return mOrientation; }
ScreenOrientationInternal GetOrientation() const { return mOrientation; }
void SetBackgroundColor(const nscolor& aColor);
@ -628,7 +628,7 @@ private:
bool mDidFakeShow;
bool mNotified;
bool mTriedBrowserInit;
ScreenOrientation mOrientation;
ScreenOrientationInternal mOrientation;
bool mUpdateHitRegion;
bool mIgnoreKeyPressEvent;

View File

@ -1006,7 +1006,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
}
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
ScreenOrientation orientation = config.orientation();
ScreenOrientationInternal orientation = config.orientation();
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
nsCOMPtr<nsIWidget> widget = GetWidget();

View File

@ -482,7 +482,7 @@ protected:
nsIntRect mRect;
ScreenIntSize mDimensions;
ScreenOrientation mOrientation;
ScreenOrientationInternal mOrientation;
float mDPI;
CSSToLayoutDeviceScale mDefaultScale;
bool mUpdatedDimensions;

View File

@ -410,7 +410,7 @@ MediaEngineGonkVideoSource::DeallocImpl() {
// The same algorithm from bug 840244
static int
GetRotateAmount(ScreenOrientation aScreen, int aCameraMountAngle, bool aBackCamera) {
GetRotateAmount(ScreenOrientationInternal aScreen, int aCameraMountAngle, bool aBackCamera) {
int screenAngle = 0;
switch (aScreen) {
case eScreenOrientation_PortraitPrimary:

View File

@ -194,7 +194,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
// If the last transaction was incomplete (a failed DoEmptyTransaction),
// don't signal a new transaction to ShadowLayerForwarder. Carry on adding
// to the previous transaction.
dom::ScreenOrientation orientation;
dom::ScreenOrientationInternal orientation;
if (dom::TabChild* window = mWidget->GetOwningTabChild()) {
orientation = window->GetOrientation();
} else {

View File

@ -51,7 +51,7 @@ using namespace mozilla::gfx;
enum Op { Resolve, Detach };
static bool
IsSameDimension(dom::ScreenOrientation o1, dom::ScreenOrientation o2)
IsSameDimension(dom::ScreenOrientationInternal o1, dom::ScreenOrientationInternal o2)
{
bool isO1portrait = (o1 == dom::eScreenOrientation_PortraitPrimary || o1 == dom::eScreenOrientation_PortraitSecondary);
bool isO2portrait = (o2 == dom::eScreenOrientation_PortraitPrimary || o2 == dom::eScreenOrientation_PortraitSecondary);
@ -74,8 +74,8 @@ WalkTheTree(Layer* aLayer,
if (const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(ref->GetReferentId())) {
if (Layer* referent = state->mRoot) {
if (!ref->GetVisibleRegion().IsEmpty()) {
dom::ScreenOrientation chromeOrientation = aTargetConfig.orientation();
dom::ScreenOrientation contentOrientation = state->mTargetConfig.orientation();
dom::ScreenOrientationInternal chromeOrientation = aTargetConfig.orientation();
dom::ScreenOrientationInternal contentOrientation = state->mTargetConfig.orientation();
if (!IsSameDimension(chromeOrientation, contentOrientation) &&
ContentMightReflowOnOrientationChange(aTargetConfig.naturalBounds())) {
aReady = false;

View File

@ -109,7 +109,7 @@ public:
}
}
bool RequiresReorientation(mozilla::dom::ScreenOrientation aOrientation)
bool RequiresReorientation(mozilla::dom::ScreenOrientationInternal aOrientation) const
{
return mTargetConfig.orientation() != aOrientation;
}

View File

@ -29,7 +29,7 @@ using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
using nsCSSProperty from "nsCSSProperty.h";
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::LayerMargin from "Units.h";
using mozilla::LayerPoint from "Units.h";
@ -50,7 +50,7 @@ namespace layers {
struct TargetConfig {
IntRect naturalBounds;
ScreenRotation rotation;
ScreenOrientation orientation;
ScreenOrientationInternal orientation;
nsIntRegion clearRegion;
};

View File

@ -60,7 +60,7 @@ public:
{}
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
dom::ScreenOrientation aOrientation)
dom::ScreenOrientationInternal aOrientation)
{
mOpen = true;
mTargetBounds = aTargetBounds;
@ -138,7 +138,7 @@ public:
ShadowableLayerSet mMutants;
gfx::IntRect mTargetBounds;
ScreenRotation mTargetRotation;
dom::ScreenOrientation mTargetOrientation;
dom::ScreenOrientationInternal mTargetOrientation;
bool mSwapRequired;
private:
@ -185,7 +185,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
void
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
dom::ScreenOrientation aOrientation)
dom::ScreenOrientationInternal aOrientation)
{
MOZ_ASSERT(HasShadowManager(), "no manager to forward to");
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");

View File

@ -155,7 +155,7 @@ public:
*/
void BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
mozilla::dom::ScreenOrientation aOrientation);
mozilla::dom::ScreenOrientationInternal aOrientation);
/**
* The following methods may only be called after BeginTransaction()

View File

@ -42,7 +42,7 @@ namespace {
// screen orientation. Similar to what Android SensorManager.remapCoordinateSystem
// does, except only for a fixed number of transforms that we need.
Matrix4x4
RemapMatrixForOrientation(ScreenOrientation screenConfig, const Matrix4x4& aMatrix)
RemapMatrixForOrientation(ScreenOrientationInternal screenConfig, const Matrix4x4& aMatrix)
{
Matrix4x4 out;
const float *in = &aMatrix._11;

View File

@ -709,7 +709,7 @@ NotifyScreenConfigurationChange(const ScreenConfiguration& aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
{
AssertMainThread();
RETURN_PROXY_IF_SANDBOXED(LockScreenOrientation(aOrientation), false);

View File

@ -394,7 +394,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf
* Lock the screen orientation to the specific orientation.
* @return Whether the lock has been accepted.
*/
bool LockScreenOrientation(const dom::ScreenOrientation& aOrientation);
bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
/**
* Unlock the screen orientation.

View File

@ -123,21 +123,21 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
nsIntRect rect;
int32_t colorDepth, pixelDepth;
ScreenOrientation orientation;
ScreenOrientationInternal orientation;
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
*aScreenConfiguration =
hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
}
bool
LockScreenOrientation(const ScreenOrientation& aOrientation)
LockScreenOrientation(const ScreenOrientationInternal& aOrientation)
{
switch (aOrientation) {
// The Android backend only supports these orientations.

View File

@ -33,7 +33,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
nsIntRect rect;
int32_t colorDepth, pixelDepth;
dom::ScreenOrientation orientation;
dom::ScreenOrientationInternal orientation;
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
@ -49,7 +49,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
{
return false;
}

View File

@ -1030,7 +1030,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
{
return OrientationObserver::GetInstance()->LockScreenOrientation(aOrientation);
}

View File

@ -9,7 +9,7 @@ include protocol PBrowser;
include "mozilla/GfxMessageUtils.h";
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
@ -58,7 +58,7 @@ struct WakeLockInformation {
struct ScreenConfiguration {
nsIntRect rect;
ScreenOrientation orientation;
ScreenOrientationInternal orientation;
uint32_t colorDepth;
uint32_t pixelDepth;
};
@ -157,7 +157,7 @@ parent:
DisableScreenConfigurationNotifications();
prio(urgent) sync GetCurrentScreenConfiguration()
returns (ScreenConfiguration aScreenConfiguration);
sync LockScreenOrientation(ScreenOrientation aOrientation)
sync LockScreenOrientation(ScreenOrientationInternal aOrientation)
returns (bool allowed);
UnlockScreenOrientation();

View File

@ -122,7 +122,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
}
bool
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
{
bool allowed;
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
@ -592,7 +592,7 @@ public:
}
virtual bool
RecvLockScreenOrientation(const dom::ScreenOrientation& aOrientation, bool* aAllowed) override
RecvLockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation, bool* aAllowed) override
{
// FIXME/bug 777980: unprivileged content may only lock
// orientation while fullscreen. We should check whether the

View File

@ -1578,7 +1578,7 @@ AndroidBridge::GetScreenOrientation()
if (!orientation)
return dom::eScreenOrientation_None;
return static_cast<dom::ScreenOrientation>(orientation);
return static_cast<dom::ScreenOrientationInternal>(orientation);
}
void

View File

@ -588,7 +588,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
nsIntRect rect;
int32_t colorDepth, pixelDepth;
dom::ScreenOrientation orientation;
dom::ScreenOrientationInternal orientation;
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
@ -596,7 +596,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
screen->GetColorDepth(&colorDepth);
screen->GetPixelDepth(&pixelDepth);
orientation =
static_cast<dom::ScreenOrientation>(curEvent->ScreenOrientation());
static_cast<dom::ScreenOrientationInternal>(curEvent->ScreenOrientation());
hal::NotifyScreenConfigurationChange(
hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth));

View File

@ -33,7 +33,7 @@ namespace {
struct OrientationMapping {
uint32_t mScreenRotation;
ScreenOrientation mDomOrientation;
ScreenOrientationInternal mDomOrientation;
};
static OrientationMapping sOrientationMappings[] = {
@ -106,7 +106,7 @@ DetectDefaultOrientation()
* @return NS_OK on success. NS_ILLEGAL_VALUE on failure.
*/
static nsresult
ConvertToScreenRotation(ScreenOrientation aOrientation, uint32_t *aResult)
ConvertToScreenRotation(ScreenOrientationInternal aOrientation, uint32_t *aResult)
{
for (int i = 0; i < ArrayLength(sOrientationMappings); i++) {
if (aOrientation & sOrientationMappings[i].mDomOrientation) {
@ -132,7 +132,7 @@ ConvertToScreenRotation(ScreenOrientation aOrientation, uint32_t *aResult)
* @return NS_OK on success. NS_ILLEGAL_VALUE on failure.
*/
nsresult
ConvertToDomOrientation(uint32_t aRotation, ScreenOrientation *aResult)
ConvertToDomOrientation(uint32_t aRotation, ScreenOrientationInternal *aResult)
{
for (int i = 0; i < ArrayLength(sOrientationMappings); i++) {
if (aRotation == sOrientationMappings[i].mScreenRotation) {
@ -217,7 +217,7 @@ OrientationObserver::Notify(const hal::SensorData& aSensorData)
return;
}
ScreenOrientation orientation;
ScreenOrientationInternal orientation;
if (NS_FAILED(ConvertToDomOrientation(rotation, &orientation))) {
return;
}
@ -259,7 +259,7 @@ OrientationObserver::DisableAutoOrientation()
}
bool
OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
OrientationObserver::LockScreenOrientation(ScreenOrientationInternal aOrientation)
{
MOZ_ASSERT(aOrientation | (eScreenOrientation_PortraitPrimary |
eScreenOrientation_PortraitSecondary |
@ -295,7 +295,7 @@ OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
nsresult rv = screen->GetRotation(&currRotation);
NS_ENSURE_SUCCESS(rv, false);
ScreenOrientation currOrientation = eScreenOrientation_None;
ScreenOrientationInternal currOrientation = eScreenOrientation_None;
rv = ConvertToDomOrientation(currRotation, &currOrientation);
NS_ENSURE_SUCCESS(rv, false);
@ -314,7 +314,7 @@ OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
NS_ENSURE_SUCCESS(rv, false);
// This conversion will disambiguate aOrientation.
ScreenOrientation orientation;
ScreenOrientationInternal orientation;
rv = ConvertToDomOrientation(rotation, &orientation);
NS_ENSURE_SUCCESS(rv, false);

View File

@ -32,7 +32,7 @@ typedef mozilla::Observer<SensorData> ISensorObserver;
using mozilla::hal::ISensorObserver;
using mozilla::hal::SensorData;
using mozilla::dom::ScreenOrientation;
using mozilla::dom::ScreenOrientationInternal;
class OrientationObserver : public ISensorObserver {
public:
@ -51,7 +51,7 @@ public:
void DisableAutoOrientation();
// Methods called by methods in hal_impl namespace.
bool LockScreenOrientation(ScreenOrientation aOrientation);
bool LockScreenOrientation(ScreenOrientationInternal aOrientation);
void UnlockScreenOrientation();
static OrientationObserver* GetInstance();

View File

@ -295,7 +295,7 @@ nsScreenGonk::EffectiveScreenRotation()
// NB: This isn't gonk-specific, but gonk is the only widget backend
// that does this calculation itself, currently.
static ScreenOrientation
static ScreenOrientationInternal
ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
{
bool naturallyPortrait = (aScreenSize.height > aScreenSize.width);
@ -322,8 +322,8 @@ ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
ScreenConfiguration
nsScreenGonk::GetConfiguration()
{
ScreenOrientation orientation = ComputeOrientation(mScreenRotation,
mNaturalBounds.Size());
ScreenOrientationInternal orientation = ComputeOrientation(mScreenRotation,
mNaturalBounds.Size());
// NB: perpetuating colorDepth == pixelDepth illusion here, for
// consistency.