Bug 982888 - Add a mScrollHandoffParent field to ContainerLayers. r=

This commit is contained in:
Kartikaya Gupta 2014-04-11 19:39:21 -04:00
parent 058f67f786
commit 7c9a50e4de
4 changed files with 27 additions and 1 deletions

View File

@ -733,6 +733,7 @@ ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData),
mFirstChild(nullptr),
mLastChild(nullptr),
mScrollHandoffParentId(FrameMetrics::NULL_SCROLL_ID),
mPreXScale(1.0f),
mPreYScale(1.0f),
mInheritedXScale(1.0f),
@ -893,7 +894,8 @@ ContainerLayer::RepositionChild(Layer* aChild, Layer* aAfter)
void
ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
aAttrs = ContainerLayerAttributes(GetFrameMetrics(), mPreXScale, mPreYScale,
aAttrs = ContainerLayerAttributes(GetFrameMetrics(), mScrollHandoffParentId,
mPreXScale, mPreYScale,
mInheritedXScale, mInheritedYScale);
}
@ -1381,6 +1383,9 @@ ContainerLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
if (!mFrameMetrics.IsDefault()) {
AppendToString(aTo, mFrameMetrics, " [metrics=", "]");
}
if (mScrollHandoffParentId != FrameMetrics::NULL_SCROLL_ID) {
aTo.AppendPrintf(" [scrollParent=%llu]", mScrollHandoffParentId);
}
if (UseIntermediateSurface()) {
aTo += " [usesTmpSurf]";
}

View File

@ -1627,6 +1627,22 @@ public:
void SetAsyncPanZoomController(AsyncPanZoomController *controller);
AsyncPanZoomController* GetAsyncPanZoomController() const;
/**
* CONSTRUCTION PHASE ONLY
* Set the ViewID of the ContainerLayer to which overscroll should be handed
* off. A value of NULL_SCROLL_ID means that the default handoff-parent-finding
* behaviour should be used (i.e. walk up the layer tree to find the next
* scrollable ancestor layer).
*/
void SetScrollHandoffParentId(FrameMetrics::ViewID aScrollParentId)
{
if (mScrollHandoffParentId != aScrollParentId) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ScrollHandoffParentId", this));
mScrollHandoffParentId = aScrollParentId;
Mutated();
}
}
void SetPreScale(float aXScale, float aYScale)
{
if (mPreXScale == aXScale && mPreYScale == aYScale) {
@ -1663,6 +1679,7 @@ public:
virtual Layer* GetFirstChild() const { return mFirstChild; }
virtual Layer* GetLastChild() const { return mLastChild; }
const FrameMetrics& GetFrameMetrics() const { return mFrameMetrics; }
FrameMetrics::ViewID GetScrollHandoffParentId() const { return mScrollHandoffParentId; }
float GetPreXScale() const { return mPreXScale; }
float GetPreYScale() const { return mPreYScale; }
float GetInheritedXScale() const { return mInheritedXScale; }
@ -1734,6 +1751,7 @@ protected:
Layer* mLastChild;
FrameMetrics mFrameMetrics;
nsRefPtr<AsyncPanZoomController> mAPZC;
FrameMetrics::ViewID mScrollHandoffParentId;
float mPreXScale;
float mPreYScale;
// The resolution scale inherited from the parent layer. This will already

View File

@ -346,6 +346,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const ContainerLayerAttributes& attrs =
specific.get_ContainerLayerAttributes();
containerLayer->SetFrameMetrics(attrs.metrics());
containerLayer->SetScrollHandoffParentId(attrs.scrollParentId());
containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
break;

View File

@ -39,6 +39,7 @@ using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h";
using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h";
using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
namespace mozilla {
@ -216,6 +217,7 @@ struct ThebesLayerAttributes {
};
struct ContainerLayerAttributes {
FrameMetrics metrics;
ViewID scrollParentId;
float preXScale;
float preYScale;
float inheritedXScale;