2017-10-27 17:33:53 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2018-11-06 21:35:37 +00:00
|
|
|
#ifndef mozilla_layout_RenderFrame_h
|
|
|
|
#define mozilla_layout_RenderFrame_h
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2018-11-05 18:45:06 +00:00
|
|
|
#include "base/process.h"
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-07-20 06:48:27 +00:00
|
|
|
|
2018-09-25 02:45:54 +00:00
|
|
|
#include "mozilla/dom/ipc/IdType.h"
|
2017-04-09 21:30:27 +00:00
|
|
|
#include "mozilla/layers/CompositorOptions.h"
|
2015-02-17 02:30:02 +00:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
2010-08-20 23:24:41 +00:00
|
|
|
#include "nsDisplayList.h"
|
|
|
|
|
|
|
|
class nsFrameLoader;
|
2011-01-13 17:45:14 +00:00
|
|
|
class nsSubDocumentFrame;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2019-01-23 15:52:30 +00:00
|
|
|
namespace dom {
|
2019-04-09 21:38:15 +00:00
|
|
|
class BrowserParent;
|
2019-01-23 15:52:30 +00:00
|
|
|
} // namespace dom
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
namespace layers {
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
struct TextureFactoryIdentifier;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace layers
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
namespace layout {
|
|
|
|
|
2019-01-23 15:34:29 +00:00
|
|
|
/**
|
|
|
|
* RenderFrame connects and manages layer trees for remote frames. It is
|
2019-04-09 21:38:15 +00:00
|
|
|
* directly owned by a BrowserParent and always lives in the parent process.
|
2019-01-23 15:34:29 +00:00
|
|
|
*/
|
2018-11-06 21:35:37 +00:00
|
|
|
class RenderFrame final {
|
2017-04-09 21:30:27 +00:00
|
|
|
typedef mozilla::layers::CompositorOptions CompositorOptions;
|
2010-08-20 23:24:41 +00:00
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2018-03-24 23:06:01 +00:00
|
|
|
typedef mozilla::layers::LayersId LayersId;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
typedef mozilla::layers::TextureFactoryIdentifier TextureFactoryIdentifier;
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
public:
|
2018-11-06 21:35:37 +00:00
|
|
|
RenderFrame();
|
|
|
|
virtual ~RenderFrame();
|
2013-11-20 12:32:52 +00:00
|
|
|
|
2019-04-09 21:38:15 +00:00
|
|
|
bool Initialize(dom::BrowserParent* aBrowserParent);
|
2011-01-06 04:54:47 +00:00
|
|
|
void Destroy();
|
|
|
|
|
2018-10-25 20:23:46 +00:00
|
|
|
void EnsureLayersConnected(CompositorOptions* aCompositorOptions);
|
|
|
|
LayerManager* AttachLayerManager();
|
2019-01-23 15:52:30 +00:00
|
|
|
void OwnerContentChanged();
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2018-10-25 20:23:46 +00:00
|
|
|
LayersId GetLayersId() const { return mLayersId; }
|
|
|
|
CompositorOptions GetCompositorOptions() const { return mCompositorOptions; }
|
2013-08-13 07:56:57 +00:00
|
|
|
|
2018-10-25 20:23:46 +00:00
|
|
|
void GetTextureFactoryIdentifier(
|
|
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier) const;
|
2017-04-18 04:41:18 +00:00
|
|
|
|
2018-10-25 20:23:46 +00:00
|
|
|
bool IsInitialized() const { return mInitialized; }
|
|
|
|
bool IsLayersConnected() const { return mLayersConnected; }
|
2018-09-25 02:45:54 +00:00
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
private:
|
2019-01-23 15:34:29 +00:00
|
|
|
// The process id of the remote frame. This is used by the compositor to
|
|
|
|
// do security checks on incoming layer transactions.
|
2018-11-05 18:45:06 +00:00
|
|
|
base::ProcessId mTabProcessId;
|
2019-01-23 15:34:29 +00:00
|
|
|
// The layers id of the remote frame.
|
2018-03-24 23:06:01 +00:00
|
|
|
LayersId mLayersId;
|
2017-04-09 21:30:27 +00:00
|
|
|
// The compositor options for this layers id. This is only meaningful if
|
|
|
|
// the compositor actually knows about this layers id (i.e. when
|
|
|
|
// mLayersConnected is true).
|
|
|
|
CompositorOptions mCompositorOptions;
|
2012-07-17 23:59:45 +00:00
|
|
|
|
2019-04-09 21:38:15 +00:00
|
|
|
dom::BrowserParent* mBrowserParent;
|
2017-04-18 04:41:18 +00:00
|
|
|
RefPtr<LayerManager> mLayerManager;
|
2013-07-30 18:03:40 +00:00
|
|
|
|
2018-10-25 20:23:46 +00:00
|
|
|
bool mInitialized;
|
|
|
|
// A flag that indicates whether or not the compositor knows about the
|
2018-11-06 21:35:37 +00:00
|
|
|
// layers id. In some cases this RenderFrame is not connected to the
|
2018-10-25 20:23:46 +00:00
|
|
|
// compositor and so this flag is false.
|
|
|
|
bool mLayersConnected;
|
2010-08-20 23:24:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
/**
|
2019-01-23 15:34:29 +00:00
|
|
|
* A nsDisplayRemote will graft a remote frame's shadow layer tree (for a given
|
|
|
|
* nsFrameLoader) into its parent frame's layer tree.
|
2010-08-20 23:24:41 +00:00
|
|
|
*/
|
2019-05-08 13:49:56 +00:00
|
|
|
class nsDisplayRemote final : public nsPaintedDisplayItem {
|
2018-10-25 20:23:46 +00:00
|
|
|
typedef mozilla::dom::TabId TabId;
|
|
|
|
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
|
|
|
typedef mozilla::layers::EventRegionsOverride EventRegionsOverride;
|
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayersId LayersId;
|
|
|
|
typedef mozilla::layers::RefLayer RefLayer;
|
2018-11-06 21:35:37 +00:00
|
|
|
typedef mozilla::layout::RenderFrame RenderFrame;
|
2018-10-25 20:23:46 +00:00
|
|
|
typedef mozilla::LayoutDeviceRect LayoutDeviceRect;
|
|
|
|
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
public:
|
2018-08-31 19:08:01 +00:00
|
|
|
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* aFrame);
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2018-08-31 19:08:01 +00:00
|
|
|
LayerState GetLayerState(
|
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2018-09-25 02:45:54 +00:00
|
|
|
const ContainerLayerParameters& aParameters) override;
|
2018-08-31 19:08:01 +00:00
|
|
|
|
|
|
|
already_AddRefed<Layer> BuildLayer(
|
2011-06-22 12:11:27 +00:00
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2015-03-21 16:28:04 +00:00
|
|
|
const ContainerLayerParameters& aContainerParameters) override;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2018-09-25 02:45:54 +00:00
|
|
|
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
|
|
|
|
2018-08-31 19:08:01 +00:00
|
|
|
bool CreateWebRenderCommands(
|
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const StackingContextHelper& aSc,
|
2019-01-07 21:33:10 +00:00
|
|
|
mozilla::layers::RenderRootStateManager* aManager,
|
2018-08-31 19:08:01 +00:00
|
|
|
nsDisplayListBuilder* aDisplayListBuilder) override;
|
|
|
|
bool UpdateScrollData(
|
|
|
|
mozilla::layers::WebRenderScrollData* aData,
|
|
|
|
mozilla::layers::WebRenderLayerScrollData* aLayerData) override;
|
2017-07-25 12:18:49 +00:00
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
|
|
|
|
|
|
|
|
private:
|
2019-04-22 19:57:59 +00:00
|
|
|
friend class nsDisplayItemBase;
|
2019-01-23 17:07:57 +00:00
|
|
|
nsFrameLoader* GetFrameLoader() const;
|
2018-08-31 19:08:01 +00:00
|
|
|
|
2018-10-25 20:23:46 +00:00
|
|
|
TabId mTabId;
|
2019-01-23 17:07:57 +00:00
|
|
|
LayersId mLayersId;
|
2018-10-25 20:23:46 +00:00
|
|
|
LayoutDeviceIntPoint mOffset;
|
|
|
|
EventRegionsOverride mEventRegionsOverride;
|
2010-08-20 23:24:41 +00:00
|
|
|
};
|
|
|
|
|
2018-11-06 21:35:37 +00:00
|
|
|
#endif // mozilla_layout_RenderFrame_h
|