mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1299335 (part 7) - Streamline nsIWidget::{Move,Resize}. r=mstange.
This patch changes them from |NS_IMETHOD| to |virtual void| because every implementation of these functions always returns |NS_OK|. --HG-- extra : rebase_source : 6207df5a46aeb6b8aaa0f697447a51bc6a6dc366
This commit is contained in:
parent
b2889711de
commit
a28c8f38b2
@ -1384,9 +1384,8 @@ nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY,
|
||||
// We also need to resize our widget then.
|
||||
if (mInternalWidget) {
|
||||
doc_x = doc_y = 0;
|
||||
NS_ENSURE_SUCCESS(mInternalWidget->Resize(aX, aY, aCX, aCY,
|
||||
!!(aFlags & nsIBaseWindow::eRepaint)),
|
||||
NS_ERROR_FAILURE);
|
||||
mInternalWidget->Resize(aX, aY, aCX, aCY,
|
||||
!!(aFlags & nsIBaseWindow::eRepaint));
|
||||
}
|
||||
// Now reposition/ resize the doc
|
||||
NS_ENSURE_SUCCESS(
|
||||
|
@ -469,10 +469,9 @@ CompositorBridgeChild::RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint
|
||||
// by a child window move, and will call invalidate on the plugin
|
||||
// parent window which the browser owns. The latter gets picked up in
|
||||
// our OnPaint handler and forwarded over to the plugin process async.
|
||||
rv = widget->Resize(aContentOffset.x + bounds.x,
|
||||
aContentOffset.y + bounds.y,
|
||||
bounds.width, bounds.height, true);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
|
||||
widget->Resize(aContentOffset.x + bounds.x,
|
||||
aContentOffset.y + bounds.y,
|
||||
bounds.width, bounds.height, true);
|
||||
}
|
||||
|
||||
rv = widget->Enable(isVisible);
|
||||
|
@ -68,10 +68,10 @@ public:
|
||||
nsWidgetInitData* aInitData = nullptr) override { return NS_OK; }
|
||||
NS_IMETHOD Show(bool aState) override { return NS_OK; }
|
||||
virtual bool IsVisible() const override { return true; }
|
||||
NS_IMETHOD Move(double aX, double aY) override { return NS_OK; }
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override { return NS_OK; }
|
||||
NS_IMETHOD Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint) override { return NS_OK; }
|
||||
virtual void Move(double aX, double aY) override {}
|
||||
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override {}
|
||||
virtual void Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint) override {}
|
||||
|
||||
NS_IMETHOD Enable(bool aState) override { return NS_OK; }
|
||||
virtual bool IsEnabled() const override { return true; }
|
||||
|
@ -220,7 +220,7 @@ PuppetWidget::Show(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
PuppetWidget::Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
@ -230,7 +230,8 @@ PuppetWidget::Resize(double aWidth,
|
||||
NSToIntRound(aHeight)));
|
||||
|
||||
if (mChild) {
|
||||
return mChild->Resize(aWidth, aHeight, aRepaint);
|
||||
mChild->Resize(aWidth, aHeight, aRepaint);
|
||||
return;
|
||||
}
|
||||
|
||||
// XXX: roc says that |aRepaint| dictates whether or not to
|
||||
@ -251,8 +252,6 @@ PuppetWidget::Resize(double aWidth,
|
||||
}
|
||||
mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -89,17 +89,16 @@ public:
|
||||
{ *aX = kMaxDimension; *aY = kMaxDimension; }
|
||||
|
||||
// Widget position is controlled by the parent process via TabChild.
|
||||
NS_IMETHOD Move(double aX, double aY) override
|
||||
{ return NS_OK; }
|
||||
virtual void Move(double aX, double aY) override {}
|
||||
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override
|
||||
virtual void Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
virtual void Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override
|
||||
{
|
||||
if (mBounds.x != aX || mBounds.y != aY) {
|
||||
NotifyWindowMoved(aX, aY);
|
||||
|
@ -1748,33 +1748,33 @@ nsWindow::ConstrainPosition(bool aAllowSlop,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Move(double aX,
|
||||
double aY)
|
||||
{
|
||||
if (IsTopLevel())
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
return Resize(aX,
|
||||
aY,
|
||||
mBounds.width,
|
||||
mBounds.height,
|
||||
true);
|
||||
Resize(aX,
|
||||
aY,
|
||||
mBounds.width,
|
||||
mBounds.height,
|
||||
true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return Resize(mBounds.x,
|
||||
mBounds.y,
|
||||
aWidth,
|
||||
aHeight,
|
||||
aRepaint);
|
||||
Resize(mBounds.x,
|
||||
mBounds.y,
|
||||
aWidth,
|
||||
aHeight,
|
||||
aRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
@ -1800,11 +1800,9 @@ nsWindow::Resize(double aX,
|
||||
|
||||
nsIWidgetListener* listener = GetWidgetListener();
|
||||
if (mAwaitingFullScreen && listener) {
|
||||
listener->FullscreenChanged(mIsFullScreen);
|
||||
mAwaitingFullScreen = false;
|
||||
listener->FullscreenChanged(mIsFullScreen);
|
||||
mAwaitingFullScreen = false;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -167,16 +167,16 @@ public:
|
||||
virtual void ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
int32_t *aY) override;
|
||||
NS_IMETHOD Move(double aX,
|
||||
double aY) override;
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
virtual void Move(double aX,
|
||||
double aY) override;
|
||||
virtual void Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
virtual void Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
void SetZIndex(int32_t aZIndex) override;
|
||||
virtual void SetSizeMode(nsSizeMode aMode) override;
|
||||
NS_IMETHOD Enable(bool aState) override;
|
||||
|
@ -313,9 +313,9 @@ public:
|
||||
virtual nsIWidget* GetParent(void) override;
|
||||
virtual float GetDPI() override;
|
||||
|
||||
NS_IMETHOD Move(double aX, double aY) override;
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX, double aY,
|
||||
virtual void Move(double aX, double aY) override;
|
||||
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual void Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint) override;
|
||||
|
||||
NS_IMETHOD Enable(bool aState) override;
|
||||
|
@ -948,15 +948,16 @@ nsChildView::RoundsWidgetCoordinatesTo()
|
||||
}
|
||||
|
||||
// Move this component, aX and aY are in the parent widget coordinate system
|
||||
NS_IMETHODIMP nsChildView::Move(double aX, double aY)
|
||||
void
|
||||
nsChildView::Move(double aX, double aY)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
|
||||
if (!mView || (mBounds.x == x && mBounds.y == y))
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
@ -968,20 +969,19 @@ NS_IMETHODIMP nsChildView::Move(double aX, double aY)
|
||||
NotifyRollupGeometryChange();
|
||||
ReportMoveEvent();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
void
|
||||
nsChildView::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
|
||||
if (!mView || (mBounds.width == width && mBounds.height == height))
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
mBounds.width = width;
|
||||
mBounds.height = height;
|
||||
@ -996,15 +996,14 @@ NS_IMETHODIMP nsChildView::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
NotifyRollupGeometryChange();
|
||||
ReportSizeEvent();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint)
|
||||
void
|
||||
nsChildView::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
@ -1014,7 +1013,7 @@ NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
||||
BOOL isMoving = (mBounds.x != x || mBounds.y != y);
|
||||
BOOL isResizing = (mBounds.width != width || mBounds.height != height);
|
||||
if (!mView || (!isMoving && !isResizing))
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
if (isMoving) {
|
||||
mBounds.x = x;
|
||||
@ -1036,14 +1035,12 @@ NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
||||
if (isMoving) {
|
||||
ReportMoveEvent();
|
||||
if (mOnDestroyCalled)
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
if (isResizing)
|
||||
ReportSizeEvent();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
static const int32_t resizeIndicatorWidth = 15;
|
||||
|
@ -256,7 +256,7 @@ public:
|
||||
virtual void ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX, int32_t *aY) override;
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
||||
NS_IMETHOD Move(double aX, double aY) override;
|
||||
virtual void Move(double aX, double aY) override;
|
||||
virtual void SetSizeMode(nsSizeMode aMode) override;
|
||||
virtual void HideWindowChrome(bool aShouldHide) override;
|
||||
|
||||
@ -279,8 +279,8 @@ public:
|
||||
mFullscreenTransitionAnimation = nil;
|
||||
}
|
||||
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual void Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual LayoutDeviceIntRect GetClientBounds() override;
|
||||
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
||||
void ReportMoveEvent();
|
||||
@ -365,7 +365,7 @@ protected:
|
||||
void SetWindowBackgroundBlur();
|
||||
void UpdateBounds();
|
||||
|
||||
nsresult DoResize(double aX, double aY, double aWidth, double aHeight,
|
||||
void DoResize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint, bool aConstrainToCurrentScreen);
|
||||
|
||||
inline bool ShouldToggleNativeFullscreen(bool aFullScreen,
|
||||
|
@ -1216,10 +1216,13 @@ void nsCocoaWindow::SetSizeConstraints(const SizeConstraints& aConstraints)
|
||||
}
|
||||
|
||||
// Coordinates are desktop pixels
|
||||
NS_IMETHODIMP nsCocoaWindow::Move(double aX, double aY)
|
||||
void
|
||||
nsCocoaWindow::Move(double aX, double aY)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (!mWindow) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// The point we have is in Gecko coordinates (origin top-left). Convert
|
||||
@ -1235,7 +1238,7 @@ NS_IMETHODIMP nsCocoaWindow::Move(double aX, double aY)
|
||||
[mWindow setFrameTopLeftPoint:coord];
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1538,15 +1541,16 @@ nsCocoaWindow::DoMakeFullScreen(bool aFullScreen, bool aUseSystemTransition)
|
||||
}
|
||||
|
||||
// Coordinates are desktop pixels
|
||||
nsresult nsCocoaWindow::DoResize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint,
|
||||
bool aConstrainToCurrentScreen)
|
||||
void
|
||||
nsCocoaWindow::DoResize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint,
|
||||
bool aConstrainToCurrentScreen)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (!mWindow || mInResize) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
AutoRestore<bool> reentrantResizeGuard(mInResize);
|
||||
@ -1577,7 +1581,7 @@ nsresult nsCocoaWindow::DoResize(double aX, double aY,
|
||||
newFrame.size.height != frame.size.height;
|
||||
|
||||
if (!isMoving && !isResizing) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// We ignore aRepaint -- we have to call display:YES, otherwise the
|
||||
@ -1585,25 +1589,25 @@ nsresult nsCocoaWindow::DoResize(double aX, double aY,
|
||||
// the wrong place, leading to a visual jump.
|
||||
[mWindow setFrame:newFrame display:YES];
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
// Coordinates are desktop pixels
|
||||
NS_IMETHODIMP nsCocoaWindow::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
void
|
||||
nsCocoaWindow::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return DoResize(aX, aY, aWidth, aHeight, aRepaint, false);
|
||||
DoResize(aX, aY, aWidth, aHeight, aRepaint, false);
|
||||
}
|
||||
|
||||
// Coordinates are desktop pixels
|
||||
NS_IMETHODIMP nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
void
|
||||
nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
double invScale = 1.0 / BackingScaleFactor();
|
||||
return DoResize(mBounds.x * invScale, mBounds.y * invScale,
|
||||
aWidth, aHeight, aRepaint, true);
|
||||
DoResize(mBounds.x * invScale, mBounds.y * invScale,
|
||||
aWidth, aHeight, aRepaint, true);
|
||||
}
|
||||
|
||||
LayoutDeviceIntRect
|
||||
|
@ -385,22 +385,21 @@ nsWindow::IsVisible() const
|
||||
return mVisible;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Move(double aX,
|
||||
double aY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return Resize(0, 0, aWidth, aHeight, aRepaint);
|
||||
Resize(0, 0, aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
@ -416,8 +415,6 @@ nsWindow::Resize(double aX,
|
||||
if (aRepaint) {
|
||||
Invalidate(mBounds);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -56,16 +56,16 @@ public:
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD Move(double aX,
|
||||
double aY);
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
virtual void Move(double aX,
|
||||
double aY);
|
||||
virtual void Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
virtual void Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
virtual bool IsEnabled() const;
|
||||
NS_IMETHOD SetFocus(bool aRaise = false);
|
||||
|
@ -1106,7 +1106,7 @@ nsWindow::Show(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
double scale = BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
|
||||
@ -1121,7 +1121,7 @@ nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
if (!mCreated)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
NativeResize();
|
||||
|
||||
@ -1133,10 +1133,10 @@ nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
DispatchResized();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
@ -1152,7 +1152,7 @@ nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
if (!mCreated)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
NativeMoveResize();
|
||||
|
||||
@ -1163,7 +1163,7 @@ nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
DispatchResized();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1197,9 +1197,7 @@ nsWindow::IsEnabled() const
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
LOG(("nsWindow::Move [%p] %f %f\n", (void *)this,
|
||||
@ -1219,7 +1217,7 @@ nsWindow::Move(double aX, double aY)
|
||||
// popup window.
|
||||
if (x == mBounds.x && y == mBounds.y &&
|
||||
mWindowType != eWindowType_popup)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// XXX Should we do some AreBoundsSane check here?
|
||||
|
||||
@ -1227,12 +1225,11 @@ nsWindow::Move(double aX, double aY)
|
||||
mBounds.y = y;
|
||||
|
||||
if (!mCreated)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
NativeMove();
|
||||
|
||||
NotifyRollupGeometryChange();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,13 +114,13 @@ public:
|
||||
int32_t *aX,
|
||||
int32_t *aY) override;
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
||||
NS_IMETHOD Move(double aX,
|
||||
virtual void Move(double aX,
|
||||
double aY) override;
|
||||
NS_IMETHOD Show (bool aState) override;
|
||||
NS_IMETHOD Resize (double aWidth,
|
||||
virtual void Resize (double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) override;
|
||||
NS_IMETHOD Resize (double aX,
|
||||
virtual void Resize (double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
|
@ -721,7 +721,7 @@ class nsIWidget : public nsISupports
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD Move(double aX, double aY) = 0;
|
||||
virtual void Move(double aX, double aY) = 0;
|
||||
|
||||
/**
|
||||
* Reposition this widget so that the client area has the given offset.
|
||||
@ -744,11 +744,10 @@ class nsIWidget : public nsISupports
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
virtual void Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Move or resize this widget. Any size constraints set for the window by
|
||||
@ -761,11 +760,11 @@ class nsIWidget : public nsISupports
|
||||
* @param aRepaint whether the widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
virtual void Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Resize the widget so that the inner client area has the given size.
|
||||
|
@ -51,11 +51,11 @@ public:
|
||||
virtual void SetBackgroundColor(const nscolor &aColor) override;
|
||||
virtual void* GetNativeData(uint32_t aDataType) override;
|
||||
|
||||
NS_IMETHOD Move(double aX, double aY) override;
|
||||
virtual void Move(double aX, double aY) override;
|
||||
virtual void 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;
|
||||
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual void Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
||||
void ReportMoveEvent();
|
||||
void ReportSizeEvent();
|
||||
|
@ -573,11 +573,11 @@ nsWindow::Show(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
if (!mNativeView || (mBounds.x == aX && mBounds.y == aY))
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
//XXX: handle this
|
||||
// The point we have is in Gecko coordinates (origin top-left). Convert
|
||||
@ -591,10 +591,9 @@ nsWindow::Move(double aX, double aY)
|
||||
[mNativeView setNeedsDisplay];
|
||||
|
||||
ReportMoveEvent();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
@ -602,7 +601,7 @@ nsWindow::Resize(double aX, double aY,
|
||||
BOOL isMoving = (mBounds.x != aX || mBounds.y != aY);
|
||||
BOOL isResizing = (mBounds.width != aWidth || mBounds.height != aHeight);
|
||||
if (!mNativeView || (!isMoving && !isResizing))
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
if (isMoving) {
|
||||
mBounds.x = aX;
|
||||
@ -623,14 +622,13 @@ nsWindow::Resize(double aX, double aY,
|
||||
|
||||
if (isResizing)
|
||||
ReportSizeEvent();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
void
|
||||
nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
if (!mNativeView || (mBounds.width == aWidth && mBounds.height == aHeight))
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
@ -641,8 +639,6 @@ NS_IMETHODIMP nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
[mNativeView setNeedsDisplay];
|
||||
|
||||
ReportSizeEvent();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1675,7 +1675,8 @@ nsWindow::GetSizeConstraints()
|
||||
}
|
||||
|
||||
// Move this component
|
||||
NS_IMETHODIMP nsWindow::Move(double aX, double aY)
|
||||
void
|
||||
nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
if (mWindowType == eWindowType_toplevel ||
|
||||
mWindowType == eWindowType_dialog) {
|
||||
@ -1699,7 +1700,7 @@ NS_IMETHODIMP nsWindow::Move(double aX, double aY)
|
||||
if (mWindowType != eWindowType_popup && (mBounds.x == x) && (mBounds.y == y))
|
||||
{
|
||||
// Nothing to do, since it is already positioned correctly.
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
mBounds.x = x;
|
||||
@ -1749,11 +1750,11 @@ NS_IMETHODIMP nsWindow::Move(double aX, double aY)
|
||||
SetThemeRegion();
|
||||
}
|
||||
NotifyRollupGeometryChange();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Resize this component
|
||||
NS_IMETHODIMP nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
void
|
||||
nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
// for top-level windows only, convert coordinates from desktop pixels
|
||||
// (the "parent" coordinate space) to the window's device pixel space
|
||||
@ -1771,7 +1772,7 @@ NS_IMETHODIMP nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
if (aRepaint) {
|
||||
Invalidate();
|
||||
}
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set cached value for lightweight and printing
|
||||
@ -1799,12 +1800,12 @@ NS_IMETHODIMP nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
Invalidate();
|
||||
|
||||
NotifyRollupGeometryChange();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Resize this component
|
||||
NS_IMETHODIMP nsWindow::Resize(double aX, double aY, double aWidth,
|
||||
double aHeight, bool aRepaint)
|
||||
void
|
||||
nsWindow::Resize(double aX, double aY, double aWidth,
|
||||
double aHeight, bool aRepaint)
|
||||
{
|
||||
// for top-level windows only, convert coordinates from desktop pixels
|
||||
// (the "parent" coordinate space) to the window's device pixel space
|
||||
@ -1825,7 +1826,7 @@ NS_IMETHODIMP nsWindow::Resize(double aX, double aY, double aWidth,
|
||||
if (aRepaint) {
|
||||
Invalidate();
|
||||
}
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set cached value for lightweight and printing
|
||||
@ -1863,7 +1864,6 @@ NS_IMETHODIMP nsWindow::Resize(double aX, double aY, double aWidth,
|
||||
Invalidate();
|
||||
|
||||
NotifyRollupGeometryChange();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -123,9 +123,9 @@ public:
|
||||
virtual void ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY) override;
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
||||
virtual const SizeConstraints GetSizeConstraints() override;
|
||||
NS_IMETHOD Move(double aX, double aY) override;
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual void Move(double aX, double aY) override;
|
||||
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual void Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
||||
virtual MOZ_MUST_USE nsresult
|
||||
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
||||
int32_t aHorizontal,
|
||||
|
@ -541,8 +541,7 @@ NS_IMETHODIMP nsXULWindow::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::SetPositionDesktopPix(int32_t aX, int32_t aY)
|
||||
{
|
||||
nsresult rv = mWindow->Move(aX, aY);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
mWindow->Move(aX, aY);
|
||||
if (!mChromeLoaded) {
|
||||
// If we're called before the chrome is loaded someone obviously wants this
|
||||
// window at this position. We don't persist this one-time position.
|
||||
@ -581,8 +580,7 @@ NS_IMETHODIMP nsXULWindow::SetSize(int32_t aCX, int32_t aCY, bool aRepaint)
|
||||
|
||||
DesktopToLayoutDeviceScale scale = mWindow->GetDesktopToDeviceScale();
|
||||
DesktopSize size = LayoutDeviceIntSize(aCX, aCY) / scale;
|
||||
nsresult rv = mWindow->Resize(size.width, size.height, aRepaint);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
mWindow->Resize(size.width, size.height, aRepaint);
|
||||
if (!mChromeLoaded) {
|
||||
// If we're called before the chrome is loaded someone obviously wants this
|
||||
// window at this size & in the normal size mode (since it is the only mode
|
||||
@ -614,9 +612,8 @@ NS_IMETHODIMP nsXULWindow::SetPositionAndSize(int32_t aX, int32_t aY,
|
||||
|
||||
DesktopToLayoutDeviceScale scale = mWindow->GetDesktopToDeviceScale();
|
||||
DesktopRect rect = LayoutDeviceIntRect(aX, aY, aCX, aCY) / scale;
|
||||
nsresult rv = mWindow->Resize(rect.x, rect.y, rect.width, rect.height,
|
||||
!!(aFlags & nsIBaseWindow::eRepaint));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
mWindow->Resize(rect.x, rect.y, rect.width, rect.height,
|
||||
!!(aFlags & nsIBaseWindow::eRepaint));
|
||||
if (!mChromeLoaded) {
|
||||
// If we're called before the chrome is loaded someone obviously wants this
|
||||
// window at this size and position. We don't persist this one-time setting.
|
||||
|
Loading…
Reference in New Issue
Block a user