Bug 1349750 - Store the entire ScrollThumbData in HitTestingTreeNode. r=kats

This is preparation for future changes that will add fields to ScrollThumbData
that will be accessed via HitTestingTreeNode.

To accomplish this, this patch also exposes the entire ScrollThumbData via
LayerMetricsWrapper and WebRenderScrollDataWrapper.

MozReview-Commit-ID: 1Ed8Z80Wk1V

--HG--
extra : rebase_source : 86cce84eab0cd8bcd2998f1682137e9514bb1fb5
This commit is contained in:
Botond Ballo 2017-05-03 20:25:09 -04:00
Родитель 0f1863f7ac
Коммит 2029f1cf93
7 изменённых файлов: 29 добавлений и 19 удалений

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

@ -409,11 +409,11 @@ public:
return EventRegionsOverride::NoOverride;
}
ScrollDirection GetScrollbarDirection() const
const ScrollThumbData& GetScrollThumbData() const
{
MOZ_ASSERT(IsValid());
return mLayer->GetScrollThumbData().mDirection;
return mLayer->GetScrollThumbData();
}
FrameMetrics::ViewID GetScrollbarTargetContainerId() const

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

@ -518,7 +518,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
aLayer.GetClipRect() ? Some(ParentLayerIntRegion(*aLayer.GetClipRect())) : Nothing(),
GetEventRegionsOverride(aParent, aLayer));
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
aLayer.GetScrollbarDirection(),
aLayer.GetScrollThumbData(),
aLayer.IsScrollbarContainer());
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
return node;
@ -707,7 +707,7 @@ APZCTreeManager::PrepareNodeForLayer(const ScrollNode& aLayer,
// LayerTransactionParent.cpp must ensure that APZ will be notified
// when those properties change.
node->SetScrollbarData(aLayer.GetScrollbarTargetContainerId(),
aLayer.GetScrollbarDirection(),
aLayer.GetScrollThumbData(),
aLayer.IsScrollbarContainer());
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId());
return node;

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

@ -27,7 +27,6 @@ HitTestingTreeNode::HitTestingTreeNode(AsyncPanZoomController* aApzc,
, mIsPrimaryApzcHolder(aIsPrimaryHolder)
, mLayersId(aLayersId)
, mScrollViewId(FrameMetrics::NULL_SCROLL_ID)
, mScrollDir(ScrollDirection::NONE)
, mIsScrollbarContainer(false)
, mFixedPosTarget(FrameMetrics::NULL_SCROLL_ID)
, mOverride(EventRegionsOverride::NoOverride)
@ -95,20 +94,20 @@ HitTestingTreeNode::SetLastChild(HitTestingTreeNode* aChild)
void
HitTestingTreeNode::SetScrollbarData(FrameMetrics::ViewID aScrollViewId,
ScrollDirection aDir,
const ScrollThumbData& aThumbData,
bool aIsScrollContainer)
{
mScrollViewId = aScrollViewId;
mScrollDir = aDir;
mScrollThumbData = aThumbData;
mIsScrollbarContainer = aIsScrollContainer;
}
bool
HitTestingTreeNode::MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const
{
return ((mScrollDir == ScrollDirection::HORIZONTAL &&
return ((mScrollThumbData.mDirection == ScrollDirection::HORIZONTAL &&
aDragMetrics.mDirection == AsyncDragMetrics::HORIZONTAL) ||
(mScrollDir == ScrollDirection::VERTICAL &&
(mScrollThumbData.mDirection == ScrollDirection::VERTICAL &&
aDragMetrics.mDirection == AsyncDragMetrics::VERTICAL)) &&
mScrollViewId == aDragMetrics.mViewId;
}
@ -116,7 +115,7 @@ HitTestingTreeNode::MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetric
bool
HitTestingTreeNode::IsScrollbarNode() const
{
return mIsScrollbarContainer || (mScrollDir != ScrollDirection::NONE);
return mIsScrollbarContainer || (mScrollThumbData.mDirection != ScrollDirection::NONE);
}
FrameMetrics::ViewID

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

@ -92,7 +92,7 @@ public:
/* Scrollbar info */
void SetScrollbarData(FrameMetrics::ViewID aScrollViewId,
ScrollDirection aDir,
const ScrollThumbData& aThumbData,
bool aIsScrollContainer);
bool MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const;
bool IsScrollbarNode() const;
@ -132,7 +132,7 @@ private:
FrameMetrics::ViewID mScrollViewId;
// This is set for scroll thumb Container layers only.
ScrollDirection mScrollDir;
ScrollThumbData mScrollThumbData;
// This is set for scroll track Container layers only.
bool mIsScrollbarContainer;

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

@ -43,7 +43,7 @@ WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
mEventRegionsOverride = aLayer->AsContainerLayer()
? aLayer->AsContainerLayer()->GetEventRegionsOverride()
: EventRegionsOverride::NoOverride;
mScrollbarDirection = aLayer->GetScrollThumbData().mDirection;
mScrollThumbData = aLayer->GetScrollThumbData();
mScrollbarTargetContainerId = aLayer->GetScrollbarTargetContainerId();
mIsScrollbarContainer = aLayer->IsScrollbarContainer();
mFixedPosScrollContainerId = aLayer->GetFixedPositionScrollContainerId();

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

@ -53,7 +53,7 @@ public:
EventRegions GetEventRegions() const { return mEventRegions; }
Maybe<uint64_t> GetReferentId() const { return mReferentId; }
EventRegionsOverride GetEventRegionsOverride() const { return mEventRegionsOverride; }
ScrollDirection GetScrollbarDirection() const { return mScrollbarDirection; }
const ScrollThumbData& GetScrollThumbData() const { return mScrollThumbData; }
FrameMetrics::ViewID GetScrollbarTargetContainerId() const { return mScrollbarTargetContainerId; }
bool IsScrollbarContainer() const { return mIsScrollbarContainer; }
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const { return mFixedPosScrollContainerId; }
@ -82,7 +82,7 @@ private:
EventRegions mEventRegions;
Maybe<uint64_t> mReferentId;
EventRegionsOverride mEventRegionsOverride;
ScrollDirection mScrollbarDirection;
ScrollThumbData mScrollThumbData;
FrameMetrics::ViewID mScrollbarTargetContainerId;
bool mIsScrollbarContainer;
FrameMetrics::ViewID mFixedPosScrollContainerId;
@ -148,6 +148,17 @@ private:
namespace IPC {
// When ScrollThumbData is stored on the layer tree, it's part of
// SimpleAttributes which itself uses PlainOldDataSerializer, so
// we don't need a ParamTraits specialization for ScrollThumbData
// separately. Here, however, ScrollThumbData is stored as part
// of WebRenderLayerScrollData whose fields are serialized
// individually, so we do.
template<>
struct ParamTraits<mozilla::layers::ScrollThumbData>
: public PlainOldDataSerializer<mozilla::layers::ScrollThumbData>
{ };
template<>
struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
{
@ -164,7 +175,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
WriteParam(aMsg, aParam.mEventRegions);
WriteParam(aMsg, aParam.mReferentId);
WriteParam(aMsg, aParam.mEventRegionsOverride);
WriteParam(aMsg, aParam.mScrollbarDirection);
WriteParam(aMsg, aParam.mScrollThumbData);
WriteParam(aMsg, aParam.mScrollbarTargetContainerId);
WriteParam(aMsg, aParam.mIsScrollbarContainer);
WriteParam(aMsg, aParam.mFixedPosScrollContainerId);
@ -181,7 +192,7 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData>
&& ReadParam(aMsg, aIter, &aResult->mEventRegions)
&& ReadParam(aMsg, aIter, &aResult->mReferentId)
&& ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride)
&& ReadParam(aMsg, aIter, &aResult->mScrollbarDirection)
&& ReadParam(aMsg, aIter, &aResult->mScrollThumbData)
&& ReadParam(aMsg, aIter, &aResult->mScrollbarTargetContainerId)
&& ReadParam(aMsg, aIter, &aResult->mIsScrollbarContainer)
&& ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId);

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

@ -279,10 +279,10 @@ public:
return mLayer->GetEventRegionsOverride();
}
ScrollDirection GetScrollbarDirection() const
const ScrollThumbData& GetScrollThumbData() const
{
MOZ_ASSERT(IsValid());
return mLayer->GetScrollbarDirection();
return mLayer->GetScrollThumbData();
}
FrameMetrics::ViewID GetScrollbarTargetContainerId() const