Bug 1196163 part 1 - Use nsSizeMode instead of int32_t for nsIWidget::{SizeMode,SetSizeMode}. r=roc

This commit is contained in:
Xidorn Quan 2015-08-29 11:12:41 +10:00
parent 3b41b5028f
commit d466352a8c
16 changed files with 31 additions and 32 deletions

View File

@ -520,7 +520,7 @@ nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
}
NS_IMETHODIMP
nsWindow::SetSizeMode(int32_t aMode)
nsWindow::SetSizeMode(nsSizeMode aMode)
{
switch (aMode) {
case nsSizeMode_Minimized:

View File

@ -93,7 +93,7 @@ public:
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget,
bool aActivate) override;
NS_IMETHOD SetSizeMode(int32_t aMode) override;
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
NS_IMETHOD Enable(bool aState) override;
virtual bool IsEnabled() const override;
NS_IMETHOD Invalidate(const nsIntRect &aRect) override;

View File

@ -283,7 +283,7 @@ public:
NS_IMETHOD Move(double aX, double aY) override;
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget, bool aActivate) override;
NS_IMETHOD SetSizeMode(int32_t aMode) override;
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
NS_IMETHOD HideWindowChrome(bool aShouldHide) override;
void EnteredFullScreen(bool aFullScreen, bool aNativeMode = true);

View File

@ -1177,7 +1177,7 @@ NS_METHOD nsCocoaWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
return NS_OK;
}
NS_METHOD nsCocoaWindow::SetSizeMode(int32_t aMode)
NS_METHOD nsCocoaWindow::SetSizeMode(nsSizeMode aMode)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;

View File

@ -1236,7 +1236,7 @@ nsWindow::SetZIndex(int32_t aZIndex)
}
NS_IMETHODIMP
nsWindow::SetSizeMode(int32_t aMode)
nsWindow::SetSizeMode(nsSizeMode aMode)
{
nsresult rv;

View File

@ -126,7 +126,7 @@ public:
nsIWidget *aWidget,
bool aActivate) override;
void SetZIndex(int32_t aZIndex) override;
NS_IMETHOD SetSizeMode(int32_t aMode) override;
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
NS_IMETHOD Enable(bool aState) override;
NS_IMETHOD SetFocus(bool aRaise = false) override;
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) override;

View File

@ -640,17 +640,15 @@ NS_IMETHODIMP nsBaseWidget::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
// merely stores the state.
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseWidget::SetSizeMode(int32_t aMode)
NS_IMETHODIMP
nsBaseWidget::SetSizeMode(nsSizeMode aMode)
{
if (aMode == nsSizeMode_Normal ||
aMode == nsSizeMode_Minimized ||
aMode == nsSizeMode_Maximized ||
aMode == nsSizeMode_Fullscreen) {
mSizeMode = (nsSizeMode) aMode;
return NS_OK;
}
return NS_ERROR_ILLEGAL_VALUE;
MOZ_ASSERT(aMode == nsSizeMode_Normal ||
aMode == nsSizeMode_Minimized ||
aMode == nsSizeMode_Maximized ||
aMode == nsSizeMode_Fullscreen);
mSizeMode = aMode;
return NS_OK;
}
//-------------------------------------------------------------------------

View File

@ -124,8 +124,8 @@ public:
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget, bool aActivate) override;
NS_IMETHOD SetSizeMode(int32_t aMode) override;
virtual int32_t SizeMode() override
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
virtual nsSizeMode SizeMode() override
{
return mSizeMode;
}

View File

