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:
Kartikaya Gupta 2017-04-20 10:38:05 -04:00
Родитель 1459e240f4
Коммит 7e8f4eeba8
3 изменённых файлов: 108 добавлений и 25 удалений

Просмотреть файл

@ -32,6 +32,24 @@ WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
for (uint32_t i = 0; i < aLayer->GetScrollMetadataCount(); i++) { for (uint32_t i = 0; i < aLayer->GetScrollMetadataCount(); i++) {
mScrollIds.AppendElement(aOwner.AddMetadata(aLayer->GetScrollMetadata(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 int32_t

Просмотреть файл

@ -10,6 +10,7 @@
#include "chrome/common/ipc_message_utils.h" #include "chrome/common/ipc_message_utils.h"
#include "FrameMetrics.h" #include "FrameMetrics.h"
#include "LayersTypes.h"
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
#include "nsTArrayForwardDeclare.h" #include "nsTArrayForwardDeclare.h"
@ -46,6 +47,18 @@ public:
const ScrollMetadata& GetScrollMetadata(const WebRenderScrollData& aOwner, const ScrollMetadata& GetScrollMetadata(const WebRenderScrollData& aOwner,
size_t aIndex) const; 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>; friend struct IPC::ParamTraits<WebRenderLayerScrollData>;
private: private:
@ -60,6 +73,21 @@ private:
// ScrollMetadata objects, since there is usually heavy duplication of them // ScrollMetadata objects, since there is usually heavy duplication of them
// within a layer tree. // within a layer tree.
nsTArray<size_t> mScrollIds; 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 // 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.mDescendantCount);
WriteParam(aMsg, aParam.mScrollIds); 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 static bool
Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{ {
return ReadParam(aMsg, aIter, &aResult->mDescendantCount) 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 bool IsScrollInfoLayer() const
{ {
// TODO MOZ_ASSERT(IsValid());
return false;
return Metrics().IsScrollable()
&& mLayer->IsScrollInfoLayer();
} }
WebRenderScrollDataWrapper GetLastChild() const WebRenderScrollDataWrapper GetLastChild() const
@ -193,24 +195,25 @@ public:
AsyncPanZoomController* GetApzc() const AsyncPanZoomController* GetApzc() const
{ {
// TODO
return nullptr; return nullptr;
} }
void SetApzc(AsyncPanZoomController* aApzc) const void SetApzc(AsyncPanZoomController* aApzc) const
{ {
// TODO
} }
const char* Name() const const char* Name() const
{ {
// TODO return "WebRenderScrollDataWrapper";
return nullptr;
} }
gfx::Matrix4x4 GetTransform() const gfx::Matrix4x4 GetTransform() const
{ {
// TODO MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetTransform();
}
return gfx::Matrix4x4(); return gfx::Matrix4x4();
} }
@ -221,19 +224,31 @@ public:
bool TransformIsPerspective() const bool TransformIsPerspective() const
{ {
// TODO MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetTransformIsPerspective();
}
return false; return false;
} }
EventRegions GetEventRegions() const EventRegions GetEventRegions() const
{ {
// TODO MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetEventRegions();
}
return EventRegions(); return EventRegions();
} }
Maybe<uint64_t> GetReferentId() const Maybe<uint64_t> GetReferentId() const
{ {
// TODO MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetReferentId();
}
return Nothing(); return Nothing();
} }
@ -245,44 +260,44 @@ public:
EventRegionsOverride GetEventRegionsOverride() const EventRegionsOverride GetEventRegionsOverride() const
{ {
// TODO MOZ_ASSERT(IsValid());
return EventRegionsOverride::NoOverride; return mLayer->GetEventRegionsOverride();
} }
ScrollDirection GetScrollbarDirection() const ScrollDirection GetScrollbarDirection() const
{ {
// TODO MOZ_ASSERT(IsValid());
return ScrollDirection::NONE; return mLayer->GetScrollbarDirection();
} }
FrameMetrics::ViewID GetScrollbarTargetContainerId() const FrameMetrics::ViewID GetScrollbarTargetContainerId() const
{ {
// TODO MOZ_ASSERT(IsValid());
return 0; return mLayer->GetScrollbarTargetContainerId();
} }
int32_t GetScrollThumbLength() const int32_t GetScrollThumbLength() const
{ {
// TODO MOZ_ASSERT(IsValid());
return 0; return mLayer->GetScrollThumbLength();
} }
bool IsScrollbarContainer() const bool IsScrollbarContainer() const
{ {
// TODO MOZ_ASSERT(IsValid());
return false; return mLayer->IsScrollbarContainer();
} }
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const FrameMetrics::ViewID GetFixedPositionScrollContainerId() const
{ {
// TODO MOZ_ASSERT(IsValid());
return 0; return mLayer->GetFixedPositionScrollContainerId();
} }
const void* GetLayer() const const void* GetLayer() const
{ {
// TODO MOZ_ASSERT(IsValid());
return nullptr; return mLayer;
} }
private: private: