diff --git a/gfx/public/nsRect.h b/gfx/public/nsRect.h index 925b96ca825f..2ffeee400c7e 100644 --- a/gfx/public/nsRect.h +++ b/gfx/public/nsRect.h @@ -124,20 +124,9 @@ struct NS_GFX nsRect { return (PRBool) !operator==(aRect); } - // This method is weird. It should probably be deprecated. - nsRect operator+(const nsRect& aRect) const { - return nsRect(x + aRect.x, y + aRect.y, - width + aRect.width, height + aRect.height); - } nsRect operator+(const nsPoint& aPoint) const { return nsRect(x + aPoint.x, y + aPoint.y, width, height); } - - // This method is weird. It should probably be deprecated. - nsRect operator-(const nsRect& aRect) const { - return nsRect(x - aRect.x, y - aRect.y, - width - aRect.width, height - aRect.height); - } nsRect operator-(const nsPoint& aPoint) const { return nsRect(x - aPoint.x, y - aPoint.y, width, height); } @@ -153,6 +142,12 @@ struct NS_GFX nsRect { nsRect& ScaleRoundOut(const float aScale); nsRect& ScaleRoundIn(const float aScale); + // Helpers for accessing the vertices + nsPoint TopLeft() const { return nsPoint(x, y); } + nsPoint TopRight() const { return nsPoint(XMost(), y); } + nsPoint BottomLeft() const { return nsPoint(x, YMost()); } + nsPoint BottomRight() const { return nsPoint(XMost(), YMost()); } + // Helper methods for computing the extents nscoord XMost() const {return x + width;} nscoord YMost() const {return y + height;} diff --git a/gfx/public/nsSize.h b/gfx/public/nsSize.h index 6514fb15e930..6419c344dd09 100644 --- a/gfx/public/nsSize.h +++ b/gfx/public/nsSize.h @@ -67,15 +67,9 @@ struct nsSize { nsSize operator+(const nsSize& aSize) const { return nsSize(width + aSize.width, height + aSize.height); } - nsSize operator-(const nsSize& aSize) const { - return nsSize(width - aSize.width, height - aSize.height); - } nsSize& operator+=(const nsSize& aSize) {width += aSize.width; height += aSize.height; return *this;} - nsSize& operator-=(const nsSize& aSize) {width -= aSize.width; - height -= aSize.height; - return *this;} }; #endif /* NSSIZE_H */