Bug 1051985 - Move the scroll handoff parent id from ContainerLayer to Layer. r=mattwoodrow

This commit is contained in:
Kartikaya Gupta 2014-08-11 20:00:37 -04:00
parent a0ad18d035
commit 7f106b13e3
6 changed files with 27 additions and 27 deletions

View File

@ -172,6 +172,7 @@ Layer::Layer(LayerManager* aManager, void* aImplData) :
mPrevSibling(nullptr),
mImplData(aImplData),
mMaskLayer(nullptr),
mScrollHandoffParentId(FrameMetrics::NULL_SCROLL_ID),
mPostXScale(1.0f),
mPostYScale(1.0f),
mOpacity(1.0),
@ -758,7 +759,6 @@ 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),
@ -920,8 +920,7 @@ ContainerLayer::RepositionChild(Layer* aChild, Layer* aAfter)
void
ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
aAttrs = ContainerLayerAttributes(mScrollHandoffParentId,
mPreXScale, mPreYScale,
aAttrs = ContainerLayerAttributes(mPreXScale, mPreYScale,
mInheritedXScale, mInheritedYScale,
mBackgroundColor, mContentDescription);
}
@ -1443,6 +1442,9 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
if (!mFrameMetrics.IsDefault()) {
AppendToString(aStream, mFrameMetrics, " [metrics=", "]");
}
if (mScrollHandoffParentId != FrameMetrics::NULL_SCROLL_ID) {
aStream << nsPrintfCString(" [scrollParent=%llu]", mScrollHandoffParentId).get();
}
}
// The static helper function sets the transform matrix into the packet
@ -1570,9 +1572,6 @@ void
ContainerLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
if (mScrollHandoffParentId != FrameMetrics::NULL_SCROLL_ID) {
aStream << nsPrintfCString(" [scrollParent=%llu]", mScrollHandoffParentId).get();
}
if (UseIntermediateSurface()) {
aStream << " [usesTmpSurf]";
}

View File

@ -828,6 +828,22 @@ public:
}
}
/**
* 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();
}
}
/*
* Compositor event handling
* =========================
@ -1135,6 +1151,7 @@ public:
uint32_t GetContentFlags() { return mContentFlags; }
const nsIntRegion& GetVisibleRegion() { return mVisibleRegion; }
const FrameMetrics& GetFrameMetrics() const { return mFrameMetrics; }
FrameMetrics::ViewID GetScrollHandoffParentId() const { return mScrollHandoffParentId; }
const EventRegions& GetEventRegions() const { return mEventRegions; }
ContainerLayer* GetParent() { return mParent; }
Layer* GetNextSibling() { return mNextSibling; }
@ -1511,6 +1528,7 @@ protected:
gfx::UserData mUserData;
nsIntRegion mVisibleRegion;
FrameMetrics mFrameMetrics;
FrameMetrics::ViewID mScrollHandoffParentId;
EventRegions mEventRegions;
gfx::Matrix4x4 mTransform;
// A mutation of |mTransform| that we've queued to be applied at the
@ -1703,22 +1721,6 @@ 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) {
@ -1776,7 +1778,6 @@ public:
virtual Layer* GetFirstChild() const { return mFirstChild; }
virtual Layer* GetLastChild() const { return mLastChild; }
FrameMetrics::ViewID GetScrollHandoffParentId() const { return mScrollHandoffParentId; }
float GetPreXScale() const { return mPreXScale; }
float GetPreYScale() const { return mPreYScale; }
float GetInheritedXScale() const { return mInheritedXScale; }
@ -1864,7 +1865,6 @@ protected:
Layer* mFirstChild;
Layer* mLastChild;
nsRefPtr<AsyncPanZoomController> mAPZC;
FrameMetrics::ViewID mScrollHandoffParentId;
float mPreXScale;
float mPreYScale;
// The resolution scale inherited from the parent layer. This will already

View File

@ -233,7 +233,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
apzc->NotifyLayersUpdated(metrics,
aIsFirstPaint && (aLayersId == aOriginatingLayersId));
apzc->SetScrollHandoffParentId(container->GetScrollHandoffParentId());
apzc->SetScrollHandoffParentId(aLayer->GetScrollHandoffParentId());
// Use the composition bounds as the hit test region.
// Optionally, the GeckoContentController can provide a touch-sensitive

View File

@ -319,6 +319,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
layer->SetAnimations(common.animations());
layer->SetInvalidRegion(common.invalidRegion());
layer->SetFrameMetrics(common.metrics());
layer->SetScrollHandoffParentId(common.scrollParentId());
typedef SpecificLayerAttributes Specific;
const SpecificLayerAttributes& specific = attrs.specific();
@ -349,7 +350,6 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
}
const ContainerLayerAttributes& attrs =
specific.get_ContainerLayerAttributes();
containerLayer->SetScrollHandoffParentId(attrs.scrollParentId());
containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
containerLayer->SetBackgroundColor(attrs.backgroundColor().value());

View File

@ -216,13 +216,13 @@ struct CommonLayerAttributes {
Animation[] animations;
nsIntRegion invalidRegion;
FrameMetrics metrics;
ViewID scrollParentId;
};
struct ThebesLayerAttributes {
nsIntRegion validRegion;
};
struct ContainerLayerAttributes {
ViewID scrollParentId;
float preXScale;
float preYScale;
float inheritedXScale;

View File

@ -598,6 +598,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
common.animations() = mutant->GetAnimations();
common.invalidRegion() = mutant->GetInvalidRegion();
common.metrics() = mutant->GetFrameMetrics();
common.scrollParentId() = mutant->GetScrollHandoffParentId();
attrs.specific() = null_t();
mutant->FillSpecificAttributes(attrs.specific());