diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index 4ae17b70e8ae..f344274c6ea6 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -28,6 +28,7 @@ namespace layers { WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget) : mWidget(aWidget) , mLatestTransactionId(0) + , mWindowOverlayChanged(false) , mNeedsComposite(false) , mIsFirstPaint(false) , mTarget(nullptr) @@ -174,6 +175,16 @@ WebRenderLayerManager::BeginTransaction() bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) { + if (mWindowOverlayChanged) { + // If the window overlay changed then we can't do an empty transaction + // because we need to repaint the window overlay which we only currently + // support in a full transaction. + // XXX If we end up hitting this branch a lot we can probably optimize it + // by just sending an updated window overlay image instead of rebuilding + // the entire WR display list. + return false; + } + // With the WebRenderLayerManager we reject attempts to set most kind of // "pending data" for empty transactions. Any place that attempts to update // transforms or scroll offset, for example, will get failure return values @@ -275,6 +286,8 @@ WebRenderLayerManager::EndTransactionWithoutLayer(nsDisplayList* aDisplayList, contentSize); mWidget->AddWindowOverlayWebRenderCommands(WrBridge(), builder, resourceUpdates); + mWindowOverlayChanged = false; + WrBridge()->ClearReadLocks(); if (AsyncPanZoomEnabled()) { diff --git a/gfx/layers/wr/WebRenderLayerManager.h b/gfx/layers/wr/WebRenderLayerManager.h index 79a7a3d52f17..7c26fc583151 100644 --- a/gfx/layers/wr/WebRenderLayerManager.h +++ b/gfx/layers/wr/WebRenderLayerManager.h @@ -154,6 +154,7 @@ public: WebRenderScrollData& GetScrollData() { return mScrollData; } void WrUpdated(); + void WindowOverlayChanged() { mWindowOverlayChanged = true; } private: /** @@ -191,6 +192,7 @@ private: // APZ to do it's job WebRenderScrollData mScrollData; + bool mWindowOverlayChanged; bool mNeedsComposite; bool mIsFirstPaint; FocusTarget mFocusTarget; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 7367b24a4450..05f359f131ad 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -71,6 +71,7 @@ #include "mozilla/layers/InputAPZContext.h" #include "mozilla/layers/IpcResourceUpdateQueue.h" #include "mozilla/layers/WebRenderBridgeChild.h" +#include "mozilla/layers/WebRenderLayerManager.h" #include "mozilla/webrender/WebRenderAPI.h" #include "mozilla/widget/CompositorWidget.h" #include "gfxUtils.h" @@ -4021,6 +4022,8 @@ NSEvent* gLastDragMouseDownEvent = nil; if ([self isUsingOpenGL]) { if (ShadowLayerForwarder* slf = mGeckoChild->GetLayerManager()->AsShadowForwarder()) { slf->WindowOverlayChanged(); + } else if (WebRenderLayerManager* wrlm = mGeckoChild->GetLayerManager()->AsWebRenderLayerManager()) { + wrlm->WindowOverlayChanged(); } }