Bug 1370131 - Allow shadows on accelerated popups. r?kmag draft
authorMarkus Stange <mstange@themasta.com>
Sun, 04 Jun 2017 22:47:58 -0400
changeset 758143 f9e7fe76d740e095681836238f761227e7e64c79
parent 758142 994a684a7564c2735d98d6910a78d079a68f0b25
push id99961
push userbmo:mstange@themasta.com
push dateWed, 21 Feb 2018 23:03:57 +0000
reviewerskmag
bugs1370131, 1291457
milestone60.0a1
Bug 1370131 - Allow shadows on accelerated popups. r?kmag It looks like the work in bug 1291457 was all that was necessary to get working window shadows for accelerated popups. It seems that macOS is able to compute the correct shadow style consistently for whatever is drawn in the NSOpenGLContext during the first paint of the window (inside the drawRect call during the orderFront call that opens the window). We only ran into problems when we animated the contents of the window in a way that affects the shadow style; we're no longer doing that after bug 1291457. MozReview-Commit-ID: 62mfWuAsrg2
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -2225,23 +2225,17 @@ nsCocoaWindow::SetWindowShadowStyle(int3
 
   if (!mWindow)
     return;
 
   mShadowStyle = aStyle;
 
   // Shadowless windows are only supported on popups.
   if (mWindowType == eWindowType_popup) {
-    MOZ_ASSERT(mPopupContentView);
-
-    // Drop shadows are not sized correctly for composited popups when they are
-    // animated, so disable them entirely if the popup is composited.
-    bool disableShadow = (aStyle == NS_STYLE_WINDOW_SHADOW_NONE ||
-                          mPopupContentView->ShouldUseOffMainThreadCompositing());
-    [mWindow setHasShadow:!disableShadow];
+    [mWindow setHasShadow:aStyle != NS_STYLE_WINDOW_SHADOW_NONE];
   }
 
   [mWindow setUseMenuStyle:(aStyle == NS_STYLE_WINDOW_SHADOW_MENU)];
   AdjustWindowShadow();
   SetWindowBackgroundBlur();
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }