From b2889711de01e48a76d40d71c52e898546e03233 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 19 Dec 2016 14:38:19 +1100 Subject: [PATCH] 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 --- widget/nsBaseWidget.cpp | 45 +++++++++++++++++++++-------------------- widget/nsBaseWidget.h | 6 +++--- widget/nsIWidget.h | 21 +++++++++---------- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index c53ebd6ac041..1c1329bc8104 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -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); } } diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index e4dc6e3549a1..e24cc3eab48f 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -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; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index e346cd5a44bf..5db05d76a008 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -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.