Bug 1383204 - Create webrender commands for the nsDisplayRemote display item. r=ethlin
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 25 Jul 2017 08:18:49 -0400
changeset 419575 43aa857808d6210c16ab29dfc06d49dc20b0af1c
parent 419574 810678e8a29e250ecc37fbc83f61d5b3643354e0
child 419576 961e6b6a79a211e254102f9529741f23a36608d1
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethlin
bugs1383204
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383204 - Create webrender commands for the nsDisplayRemote display item. r=ethlin This allows us to turn on layers-free mode in the firefox UI process, and have it work better in that the content process' content actually shows up. MozReview-Commit-ID: qBnfueYmuf
layout/ipc/RenderFrameParent.cpp
layout/ipc/RenderFrameParent.h
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -27,16 +27,17 @@
 #include "nsStyleStructInlines.h"
 #include "nsSubDocumentFrame.h"
 #include "nsView.h"
 #include "RenderFrameParent.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
+#include "mozilla/webrender/WebRenderAPI.h"
 #include "ClientLayerManager.h"
 #include "FrameLayerBuilder.h"
 
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 namespace mozilla {
@@ -374,8 +375,27 @@ nsDisplayRemote::BuildLayer(nsDisplayLis
                             const ContainerLayerParameters& aContainerParameters)
 {
   RefPtr<Layer> layer = mRemoteFrame->BuildLayer(aBuilder, mFrame, aManager, this, aContainerParameters);
   if (layer && layer->AsContainerLayer()) {
     layer->AsContainerLayer()->SetEventRegionsOverride(mEventRegionsOverride);
   }
   return layer.forget();
 }
+
+bool
+nsDisplayRemote::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
+                                         const StackingContextHelper& aSc,
+                                         nsTArray<WebRenderParentCommand>& aParentCommands,
+                                         mozilla::layers::WebRenderLayerManager* aManager,
+                                         nsDisplayListBuilder* aDisplayListBuilder)
+{
+  MOZ_ASSERT(aManager->IsLayersFreeTransaction());
+
+  mozilla::LayoutDeviceRect visible = mozilla::LayoutDeviceRect::FromAppUnits(
+      GetVisibleRect(), mFrame->PresContext()->AppUnitsPerDevPixel());
+  visible += mozilla::layout::GetContentRectLayerOffset(mFrame, aDisplayListBuilder);
+
+  aBuilder.PushIFrame(aSc.ToRelativeLayoutRect(visible),
+      mozilla::wr::AsPipelineId(mRemoteFrame->GetLayersId()));
+
+  return true;
+}
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -157,16 +157,22 @@ public:
                                    LayerManager* aManager,
                                    const ContainerLayerParameters& aParameters) override
   { return mozilla::LAYER_ACTIVE_FORCE; }
 
   virtual already_AddRefed<Layer>
   BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
              const ContainerLayerParameters& aContainerParameters) override;
 
+  virtual bool CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
+                                       const StackingContextHelper& aSc,
+                                       nsTArray<WebRenderParentCommand>& aParentCommands,
+                                       mozilla::layers::WebRenderLayerManager* aManager,
+                                       nsDisplayListBuilder* aDisplayListBuilder) override;
+
   NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
 
 private:
   RenderFrameParent* mRemoteFrame;
   mozilla::layers::EventRegionsOverride mEventRegionsOverride;
 };