From 267c1c0f3409a806945b79ba95b99da9af61b335 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Fri, 24 May 2019 09:28:34 -0500 Subject: [PATCH] Bug 1519546, part 8 - Also gather EffectsInfo for remote browsers with WebRender. r=jrmuizel The nsDisplayListBuilder bits were added in the previous commit. Differential Revision: https://phabricator.services.mozilla.com/D32477 --HG-- extra : rebase_source : aec41ccaaab4c99b11ed94baf908d1ec61eaee31 extra : intermediate-source : bbcfdcc12774c1b8d78c6420614141382fed3d40 extra : source : 489c8d663f7f63ea32d3eb2226d45a84e51aabe8 --- gfx/layers/wr/WebRenderUserData.cpp | 10 ++++++++++ gfx/layers/wr/WebRenderUserData.h | 18 ++++++++++++++++++ layout/ipc/RenderFrame.cpp | 15 +++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/gfx/layers/wr/WebRenderUserData.cpp b/gfx/layers/wr/WebRenderUserData.cpp index 2226d1a95d0d..11b20b9075e1 100644 --- a/gfx/layers/wr/WebRenderUserData.cpp +++ b/gfx/layers/wr/WebRenderUserData.cpp @@ -372,6 +372,16 @@ WebRenderCanvasRendererAsync* WebRenderCanvasData::CreateCanvasRenderer() { return mCanvasRenderer.get(); } +WebRenderRemoteData::WebRenderRemoteData(RenderRootStateManager* aManager, + nsDisplayItem* aItem) + : WebRenderUserData(aManager, aItem) {} + +WebRenderRemoteData::~WebRenderRemoteData() { + if (mRemoteBrowser) { + mRemoteBrowser->UpdateEffects(mozilla::dom::EffectsInfo::FullyHidden()); + } +} + WebRenderRenderRootData::WebRenderRenderRootData( RenderRootStateManager* aManager, nsDisplayItem* aItem) : WebRenderUserData(aManager, aItem) {} diff --git a/gfx/layers/wr/WebRenderUserData.h b/gfx/layers/wr/WebRenderUserData.h index e8165752ae4b..feba0ac419be 100644 --- a/gfx/layers/wr/WebRenderUserData.h +++ b/gfx/layers/wr/WebRenderUserData.h @@ -13,6 +13,7 @@ #include "mozilla/webrender/WebRenderAPI.h" #include "mozilla/layers/AnimationInfo.h" #include "mozilla/layers/RenderRootBoundary.h" +#include "mozilla/dom/RemoteBrowser.h" #include "nsIFrame.h" #include "ImageTypes.h" @@ -78,6 +79,7 @@ class WebRenderUserData { eFallback, eAnimation, eCanvas, + eRemote, eGroup, eMask, eRenderRoot, @@ -248,6 +250,22 @@ class WebRenderCanvasData : public WebRenderUserData { UniquePtr mCanvasRenderer; }; +class WebRenderRemoteData : public WebRenderUserData { + public: + WebRenderRemoteData(RenderRootStateManager* aManager, nsDisplayItem* aItem); + virtual ~WebRenderRemoteData(); + + UserDataType GetType() override { return UserDataType::eRemote; } + static UserDataType Type() { return UserDataType::eRemote; } + + void SetRemoteBrowser(dom::RemoteBrowser* aBrowser) { + mRemoteBrowser = aBrowser; + } + + protected: + RefPtr mRemoteBrowser; +}; + class WebRenderRenderRootData : public WebRenderUserData { public: WebRenderRenderRootData(RenderRootStateManager* aManager, diff --git a/layout/ipc/RenderFrame.cpp b/layout/ipc/RenderFrame.cpp index 7b4d645da5fd..1ab0b8b94898 100644 --- a/layout/ipc/RenderFrame.cpp +++ b/layout/ipc/RenderFrame.cpp @@ -278,6 +278,21 @@ bool nsDisplayRemote::CreateWebRenderCommands( return true; } + if (RefPtr remoteBrowser = + GetFrameLoader()->GetRemoteBrowser()) { + // Generate an effects update notifying the browser it is visible + aDisplayListBuilder->AddEffectUpdate(remoteBrowser, + EffectsInfo::FullyVisible()); + + // Create a WebRenderRemoteData to notify the RemoteBrowser when it is no + // longer visible + RefPtr userData = + aManager->CommandBuilder() + .CreateOrRecycleWebRenderUserData( + this, aBuilder.GetRenderRoot(), nullptr); + userData->SetRemoteBrowser(remoteBrowser); + } + mOffset = GetContentRectLayerOffset(mFrame, aDisplayListBuilder); LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(