2010-05-20 20:20:48 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
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-05-20 20:20:48 -07:00
|
|
|
|
|
|
|
#ifndef FRAMELAYERBUILDER_H_
|
|
|
|
#define FRAMELAYERBUILDER_H_
|
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsRegion.h"
|
|
|
|
#include "nsIFrame.h"
|
2012-08-28 22:38:58 -07:00
|
|
|
#include "nsDisplayListInvalidation.h"
|
|
|
|
#include "LayerTreeInvalidation.h"
|
2010-05-20 20:20:48 -07:00
|
|
|
|
|
|
|
class nsDisplayListBuilder;
|
|
|
|
class nsDisplayList;
|
|
|
|
class nsDisplayItem;
|
2010-07-15 14:07:46 -07:00
|
|
|
class gfxContext;
|
2010-09-17 12:09:08 -07:00
|
|
|
class nsRootPresContext;
|
2010-05-20 20:20:48 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2012-07-18 09:31:40 -07:00
|
|
|
namespace layers {
|
|
|
|
class ContainerLayer;
|
2012-08-20 21:06:46 -07:00
|
|
|
class LayerManager;
|
2012-07-18 09:31:40 -07:00
|
|
|
class ThebesLayer;
|
|
|
|
}
|
2010-05-20 20:20:48 -07:00
|
|
|
|
2012-07-17 10:03:51 -07:00
|
|
|
class FrameLayerBuilder;
|
2012-08-28 22:38:58 -07:00
|
|
|
class LayerManagerData;
|
2012-07-17 10:03:51 -07:00
|
|
|
|
2010-07-15 14:08:05 -07:00
|
|
|
enum LayerState {
|
|
|
|
LAYER_NONE,
|
|
|
|
LAYER_INACTIVE,
|
2011-03-15 16:20:19 -07:00
|
|
|
LAYER_ACTIVE,
|
|
|
|
// Force an active layer even if it causes incorrect rendering, e.g.
|
|
|
|
// when the layer has rounded rect clips.
|
2011-04-11 13:53:01 -07:00
|
|
|
LAYER_ACTIVE_FORCE,
|
|
|
|
// Special layer that is metadata only.
|
2012-07-17 10:03:51 -07:00
|
|
|
LAYER_ACTIVE_EMPTY,
|
|
|
|
// Inactive style layer for rendering SVG effects.
|
|
|
|
LAYER_SVG_EFFECTS
|
2010-07-15 14:08:05 -07:00
|
|
|
};
|
|
|
|
|
2012-08-28 22:48:41 -07:00
|
|
|
extern uint8_t gLayerManagerSecondary;
|
|
|
|
|
|
|
|
class LayerManagerSecondary : public layers::LayerUserData {
|
|
|
|
};
|
|
|
|
|
2012-07-14 00:49:05 -07:00
|
|
|
class RefCountedRegion : public RefCounted<RefCountedRegion> {
|
|
|
|
public:
|
2012-08-23 04:14:47 -07:00
|
|
|
RefCountedRegion() : mIsInfinite(false) {}
|
2012-07-14 00:49:05 -07:00
|
|
|
nsRegion mRegion;
|
2012-08-23 04:14:47 -07:00
|
|
|
bool mIsInfinite;
|
2012-07-14 00:49:05 -07:00
|
|
|
};
|
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
2012-08-28 22:38:58 -07:00
|
|
|
* The FrameLayerBuilder is responsible for converting display lists
|
|
|
|
* into layer trees. Every LayerManager needs a unique FrameLayerBuilder
|
|
|
|
* to build layers.
|
2010-07-15 14:07:51 -07:00
|
|
|
*
|
|
|
|
* The most important API in this class is BuildContainerLayerFor. This
|
|
|
|
* method takes a display list as input and constructs a ContainerLayer
|
|
|
|
* with child layers that render the contents of the display list. It
|
|
|
|
* also updates userdata for the retained layer manager, and
|
|
|
|
* DisplayItemDataProperty data for frames, to record the relationship
|
|
|
|
* between frames and layers.
|
|
|
|
*
|
|
|
|
* That data enables us to retain layer trees. When constructing a
|
|
|
|
* ContainerLayer, we first check to see if there's an existing
|
|
|
|
* ContainerLayer for the same frame that can be recycled. If we recycle
|
|
|
|
* it, we also try to reuse its existing ThebesLayer children to render
|
|
|
|
* the display items without layers of their own. The idea is that by
|
|
|
|
* recycling layers deterministically, we can ensure that when nothing
|
|
|
|
* changes in a display list, we will reuse the existing layers without
|
|
|
|
* changes.
|
|
|
|
*
|
|
|
|
* We expose a GetLeafLayerFor method that can be called by display items
|
|
|
|
* that make their own layers (e.g. canvas and video); this method
|
|
|
|
* locates the last layer used to render the display item, if any, and
|
|
|
|
* return it as a candidate for recycling.
|
|
|
|
*
|
|
|
|
* FrameLayerBuilder sets up ThebesLayers so that 0,0 in the Thebes layer
|
|
|
|
* corresponds to the (pixel-snapped) top-left of the aActiveScrolledRoot.
|
|
|
|
* It sets up ContainerLayers so that 0,0 in the container layer
|
|
|
|
* corresponds to the snapped top-left of the display list reference frame.
|
2011-06-22 05:11:27 -07:00
|
|
|
*
|
|
|
|
* When we construct a container layer, we know the transform that will be
|
|
|
|
* applied to the layer. If the transform scales the content, we can get
|
|
|
|
* better results when intermediate buffers are used by pushing some scale
|
|
|
|
* from the container's transform down to the children. For ThebesLayer
|
|
|
|
* children, the scaling can be achieved by changing the size of the layer
|
|
|
|
* and drawing into it with increased or decreased resolution. By convention,
|
|
|
|
* integer types (nsIntPoint/nsIntSize/nsIntRect/nsIntRegion) are all in layer
|
|
|
|
* coordinates, post-scaling, whereas appunit types are all pre-scaling.
|
2010-07-15 14:07:51 -07:00
|
|
|
*/
|
2012-08-28 22:48:15 -07:00
|
|
|
class FrameLayerBuilder : public layers::LayerUserData {
|
2010-05-20 20:20:48 -07:00
|
|
|
public:
|
2012-08-20 21:06:46 -07:00
|
|
|
typedef layers::ContainerLayer ContainerLayer;
|
|
|
|
typedef layers::Layer Layer;
|
2010-07-15 14:07:51 -07:00
|
|
|
typedef layers::ThebesLayer ThebesLayer;
|
|
|
|
typedef layers::LayerManager LayerManager;
|
|
|
|
|
|
|
|
FrameLayerBuilder() :
|
2012-07-30 07:20:58 -07:00
|
|
|
mRetainingManager(nullptr),
|
2011-10-17 07:59:28 -07:00
|
|
|
mDetectedDOMModification(false),
|
2012-07-22 20:00:36 -07:00
|
|
|
mInvalidateAllLayers(false),
|
|
|
|
mContainerLayerGeneration(0),
|
|
|
|
mMaxContainerLayerGeneration(0)
|
2010-07-15 14:07:51 -07:00
|
|
|
{
|
2012-07-17 10:03:51 -07:00
|
|
|
MOZ_COUNT_CTOR(FrameLayerBuilder);
|
2010-07-15 14:07:51 -07:00
|
|
|
mNewDisplayItemData.Init();
|
|
|
|
mThebesLayerItems.Init();
|
|
|
|
}
|
2012-07-17 10:03:51 -07:00
|
|
|
~FrameLayerBuilder()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(FrameLayerBuilder);
|
|
|
|
}
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2012-06-25 19:43:30 -07:00
|
|
|
static void Shutdown();
|
|
|
|
|
2012-08-20 21:06:46 -07:00
|
|
|
void Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager);
|
2010-09-17 12:09:08 -07:00
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
2011-01-19 00:27:54 -08:00
|
|
|
* Call this to notify that we have just started a transaction on the
|
2010-07-15 14:08:11 -07:00
|
|
|
* retained layer manager aManager.
|
2010-07-15 14:07:51 -07:00
|
|
|
*/
|
2011-01-19 00:27:54 -08:00
|
|
|
void DidBeginRetainedLayerTransaction(LayerManager* aManager);
|
2010-07-15 14:07:51 -07:00
|
|
|
|
|
|
|
/**
|
2012-08-28 22:38:58 -07:00
|
|
|
* Call this just before we end a transaction.
|
2010-07-15 14:08:11 -07:00
|
|
|
*/
|
2012-08-28 22:38:58 -07:00
|
|
|
void WillEndTransaction();
|
2010-07-15 14:08:11 -07:00
|
|
|
|
|
|
|
/**
|
2012-08-28 22:38:58 -07:00
|
|
|
* Call this after we end a transaction.
|
2010-07-15 14:07:51 -07:00
|
|
|
*/
|
2012-08-28 22:38:58 -07:00
|
|
|
void DidEndTransaction();
|
2010-05-20 20:20:48 -07:00
|
|
|
|
2011-06-22 05:11:27 -07:00
|
|
|
struct ContainerParameters {
|
2011-06-22 05:11:28 -07:00
|
|
|
ContainerParameters() :
|
|
|
|
mXScale(1), mYScale(1),
|
2012-01-11 03:26:33 -08:00
|
|
|
mInTransformedSubtree(false), mInActiveTransformedSubtree(false),
|
|
|
|
mDisableSubpixelAntialiasingInDescendants(false)
|
|
|
|
{}
|
2011-06-22 05:11:27 -07:00
|
|
|
ContainerParameters(float aXScale, float aYScale) :
|
2011-06-22 05:11:28 -07:00
|
|
|
mXScale(aXScale), mYScale(aYScale),
|
2012-01-11 03:26:33 -08:00
|
|
|
mInTransformedSubtree(false), mInActiveTransformedSubtree(false),
|
|
|
|
mDisableSubpixelAntialiasingInDescendants(false)
|
|
|
|
{}
|
2011-06-22 05:11:28 -07:00
|
|
|
ContainerParameters(float aXScale, float aYScale,
|
2012-09-16 15:25:33 -07:00
|
|
|
const nsIntPoint& aOffset,
|
2011-06-22 05:11:28 -07:00
|
|
|
const ContainerParameters& aParent) :
|
|
|
|
mXScale(aXScale), mYScale(aYScale),
|
2012-09-16 15:25:33 -07:00
|
|
|
mOffset(aOffset),
|
2011-06-22 05:11:28 -07:00
|
|
|
mInTransformedSubtree(aParent.mInTransformedSubtree),
|
2012-01-11 03:26:33 -08:00
|
|
|
mInActiveTransformedSubtree(aParent.mInActiveTransformedSubtree),
|
|
|
|
mDisableSubpixelAntialiasingInDescendants(aParent.mDisableSubpixelAntialiasingInDescendants)
|
|
|
|
{}
|
2011-06-22 05:11:27 -07:00
|
|
|
float mXScale, mYScale;
|
2012-09-16 15:25:33 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An offset to append to the transform set on all child layers created.
|
|
|
|
*/
|
|
|
|
nsIntPoint mOffset;
|
|
|
|
|
2011-06-22 05:11:28 -07:00
|
|
|
bool mInTransformedSubtree;
|
|
|
|
bool mInActiveTransformedSubtree;
|
2012-01-11 03:26:33 -08:00
|
|
|
bool mDisableSubpixelAntialiasingInDescendants;
|
2012-04-10 04:24:18 -07:00
|
|
|
/**
|
|
|
|
* When this is false, ThebesLayer coordinates are drawn to with an integer
|
|
|
|
* translation and the scale in mXScale/mYScale.
|
|
|
|
*/
|
|
|
|
bool AllowResidualTranslation()
|
|
|
|
{
|
|
|
|
// If we're in a transformed subtree, but no ancestor transform is actively
|
|
|
|
// changing, we'll use the residual translation when drawing into the
|
|
|
|
// ThebesLayer to ensure that snapping exactly matches the ideal transform.
|
|
|
|
return mInTransformedSubtree && !mInActiveTransformedSubtree;
|
|
|
|
}
|
2011-06-22 05:11:27 -07:00
|
|
|
};
|
2010-05-20 20:20:48 -07:00
|
|
|
/**
|
2010-07-15 14:07:51 -07:00
|
|
|
* Build a container layer for a display item that contains a child
|
|
|
|
* list, either reusing an existing one or creating a new one. It
|
|
|
|
* sets the container layer children to layers which together render
|
|
|
|
* the contents of the display list. It reuses existing layers from
|
|
|
|
* the retained layer manager if possible.
|
2010-05-20 20:20:48 -07:00
|
|
|
* aContainer may be null, in which case we construct a root layer.
|
2010-07-15 14:07:51 -07:00
|
|
|
* This gets called by display list code. It calls BuildLayer on the
|
|
|
|
* items in the display list, making items with their own layers
|
|
|
|
* children of the new container, and assigning all other items to
|
|
|
|
* ThebesLayer children created and managed by the FrameLayerBuilder.
|
|
|
|
* Returns a layer with clip rect cleared; it is the
|
2011-02-22 21:38:09 -08:00
|
|
|
* caller's responsibility to add any clip rect. The visible region
|
|
|
|
* is set based on what's in the layer.
|
2011-06-22 05:11:27 -07:00
|
|
|
* The container layer is transformed by aTransform (if non-null), and
|
|
|
|
* the result is transformed by the scale factors in aContainerParameters.
|
2010-05-20 20:20:48 -07:00
|
|
|
*/
|
2010-09-03 13:10:45 -07:00
|
|
|
already_AddRefed<ContainerLayer>
|
|
|
|
BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
|
|
|
|
LayerManager* aManager,
|
|
|
|
nsIFrame* aContainerFrame,
|
|
|
|
nsDisplayItem* aContainerItem,
|
2011-06-22 05:11:27 -07:00
|
|
|
const nsDisplayList& aChildren,
|
|
|
|
const ContainerParameters& aContainerParameters,
|
|
|
|
const gfx3DMatrix* aTransform);
|
2010-07-15 14:07:46 -07:00
|
|
|
|
|
|
|
/**
|
2010-07-15 14:07:51 -07:00
|
|
|
* Get a retained layer for a display item that needs to create its own
|
|
|
|
* layer for rendering (i.e. under nsDisplayItem::BuildLayer). Returns
|
|
|
|
* null if no retained layer is available, which usually means that this
|
|
|
|
* display item didn't have a layer before so the caller will
|
|
|
|
* need to create one.
|
|
|
|
* Returns a layer with clip rect cleared; it is the
|
|
|
|
* caller's responsibility to add any clip rect and set the visible
|
|
|
|
* region.
|
2010-07-15 14:07:46 -07:00
|
|
|
*/
|
|
|
|
Layer* GetLeafLayerFor(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsDisplayItem* aItem);
|
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* Call this to force all retained layers to be discarded and recreated at
|
|
|
|
* the next paint.
|
|
|
|
*/
|
|
|
|
static void InvalidateAllLayers(LayerManager* aManager);
|
2010-07-15 14:07:53 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this to determine if a frame has a dedicated (non-Thebes) layer
|
2011-03-27 16:59:47 -07:00
|
|
|
* for the given display item key. If there isn't one, we return null,
|
|
|
|
* otherwise we return the layer.
|
2010-07-15 14:07:53 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
static Layer* GetDedicatedLayer(nsIFrame* aFrame, uint32_t aDisplayItemKey);
|
2012-07-03 17:24:55 -07:00
|
|
|
|
2010-05-20 20:20:48 -07:00
|
|
|
/**
|
|
|
|
* This callback must be provided to EndTransaction. The callback data
|
|
|
|
* must be the nsDisplayListBuilder containing this FrameLayerBuilder.
|
2012-07-06 10:57:47 -07:00
|
|
|
* This function can be called multiple times in a row to draw
|
|
|
|
* different regions.
|
2010-05-20 20:20:48 -07:00
|
|
|
*/
|
|
|
|
static void DrawThebesLayer(ThebesLayer* aLayer,
|
|
|
|
gfxContext* aContext,
|
|
|
|
const nsIntRegion& aRegionToDraw,
|
2010-03-03 13:37:04 -08:00
|
|
|
const nsIntRegion& aRegionToInvalidate,
|
2010-05-20 20:20:48 -07:00
|
|
|
void* aCallbackData);
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2011-11-16 19:44:16 -08:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* Dumps this FrameLayerBuilder's retained layer manager's retained
|
2012-08-07 10:57:26 -07:00
|
|
|
* layer tree. Defaults to dumping to stdout in non-HTML format.
|
2010-07-15 14:07:51 -07:00
|
|
|
*/
|
2012-08-07 10:57:26 -07:00
|
|
|
static void DumpRetainedLayerTree(LayerManager* aManager, FILE* aFile = stdout, bool aDumpHtml = false);
|
2010-07-15 14:07:51 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/******* PRIVATE METHODS to FrameLayerBuilder.cpp ********/
|
|
|
|
/* These are only in the public section because they need
|
|
|
|
* to be called by file-scope helper functions in FrameLayerBuilder.cpp.
|
|
|
|
*/
|
2012-08-29 03:53:27 -07:00
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* Record aItem as a display item that is rendered by aLayer.
|
2012-08-28 22:38:58 -07:00
|
|
|
*
|
|
|
|
* @param aLayer Layer that the display item will be rendered into
|
|
|
|
* @param aItem Display item to be drawn.
|
|
|
|
* @param aLayerState What LayerState the item is using.
|
|
|
|
* @param aManager If the layer is in the LAYER_INACTIVE state,
|
|
|
|
* then this is the temporary layer manager to draw with.
|
2010-07-15 14:07:51 -07:00
|
|
|
*/
|
2012-08-28 22:48:43 -07:00
|
|
|
struct Clip;
|
2011-05-18 15:54:31 -07:00
|
|
|
void AddLayerDisplayItem(Layer* aLayer,
|
|
|
|
nsDisplayItem* aItem,
|
2012-08-28 22:48:43 -07:00
|
|
|
const Clip& aClip,
|
2012-08-28 22:38:58 -07:00
|
|
|
LayerState aLayerState,
|
|
|
|
const nsPoint& aTopLeft,
|
|
|
|
LayerManager* aManager = nullptr);
|
2012-08-29 03:53:27 -07:00
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* Record aItem as a display item that is rendered by the ThebesLayer
|
|
|
|
* aLayer, with aClipRect, where aContainerLayerFrame is the frame
|
|
|
|
* for the container layer this ThebesItem belongs to.
|
|
|
|
* aItem must have an underlying frame.
|
|
|
|
*/
|
2010-07-15 14:08:05 -07:00
|
|
|
void AddThebesDisplayItem(ThebesLayer* aLayer,
|
|
|
|
nsDisplayItem* aItem,
|
2010-09-09 08:21:46 -07:00
|
|
|
const Clip& aClip,
|
2010-07-15 14:08:05 -07:00
|
|
|
nsIFrame* aContainerLayerFrame,
|
2012-08-28 22:38:58 -07:00
|
|
|
LayerState aLayerState,
|
|
|
|
const nsPoint& aTopLeft);
|
2012-08-29 03:53:27 -07:00
|
|
|
|
2012-08-28 22:48:41 -07:00
|
|
|
/**
|
|
|
|
* Set the current top-level LayerManager for the widget being
|
|
|
|
* painted.
|
|
|
|
*/
|
|
|
|
static void SetWidgetLayerManager(LayerManager* aManager)
|
|
|
|
{
|
|
|
|
LayerManagerSecondary* secondary =
|
|
|
|
static_cast<LayerManagerSecondary*>(aManager->GetUserData(&gLayerManagerSecondary));
|
|
|
|
sWidgetManagerSecondary = !!secondary;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the frame property descriptor for the given manager, or for the current
|
|
|
|
* widget layer manager if nullptr is passed.
|
|
|
|
*/
|
|
|
|
static const FramePropertyDescriptor* GetDescriptorForManager(LayerManager* aManager);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the LayerManagerData for a given frame and layer manager. If no layer manager
|
|
|
|
* is passed, then the current widget layer manager is used.
|
|
|
|
*/
|
|
|
|
static LayerManagerData* GetManagerData(nsIFrame* aFrame, LayerManager* aManager = nullptr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the LayerManagerData for a given frame and current widget layer manager.
|
|
|
|
* This replaces any existing data for the same frame/layer manager pair.
|
|
|
|
*/
|
|
|
|
static void SetManagerData(nsIFrame* aFrame, LayerManagerData* aData);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the current LayerManagerData for the given frame and current widget
|
|
|
|
* layer manager.
|
|
|
|
*/
|
|
|
|
static void ClearManagerData(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears any references to the given LayerManagerData for the given frame
|
|
|
|
* and belonging to any layer manager.
|
|
|
|
*/
|
|
|
|
static void ClearManagerData(nsIFrame* aFrame, LayerManagerData* aData);
|
|
|
|
|
2012-08-29 03:53:27 -07:00
|
|
|
/**
|
|
|
|
* Calls GetOldLayerForFrame on the underlying frame of the display item,
|
|
|
|
* and each subsequent merged frame if no layer is found for the underlying
|
|
|
|
* frame.
|
|
|
|
*/
|
2012-08-28 22:48:43 -07:00
|
|
|
Layer* GetOldLayerFor(nsDisplayItem* aItem, nsDisplayItemGeometry** aOldGeometry = nullptr, Clip** aOldClip = nullptr);
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static Layer* GetDebugOldLayerFor(nsIFrame* aFrame, uint32_t aDisplayItemKey);
|
2012-08-28 22:38:58 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the display item was previously drawn as an inactive layer,
|
|
|
|
* then return the layer manager used for the inactive transaction.
|
|
|
|
* Returns nullptr if no manager could be found.
|
|
|
|
*/
|
|
|
|
LayerManager* GetInactiveLayerManagerFor(nsDisplayItem* aItem);
|
|
|
|
|
2010-09-02 02:18:39 -07:00
|
|
|
/**
|
|
|
|
* Try to determine whether the ThebesLayer aLayer paints an opaque
|
|
|
|
* single color everywhere it's visible in aRect.
|
|
|
|
* If successful, return that color, otherwise return NS_RGBA(0,0,0,0).
|
|
|
|
*/
|
|
|
|
nscolor FindOpaqueColorCovering(nsDisplayListBuilder* aBuilder,
|
|
|
|
ThebesLayer* aLayer, const nsRect& aRect);
|
|
|
|
|
2010-09-18 04:28:49 -07:00
|
|
|
/**
|
2011-10-06 14:35:08 -07:00
|
|
|
* Destroy any stored LayerManagerDataProperty and the associated data for
|
|
|
|
* aFrame.
|
2010-09-18 04:28:49 -07:00
|
|
|
*/
|
2012-08-28 22:48:41 -07:00
|
|
|
static void DestroyDisplayItemDataFor(nsIFrame* aFrame);
|
2010-09-18 04:28:49 -07:00
|
|
|
|
2011-02-10 00:58:11 -08:00
|
|
|
LayerManager* GetRetainingLayerManager() { return mRetainingManager; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given item (which we assume here is
|
|
|
|
* background-attachment:fixed) needs to be repainted as we scroll in its
|
|
|
|
* document.
|
|
|
|
* Returns false if it doesn't need to be repainted because the layer system
|
|
|
|
* is ensuring its fixed-ness for us.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool NeedToInvalidateFixedDisplayItem(nsDisplayListBuilder* aBuilder,
|
2011-02-10 00:58:11 -08:00
|
|
|
nsDisplayItem* aItem);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given display item was rendered directly
|
|
|
|
* into a retained layer.
|
|
|
|
* Returns false if it was rendered into a temporary layer manager and then
|
|
|
|
* into a retained layer.
|
2012-08-28 22:38:58 -07:00
|
|
|
*
|
|
|
|
* Since display items can belong to multiple retained LayerManagers, we need to
|
|
|
|
* specify which LayerManager to check.
|
2011-02-10 00:58:11 -08:00
|
|
|
*/
|
2012-08-28 22:38:58 -07:00
|
|
|
static bool HasRetainedLayerFor(nsIFrame* aFrame, uint32_t aDisplayItemKey, LayerManager* aManager);
|
2011-02-10 00:58:11 -08:00
|
|
|
|
2011-05-16 16:05:56 -07:00
|
|
|
/**
|
2012-08-28 22:38:58 -07:00
|
|
|
* Save transform that was in aLayer when we last painted, and the position
|
|
|
|
* of the active scrolled root frame. It must be an integer
|
2011-05-17 22:48:43 -07:00
|
|
|
* translation.
|
2011-05-16 16:05:56 -07:00
|
|
|
*/
|
2011-05-17 22:48:43 -07:00
|
|
|
void SaveLastPaintOffset(ThebesLayer* aLayer);
|
2011-05-16 16:05:56 -07:00
|
|
|
/**
|
2011-05-17 22:48:43 -07:00
|
|
|
* Get the translation transform that was in aLayer when we last painted. It's either
|
2011-05-16 16:05:56 -07:00
|
|
|
* the transform saved by SaveLastPaintTransform, or else the transform
|
2011-05-17 22:48:43 -07:00
|
|
|
* that's currently in the layer (which must be an integer translation).
|
2011-05-16 16:05:56 -07:00
|
|
|
*/
|
2011-05-17 22:48:43 -07:00
|
|
|
nsIntPoint GetLastPaintOffset(ThebesLayer* aLayer);
|
2011-05-16 16:05:56 -07:00
|
|
|
|
2012-05-09 22:24:18 -07:00
|
|
|
/**
|
2012-08-04 05:26:38 -07:00
|
|
|
* Return the resolution at which we expect to render aFrame's contents,
|
|
|
|
* assuming they are being painted to retained layers. This takes into account
|
|
|
|
* the resolution the contents of the ContainerLayer containing aFrame are
|
|
|
|
* being rendered at, as well as any currently-inactive transforms between
|
|
|
|
* aFrame and that container layer.
|
2012-05-09 22:24:18 -07:00
|
|
|
*/
|
2012-08-04 05:26:38 -07:00
|
|
|
static gfxSize GetThebesLayerScaleForFrame(nsIFrame* aFrame);
|
2012-05-09 22:24:18 -07:00
|
|
|
|
2010-09-09 08:21:46 -07:00
|
|
|
/**
|
|
|
|
* Clip represents the intersection of an optional rectangle with a
|
|
|
|
* list of rounded rectangles.
|
|
|
|
*/
|
|
|
|
struct Clip {
|
|
|
|
struct RoundedRect {
|
|
|
|
nsRect mRect;
|
|
|
|
// Indices into mRadii are the NS_CORNER_* constants in nsStyleConsts.h
|
|
|
|
nscoord mRadii[8];
|
|
|
|
|
2012-08-28 22:48:44 -07:00
|
|
|
RoundedRect operator+(const nsPoint& aOffset) const {
|
|
|
|
RoundedRect r = *this;
|
|
|
|
r.mRect += aOffset;
|
|
|
|
return r;
|
|
|
|
}
|
2010-09-09 08:21:46 -07:00
|
|
|
bool operator==(const RoundedRect& aOther) const {
|
2011-04-18 20:07:23 -07:00
|
|
|
if (!mRect.IsEqualInterior(aOther.mRect)) {
|
2010-09-09 08:21:46 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_FOR_CSS_HALF_CORNERS(corner) {
|
|
|
|
if (mRadii[corner] != aOther.mRadii[corner]) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
bool operator!=(const RoundedRect& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
nsRect mClipRect;
|
|
|
|
nsTArray<RoundedRect> mRoundedClipRects;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHaveClipRect;
|
2010-09-09 08:21:46 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
Clip() : mHaveClipRect(false) {}
|
2010-09-09 08:21:46 -07:00
|
|
|
|
|
|
|
// Construct as the intersection of aOther and aClipItem.
|
|
|
|
Clip(const Clip& aOther, nsDisplayItem* aClipItem);
|
|
|
|
|
|
|
|
// Apply this |Clip| to the given gfxContext. Any saving of state
|
|
|
|
// or clearing of other clips must be done by the caller.
|
2012-02-07 14:27:44 -08:00
|
|
|
// See aBegin/aEnd note on ApplyRoundedRectsTo.
|
|
|
|
void ApplyTo(gfxContext* aContext, nsPresContext* aPresContext,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aBegin = 0, uint32_t aEnd = PR_UINT32_MAX);
|
2012-02-07 14:27:44 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void ApplyRectTo(gfxContext* aContext, int32_t A2D) const;
|
2012-02-07 14:27:44 -08:00
|
|
|
// Applies the rounded rects in this Clip to aContext
|
|
|
|
// Will only apply rounded rects from aBegin (inclusive) to aEnd
|
|
|
|
// (exclusive) or the number of rounded rects, whichever is smaller.
|
2012-08-22 08:56:38 -07:00
|
|
|
void ApplyRoundedRectsTo(gfxContext* aContext, int32_t A2DPRInt32,
|
|
|
|
uint32_t aBegin, uint32_t aEnd) const;
|
2010-09-09 08:21:46 -07:00
|
|
|
|
2012-05-27 13:55:22 -07:00
|
|
|
// Draw (fill) the rounded rects in this clip to aContext
|
2012-08-22 08:56:38 -07:00
|
|
|
void DrawRoundedRectsTo(gfxContext* aContext, int32_t A2D,
|
|
|
|
uint32_t aBegin, uint32_t aEnd) const;
|
2012-05-27 13:55:22 -07:00
|
|
|
// 'Draw' (create as a path, does not stroke or fill) aRoundRect to aContext
|
2012-08-22 08:56:38 -07:00
|
|
|
void AddRoundedRectPathTo(gfxContext* aContext, int32_t A2D,
|
2012-05-27 13:55:22 -07:00
|
|
|
const RoundedRect &aRoundRect) const;
|
|
|
|
|
2011-01-02 17:48:09 -08:00
|
|
|
// Return a rectangle contained in the intersection of aRect with this
|
|
|
|
// clip region. Tries to return the largest possible rectangle, but may
|
|
|
|
// not succeed.
|
|
|
|
nsRect ApproximateIntersect(const nsRect& aRect) const;
|
|
|
|
|
2011-01-26 10:36:11 -08:00
|
|
|
// Returns false if aRect is definitely not clipped by a rounded corner in
|
|
|
|
// this clip. Returns true if aRect is clipped by a rounded corner in this
|
|
|
|
// clip or it can not be quickly determined that it is not clipped by a
|
|
|
|
// rounded corner in this clip.
|
|
|
|
bool IsRectClippedByRoundedCorner(const nsRect& aRect) const;
|
|
|
|
|
|
|
|
// Intersection of all rects in this clip ignoring any rounded corners.
|
|
|
|
nsRect NonRoundedIntersection() const;
|
|
|
|
|
|
|
|
// Gets rid of any rounded corners in this clip.
|
|
|
|
void RemoveRoundedCorners();
|
|
|
|
|
2012-08-28 22:48:44 -07:00
|
|
|
// Adds the difference between Intersect(*this + aPoint, aBounds) and
|
|
|
|
// Intersect(aOther, aOtherBounds) to aDifference.
|
|
|
|
void AddOffsetAndComputeDifference(const nsPoint& aPoint, const nsRect& aBounds,
|
|
|
|
const Clip& aOther, const nsRect& aOtherBounds,
|
|
|
|
nsRegion* aDifference);
|
|
|
|
|
2010-09-09 08:21:46 -07:00
|
|
|
bool operator==(const Clip& aOther) const {
|
|
|
|
return mHaveClipRect == aOther.mHaveClipRect &&
|
2011-04-18 20:07:23 -07:00
|
|
|
(!mHaveClipRect || mClipRect.IsEqualInterior(aOther.mClipRect)) &&
|
2010-09-09 08:21:46 -07:00
|
|
|
mRoundedClipRects == aOther.mRoundedClipRects;
|
|
|
|
}
|
|
|
|
bool operator!=(const Clip& aOther) const {
|
|
|
|
return !(*this == aOther);
|
|
|
|
}
|
|
|
|
};
|
2012-08-28 22:48:41 -07:00
|
|
|
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_WITH_FRAME_IN_DTOR(LayerManagerDataProperty,
|
|
|
|
RemoveFrameFromLayerManager)
|
|
|
|
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_WITH_FRAME_IN_DTOR(LayerManagerSecondaryDataProperty,
|
|
|
|
RemoveFrameFromLayerManager)
|
2010-09-09 08:21:46 -07:00
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* We store an array of these for each frame that is associated with
|
|
|
|
* one or more retained layers. Each DisplayItemData records the layer
|
|
|
|
* used to render one of the frame's display items.
|
|
|
|
*/
|
|
|
|
class DisplayItemData {
|
|
|
|
public:
|
2012-08-22 08:56:38 -07:00
|
|
|
DisplayItemData(Layer* aLayer, uint32_t aKey, LayerState aLayerState, uint32_t aGeneration);
|
2012-08-28 22:38:58 -07:00
|
|
|
DisplayItemData()
|
|
|
|
: mUsed(false)
|
|
|
|
{}
|
|
|
|
DisplayItemData(DisplayItemData &toCopy);
|
2012-08-20 21:06:46 -07:00
|
|
|
~DisplayItemData();
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2012-08-28 22:38:58 -07:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(DisplayItemData)
|
|
|
|
|
|
|
|
void AddFrame(nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
mFrameList.AppendElement(aFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FrameListMatches(nsDisplayItem* aOther);
|
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
nsRefPtr<Layer> mLayer;
|
2012-08-28 22:38:58 -07:00
|
|
|
nsRefPtr<LayerManager> mInactiveManager;
|
|
|
|
nsAutoTArray<nsIFrame*, 2> mFrameList;
|
|
|
|
nsAutoPtr<nsDisplayItemGeometry> mGeometry;
|
2012-08-28 22:48:43 -07:00
|
|
|
Clip mClip;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mDisplayItemKey;
|
|
|
|
uint32_t mContainerLayerGeneration;
|
2012-04-13 04:44:05 -07:00
|
|
|
LayerState mLayerState;
|
2012-08-28 22:38:58 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to track if data currently stored in mFramesWithLayers (from an existing
|
|
|
|
* paint) is also used in the current paint and has an equivalent data object
|
|
|
|
* in mNewDisplayItemData.
|
|
|
|
*/
|
|
|
|
bool mUsed;
|
2010-07-15 14:07:51 -07:00
|
|
|
};
|
|
|
|
|
2011-10-06 14:35:08 -07:00
|
|
|
static void RemoveFrameFromLayerManager(nsIFrame* aFrame, void* aPropertyValue);
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2012-08-28 22:38:58 -07:00
|
|
|
/**
|
|
|
|
* Given a frame and a display item key that uniquely identifies a
|
|
|
|
* display item for the frame, find the layer that was last used to
|
|
|
|
* render that display item. Returns null if there is no such layer.
|
|
|
|
* This could be a dedicated layer for the display item, or a ThebesLayer
|
|
|
|
* that renders many display items.
|
|
|
|
*/
|
|
|
|
DisplayItemData* GetOldLayerForFrame(nsIFrame* aFrame, uint32_t aDisplayItemKey);
|
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* We accumulate DisplayItemData elements in a hashtable during
|
|
|
|
* the paint process, and store them in the frame property only when
|
|
|
|
* paint is complete. This is the hashentry for that hashtable.
|
|
|
|
*/
|
|
|
|
class DisplayItemDataEntry : public nsPtrHashKey<nsIFrame> {
|
|
|
|
public:
|
2012-08-23 01:30:53 -07:00
|
|
|
DisplayItemDataEntry(const nsIFrame *key)
|
|
|
|
: nsPtrHashKey<nsIFrame>(key)
|
2012-08-28 22:38:58 -07:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(DisplayItemDataEntry);
|
|
|
|
}
|
2012-08-23 01:30:53 -07:00
|
|
|
DisplayItemDataEntry(DisplayItemDataEntry &toCopy)
|
|
|
|
: nsPtrHashKey<nsIFrame>(toCopy.mKey)
|
2010-07-15 14:07:51 -07:00
|
|
|
{
|
2012-08-28 22:38:58 -07:00
|
|
|
MOZ_COUNT_CTOR(DisplayItemDataEntry);
|
2011-10-06 14:35:08 -07:00
|
|
|
// This isn't actually a copy-constructor; notice that it steals toCopy's
|
2012-07-14 00:49:05 -07:00
|
|
|
// array and invalid region. Be careful.
|
2011-10-06 14:35:08 -07:00
|
|
|
mData.SwapElements(toCopy.mData);
|
2012-07-22 20:00:36 -07:00
|
|
|
mContainerLayerGeneration = toCopy.mContainerLayerGeneration;
|
2010-07-15 14:07:51 -07:00
|
|
|
}
|
2012-08-28 22:38:58 -07:00
|
|
|
~DisplayItemDataEntry() { MOZ_COUNT_DTOR(DisplayItemDataEntry); }
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasNonEmptyContainerLayer();
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2012-08-28 22:38:58 -07:00
|
|
|
nsAutoTArray<nsRefPtr<DisplayItemData>, 1> mData;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mContainerLayerGeneration;
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2011-10-06 14:35:08 -07:00
|
|
|
enum { ALLOW_MEMMOVE = false };
|
2010-07-15 14:07:51 -07:00
|
|
|
};
|
|
|
|
|
2012-07-03 17:17:01 -07:00
|
|
|
// LayerManagerData needs to see DisplayItemDataEntry.
|
|
|
|
friend class LayerManagerData;
|
|
|
|
|
2012-08-28 22:38:58 -07:00
|
|
|
/**
|
|
|
|
* Stores DisplayItemData associated with aFrame, stores the data in
|
|
|
|
* mNewDisplayItemData.
|
|
|
|
*/
|
|
|
|
void StoreDataForFrame(nsIFrame* aFrame, DisplayItemData* data);
|
|
|
|
|
2011-11-14 20:59:03 -08:00
|
|
|
// Flash the area within the context clip if paint flashing is enabled.
|
|
|
|
static void FlashPaint(gfxContext *aContext);
|
|
|
|
|
2011-10-06 14:35:08 -07:00
|
|
|
/*
|
|
|
|
* Get the DisplayItemData array associated with this frame, or null if one
|
|
|
|
* doesn't exist.
|
|
|
|
*
|
|
|
|
* Note that the pointer returned here is only valid so long as you don't
|
|
|
|
* poke the LayerManagerData's mFramesWithLayers hashtable.
|
|
|
|
*/
|
2012-08-28 22:38:58 -07:00
|
|
|
nsTArray<nsRefPtr<DisplayItemData> >* GetDisplayItemDataArrayForFrame(nsIFrame *aFrame);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the DisplayItemData associated with this frame / display item pair,
|
|
|
|
* using the LayerManager instead of FrameLayerBuilder.
|
|
|
|
*/
|
|
|
|
static DisplayItemData* GetDisplayItemDataForManager(nsIFrame* aFrame,
|
|
|
|
uint32_t aDisplayItemKey,
|
|
|
|
LayerManager* aManager);
|
|
|
|
static DisplayItemData* GetDisplayItemDataForManager(nsDisplayItem* aItem, LayerManager* aManager);
|
2011-10-06 14:35:08 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A useful hashtable iteration function that removes the
|
|
|
|
* DisplayItemData property for the frame, clears its
|
|
|
|
* NS_FRAME_HAS_CONTAINER_LAYER bit and returns PL_DHASH_REMOVE.
|
|
|
|
* aClosure is ignored.
|
|
|
|
*/
|
|
|
|
static PLDHashOperator RemoveDisplayItemDataForFrame(DisplayItemDataEntry* aEntry,
|
2012-08-28 22:38:58 -07:00
|
|
|
void* aClosure);
|
2011-10-06 14:35:08 -07:00
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* We store one of these for each display item associated with a
|
|
|
|
* ThebesLayer, in a hashtable that maps each ThebesLayer to an array
|
|
|
|
* of ClippedDisplayItems. (ThebesLayerItemsEntry is the hash entry
|
|
|
|
* for that hashtable.)
|
|
|
|
* These are only stored during the paint process, so that the
|
|
|
|
* DrawThebesLayer callback can figure out which items to draw for the
|
|
|
|
* ThebesLayer.
|
|
|
|
* mItem always has an underlying frame.
|
|
|
|
*/
|
|
|
|
struct ClippedDisplayItem {
|
2012-08-22 08:56:38 -07:00
|
|
|
ClippedDisplayItem(nsDisplayItem* aItem, const Clip& aClip, uint32_t aGeneration)
|
2012-07-22 20:00:36 -07:00
|
|
|
: mItem(aItem), mClip(aClip), mContainerLayerGeneration(aGeneration)
|
2010-07-15 14:07:51 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-28 22:38:58 -07:00
|
|
|
~ClippedDisplayItem();
|
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
nsDisplayItem* mItem;
|
2012-08-28 22:38:58 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the display item is being rendered as an inactive
|
|
|
|
* layer, then this stores the layer manager being
|
|
|
|
* used for the inactive transaction.
|
|
|
|
*/
|
|
|
|
nsRefPtr<LayerManager> mInactiveLayer;
|
|
|
|
|
2010-09-09 08:21:46 -07:00
|
|
|
Clip mClip;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mContainerLayerGeneration;
|
2010-07-15 14:07:51 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* We accumulate ClippedDisplayItem elements in a hashtable during
|
|
|
|
* the paint process. This is the hashentry for that hashtable.
|
|
|
|
*/
|
2012-02-07 14:27:44 -08:00
|
|
|
public:
|
2010-07-15 14:07:51 -07:00
|
|
|
class ThebesLayerItemsEntry : public nsPtrHashKey<ThebesLayer> {
|
|
|
|
public:
|
2011-05-16 16:05:56 -07:00
|
|
|
ThebesLayerItemsEntry(const ThebesLayer *key) :
|
2012-07-30 07:20:58 -07:00
|
|
|
nsPtrHashKey<ThebesLayer>(key), mContainerLayerFrame(nullptr),
|
2012-09-11 14:17:26 -07:00
|
|
|
mContainerLayerGeneration(0),
|
2012-05-14 16:01:05 -07:00
|
|
|
mHasExplicitLastPaintOffset(false), mCommonClipCount(0) {}
|
2010-07-15 14:07:51 -07:00
|
|
|
ThebesLayerItemsEntry(const ThebesLayerItemsEntry &toCopy) :
|
|
|
|
nsPtrHashKey<ThebesLayer>(toCopy.mKey), mItems(toCopy.mItems)
|
|
|
|
{
|
|
|
|
NS_ERROR("Should never be called, since we ALLOW_MEMMOVE");
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTArray<ClippedDisplayItem> mItems;
|
|
|
|
nsIFrame* mContainerLayerFrame;
|
2011-05-17 22:48:43 -07:00
|
|
|
// The translation set on this ThebesLayer before we started updating the
|
2011-05-16 16:05:56 -07:00
|
|
|
// layer tree.
|
2011-05-17 22:48:43 -07:00
|
|
|
nsIntPoint mLastPaintOffset;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mContainerLayerGeneration;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHasExplicitLastPaintOffset;
|
2012-02-07 14:27:44 -08:00
|
|
|
/**
|
|
|
|
* The first mCommonClipCount rounded rectangle clips are identical for
|
|
|
|
* all items in the layer. Computed in ThebesLayerData.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mCommonClipCount;
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
enum { ALLOW_MEMMOVE = true };
|
2010-07-15 14:07:51 -07:00
|
|
|
};
|
|
|
|
|
2012-02-07 14:27:44 -08:00
|
|
|
/**
|
|
|
|
* Get the ThebesLayerItemsEntry object associated with aLayer in this
|
|
|
|
* FrameLayerBuilder
|
|
|
|
*/
|
|
|
|
ThebesLayerItemsEntry* GetThebesLayerItemsEntry(ThebesLayer* aLayer)
|
|
|
|
{
|
|
|
|
return mThebesLayerItems.GetEntry(aLayer);
|
|
|
|
}
|
|
|
|
|
2012-08-28 22:38:58 -07:00
|
|
|
static PLDHashOperator ProcessRemovedDisplayItems(DisplayItemDataEntry* aEntry,
|
|
|
|
void* aUserArg);
|
2012-02-07 14:27:44 -08:00
|
|
|
protected:
|
2012-08-29 03:53:34 -07:00
|
|
|
void RemoveThebesItemsAndOwnerDataForLayerSubtree(Layer* aLayer,
|
|
|
|
bool aRemoveThebesItems,
|
|
|
|
bool aRemoveOwnerData);
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2012-07-14 00:49:05 -07:00
|
|
|
static void SetAndClearInvalidRegion(DisplayItemDataEntry* aEntry);
|
2011-10-06 14:35:08 -07:00
|
|
|
static PLDHashOperator UpdateDisplayItemDataForFrame(DisplayItemDataEntry* aEntry,
|
2010-07-15 14:07:51 -07:00
|
|
|
void* aUserArg);
|
|
|
|
static PLDHashOperator StoreNewDisplayItemData(DisplayItemDataEntry* aEntry,
|
|
|
|
void* aUserArg);
|
2012-07-22 20:00:36 -07:00
|
|
|
static PLDHashOperator RestoreDisplayItemData(DisplayItemDataEntry* aEntry,
|
|
|
|
void *aUserArg);
|
|
|
|
|
|
|
|
static PLDHashOperator RestoreThebesLayerItemEntries(ThebesLayerItemsEntry* aEntry,
|
|
|
|
void *aUserArg);
|
2010-07-15 14:07:51 -07:00
|
|
|
|
2010-09-17 12:09:08 -07:00
|
|
|
/**
|
|
|
|
* Returns true if the DOM has been modified since we started painting,
|
|
|
|
* in which case we should bail out and not paint anymore. This should
|
|
|
|
* never happen, but plugins can trigger it in some cases.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CheckDOMModified();
|
2010-09-17 12:09:08 -07:00
|
|
|
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* The layer manager belonging to the widget that is being retained
|
|
|
|
* across paints.
|
|
|
|
*/
|
|
|
|
LayerManager* mRetainingManager;
|
2010-09-17 12:09:08 -07:00
|
|
|
/**
|
|
|
|
* The root prescontext for the display list builder reference frame
|
|
|
|
*/
|
|
|
|
nsRootPresContext* mRootPresContext;
|
2012-08-28 22:38:58 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The display list builder being used.
|
|
|
|
*/
|
|
|
|
nsDisplayListBuilder* mDisplayListBuilder;
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* A map from frames to a list of (display item key, layer) pairs that
|
|
|
|
* describes what layers various parts of the frame are assigned to.
|
|
|
|
*/
|
|
|
|
nsTHashtable<DisplayItemDataEntry> mNewDisplayItemData;
|
|
|
|
/**
|
|
|
|
* A map from ThebesLayers to the list of display items (plus
|
|
|
|
* clipping data) to be rendered in the layer.
|
|
|
|
*/
|
|
|
|
nsTHashtable<ThebesLayerItemsEntry> mThebesLayerItems;
|
2010-09-17 12:09:08 -07:00
|
|
|
/**
|
|
|
|
* Saved generation counter so we can detect DOM changes.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mInitialDOMGeneration;
|
2010-09-17 12:09:08 -07:00
|
|
|
/**
|
|
|
|
* Set to true if we have detected and reported DOM modification during
|
|
|
|
* the current paint.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDetectedDOMModification;
|
2010-07-15 14:07:51 -07:00
|
|
|
/**
|
|
|
|
* Indicates that the entire layer tree should be rerendered
|
|
|
|
* during this paint.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mInvalidateAllLayers;
|
2012-07-22 20:00:36 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mContainerLayerGeneration;
|
|
|
|
uint32_t mMaxContainerLayerGeneration;
|
2012-08-28 22:48:41 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* True if the current top-level LayerManager for the widget being
|
|
|
|
* painted is marked as being a 'secondary' LayerManager.
|
|
|
|
*/
|
|
|
|
static bool sWidgetManagerSecondary;
|
2010-05-20 20:20:48 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* FRAMELAYERBUILDER_H_ */
|