зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1357754 - Add more data to the WebRenderScrollData object. r=botond,jrmuizel
This puts all the other things that APZ needs into the WebRenderScrollData object. The main exception is the scroll clip - I'm not totally sure how that will be handled yet, so for now we just return no clip from WebRenderScrollDataWrapper. MozReview-Commit-ID: 1IhGhSFiPYi
This commit is contained in:
Родитель
1459e240f4
Коммит
7e8f4eeba8
|
@ -32,6 +32,24 @@ WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
|
|||
for (uint32_t i = 0; i < aLayer->GetScrollMetadataCount(); i++) {
|
||||
mScrollIds.AppendElement(aOwner.AddMetadata(aLayer->GetScrollMetadata(i)));
|
||||
}
|
||||
|
||||
mIsScrollInfoLayer = aLayer->AsContainerLayer() && !aLayer->GetFirstChild();
|
||||
mTransform = aLayer->GetTransform();
|
||||
mTransformIsPerspective = aLayer->GetTransformIsPerspective();
|
||||
mEventRegions = aLayer->GetEventRegions();
|
||||
mReferentId = aLayer->AsRefLayer()
|
||||
? Some(aLayer->AsRefLayer()->GetReferentId())
|
||||
: Nothing();
|
||||
mEventRegionsOverride = aLayer->AsContainerLayer()
|
||||
? aLayer->AsContainerLayer()->GetEventRegionsOverride()
|
||||
: EventRegionsOverride::NoOverride;
|
||||
mScrollbarDirection = aLayer->GetScrollbarDirection();
|
||||
mScrollbarTargetContainerId = aLayer->GetScrollbarTargetContainerId();
|
||||
mScrollThumbLength = mScrollbarDirection == ScrollDirection::VERTICAL
|
||||
? aLayer->GetVisibleRegion().GetBounds().height
|
||||
: aLayer->GetVisibleRegion().GetBounds().width;
|
||||
mIsScrollbarContainer = aLayer->IsScrollbarContainer();
|
||||
mFixedPosScrollContainerId = aLayer->GetFixedPositionScrollContainerId();
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
#include "FrameMetrics.h"
|
||||
#include "LayersTypes.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
|
@ -46,6 +47,18 @@ public:
|
|||
const ScrollMetadata& GetScrollMetadata(const WebRenderScrollData& aOwner,
|
||||
size_t aIndex) const;
|
||||
|
||||
bool IsScrollInfoLayer() const { return mIsScrollInfoLayer; }
|
||||
gfx::Matrix4x4 GetTransform() const { return mTransform; }
|
||||
bool GetTransformIsPerspective() const { return mTransformIsPerspective; }
|
||||
EventRegions GetEventRegions() const { return mEventRegions; }
|
||||
Maybe<uint64_t> GetReferentId() const { return mReferentId; }
|
||||
EventRegionsOverride GetEventRegionsOverride() const { return mEventRegionsOverride; }
|
||||
ScrollDirection GetScrollbarDirection() const { return mScrollbarDirection; }
|
||||
FrameMetrics::ViewID GetScrollbarTargetContainerId() const { return mScrollbarTargetContainerId; }
|
||||
int32_t GetScrollThumbLength() const { return mScrollThumbLength; }
|
||||
bool IsScrollbarContainer() const { return mIsScrollbarContainer; }
|
||||
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const { return mFixedPosScrollContainerId; }
|
||||
|
||||
friend struct IPC::ParamTraits<WebRenderLayerScrollData>;
|
||||
|
||||
private:
|
||||
|
@ -60,6 +73,21 @@ private:
|
|||
// ScrollMetadata objects, since there is usually heavy duplication of them
|
||||
// within a layer tree.
|
||||
nsTArray<size_t> mScrollIds;
|
||||
|
||||
// Various data that we collect from the Layer in Initialize(), serialize
|
||||
// over IPC, and use on the parent side in APZ.
|
||||
|
||||
bool mIsScrollInfoLayer;
|
||||
gfx::Matrix4x4 mTransform;
|
||||
bool mTransformIsPerspective;
|
||||
EventRegions mEventRegions;
|
||||
Maybe<uint64_t> mReferentId;
|
||||
EventRegionsOverride mEventRegionsOverride;
|
||||
ScrollDirection mScrollbarDirection;
|
||||
FrameMetrics::ViewID mScrollbarTargetContainerId;
|
||||
int32_t mScrollThumbLength;
|
||||
bool mIsScrollbarContainer;
|
||||
FrameMetrics::ViewID mFixedPosScrollContainerId;
|
||||
};
|
||||
|
||||
// Data needed by APZ, for the whole layer tree. One instance of this class
|
||||
|
@ -127,13 +155,35 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
|
|||
{
|
||||
WriteParam(aMsg, aParam.mDescendantCount);
|
||||
WriteParam(aMsg, aParam.mScrollIds);
|
||||
WriteParam(aMsg, aParam.mIsScrollInfoLayer);
|
||||
WriteParam(aMsg, aParam.mTransform);
|
||||
WriteParam(aMsg, aParam.mTransformIsPerspective);
|
||||
WriteParam(aMsg, aParam.mEventRegions);
|
||||
WriteParam(aMsg, aParam.mReferentId);
|
||||
WriteParam(aMsg, aParam.mEventRegionsOverride);
|
||||
WriteParam(aMsg, aParam.mScrollbarDirection);
|
||||
WriteParam(aMsg, aParam.mScrollbarTargetContainerId);
|
||||
WriteParam(aMsg, aParam.mScrollThumbLength);
|
||||
WriteParam(aMsg, aParam.mIsScrollbarContainer);
|
||||
WriteParam(aMsg, aParam.mFixedPosScrollContainerId);
|
||||
}
|
||||
|
||||
static bool
|
||||
Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mDescendantCount)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mScrollIds);
|
||||
&& ReadParam(aMsg, aIter, &aResult->mScrollIds)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mIsScrollInfoLayer)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mTransform)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mTransformIsPerspective)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mEventRegions)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mReferentId)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mScrollbarDirection)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mScrollbarTargetContainerId)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mScrollThumbLength)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mIsScrollbarContainer)
|
||||
&& ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -125,8 +125,10 @@ public:
|
|||
|
||||
bool IsScrollInfoLayer() const
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
return Metrics().IsScrollable()
|
||||
&& mLayer->IsScrollInfoLayer();
|
||||
}
|
||||
|
||||
WebRenderScrollDataWrapper GetLastChild() const
|
||||
|
@ -193,24 +195,25 @@ public:
|
|||
|
||||
AsyncPanZoomController* GetApzc() const
|
||||
{
|
||||
// TODO
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SetApzc(AsyncPanZoomController* aApzc) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
const char* Name() const
|
||||
{
|
||||
// TODO
|
||||
return nullptr;
|
||||
return "WebRenderScrollDataWrapper";
|
||||
}
|
||||
|
||||
gfx::Matrix4x4 GetTransform() const
|
||||
{
|
||||
// TODO
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
if (AtBottomLayer()) {
|
||||
return mLayer->GetTransform();
|
||||
}
|
||||
return gfx::Matrix4x4();
|
||||
}
|
||||
|
||||
|
@ -221,19 +224,31 @@ public:
|
|||
|
||||
bool TransformIsPerspective() const
|
||||
{
|
||||
// TODO
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
if (AtBottomLayer()) {
|
||||
return mLayer->GetTransformIsPerspective();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EventRegions GetEventRegions() const
|
||||
{
|
||||
// TODO
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
if (AtBottomLayer()) {
|
||||
return mLayer->GetEventRegions();
|
||||
}
|
||||
return EventRegions();
|
||||
}
|
||||
|
||||
Maybe<uint64_t> GetReferentId() const
|
||||
{
|
||||
// TODO
|
||||
MOZ_ASSERT(IsValid());
|
||||
|
||||
if (AtBottomLayer()) {
|
||||
return mLayer->GetReferentId();
|
||||
}
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
@ -245,44 +260,44 @@ public:
|
|||
|
||||
EventRegionsOverride GetEventRegionsOverride() const
|
||||
{
|
||||
// TODO
|
||||
return EventRegionsOverride::NoOverride;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetEventRegionsOverride();
|
||||
}
|
||||
|
||||
ScrollDirection GetScrollbarDirection() const
|
||||
{
|
||||
// TODO
|
||||
return ScrollDirection::NONE;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetScrollbarDirection();
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetScrollbarTargetContainerId() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetScrollbarTargetContainerId();
|
||||
}
|
||||
|
||||
int32_t GetScrollThumbLength() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetScrollThumbLength();
|
||||
}
|
||||
|
||||
bool IsScrollbarContainer() const
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->IsScrollbarContainer();
|
||||
}
|
||||
|
||||
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer->GetFixedPositionScrollContainerId();
|
||||
}
|
||||
|
||||
const void* GetLayer() const
|
||||
{
|
||||
// TODO
|
||||
return nullptr;
|
||||
MOZ_ASSERT(IsValid());
|
||||
return mLayer;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче