Bug 374652 - return appropriate rect for gfxRect::Union if one of the

sources is empty.  r=vlad


git-svn-id: svn://10.0.0.236/trunk@222133 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tor%cs.brown.edu
2007-03-21 01:32:01 +00:00
parent 3b68325b2f
commit 4cd0863508

View File

@@ -57,13 +57,14 @@ gfxRect gfxRect::Intersect(const gfxRect& aRect) const
gfxRect gfxRect::Union(const gfxRect& aRect) const
{
gfxRect result(0,0,0,0);
if (!aRect.IsEmpty() && !IsEmpty()) {
gfxFloat x = PR_MIN(aRect.X(), X());
gfxFloat xmost = PR_MAX(aRect.XMost(), XMost());
gfxFloat y = PR_MIN(aRect.Y(), Y());
gfxFloat ymost = PR_MAX(aRect.YMost(), YMost());
result = gfxRect(x, y, xmost - x, ymost - y);
}
return result;
if (IsEmpty())
return aRect;
if (aRect.IsEmpty())
return *this;
gfxFloat x = PR_MIN(aRect.X(), X());
gfxFloat xmost = PR_MAX(aRect.XMost(), XMost());
gfxFloat y = PR_MIN(aRect.Y(), Y());
gfxFloat ymost = PR_MAX(aRect.YMost(), YMost());
return gfxRect(x, y, xmost - x, ymost - y);
}