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
--- 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;
}