Bug 1365660: Part 3 - Disable transparency (where necessary) and drop shadows for popups which contain remote content. r?mstange,bas.schouten draft
authorKris Maglione <maglione.k@gmail.com>
Tue, 16 May 2017 14:29:35 -0700
changeset 579864 5d302681d2a65eac15bdb7d1cacd9d7c92f8dde3
parent 579705 400c8681004568a5840180f23213ce5cc2ea5805
child 579865 77e773de3d206366d5b2bbd6a6aacfe90dd3216f
push id59389
push usermaglione.k@gmail.com
push dateWed, 17 May 2017 21:48:42 +0000
reviewersmstange, bas.schouten
bugs1365660
milestone55.0a1
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
layout/xul/nsMenuPopupFrame.cpp
--- 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);