Bug 590294, part 3: Keep ContainerLayer type info around in a few places. r=roc
--- a/gfx/layers/ipc/ShadowLayersParent.cpp
+++ b/gfx/layers/ipc/ShadowLayersParent.cpp
@@ -320,17 +320,17 @@ ShadowLayersParent::RecvUpdate(const nsT
}
break;
}
// Tree ops
case Edit::TOpSetRoot: {
MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
- mRoot = AsShadowLayer(edit.get_OpSetRoot())->AsLayer();
+ mRoot = AsShadowLayer(edit.get_OpSetRoot())->AsContainer();
break;
}
case Edit::TOpInsertAfter: {
MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
const OpInsertAfter& oia = edit.get_OpInsertAfter();
ShadowContainer(oia)->AsContainer()->InsertAfter(
ShadowChild(oia)->AsLayer(), ShadowAfter(oia)->AsLayer());
--- a/gfx/layers/ipc/ShadowLayersParent.h
+++ b/gfx/layers/ipc/ShadowLayersParent.h
@@ -61,30 +61,30 @@ class ShadowLayersParent : public PLayer
typedef nsTArray<EditReply> EditReplyArray;
public:
ShadowLayersParent(ShadowLayerManager* aManager);
~ShadowLayersParent();
ShadowLayerManager* layer_manager() const { return mLayerManager; }
- Layer* GetRoot() const { return mRoot; }
+ ContainerLayer* GetRoot() const { return mRoot; }
protected:
NS_OVERRIDE virtual bool RecvUpdate(const EditArray& cset,
EditReplyArray* reply);
NS_OVERRIDE virtual PLayerParent* AllocPLayer();
NS_OVERRIDE virtual bool DeallocPLayer(PLayerParent* actor);
private:
RenderFrameParent* Frame();
nsRefPtr<ShadowLayerManager> mLayerManager;
// Hold the root because it might be grafted under various
// containers in the "real" layer tree
- nsRefPtr<Layer> mRoot;
+ nsRefPtr<ContainerLayer> mRoot;
};
} // namespace layers
} // namespace mozilla
#endif // ifndef mozilla_layers_ShadowLayersParent_h
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1315,17 +1315,17 @@ SetHasContainerLayer(nsIFrame* aFrame)
aFrame->AddStateBits(NS_FRAME_HAS_CONTAINER_LAYER);
for (nsIFrame* f = aFrame;
f && !(f->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
f->AddStateBits(NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
}
}
-already_AddRefed<Layer>
+already_AddRefed<ContainerLayer>
FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
nsIFrame* aContainerFrame,
nsDisplayItem* aContainerItem,
const nsDisplayList& aChildren)
{
FrameProperties props = aContainerFrame->Properties();
PRUint32 containerDisplayItemKey =
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -85,16 +85,17 @@ enum LayerState {
*
* 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.
*/
class FrameLayerBuilder {
public:
+ typedef layers::ContainerLayer ContainerLayer;
typedef layers::Layer Layer;
typedef layers::ThebesLayer ThebesLayer;
typedef layers::LayerManager LayerManager;
FrameLayerBuilder() :
mRetainingManager(nsnull),
mInvalidateAllThebesContent(PR_FALSE),
mInvalidateAllLayers(PR_FALSE)
@@ -133,21 +134,22 @@ public:
* 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
* caller's responsibility to add any clip rect and set the visible
* region.
*/
- already_AddRefed<Layer> BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
- LayerManager* aManager,
- nsIFrame* aContainerFrame,
- nsDisplayItem* aContainerItem,
- const nsDisplayList& aChildren);
+ already_AddRefed<ContainerLayer>
+ BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
+ LayerManager* aManager,
+ nsIFrame* aContainerFrame,
+ nsDisplayItem* aContainerItem,
+ const nsDisplayList& aChildren);
/**
* 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
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -398,17 +398,17 @@ void nsDisplayList::PaintForFrame(nsDisp
}
if (aCtx) {
layerManager->BeginTransactionWithTarget(aCtx->ThebesContext());
} else {
layerManager->BeginTransaction();
}
- nsRefPtr<Layer> root = aBuilder->LayerBuilder()->
+ nsRefPtr<ContainerLayer> root = aBuilder->LayerBuilder()->
BuildContainerLayerFor(aBuilder, layerManager, aForFrame, nsnull, *this);
if (!root)
return;
nsIntRect visible =
mVisibleRect.ToNearestPixels(aForFrame->PresContext()->AppUnitsPerDevPixel());
root->SetVisibleRegion(nsIntRegion(visible));
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -168,17 +168,17 @@ RenderFrameParent::BuildLayer(nsDisplayL
// FIXME handle the former case somehow, probably with an API to
// draw a manager's subtree. The latter is bad bad bad, but the
// the NS_ABORT_IF_FALSE() above will flag it. Returning NULL
// here will just cause the shadow subtree not to be rendered.
return nsnull;
}
Layer* containerRoot = mContainer ? RootOf(mContainer) : nsnull;
- Layer* shadowRoot = GetRootLayer();
+ ContainerLayer* shadowRoot = GetRootLayer();
NS_ABORT_IF_FALSE(!shadowRoot || shadowRoot->Manager() == aManager,
"retaining manager changed out from under us ... HELP!");
if (mContainer && shadowRoot != containerRoot) {
// Shadow root changed. Remove it from the container, if it
// existed.
if (containerRoot) {
mContainer->RemoveChild(containerRoot);
@@ -258,17 +258,17 @@ RenderFrameParent::GetShadowLayers() con
{
const nsTArray<PLayersParent*>& shadowParents = ManagedPLayersParent();
NS_ABORT_IF_FALSE(shadowParents.Length() <= 1,
"can only support at most 1 ShadowLayersParent");
return (shadowParents.Length() == 1) ?
static_cast<ShadowLayersParent*>(shadowParents[0]) : nsnull;
}
-Layer*
+ContainerLayer*
RenderFrameParent::GetRootLayer() const
{
ShadowLayersParent* shadowLayers = GetShadowLayers();
return shadowLayers ? shadowLayers->GetRoot() : nsnull;
}
} // namespace layout
} // namespace mozilla
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -78,17 +78,17 @@ protected:
NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
NS_OVERRIDE virtual PLayersParent* AllocPLayers();
NS_OVERRIDE virtual bool DeallocPLayers(PLayersParent* aLayers);
private:
LayerManager* GetLayerManager() const;
ShadowLayersParent* GetShadowLayers() const;
- Layer* GetRootLayer() const;
+ ContainerLayer* GetRootLayer() const;
nsRefPtr<nsFrameLoader> mFrameLoader;
nsRefPtr<ContainerLayer> mContainer;
};
} // namespace layout
} // namespace mozilla