2010-08-20 23:24:41 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
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
|
|
|
|
|
|
|
#ifndef mozilla_layout_RenderFrameParent_h
|
|
|
|
#define mozilla_layout_RenderFrameParent_h
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-07-20 06:48:27 +00:00
|
|
|
#include <map>
|
|
|
|
|
2015-03-19 10:33:33 +00:00
|
|
|
#include "mozilla/layers/APZUtils.h"
|
2015-02-17 02:30:02 +00:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
2010-08-20 23:24:41 +00:00
|
|
|
#include "mozilla/layout/PRenderFrameParent.h"
|
|
|
|
#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
|
|
|
|
2012-07-20 06:48:27 +00:00
|
|
|
class InputEvent;
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
namespace layers {
|
2013-07-30 18:03:40 +00:00
|
|
|
class APZCTreeManager;
|
2012-07-24 19:01:09 +00:00
|
|
|
class TargetConfig;
|
2013-04-24 18:42:40 +00:00
|
|
|
class LayerTransactionParent;
|
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;
|
2013-11-13 18:20:31 +00:00
|
|
|
struct ScrollableLayerGuid;
|
2010-08-20 23:24:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace layout {
|
|
|
|
|
2012-07-20 06:48:27 +00:00
|
|
|
class RemoteContentController;
|
|
|
|
|
2014-08-22 00:16:44 +00:00
|
|
|
class RenderFrameParent : public PRenderFrameParent
|
2010-08-20 23:24:41 +00:00
|
|
|
{
|
2011-01-13 17:45:14 +00:00
|
|
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
2010-08-20 23:24:41 +00:00
|
|
|
typedef mozilla::layers::ContainerLayer ContainerLayer;
|
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2012-07-24 19:01:09 +00:00
|
|
|
typedef mozilla::layers::TargetConfig TargetConfig;
|
2013-04-24 18:42:40 +00:00
|
|
|
typedef mozilla::layers::LayerTransactionParent LayerTransactionParent;
|
2013-09-27 06:01:16 +00:00
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
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;
|
2013-11-13 18:20:31 +00:00
|
|
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
2015-03-19 10:33:33 +00:00
|
|
|
typedef mozilla::layers::TouchBehaviorFlags TouchBehaviorFlags;
|
2014-01-06 18:26:44 +00:00
|
|
|
typedef mozilla::layers::ZoomConstraints ZoomConstraints;
|
2011-01-13 17:45:14 +00:00
|
|
|
typedef FrameMetrics::ViewID ViewID;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
public:
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2014-01-15 21:10:39 +00:00
|
|
|
|
2012-07-20 06:48:27 +00:00
|
|
|
/**
|
|
|
|
* Select the desired scrolling behavior. If ASYNC_PAN_ZOOM is
|
|
|
|
* chosen, then RenderFrameParent will watch input events and use
|
|
|
|
* them to asynchronously pan and zoom.
|
|
|
|
*/
|
2014-05-08 14:04:00 +00:00
|
|
|
RenderFrameParent(nsFrameLoader* aFrameLoader,
|
|
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
|
|
|
uint64_t* aId, bool* aSuccess);
|
|
|
|
virtual ~RenderFrameParent();
|
2013-11-20 12:32:52 +00:00
|
|
|
|
2011-01-06 04:54:47 +00:00
|
|
|
void Destroy();
|
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsSubDocumentFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame,
|
2010-10-13 22:55:45 +00:00
|
|
|
LayerManager* aManager,
|
2012-08-07 03:00:41 +00:00
|
|
|
const nsIntRect& aVisibleRect,
|
2012-09-16 22:25:33 +00:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-27 06:01:16 +00:00
|
|
|
const ContainerLayerParameters& aContainerParameters);
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2011-01-13 17:45:14 +00:00
|
|
|
void OwnerContentChanged(nsIContent* aContent);
|
|
|
|
|
2011-10-20 22:17:09 +00:00
|
|
|
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
|
|
|
|
|
2013-11-13 18:20:30 +00:00
|
|
|
void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect);
|
2012-08-09 04:39:02 +00:00
|
|
|
|
2014-12-09 10:35:12 +00:00
|
|
|
void ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
|
|
|
|
uint64_t aInputBlockId,
|
|
|
|
bool aPreventDefault);
|
2014-11-22 02:36:25 +00:00
|
|
|
void SetTargetAPZC(uint64_t aInputBlockId,
|
|
|
|
const nsTArray<ScrollableLayerGuid>& aTargets);
|
2015-03-19 10:33:33 +00:00
|
|
|
void SetAllowedTouchBehavior(uint64_t aInputBlockId,
|
|
|
|
const nsTArray<TouchBehaviorFlags>& aFlags);
|
2012-08-22 04:37:06 +00:00
|
|
|
|
2013-11-14 17:35:41 +00:00
|
|
|
void UpdateZoomConstraints(uint32_t aPresShellId,
|
|
|
|
ViewID aViewId,
|
2013-11-09 00:07:00 +00:00
|
|
|
bool aIsRoot,
|
2014-01-06 18:26:44 +00:00
|
|
|
const ZoomConstraints& aConstraints);
|
2012-09-29 02:18:18 +00:00
|
|
|
|
2013-08-13 07:56:57 +00:00
|
|
|
bool HitTest(const nsRect& aRect);
|
|
|
|
|
2014-11-16 18:23:22 +00:00
|
|
|
void GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier);
|
|
|
|
|
|
|
|
inline uint64_t GetLayersId() { return mLayersId; }
|
2015-02-05 19:41:50 +00:00
|
|
|
|
|
|
|
void TakeFocusForClick();
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
protected:
|
2015-03-21 16:28:04 +00:00
|
|
|
void ActorDestroy(ActorDestroyReason why) override;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool RecvNotifyCompositorTransaction() override;
|
2012-07-17 23:59:45 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool RecvUpdateHitRegion(const nsRegion& aRegion) override;
|
2013-08-13 07:56:57 +00:00
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
private:
|
2012-07-17 23:59:45 +00:00
|
|
|
void TriggerRepaint();
|
2012-07-20 06:48:27 +00:00
|
|
|
void DispatchEventForPanZoomController(const InputEvent& aEvent);
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
uint64_t GetLayerTreeId() const;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
// When our child frame is pushing transactions directly to the
|
|
|
|
// compositor, this is the ID of its layer tree in the compositor's
|
|
|
|
// context.
|
|
|
|
uint64_t mLayersId;
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
nsRefPtr<nsFrameLoader> mFrameLoader;
|
|
|
|
nsRefPtr<ContainerLayer> mContainer;
|
2012-07-20 06:48:27 +00:00
|
|
|
// When our scrolling behavior is ASYNC_PAN_ZOOM, we have a nonnull
|
2013-07-30 18:03:40 +00:00
|
|
|
// APZCTreeManager. It's used to manipulate the shadow layer tree
|
|
|
|
// on the compositor thread.
|
|
|
|
nsRefPtr<layers::APZCTreeManager> mApzcTreeManager;
|
2012-07-20 06:48:27 +00:00
|
|
|
nsRefPtr<RemoteContentController> mContentController;
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2013-07-30 18:03:40 +00:00
|
|
|
layers::APZCTreeManager* GetApzcTreeManager();
|
|
|
|
|
2011-09-27 18:35:23 +00:00
|
|
|
// True after Destroy() has been called, which is triggered
|
|
|
|
// originally by nsFrameLoader::Destroy(). After this point, we can
|
|
|
|
// no longer safely ask the frame loader to find its nearest layer
|
|
|
|
// manager, because it may have been disconnected from the DOM.
|
|
|
|
// It's still OK to *tell* the frame loader that we've painted after
|
|
|
|
// it's destroyed; it'll just ignore us, and we won't be able to
|
|
|
|
// find an nsIFrame to invalidate. See ShadowLayersUpdated().
|
|
|
|
//
|
|
|
|
// Prefer the extra bit of state to null'ing out mFrameLoader in
|
|
|
|
// Destroy() so that less code needs to be special-cased for after
|
|
|
|
// Destroy().
|
|
|
|
//
|
|
|
|
// It's possible for mFrameLoader==null and
|
|
|
|
// mFrameLoaderDestroyed==false.
|
|
|
|
bool mFrameLoaderDestroyed;
|
2011-10-20 22:17:09 +00:00
|
|
|
// this is gfxRGBA because that's what ColorLayer wants.
|
|
|
|
gfxRGBA mBackgroundColor;
|
2013-08-13 07:56:57 +00:00
|
|
|
|
|
|
|
nsRegion mTouchRegion;
|
2010-08-20 23:24:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layout
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A DisplayRemote exists solely to graft a child process's shadow
|
|
|
|
* layer tree (for a given RenderFrameParent) into its parent
|
|
|
|
* process's layer tree.
|
|
|
|
*/
|
|
|
|
class nsDisplayRemote : public nsDisplayItem
|
|
|
|
{
|
|
|
|
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
|
|
|
|
|
|
|
|
public:
|
2015-02-25 18:36:19 +00:00
|
|
|
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* aFrame,
|
2015-02-10 21:28:07 +00:00
|
|
|
RenderFrameParent* aRemoteFrame);
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
2012-05-03 14:05:55 +00:00
|
|
|
LayerManager* aManager,
|
2015-03-21 16:28:04 +00:00
|
|
|
const ContainerLayerParameters& aParameters) override
|
2012-07-23 03:00:36 +00:00
|
|
|
{ return mozilla::LAYER_ACTIVE_FORCE; }
|
2010-08-20 23:24:41 +00:00
|
|
|
|
|
|
|
virtual already_AddRefed<Layer>
|
2011-06-22 12:11:27 +00:00
|
|
|
BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2015-03-21 16:28:04 +00:00
|
|
|
const ContainerLayerParameters& aContainerParameters) override;
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2013-08-13 07:56:57 +00:00
|
|
|
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) override;
|
2013-08-13 07:56:57 +00:00
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
|
|
|
|
|
|
|
|
private:
|
|
|
|
RenderFrameParent* mRemoteFrame;
|
2015-02-17 02:30:02 +00:00
|
|
|
mozilla::layers::EventRegionsOverride mEventRegionsOverride;
|
2010-08-20 23:24:41 +00:00
|
|
|
};
|
|
|
|
|
2011-01-13 17:45:14 +00:00
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
#endif // mozilla_layout_RenderFrameParent_h
|