Bug 1365660: Part 3 - Disable transparency (where necessary) and drop shadows for popups which contain remote content. r?mstange,bas.schouten
Drop shadows are currently not handled correctly for animated, composited
popups on Windows and OS-X. The shadows are rendered, but are not correctly
updated to match the final popup size.
Ideally, we should support drop shadows for these popups correctly, but in the
interim, disabling them gives better results.
Transparency is not handled correctly for composited popups on any platform,
but works with varying degrees of success on some platforms, for some popups.
Oddly, out of the three main desktop platforms, Linux seems to handle it the
best, so long as we render the popup as opaque, and let the platform
compositor handle the transparency.
MozReview-Commit-ID: E8NQlToUQq3
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -300,16 +300,26 @@ nsMenuPopupFrame::CreateWidgetForView(ns
static_cast<enum nsBorderStyle>(widgetData.mBorderStyle | eBorderStyle_close);
}
}
}
bool remote = HasRemoteContent();
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(this, this);
+#ifdef MOZ_WIDGET_GTK
+ if (remote) {
+ // Paradoxically, on Linux, setting the transparency mode to opaque will
+ // give us proper transparency for composited popups. The shape-mask-based
+ // pseudo-transparency that we use otherwise will render transparent areas
+ // as opaque black when compositing is enabled.
+ mode = eTransparencyOpaque;
+ }
+#endif
+
nsIContent* parentContent = GetContent()->GetParent();
nsIAtom *tag = nullptr;
if (parentContent && parentContent->IsXULElement())
tag = parentContent->NodeInfo()->NameAtom();
widgetData.mHasRemoteContent = remote;
widgetData.mSupportTranslucency = mode == eTransparencyTransparent;
widgetData.mDropShadow = !(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist);
widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide);