Bug 1365660: Part 5a - Enable compositing for popups with remote content on Linux. r?marco draft
authorKris Maglione <maglione.k@gmail.com>
Tue, 16 May 2017 14:30:24 -0700
changeset 586222 1e43d52c671d08ec6fc78098c46338d2329daeac
parent 586221 d7a57d1045a0695279e206c9c20ca85e6841699f
child 586223 d16aafd6d14329a00700071f94118c3e6aec4ed0
push id61333
push usermaglione.k@gmail.com
push dateTue, 30 May 2017 00:33:14 +0000
reviewersmarco
bugs1365660
milestone55.0a1
Bug 1365660: Part 5a - Enable compositing for popups with remote content on Linux. r?marco MozReview-Commit-ID: C3oykBO7oHJ
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6421,29 +6421,33 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent
 
     // tell the window manager to start the resize
     gdk_window_begin_resize_drag(gdk_window, window_edge, button,
                                  screenX, screenY, aEvent->mTime);
 
     return NS_OK;
 }
 
+bool
+nsWindow::ShouldUseOffMainThreadCompositing()
+{
+    return (nsBaseWidget::ShouldUseOffMainThreadCompositing() &&
+            (HasRemoteContent() || GetTransparencyMode() != eTransparencyTransparent));
+}
+
 nsIWidget::LayerManager*
 nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
                           LayersBackend aBackendHint,
                           LayerManagerPersistence aPersistence)
 {
     if (mIsDestroyed) {
       // Prevent external code from triggering the re-creation of the LayerManager/Compositor
       // during shutdown. Just return what we currently have, which is most likely null.
       return mLayerManager;
     }
-    if (!mLayerManager && eTransparencyTransparent == GetTransparencyMode()) {
-        mLayerManager = CreateBasicLayerManager();
-    }
 
     return nsBaseWidget::GetLayerManager(aShadowManager, aBackendHint, aPersistence);
 }
 
 void
 nsWindow::ClearCachedResources()
 {
     if (mLayerManager &&
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -156,16 +156,18 @@ public:
                                              uint16_t aDuration,
                                              nsISupports* aData,
                                              nsIRunnable* aCallback) override;
     virtual already_AddRefed<nsIScreen> GetWidgetScreen() override;
     virtual nsresult   MakeFullScreen(bool aFullScreen,
                                       nsIScreen* aTargetScreen = nullptr) override;
     virtual void       HideWindowChrome(bool aShouldHide) override;
 
+    virtual bool       ShouldUseOffMainThreadCompositing() override;
+
     /**
      * GetLastUserInputTime returns a timestamp for the most recent user input
      * event.  This is intended for pointer grab requests (including drags).
      */
     static guint32     GetLastUserInputTime();
 
     // utility method, -1 if no change should be made, otherwise returns a
     // value that can be passed to gdk_window_set_decorations