Merge mozilla-central into mozilla-inbound
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 13 Oct 2012 10:45:36 -0400
changeset 110285 7c6513e197ad4037bd467b0728861dcbf1a4d3f7
parent 110284 f305661c121702176a565fdde36133511c87bccf (current diff)
parent 110256 847807ab2646cc15d0f77c4876420a54fc61e758 (diff)
child 110286 5c273dc49dee15119fac485ee3040f1bc71f2e05
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
milestone19.0a1
Merge mozilla-central into mozilla-inbound
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -1893,21 +1893,20 @@ nsNativeThemeCocoa::DrawResizer(CGContex
 
   RenderTransformedHIThemeControl(cgContext, aRect, RenderResizer, &drawInfo,
                                   IsFrameRTL(aFrame));
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 static bool
-IsContextZoomedToHighResolution(nsDeviceContext* aContext)
+IsHiDPIContext(nsDeviceContext* aContext)
 {
-  const float devPixelsPerCSSPixel = 1.0f *
-    nsPresContext::AppUnitsPerCSSPixel() / aContext->AppUnitsPerDevPixel();
-  return devPixelsPerCSSPixel > 1.5f;
+  return nsPresContext::AppUnitsPerCSSPixel() >=
+    2 * aContext->UnscaledAppUnitsPerDevPixel();
 }
 
 NS_IMETHODIMP
 nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
                                          nsIFrame* aFrame,
                                          uint8_t aWidgetType,
                                          const nsRect& aRect,
                                          const nsRect& aDirtyRect)
@@ -1927,17 +1926,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
     return NS_OK; // Don't attempt to draw invisible widgets.
 
   gfxContext* thebesCtx = aContext->ThebesContext();
   if (!thebesCtx)
     return NS_ERROR_FAILURE;
 
   gfxContextMatrixAutoSaveRestore save(thebesCtx);
 
-  if (IsContextZoomedToHighResolution(aContext->DeviceContext())) {
+  if (IsHiDPIContext(aContext->DeviceContext())) {
     // Use high-resolution drawing.
     nativeWidgetRect.ScaleInverse(2.0f);
     nativeDirtyRect.ScaleInverse(2.0f);
     thebesCtx->Scale(2.0f, 2.0f);
   }
 
   gfxQuartzNativeDrawing nativeDrawing(thebesCtx, nativeDirtyRect);
 
@@ -2482,17 +2481,17 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDe
       break;
     }
 
     case NS_THEME_STATUSBAR:
       aResult->SizeTo(0, 1, 0, 0);
       break;
   }
 
-  if (IsContextZoomedToHighResolution(aContext)) {
+  if (IsHiDPIContext(aContext)) {
     *aResult = *aResult + *aResult; // doubled
   }
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
@@ -2755,17 +2754,17 @@ nsNativeThemeCocoa::GetMinimumWidgetSize
       HIPoint pnt = { 0, 0 };
       HIRect bounds;
       HIThemeGetGrowBoxBounds(&pnt, &drawInfo, &bounds);
       aResult->SizeTo(bounds.size.width, bounds.size.height);
       *aIsOverridable = false;
     }
   }
 
-  if (IsContextZoomedToHighResolution(aContext->DeviceContext())) {
+  if (IsHiDPIContext(aContext->DeviceContext())) {
     *aResult = *aResult * 2;
   }
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }