From cb2d9417076a845dfd4ac9462cbd4a91287973d6 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Fri, 12 Oct 2007 16:12:16 -0700 Subject: [PATCH] Bug 394279 - "nsRect::Contains() should always succeed if the parameter rect is empty" [p=bugspam.Callek@gmail.com (Justin Wood [Callek]) r+sr=roc a1.9=mconnor] --- gfx/src/nsRect.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index be846e9a0990..5db23128a271 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -60,10 +60,12 @@ PRBool nsRect::Contains(nscoord aX, nscoord aY) const (aX < XMost()) && (aY < YMost())); } +//Also Returns true if aRect is Empty PRBool nsRect::Contains(const nsRect &aRect) const { - return (PRBool) ((aRect.x >= x) && (aRect.y >= y) && - (aRect.XMost() <= XMost()) && (aRect.YMost() <= YMost())); + return aRect.IsEmpty() || + ((PRBool) ((aRect.x >= x) && (aRect.y >= y) && + (aRect.XMost() <= XMost()) && (aRect.YMost() <= YMost()))); } // Intersection. Returns TRUE if the receiver overlaps aRect and