2010-08-20 16:24:41 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07: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 16:24:41 -07:00
|
|
|
|
|
|
|
#ifndef mozilla_layout_RenderFrameParent_h
|
|
|
|
#define mozilla_layout_RenderFrameParent_h
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-07-19 23:48:27 -07:00
|
|
|
#include <map>
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
#include "mozilla/layout/PRenderFrameParent.h"
|
2012-01-19 06:45:37 -08:00
|
|
|
#include "mozilla/layers/ShadowLayersManager.h"
|
2010-08-20 16:24:41 -07:00
|
|
|
#include "nsDisplayList.h"
|
2012-07-19 23:48:27 -07:00
|
|
|
#include "RenderFrameUtils.h"
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2011-01-13 09:45:14 -08:00
|
|
|
class nsContentView;
|
2010-08-20 16:24:41 -07:00
|
|
|
class nsFrameLoader;
|
2011-01-13 09:45:14 -08:00
|
|
|
class nsSubDocumentFrame;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2011-01-13 09:45:14 -08:00
|
|
|
|
2012-07-19 23:48:27 -07:00
|
|
|
class InputEvent;
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
namespace layers {
|
2013-07-30 11:03:40 -07:00
|
|
|
class APZCTreeManager;
|
2012-07-19 23:48:27 -07:00
|
|
|
class GestureEventListener;
|
2012-07-24 12:01:09 -07:00
|
|
|
class TargetConfig;
|
2013-04-24 11:42:40 -07: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 02:20:52 -07:00
|
|
|
struct TextureFactoryIdentifier;
|
2013-11-13 10:20:31 -08:00
|
|
|
struct ScrollableLayerGuid;
|
2010-08-20 16:24:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace layout {
|
|
|
|
|
2012-07-19 23:48:27 -07:00
|
|
|
class RemoteContentController;
|
|
|
|
|
2012-01-19 06:45:37 -08:00
|
|
|
class RenderFrameParent : public PRenderFrameParent,
|
|
|
|
public mozilla::layers::ShadowLayersManager
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
2011-01-13 09:45:14 -08:00
|
|
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
2010-08-20 16:24:41 -07:00
|
|
|
typedef mozilla::layers::ContainerLayer ContainerLayer;
|
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2012-07-24 12:01:09 -07:00
|
|
|
typedef mozilla::layers::TargetConfig TargetConfig;
|
2013-04-24 11:42:40 -07:00
|
|
|
typedef mozilla::layers::LayerTransactionParent LayerTransactionParent;
|
2013-09-26 23:01:16 -07: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 02:20:52 -07:00
|
|
|
typedef mozilla::layers::TextureFactoryIdentifier TextureFactoryIdentifier;
|
2013-11-13 10:20:31 -08:00
|
|
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
2014-01-06 10:26:44 -08:00
|
|
|
typedef mozilla::layers::ZoomConstraints ZoomConstraints;
|
2011-01-13 09:45:14 -08:00
|
|
|
typedef FrameMetrics::ViewID ViewID;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
public:
|
2011-01-13 09:45:14 -08:00
|
|
|
typedef std::map<ViewID, nsRefPtr<nsContentView> > ViewMap;
|
|
|
|
|
2014-01-15 13:10:39 -08:00
|
|
|
/* Init should be called immediately after allocation. */
|
|
|
|
RenderFrameParent();
|
|
|
|
virtual ~RenderFrameParent();
|
|
|
|
|
2012-07-19 23:48:27 -07: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-01-15 13:10:39 -08:00
|
|
|
void
|
|
|
|
Init(nsFrameLoader* aFrameLoader,
|
|
|
|
ScrollingBehavior aScrollingBehavior,
|
|
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
|
|
|
uint64_t* aId);
|
2013-11-20 04:32:52 -08:00
|
|
|
|
2011-01-05 20:54:47 -08:00
|
|
|
void Destroy();
|
|
|
|
|
2011-01-13 09:45:14 -08:00
|
|
|
/**
|
2013-11-08 16:07:00 -08:00
|
|
|
* Helper functions for getting a non-owning reference to a scrollable.
|
2011-01-13 09:45:14 -08:00
|
|
|
* @param aId The ID of the frame.
|
|
|
|
*/
|
2013-11-08 16:07:00 -08:00
|
|
|
nsContentView* GetContentView(ViewID aId);
|
|
|
|
nsContentView* GetRootContentView();
|
2011-01-13 09:45:14 -08:00
|
|
|
|
2011-07-18 11:04:47 -07:00
|
|
|
void ContentViewScaleChanged(nsContentView* aView);
|
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
2012-07-24 12:01:09 -07:00
|
|
|
const TargetConfig& aTargetConfig,
|
2013-12-15 21:38:42 -08:00
|
|
|
bool aIsFirstPaint,
|
|
|
|
bool aScheduleComposite) MOZ_OVERRIDE;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsSubDocumentFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2011-01-13 09:45:14 -08:00
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame,
|
2010-10-13 15:55:45 -07:00
|
|
|
LayerManager* aManager,
|
2012-08-06 20:00:41 -07:00
|
|
|
const nsIntRect& aVisibleRect,
|
2012-09-16 15:25:33 -07:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-26 23:01:16 -07:00
|
|
|
const ContainerLayerParameters& aContainerParameters);
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2011-01-13 09:45:14 -08:00
|
|
|
void OwnerContentChanged(nsIContent* aContent);
|
|
|
|
|
2011-10-20 15:17:09 -07:00
|
|
|
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
|
|
|
|
|
2013-11-13 10:20:31 -08:00
|
|
|
/**
|
|
|
|
* Notify the APZ code of an input event, and get back the untransformed event.
|
2014-03-10 14:59:46 -07:00
|
|
|
* @param aEvent the input event; this is modified in-place so that the async
|
|
|
|
* transforms are unapplied. This can be passed to Gecko for hit testing
|
|
|
|
* and normal event dispatch.
|
2013-11-13 10:20:31 -08:00
|
|
|
* @param aOutTargetGuid An out-parameter that will contain the identifier
|
|
|
|
* of the APZC instance that handled the event, if one was found. This
|
|
|
|
* argument may be null.
|
|
|
|
*/
|
2014-03-10 14:59:46 -07:00
|
|
|
void NotifyInputEvent(WidgetInputEvent& aEvent,
|
|
|
|
ScrollableLayerGuid* aOutTargetGuid);
|
2012-07-19 23:48:27 -07:00
|
|
|
|
2013-11-13 10:20:30 -08:00
|
|
|
void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect);
|
2012-08-08 21:39:02 -07:00
|
|
|
|
2013-11-13 10:20:31 -08:00
|
|
|
void ContentReceivedTouch(const ScrollableLayerGuid& aGuid,
|
|
|
|
bool aPreventDefault);
|
2012-08-21 21:37:06 -07:00
|
|
|
|
2013-11-14 09:35:41 -08:00
|
|
|
void UpdateZoomConstraints(uint32_t aPresShellId,
|
|
|
|
ViewID aViewId,
|
2013-11-08 16:07:00 -08:00
|
|
|
bool aIsRoot,
|
2014-01-06 10:26:44 -08:00
|
|
|
const ZoomConstraints& aConstraints);
|
2012-09-28 19:18:18 -07:00
|
|
|
|
2013-08-13 00:56:57 -07:00
|
|
|
bool HitTest(const nsRect& aRect);
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
protected:
|
2012-07-17 16:59:45 -07:00
|
|
|
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2012-07-17 16:59:45 -07:00
|
|
|
virtual bool RecvNotifyCompositorTransaction() MOZ_OVERRIDE;
|
|
|
|
|
2013-08-13 00:56:57 -07:00
|
|
|
virtual bool RecvUpdateHitRegion(const nsRegion& aRegion) MOZ_OVERRIDE;
|
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PLayerTransactionParent* AllocPLayerTransactionParent() MOZ_OVERRIDE;
|
|
|
|
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
private:
|
2011-01-13 09:45:14 -08:00
|
|
|
void BuildViewMap();
|
2012-07-17 16:59:45 -07:00
|
|
|
void TriggerRepaint();
|
2012-07-19 23:48:27 -07:00
|
|
|
void DispatchEventForPanZoomController(const InputEvent& aEvent);
|
2011-01-13 09:45:14 -08:00
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionParent* GetShadowLayers() const;
|
2012-07-17 16:59:45 -07:00
|
|
|
uint64_t GetLayerTreeId() const;
|
2013-07-01 21:17:23 -07:00
|
|
|
Layer* GetRootLayer() const;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2012-07-17 16:59:45 -07: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 16:24:41 -07:00
|
|
|
nsRefPtr<nsFrameLoader> mFrameLoader;
|
|
|
|
nsRefPtr<ContainerLayer> mContainer;
|
2012-07-19 23:48:27 -07:00
|
|
|
// When our scrolling behavior is ASYNC_PAN_ZOOM, we have a nonnull
|
2013-07-30 11:03:40 -07:00
|
|
|
// APZCTreeManager. It's used to manipulate the shadow layer tree
|
|
|
|
// on the compositor thread.
|
|
|
|
nsRefPtr<layers::APZCTreeManager> mApzcTreeManager;
|
2012-07-19 23:48:27 -07:00
|
|
|
nsRefPtr<RemoteContentController> mContentController;
|
2011-01-13 09:45:14 -08:00
|
|
|
|
2013-07-30 11:03:40 -07:00
|
|
|
layers::APZCTreeManager* GetApzcTreeManager();
|
|
|
|
|
2011-01-13 09:45:14 -08:00
|
|
|
// This contains the views for all the scrollable frames currently in the
|
|
|
|
// painted region of our remote content.
|
|
|
|
ViewMap mContentViews;
|
2011-09-27 11:35:23 -07: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 15:17:09 -07:00
|
|
|
// this is gfxRGBA because that's what ColorLayer wants.
|
|
|
|
gfxRGBA mBackgroundColor;
|
2013-08-13 00:56:57 -07:00
|
|
|
|
|
|
|
nsRegion mTouchRegion;
|
2010-08-20 16:24:41 -07: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:
|
2010-08-23 20:23:37 -07:00
|
|
|
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|
|
|
RenderFrameParent* aRemoteFrame)
|
|
|
|
: nsDisplayItem(aBuilder, aFrame)
|
2010-08-20 16:24:41 -07:00
|
|
|
, mRemoteFrame(aRemoteFrame)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
2012-05-03 07:05:55 -07:00
|
|
|
LayerManager* aManager,
|
2013-09-26 23:01:16 -07:00
|
|
|
const ContainerLayerParameters& aParameters) MOZ_OVERRIDE
|
2012-07-22 20:00:36 -07:00
|
|
|
{ return mozilla::LAYER_ACTIVE_FORCE; }
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
virtual already_AddRefed<Layer>
|
2011-06-22 05:11:27 -07:00
|
|
|
BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
2013-09-26 23:01:16 -07:00
|
|
|
const ContainerLayerParameters& aContainerParameters) MOZ_OVERRIDE;
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2013-08-13 00:56:57 -07:00
|
|
|
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
|
|
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) MOZ_OVERRIDE;
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
|
|
|
|
|
|
|
|
private:
|
|
|
|
RenderFrameParent* mRemoteFrame;
|
|
|
|
};
|
|
|
|
|
2011-01-13 09:45:14 -08:00
|
|
|
/**
|
|
|
|
* nsDisplayRemoteShadow is a way of adding display items for frames in a
|
|
|
|
* separate process, for hit testing only. After being processed, the hit
|
|
|
|
* test state will contain IDs for any remote frames that were hit.
|
|
|
|
*
|
|
|
|
* The frame should be its respective render frame parent.
|
|
|
|
*/
|
|
|
|
class nsDisplayRemoteShadow : public nsDisplayItem
|
|
|
|
{
|
|
|
|
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
|
|
|
|
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsDisplayRemoteShadow(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsRect aRect,
|
|
|
|
ViewID aId)
|
|
|
|
: nsDisplayItem(aBuilder, aFrame)
|
|
|
|
, mRect(aRect)
|
|
|
|
, mId(aId)
|
|
|
|
{}
|
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) MOZ_OVERRIDE
|
2011-01-13 09:45:14 -08:00
|
|
|
{
|
2012-04-10 04:24:18 -07:00
|
|
|
*aSnap = false;
|
2011-01-13 09:45:14 -08:00
|
|
|
return mRect;
|
|
|
|
}
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual uint32_t GetPerFrameKey() MOZ_OVERRIDE
|
2011-01-13 09:45:14 -08:00
|
|
|
{
|
|
|
|
NS_ABORT();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
|
|
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) MOZ_OVERRIDE;
|
2011-01-13 09:45:14 -08:00
|
|
|
|
|
|
|
NS_DISPLAY_DECL_NAME("Remote-Shadow", TYPE_REMOTE_SHADOW)
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRect mRect;
|
|
|
|
ViewID mId;
|
|
|
|
};
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
#endif // mozilla_layout_RenderFrameParent_h
|