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
This commit is contained in:
Ryan Hunt 2019-05-24 09:28:34 -05:00
Родитель e7da3a1bef
Коммит 267c1c0f34
3 изменённых файлов: 43 добавлений и 0 удалений

Просмотреть файл

@ -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) {}

Просмотреть файл

@ -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<WebRenderCanvasRendererAsync> 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<dom::RemoteBrowser> mRemoteBrowser;
};
class WebRenderRenderRootData : public WebRenderUserData {
public:
WebRenderRenderRootData(RenderRootStateManager* aManager,

Просмотреть файл

@ -278,6 +278,21 @@ bool nsDisplayRemote::CreateWebRenderCommands(
return true;
}
if (RefPtr<RemoteBrowser> 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<WebRenderRemoteData> userData =
aManager->CommandBuilder()
.CreateOrRecycleWebRenderUserData<WebRenderRemoteData>(
this, aBuilder.GetRenderRoot(), nullptr);
userData->SetRemoteBrowser(remoteBrowser);
}
mOffset = GetContentRectLayerOffset(mFrame, aDisplayListBuilder);
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(