diff --git a/gfx/src/mac/nsDeviceContextMac.cpp b/gfx/src/mac/nsDeviceContextMac.cpp index 592499fd76c..be23f32e5cc 100644 --- a/gfx/src/mac/nsDeviceContextMac.cpp +++ b/gfx/src/mac/nsDeviceContextMac.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "il_util.h" #include #include "nsIPref.h" @@ -321,10 +322,12 @@ NS_IMETHODIMP nsDeviceContextMac :: CheckFontExistence(const nsString& aFontName NS_IMETHODIMP nsDeviceContextMac::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight) { - aWidth = 1; - aHeight = 1; - - return NS_ERROR_FAILURE; + // FIXME: could just union all of the GDevice rectangles together. + RgnHandle grayRgn = LMGetGrayRgn(); + Rect bounds = (**grayRgn).rgnBBox; + aWidth = bounds.right - bounds.left; + aHeight = bounds.bottom - bounds.top; + return NS_OK; } diff --git a/widget/src/mac/nsDeviceContextMac.cpp b/widget/src/mac/nsDeviceContextMac.cpp index 592499fd76c..be23f32e5cc 100644 --- a/widget/src/mac/nsDeviceContextMac.cpp +++ b/widget/src/mac/nsDeviceContextMac.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "il_util.h" #include #include "nsIPref.h" @@ -321,10 +322,12 @@ NS_IMETHODIMP nsDeviceContextMac :: CheckFontExistence(const nsString& aFontName NS_IMETHODIMP nsDeviceContextMac::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight) { - aWidth = 1; - aHeight = 1; - - return NS_ERROR_FAILURE; + // FIXME: could just union all of the GDevice rectangles together. + RgnHandle grayRgn = LMGetGrayRgn(); + Rect bounds = (**grayRgn).rgnBBox; + aWidth = bounds.right - bounds.left; + aHeight = bounds.bottom - bounds.top; + return NS_OK; }