@ -27,6 +27,7 @@
#include "mozilla/widget/IMEData.h"
#include "nsDataHashtable.h"
#include "nsIObserver.h"
#include "nsIWidgetListener.h"
#include "FrameMetrics.h"
#include "Units.h"
@ -35,7 +36,6 @@ class nsIRollupListener;
class imgIContainer;
class nsIContent;
class ViewWrapper;
class nsIWidgetListener;
class nsIntRegion;
class nsIScreen;
class nsIRunnable;
@ -763,13 +763,13 @@ class nsIWidget : public nsISupports {
* Minimize, maximize or normalize the window size.
* Takes a value from nsSizeMode (see nsIWidgetListener.h)
*/
NS_IMETHOD SetSizeMode(int32_t aMode) = 0;
NS_IMETHOD SetSizeMode(nsSizeMode aMode) = 0;
/**
* Return size mode (minimized, maximized, normalized).
* Returns a value from nsSizeMode (see nsIWidgetListener.h)
*/
virtual int32_t SizeMode() = 0;
virtual nsSizeMode SizeMode() = 0;
/**
* Enable or disable this Widget

View File

@ -1427,7 +1427,7 @@ nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
}
NS_IMETHODIMP
nsWindow::SetSizeMode(int32_t aMode)
nsWindow::SetSizeMode(nsSizeMode aMode)
{
nsresult rv;

View File

@ -201,7 +201,7 @@ public:
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget,
bool aActivate);
NS_IMETHOD SetSizeMode(int32_t aMode);
NS_IMETHOD SetSizeMode(nsSizeMode aMode);
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
NS_IMETHOD SetHasTransparentBackground(bool aTransparent);
NS_IMETHOD GetHasTransparentBackground(bool& aTransparent);

View File

@ -57,14 +57,14 @@ public:
NS_IMETHOD Move(double aX, double aY) override;
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget, bool aActivate) override;
NS_IMETHOD SetSizeMode(int32_t aMode) override;
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
void EnteredFullScreen(bool aFullScreen);
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) override;
void ReportMoveEvent();
void ReportSizeEvent();
void ReportSizeModeEvent(int32_t aMode);
void ReportSizeModeEvent(nsSizeMode aMode);
CGFloat BackingScaleFactor();
void BackingScaleFactorChanged();

View File

@ -682,7 +682,7 @@ nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
}
NS_IMETHODIMP
nsWindow::SetSizeMode(int32_t aMode)
nsWindow::SetSizeMode(nsSizeMode aMode)
{
if (aMode == static_cast<int32_t>(mSizeMode)) {
return NS_OK;
@ -749,7 +749,7 @@ void nsWindow::ReportMoveEvent()
NotifyWindowMoved(mBounds.x, mBounds.y);
}
void nsWindow::ReportSizeModeEvent(int32_t aMode)
void nsWindow::ReportSizeModeEvent(nsSizeMode aMode)
{
if (mWidgetListener) {
// This is terrible.

View File

@ -1665,7 +1665,8 @@ NS_METHOD nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
}
// Maximize, minimize or restore the window.
NS_IMETHODIMP nsWindow::SetSizeMode(int32_t aMode) {
NS_IMETHODIMP
nsWindow::SetSizeMode(nsSizeMode aMode) {
nsresult rv;

View File

@ -112,7 +112,7 @@ public:
int32_t aHorizontal,
int32_t aVertical);
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
NS_IMETHOD SetSizeMode(int32_t aMode);
NS_IMETHOD SetSizeMode(nsSizeMode aMode);
NS_IMETHOD Enable(bool aState);
virtual bool IsEnabled() const;
NS_IMETHOD SetFocus(bool aRaise);

View File

@ -214,7 +214,7 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(uint32_t aLevel)
/* refuse to raise a maximized window above the normal browser level,
for fear it could hide newly opened browser windows */
if (aLevel > nsIXULWindow::normalZ && mWindow) {
int32_t sizeMode = mWindow->SizeMode();
nsSizeMode sizeMode = mWindow->SizeMode();
if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen) {
return NS_ERROR_FAILURE;
}
@ -1195,7 +1195,7 @@ bool nsXULWindow::LoadMiscPersistentAttributesFromXUL()
// sizemode
windowElement->GetAttribute(MODE_ATTRIBUTE, stateString);
int32_t sizeMode = nsSizeMode_Normal;
nsSizeMode sizeMode = nsSizeMode_Normal;
/* ignore request to minimize, to not confuse novices
if (stateString.Equals(SIZEMODE_MINIMIZED))
sizeMode = nsSizeMode_Minimized;
@ -1511,7 +1511,7 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
}
if (mPersistentAttributesDirty & PAD_MISC) {
int32_t sizeMode = mWindow->SizeMode();
nsSizeMode sizeMode = mWindow->SizeMode();
if (sizeMode != nsSizeMode_Minimized) {
if (sizeMode == nsSizeMode_Maximized)