Bug 1299335 (part 6) - Streamline nsIWidget::{Move,Resize}Client(). r=mstange.

This patch changes them from |NS_IMETHOD| to |virtual void| because the return
values are never used.

--HG--
extra : rebase_source : a456f0035e66cf025305e5b3e2450057e368f3a8
This commit is contained in:
Nicholas Nethercote 2016-12-19 14:38:19 +11:00
parent 4f95087c90
commit b2889711de
3 changed files with 35 additions and 37 deletions

View File

@ -1452,7 +1452,8 @@ void nsBaseWidget::OnDestroy()
ReleaseContentController();
}
NS_IMETHODIMP nsBaseWidget::MoveClient(double aX, double aY)
void
nsBaseWidget::MoveClient(double aX, double aY)
{
LayoutDeviceIntPoint clientOffset(GetClientOffset());
@ -1460,15 +1461,14 @@ NS_IMETHODIMP nsBaseWidget::MoveClient(double aX, double aY)
// if that's what this widget uses for the Move/Resize APIs
if (BoundsUseDesktopPixels()) {
DesktopPoint desktopOffset = clientOffset / GetDesktopToDeviceScale();
return Move(aX - desktopOffset.x, aY - desktopOffset.y);
Move(aX - desktopOffset.x, aY - desktopOffset.y);
} else {
return Move(aX - clientOffset.x, aY - clientOffset.y);
Move(aX - clientOffset.x, aY - clientOffset.y);
}
}
NS_IMETHODIMP nsBaseWidget::ResizeClient(double aWidth,
double aHeight,
bool aRepaint)
void
nsBaseWidget::ResizeClient(double aWidth, double aHeight, bool aRepaint)
{
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
@ -1481,19 +1481,20 @@ NS_IMETHODIMP nsBaseWidget::ResizeClient(double aWidth,
DesktopSize desktopDelta =
(LayoutDeviceIntSize(mBounds.width, mBounds.height) -
clientBounds.Size()) / GetDesktopToDeviceScale();
return Resize(aWidth + desktopDelta.width, aHeight + desktopDelta.height,
aRepaint);
Resize(aWidth + desktopDelta.width, aHeight + desktopDelta.height,
aRepaint);
} else {
return Resize(mBounds.width + (aWidth - clientBounds.width),
mBounds.height + (aHeight - clientBounds.height), aRepaint);
Resize(mBounds.width + (aWidth - clientBounds.width),
mBounds.height + (aHeight - clientBounds.height), aRepaint);
}
}
NS_IMETHODIMP nsBaseWidget::ResizeClient(double aX,
double aY,
double aWidth,
double aHeight,
bool aRepaint)
void
nsBaseWidget::ResizeClient(double aX,
double aY,
double aWidth,
double aHeight,
bool aRepaint)
{
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
@ -1507,14 +1508,14 @@ NS_IMETHODIMP nsBaseWidget::ResizeClient(double aX,
DesktopSize desktopDelta =
(LayoutDeviceIntSize(mBounds.width, mBounds.height) -
clientBounds.Size()) / scale;
return Resize(aX - desktopOffset.x, aY - desktopOffset.y,
aWidth + desktopDelta.width, aHeight + desktopDelta.height,
aRepaint);
Resize(aX - desktopOffset.x, aY - desktopOffset.y,
aWidth + desktopDelta.width, aHeight + desktopDelta.height,
aRepaint);
} else {
return Resize(aX - clientOffset.x, aY - clientOffset.y,
aWidth + mBounds.width - clientBounds.width,
aHeight + mBounds.height - clientBounds.height,
aRepaint);
Resize(aX - clientOffset.x, aY - clientOffset.y,
aWidth + mBounds.width - clientBounds.width,
aHeight + mBounds.height - clientBounds.height,
aRepaint);
}
}

View File

@ -233,9 +233,9 @@ public:
virtual void ConstrainPosition(bool aAllowSlop,
int32_t *aX,
int32_t *aY) override {}
NS_IMETHOD MoveClient(double aX, double aY) override;
NS_IMETHOD ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
virtual void MoveClient(double aX, double aY) override;
virtual void ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
virtual void ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
virtual LayoutDeviceIntRect GetBounds() override;
virtual LayoutDeviceIntRect GetClientBounds() override;
virtual LayoutDeviceIntRect GetScreenBounds() override;

View File

@ -734,9 +734,8 @@ class nsIWidget : public nsISupports
* offset from the origin of the client area of the parent
* widget (for root widgets and popup widgets it is in
* screen coordinates)
*
**/
NS_IMETHOD MoveClient(double aX, double aY) = 0;
virtual void MoveClient(double aX, double aY) = 0;
/**
* Resize this widget. Any size constraints set for the window by a
@ -774,11 +773,10 @@ class nsIWidget : public nsISupports
* @param aWidth the new width of the client area.
* @param aHeight the new height of the client area.
* @param aRepaint whether the widget should be repainted
*
*/
NS_IMETHOD ResizeClient(double aWidth,
double aHeight,
bool aRepaint) = 0;
virtual void ResizeClient(double aWidth,
double aHeight,
bool aRepaint) = 0;
/**
* Resize and reposition the widget so tht inner client area has the given
@ -795,13 +793,12 @@ class nsIWidget : public nsISupports
* @param aWidth the new width of the client area.
* @param aHeight the new height of the client area.
* @param aRepaint whether the widget should be repainted
*
*/
NS_IMETHOD ResizeClient(double aX,
double aY,
double aWidth,
double aHeight,
bool aRepaint) = 0;
virtual void ResizeClient(double aX,
double aY,
double aWidth,
double aHeight,
bool aRepaint) = 0;
/**
* Sets the widget's z-index.