Bug 1081160 - Update window shadows for Yosemite. r=smichaud, a=lmandel
authorMarkus Stange <mstange@themasta.com>
Tue, 14 Oct 2014 11:14:05 +0200
changeset 225747 fc032520a26e
parent 225746 2418d9e17dd0
child 225748 4018d170ab06
push id4000
push userryanvm@gmail.com
push date2014-10-20 16:31 +0000
treeherdermozilla-beta@6d2e5afd8b75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, lmandel
bugs1081160
milestone34.0
Bug 1081160 - Update window shadows for Yosemite. r=smichaud, a=lmandel
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -919,39 +919,49 @@ struct ShadowParams {
   float density;
   int offsetX;
   int offsetY;
   unsigned int flags;
 };
 
 // These numbers have been determined by looking at the results of
 // CGSGetWindowShadowAndRimParameters for native window types.
-static const ShadowParams kWindowShadowParameters[] = {
+static const ShadowParams kWindowShadowParametersPreYosemite[] = {
   { 0.0f, 0.0f, 0, 0, 0 },        // none
   { 8.0f, 0.5f, 0, 6, 1 },        // default
   { 10.0f, 0.44f, 0, 10, 512 },   // menu
   { 8.0f, 0.5f, 0, 6, 1 },        // tooltip
   { 4.0f, 0.6f, 0, 4, 512 }       // sheet
 };
 
+static const ShadowParams kWindowShadowParametersPostYosemite[] = {
+  { 0.0f, 0.0f, 0, 0, 0 },        // none
+  { 8.0f, 0.5f, 0, 6, 1 },        // default
+  { 9.882353f, 0.3f, 0, 4, 0 },   // menu
+  { 3.294118f, 0.2f, 0, 1, 0 },   // tooltip
+  { 9.882353f, 0.3f, 0, 4, 0 }    // sheet
+};
+
 // This method will adjust the window shadow style for popup windows after
 // they have been made visible. Before they're visible, their window number
 // might be -1, which is not useful.
 // We won't attempt to change the shadow for windows that can acquire key state
 // since OS X will reset the shadow whenever that happens.
 void
 nsCocoaWindow::AdjustWindowShadow()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (!mWindow || ![mWindow isVisible] || ![mWindow hasShadow] ||
       [mWindow canBecomeKeyWindow] || [mWindow windowNumber] == -1)
     return;
 
-  const ShadowParams& params = kWindowShadowParameters[mShadowStyle];
+  const ShadowParams& params = nsCocoaFeatures::OnYosemiteOrLater()
+    ? kWindowShadowParametersPostYosemite[mShadowStyle]
+    : kWindowShadowParametersPreYosemite[mShadowStyle];
   CGSConnection cid = _CGSDefaultConnection();
   CGSSetWindowShadowAndRimParameters(cid, [mWindow windowNumber],
                                      params.standardDeviation, params.density,
                                      params.offsetX, params.offsetY,
                                      params.flags);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }