Bug 1429602: Rename BaseRect::IsZero to BaseRect::IsZeroArea. Also slip in some corrections to using BaseRect methods instead of direct member access. r?bas.schouten draft
authorMilan Sreckovic <milan@mozilla.com>
Wed, 10 Jan 2018 17:57:10 -0500
changeset 718863 2dbcff19dc52aad36dde4cae8bafb61d9bdf68e2
parent 718505 d5f42a23909eb181274731b07e4984bfbd18557d
child 745611 60a8ccb0a6c1c70de7e3c8aa0934ca3357068bc3
push id95061
push userbmo:milan@mozilla.com
push dateWed, 10 Jan 2018 22:57:28 +0000
reviewersbas.schouten
bugs1429602
milestone59.0a1
Bug 1429602: Rename BaseRect::IsZero to BaseRect::IsZeroArea. Also slip in some corrections to using BaseRect methods instead of direct member access. r?bas.schouten MozReview-Commit-ID: H3ApaWesbKF
gfx/2d/BaseRect.h
gfx/2d/DrawTargetCairo.cpp
gfx/layers/ImageLayers.cpp
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/X11BasicCompositor.cpp
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/opengl/CompositorOGL.cpp
gfx/tests/gtest/TestRect.cpp
gfx/thebes/gfxContext.cpp
--- a/gfx/2d/BaseRect.h
+++ b/gfx/2d/BaseRect.h
@@ -55,17 +55,17 @@ struct BaseRect {
   BaseRect(T aX, T aY, T aWidth, T aHeight) :
       x(aX), y(aY), width(aWidth), height(aHeight)
   {
   }
 
   // Emptiness. An empty rect is one that has no area, i.e. its height or width
   // is <= 0.  Zero rect is the one with height and width set to zero.  Note
   // that SetEmpty() may change a rectangle that identified as IsEmpty().
-  MOZ_ALWAYS_INLINE bool IsZero() const { return height == 0 || width == 0; }
+  MOZ_ALWAYS_INLINE bool IsZeroArea() const { return height == 0 || width == 0; }
   MOZ_ALWAYS_INLINE bool IsEmpty() const { return height <= 0 || width <= 0; }
   void SetEmpty() { width = height = 0; }
 
   // "Finite" means not inf and not NaN
   bool IsFinite() const
   {
     typedef typename mozilla::Conditional<mozilla::IsSame<T, float>::value, float, double>::Type FloatType;
     return (mozilla::IsFinite(FloatType(x)) &&
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -2134,28 +2134,28 @@ DrawTargetCairo::Draw3DTransformedSurfac
   Matrix4x4 fullMat = aMatrix * Matrix4x4::From2D(mTransform);
   IntRect xformBounds =
     RoundedOut(
       fullMat.TransformAndClipBounds(Rect(Point(0, 0), Size(aSurface->GetSize())),
                                      Rect(Point(0, 0), Size(GetSize()))));
   if (xformBounds.IsEmpty()) {
     return true;
   }
-  fullMat.PostTranslate(-xformBounds.x, -xformBounds.y, 0);
+  fullMat.PostTranslate(-xformBounds.X(), -xformBounds.Y(), 0);
   if (!fullMat.Invert()) {
     return false;
   }
   pixman_transform xform;
   if (!GfxMatrixToPixmanTransform(fullMat, &xform)) {
     return false;
   }
 
   cairo_surface_t* xformSurf =
     cairo_surface_create_similar(srcSurf, CAIRO_CONTENT_COLOR_ALPHA,
-                                 xformBounds.width, xformBounds.height);
+                                 xformBounds.Width(), xformBounds.Height());
   if (!SupportsXRender(xformSurf)) {
     cairo_surface_destroy(xformSurf);
     return false;
   }
   cairo_device_t* device = cairo_surface_get_device(xformSurf);
   if (cairo_device_acquire(device) != CAIRO_STATUS_SUCCESS) {
     cairo_surface_destroy(xformSurf);
     return false;
@@ -2173,34 +2173,34 @@ DrawTargetCairo::Draw3DTransformedSurfac
   Picture dstPict = XRenderCreatePicture(display,
                                          cairo_xlib_surface_get_drawable(xformSurf),
                                          cairo_xlib_surface_get_xrender_format(xformSurf),
                                          0, nullptr);
 
   XRenderComposite(display, PictOpSrc,
                    srcPict, X11None, dstPict,
                    0, 0, 0, 0, 0, 0,
-                   xformBounds.width, xformBounds.height);
+                   xformBounds.Width(), xformBounds.Height());
 
   XRenderFreePicture(display, srcPict);
   XRenderFreePicture(display, dstPict);
 
   cairo_device_release(device);
   cairo_surface_mark_dirty(xformSurf);
 
   AutoPrepareForDrawing(this, mContext);
 
   cairo_identity_matrix(mContext);
 
   cairo_set_operator(mContext, CAIRO_OPERATOR_OVER);
   cairo_set_antialias(mContext, CAIRO_ANTIALIAS_DEFAULT);
-  cairo_set_source_surface(mContext, xformSurf, xformBounds.x, xformBounds.y);
+  cairo_set_source_surface(mContext, xformSurf, xformBounds.X(), xformBounds.Y());
 
   cairo_new_path(mContext);
-  cairo_rectangle(mContext, xformBounds.x, xformBounds.y, xformBounds.width, xformBounds.height);
+  cairo_rectangle(mContext, xformBounds.X(), xformBounds.Y(), xformBounds.Width(), xformBounds.Height());
   cairo_fill(mContext);
 
   cairo_surface_destroy(xformSurf);
 
   return true;
 #else
   return DrawTarget::Draw3DTransformedSurface(aSurface, aMatrix);
 #endif
--- a/gfx/layers/ImageLayers.cpp
+++ b/gfx/layers/ImageLayers.cpp
@@ -39,17 +39,17 @@ void ImageLayer::ComputeEffectiveTransfo
   // Snap our local transform first, and snap the inherited transform as well.
   // This makes our snapping equivalent to what would happen if our content
   // was drawn into a PaintedLayer (gfxContext would snap using the local
   // transform, then we'd snap again when compositing the PaintedLayer).
   mEffectiveTransform =
       SnapTransform(local, sourceRect, nullptr) *
       SnapTransformTranslation(aTransformToSurface, nullptr);
 
-  if (mScaleMode != ScaleMode::SCALE_NONE && !sourceRect.IsZero()) {
+  if (mScaleMode != ScaleMode::SCALE_NONE && !sourceRect.IsZeroArea()) {
     NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
                  "No other scalemodes than stretch and none supported yet.");
     local.PreScale(mScaleToSize.width / sourceRect.Width(),
                    mScaleToSize.height / sourceRect.Height(), 1.0);
 
     mEffectiveTransformForBuffer =
         SnapTransform(local, sourceRect, nullptr) *
         SnapTransformTranslation(aTransformToSurface, nullptr);
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -254,19 +254,19 @@ BasicCompositor::GetTextureFactoryIdenti
                                  XRE_GetProcessType(),
                                  GetMaxTextureSize());
   return ident;
 }
 
 already_AddRefed<CompositingRenderTarget>
 BasicCompositor::CreateRenderTarget(const IntRect& aRect, SurfaceInitMode aInit)
 {
-  MOZ_ASSERT(!aRect.IsZero(), "Trying to create a render target of invalid size");
+  MOZ_ASSERT(!aRect.IsZeroArea(), "Trying to create a render target of invalid size");
 
-  if (aRect.IsZero()) {
+  if (aRect.IsZeroArea()) {
     return nullptr;
   }
 
   RefPtr<DrawTarget> target = mDrawTarget->CreateSimilarDrawTarget(aRect.Size(), SurfaceFormat::B8G8R8A8);
 
   if (!target) {
     return nullptr;
   }
@@ -284,19 +284,19 @@ BasicCompositor::CreateRenderTargetFromS
   MOZ_CRASH("GFX: Shouldn't be called!");
   return nullptr;
 }
 
 already_AddRefed<CompositingRenderTarget>
 BasicCompositor::CreateRenderTargetForWindow(const LayoutDeviceIntRect& aRect, const LayoutDeviceIntRect& aClearRect, BufferMode aBufferMode)
 {
   MOZ_ASSERT(mDrawTarget);
-  MOZ_ASSERT(!aRect.IsZero(), "Trying to create a render target of invalid size");
+  MOZ_ASSERT(!aRect.IsZeroArea(), "Trying to create a render target of invalid size");
 
-  if (aRect.IsZero()) {
+  if (aRect.IsZeroArea()) {
     return nullptr;
   }
 
   RefPtr<BasicCompositingRenderTarget> rt;
   IntRect rect = aRect.ToUnknownRect();
 
   if (aBufferMode != BufferMode::BUFFER_NONE) {
     RefPtr<DrawTarget> target = mWidget->GetBackBufferDrawTarget(mDrawTarget, aRect, aClearRect);
--- a/gfx/layers/basic/X11BasicCompositor.cpp
+++ b/gfx/layers/basic/X11BasicCompositor.cpp
@@ -51,18 +51,18 @@ X11DataTextureSourceBasic::Update(gfx::D
   // Image contents have changed, upload to our DrawTarget
   // If aDestRegion is null, means we're updating the whole surface
   // Note : Incremental update with a source offset is only used on Mac.
   NS_ASSERTION(!aSrcOffset, "SrcOffset should not be used with linux OMTC basic");
 
   if (aDestRegion) {
     for (auto iter = aDestRegion->RectIter(); !iter.Done(); iter.Next()) {
       const IntRect& rect = iter.Get();
-      IntRect srcRect(rect.x, rect.y, rect.width, rect.height);
-      IntPoint dstPoint(rect.x, rect.y);
+      IntRect srcRect(rect.X(), rect.Y(), rect.Width(), rect.Height());
+      IntPoint dstPoint(rect.X(), rect.Y());
 
       // We're uploading regions to our buffer, so let's just copy contents over
       mBufferDrawTarget->CopySurface(aSurface, srcRect, dstPoint);
     }
   } else {
     // We're uploading the whole buffer, so let's just copy the full surface
     IntSize size = aSurface->GetSize();
     mBufferDrawTarget->CopySurface(aSurface, IntRect(0, 0, size.width, size.height),
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -127,17 +127,17 @@ ImageLayerComposite::ComputeEffectiveTra
   // Snap our local transform first, and snap the inherited transform as well.
   // This makes our snapping equivalent to what would happen if our content
   // was drawn into a PaintedLayer (gfxContext would snap using the local
   // transform, then we'd snap again when compositing the PaintedLayer).
   mEffectiveTransform =
       SnapTransform(local, sourceRect, nullptr) *
       SnapTransformTranslation(aTransformToSurface, nullptr);
 
-  if (mScaleMode != ScaleMode::SCALE_NONE && !sourceRect.IsZero()) {
+  if (mScaleMode != ScaleMode::SCALE_NONE && !sourceRect.IsZeroArea()) {
     NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
                  "No other scalemodes than stretch and none supported yet.");
     local.PreScale(mScaleToSize.width / sourceRect.Width(),
                    mScaleToSize.height / sourceRect.Height(), 1.0);
 
     mEffectiveTransformForBuffer =
         SnapTransform(local, sourceRect, nullptr) *
         SnapTransformTranslation(aTransformToSurface, nullptr);
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -322,19 +322,19 @@ CompositorD3D11::GetMaxTextureSize() con
 {
   return GetMaxTextureSizeForFeatureLevel(mFeatureLevel);
 }
 
 already_AddRefed<CompositingRenderTarget>
 CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect,
                                     SurfaceInitMode aInit)
 {
-  MOZ_ASSERT(!aRect.IsZero());
+  MOZ_ASSERT(!aRect.IsZeroArea());
 
-  if (aRect.IsZero()) {
+  if (aRect.IsZeroArea()) {
     return nullptr;
   }
 
   CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.Width(), aRect.Height(), 1, 1,
                              D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
 
   RefPtr<ID3D11Texture2D> texture;
   HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
@@ -354,19 +354,19 @@ CompositorD3D11::CreateRenderTarget(cons
   return rt.forget();
 }
 
 RefPtr<ID3D11Texture2D>
 CompositorD3D11::CreateTexture(const gfx::IntRect& aRect,
                                const CompositingRenderTarget* aSource,
                                const gfx::IntPoint& aSourcePoint)
 {
-  MOZ_ASSERT(!aRect.IsZero());
+  MOZ_ASSERT(!aRect.IsZeroArea());
 
-  if (aRect.IsZero()) {
+  if (aRect.IsZeroArea()) {
     return nullptr;
   }
 
   CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM,
                              aRect.Width(), aRect.Height(), 1, 1,
                              D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
 
   RefPtr<ID3D11Texture2D> texture;
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -515,19 +515,19 @@ CompositorOGL::PrepareViewport(Compositi
     aRenderTarget->GetProjection(mProjMatrix, depthEnable, zNear, zFar);
     mGLContext->fDepthRange(zNear, zFar);
   }
 }
 
 already_AddRefed<CompositingRenderTarget>
 CompositorOGL::CreateRenderTarget(const IntRect &aRect, SurfaceInitMode aInit)
 {
-  MOZ_ASSERT(!aRect.IsZero(), "Trying to create a render target of invalid size");
+  MOZ_ASSERT(!aRect.IsZeroArea(), "Trying to create a render target of invalid size");
 
-  if (aRect.IsZero()) {
+  if (aRect.IsZeroArea()) {
     return nullptr;
   }
 
   if (!gl()) {
     // CompositingRenderTargetOGL does not work without a gl context.
     return nullptr;
   }
 
@@ -542,19 +542,19 @@ CompositorOGL::CreateRenderTarget(const 
   return surface.forget();
 }
 
 already_AddRefed<CompositingRenderTarget>
 CompositorOGL::CreateRenderTargetFromSource(const IntRect &aRect,
                                             const CompositingRenderTarget *aSource,
                                             const IntPoint &aSourcePoint)
 {
-  MOZ_ASSERT(!aRect.IsZero(), "Trying to create a render target of invalid size");
+  MOZ_ASSERT(!aRect.IsZeroArea(), "Trying to create a render target of invalid size");
 
-  if (aRect.IsZero()) {
+  if (aRect.IsZeroArea()) {
     return nullptr;
   }
 
   if (!gl()) {
     return nullptr;
   }
 
   GLuint tex = 0;
--- a/gfx/tests/gtest/TestRect.cpp
+++ b/gfx/tests/gtest/TestRect.cpp
@@ -31,18 +31,18 @@ TestConstructors()
 
   // Make sure the rectangle was properly initialized
   EXPECT_TRUE(rect2.IsEqualEdges(rect1) &&
               rect2.IsEqualXY(rect1.X(), rect1.Y()) &&
               rect2.IsEqualSize(rect1.Width(), rect1.Height())) <<
     "[2] Make sure the rectangle was properly initialized with copy constructor";
 
 
-  EXPECT_TRUE(!rect1.IsEmpty() && !rect1.IsZero() && rect1.IsFinite() &&
-              !rect2.IsEmpty() && !rect2.IsZero() && rect2.IsFinite()) <<
+  EXPECT_TRUE(!rect1.IsEmpty() && !rect1.IsZeroArea() && rect1.IsFinite() &&
+              !rect2.IsEmpty() && !rect2.IsZeroArea() && rect2.IsFinite()) <<
     "[3] These rectangles are not empty and are finite";
 
 
   rect1.SetRect(1, 2, 30, 40);
   EXPECT_TRUE(rect1.X() == 1 && rect1.Y() == 2 &&
               rect1.Width() == 30 && rect1.Height() == 40 &&
               rect1.XMost() == 31 && rect1.YMost() == 42);
 
@@ -274,17 +274,17 @@ TestIntersection()
     "[3] Test against a rect that overlaps the left edge of rect1";
   rect2.MoveByX(1);
 
   // Test against a rect that's outside of rect1 on the left
   rect2.MoveByX(-rect2.Width());
   EXPECT_FALSE(dest.IntersectRect(rect1, rect2)) <<
     "[4] Test against a rect that's outside of rect1 on the left";
   // Make sure an empty rect is returned
-  EXPECT_TRUE(dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(dest.IsEmpty() && dest.IsZeroArea()) <<
     "[4] Make sure an empty rect is returned";
   EXPECT_TRUE(dest.IsFinite()) << "[4b] Should be finite";
   rect2.MoveByX(rect2.Width());
 
   // Test against a rect that overlaps the top edge of rect1
   rect2.MoveByY(-1);
   EXPECT_FALSE(!dest.IntersectRect(rect1, rect2) ||
     !(dest.IsEqualInterior(RectType(rect1.X(), rect1.Y(), rect1.Width(), rect1.Height() - 1)))) <<
@@ -292,34 +292,34 @@ TestIntersection()
   EXPECT_TRUE(dest.IsFinite()) << "[5b] Should be finite";
   rect2.MoveByY(1);
 
   // Test against a rect that's outside of rect1 on the top
   rect2.MoveByY(-rect2.Height());
   EXPECT_FALSE(dest.IntersectRect(rect1, rect2)) <<
     "[6] Test against a rect that's outside of rect1 on the top";
   // Make sure an empty rect is returned
-  EXPECT_TRUE(dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(dest.IsEmpty() && dest.IsZeroArea()) <<
     "[6] Make sure an empty rect is returned";
   EXPECT_TRUE(dest.IsFinite()) << "[6b] Should be finite";
   rect2.MoveByY(rect2.Height());
 
   // Test against a rect that overlaps the right edge of rect1
   rect2.MoveByX(1);
   EXPECT_FALSE(!dest.IntersectRect(rect1, rect2) ||
     !(dest.IsEqualInterior(RectType(rect1.X() + 1, rect1.Y(), rect1.Width() - 1, rect1.Height())))) <<
     "[7] Test against a rect that overlaps the right edge of rect1";
   rect2.MoveByX(-1);
 
   // Test against a rect that's outside of rect1 on the right
   rect2.MoveByX(rect2.Width());
   EXPECT_FALSE(dest.IntersectRect(rect1, rect2)) <<
     "[8] Test against a rect that's outside of rect1 on the right";
   // Make sure an empty rect is returned
-  EXPECT_TRUE(dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(dest.IsEmpty() && dest.IsZeroArea()) <<
     "[8] Make sure an empty rect is returned";
   EXPECT_TRUE(dest.IsFinite()) << "[8b] Should be finite";
   rect2.MoveByX(-rect2.Width());
 
   // Test against a rect that overlaps the bottom edge of rect1
   rect2.MoveByY(1);
   EXPECT_FALSE(!dest.IntersectRect(rect1, rect2) ||
     !(dest.IsEqualInterior(RectType(rect1.X(), rect1.Y() + 1, rect1.Width(), rect1.Height() - 1)))) <<
@@ -327,50 +327,50 @@ TestIntersection()
   EXPECT_TRUE(dest.IsFinite()) << "[9b] Should be finite";
   rect2.MoveByY(-1);
 
   // Test against a rect that's outside of rect1 on the bottom
   rect2.MoveByY(rect2.Height());
   EXPECT_FALSE(dest.IntersectRect(rect1, rect2)) <<
     "[10] Test against a rect that's outside of rect1 on the bottom";
   // Make sure an empty rect is returned
-  EXPECT_TRUE(dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(dest.IsEmpty() && dest.IsZeroArea()) <<
     "[10] Make sure an empty rect is returned";
   EXPECT_TRUE(dest.IsFinite()) << "[10b] Should be finite";
   rect2.MoveByY(-rect2.Height());
 
   // Test against a rect with zero width or height
   rect1.SetRect(100, 100, 100, 100);
   rect2.SetRect(150, 100, 0, 100);
-  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZeroArea()) <<
     "[11] Intersection of rects with zero width or height should be empty";
   EXPECT_TRUE(dest.IsFinite()) << "[11b] Should be finite";
 
   // Tests against a rect with negative width or height
   //
 
   // Test against a rect with negative width
   rect1.SetRect(100, 100, 100, 100);
   rect2.SetRect(100, 100, -100, 100);
-  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZeroArea()) <<
     "[12] Intersection of rects with negative width or height should be empty";
   EXPECT_TRUE(dest.IsFinite()) << "[12b] Should be finite";
 
   // Those two rects exactly overlap in some way...
   // but we still want to return an empty rect
   rect1.SetRect(100, 100, 100, 100);
   rect2.SetRect(200, 200, -100, -100);
-  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZeroArea()) <<
     "[13] Intersection of rects with negative width or height should be empty";
   EXPECT_TRUE(dest.IsFinite()) << "[13b] Should be finite";
 
   // Test against two identical rects with negative height
   rect1.SetRect(100, 100, 100, -100);
   rect2.SetRect(100, 100, 100, -100);
-  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(!dest.IntersectRect(rect1, rect2) && dest.IsEmpty() && dest.IsZeroArea()) <<
     "[14] Intersection of rects with negative width or height should be empty";
   EXPECT_TRUE(dest.IsFinite()) << "[14b] Should be finite";
 
   return true;
 }
 
 template <class RectType>
 static bool
@@ -378,50 +378,50 @@ TestUnion()
 {
   RectType  rect1;
   RectType  rect2(10, 10, 50, 50);
   RectType  dest;
 
   // Check the case where the receiver is an empty rect
   rect1.SetEmpty();
   dest.UnionRect(rect1, rect2);
-  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZero() && dest.IsEqualInterior(rect2)) <<
+  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZeroArea() && dest.IsEqualInterior(rect2)) <<
     "[1] Check the case where the receiver is an empty rect";
   EXPECT_TRUE(dest.IsFinite()) << "[1b] Should be finite";
 
   // Check the case where the source rect is an empty rect
   rect1 = rect2;
   rect2.SetEmpty();
   dest.UnionRect(rect1, rect2);
-  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZero() && dest.IsEqualInterior(rect1)) <<
+  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZeroArea() && dest.IsEqualInterior(rect1)) <<
     "[2] Check the case where the source rect is an empty rect";
   EXPECT_TRUE(dest.IsFinite()) << "[2b] Should be finite";
 
   // Test the case where both rects are empty
   rect1.SetEmpty();
   rect2.SetEmpty();
   dest.UnionRect(rect1, rect2);
-  EXPECT_TRUE(dest.IsEmpty() && dest.IsZero()) <<
+  EXPECT_TRUE(dest.IsEmpty() && dest.IsZeroArea()) <<
     "[3] Test the case where both rects are empty";
   EXPECT_TRUE(dest.IsFinite()) << "[3b] Should be finite";
 
   // Test union case where the two rects don't overlap at all
   rect1.SetRect(10, 10, 50, 50);
   rect2.SetRect(100, 100, 50, 50);
   dest.UnionRect(rect1, rect2);
-  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZero() &&
+  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZeroArea() &&
     (dest.IsEqualInterior(RectType(rect1.X(), rect1.Y(), rect2.XMost() - rect1.X(), rect2.YMost() - rect1.Y())))) <<
     "[4] Test union case where the two rects don't overlap at all";
   EXPECT_TRUE(dest.IsFinite()) << "[4b] Should be finite";
 
   // Test union case where the two rects overlap
   rect1.SetRect(30, 30, 50, 50);
   rect2.SetRect(10, 10, 50, 50);
   dest.UnionRect(rect1, rect2);
-  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZero() &&
+  EXPECT_TRUE(!dest.IsEmpty() && !dest.IsZeroArea() &&
     (dest.IsEqualInterior(RectType(rect2.X(), rect2.Y(), rect1.XMost() - rect2.X(), rect1.YMost() - rect2.Y())))) <<
     "[5] Test union case where the two rects overlap";
   EXPECT_TRUE(dest.IsFinite()) << "[5b] Should be finite";
 
   return true;
 }
 
 static bool
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -598,17 +598,17 @@ gfxContext::PopClip()
   mDT->PopClip();
 }
 
 gfxRect
 gfxContext::GetClipExtents(ClipExtentsSpace aSpace) const
 {
   Rect rect = GetAzureDeviceSpaceClipBounds();
 
-  if (rect.IsZero()) {
+  if (rect.IsZeroArea()) {
     return gfxRect(0, 0, 0, 0);
   }
 
   if (aSpace == eUserSpace) {
     Matrix mat = mTransform;
     mat.Invert();
     rect = mat.TransformBounds(rect);
   }