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 579866 f1739e2666034620192f80ecb3a05f3a80a465d5
parent 579865 77e773de3d206366d5b2bbd6a6aacfe90dd3216f
child 579867 61b0bbc674f69866e6113df0638e136be8013b88
push id59389
push usermaglione.k@gmail.com
push dateWed, 17 May 2017 21:48:42 +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
@@ -6420,29 +6420,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