Bug 1594451 - Propagate sticky position info to HitTestingNode. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D60065

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2020-01-25 10:25:16 +00:00
Родитель edc2287d2f
Коммит 5d9fe8f9ea
5 изменённых файлов: 98 добавлений и 0 удалений

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

@ -411,6 +411,7 @@ class MOZ_STACK_CLASS LayerMetricsWrapper final {
ScrollableLayerGuid::ViewID GetFixedPositionScrollContainerId() const {
MOZ_ASSERT(IsValid());
// TODO: Restrict this only for AtBottomLayer.
return mLayer->GetFixedPositionScrollContainerId();
}
@ -420,6 +421,30 @@ class MOZ_STACK_CLASS LayerMetricsWrapper final {
return mLayer->GetFixedPositionSides();
}
bool GetIsStickyPosition() const {
MOZ_ASSERT(IsValid());
return mLayer->GetIsStickyPosition();
}
ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
MOZ_ASSERT(IsValid());
// TODO: Restrict this only for AtBottomLayer.
return mLayer->GetStickyScrollContainerId();
}
const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
MOZ_ASSERT(IsValid());
return mLayer->GetStickyScrollRangeOuter();
}
const LayerRectAbsolute& GetStickyScrollRangeInner() const {
MOZ_ASSERT(IsValid());
return mLayer->GetStickyScrollRangeInner();
}
Maybe<uint64_t> GetZoomAnimationId() const {
MOZ_ASSERT(IsValid());
// This function is only really needed for template-compatibility with

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

@ -1058,6 +1058,11 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(),
aLayer.GetFixedPositionSides(),
aLayer.GetFixedPositionAnimationId());
if (aLayer.GetIsStickyPosition()) {
node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
aLayer.GetStickyScrollRangeOuter(),
aLayer.GetStickyScrollRangeInner());
}
return node;
}
@ -1284,6 +1289,11 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
node->SetFixedPosData(aLayer.GetFixedPositionScrollContainerId(),
aLayer.GetFixedPositionSides(),
aLayer.GetFixedPositionAnimationId());
if (aLayer.GetIsStickyPosition()) {
node->SetStickyPosData(aLayer.GetStickyScrollContainerId(),
aLayer.GetStickyScrollRangeOuter(),
aLayer.GetStickyScrollRangeInner());
}
return node;
}

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

@ -30,6 +30,7 @@ HitTestingTreeNode::HitTestingTreeNode(AsyncPanZoomController* aApzc,
mLockCount(0),
mLayersId(aLayersId),
mFixedPosTarget(ScrollableLayerGuid::NULL_SCROLL_ID),
mStickyPosTarget(ScrollableLayerGuid::NULL_SCROLL_ID),
mIsBackfaceHidden(false),
mIsAsyncZoomContainer(false),
mOverride(EventRegionsOverride::NoOverride) {
@ -163,6 +164,27 @@ void HitTestingTreeNode::SetPrevSibling(HitTestingTreeNode* aSibling) {
}
}
void HitTestingTreeNode::SetStickyPosData(
ScrollableLayerGuid::ViewID aStickyPosTarget,
const LayerRectAbsolute& aScrollRangeOuter,
const LayerRectAbsolute& aScrollRangeInner) {
mStickyPosTarget = aStickyPosTarget;
mStickyScrollRangeOuter = aScrollRangeOuter;
mStickyScrollRangeInner = aScrollRangeInner;
}
ScrollableLayerGuid::ViewID HitTestingTreeNode::GetStickyPosTarget() const {
return mStickyPosTarget;
}
const LayerRectAbsolute& HitTestingTreeNode::GetStickyScrollRangeOuter() const {
return mStickyScrollRangeOuter;
}
const LayerRectAbsolute& HitTestingTreeNode::GetStickyScrollRangeInner() const {
return mStickyScrollRangeInner;
}
void HitTestingTreeNode::MakeRoot() {
mParent = nullptr;

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

@ -132,6 +132,14 @@ class HitTestingTreeNode {
SideBits GetFixedPosSides() const;
Maybe<uint64_t> GetFixedPositionAnimationId() const;
/* Sticky pos info */
void SetStickyPosData(ScrollableLayerGuid::ViewID aStickyPosTarget,
const LayerRectAbsolute& aScrollRangeOuter,
const LayerRectAbsolute& aScrollRangeInner);
ScrollableLayerGuid::ViewID GetStickyPosTarget() const;
const LayerRectAbsolute& GetStickyScrollRangeOuter() const;
const LayerRectAbsolute& GetStickyScrollRangeInner() const;
/* Convert |aPoint| into the LayerPixel space for the layer corresponding to
* this node. |aTransform| is the complete (content + async) transform for
* this node. */
@ -193,6 +201,10 @@ class HitTestingTreeNode {
ScrollableLayerGuid::ViewID mFixedPosTarget;
SideBits mFixedPosSides;
ScrollableLayerGuid::ViewID mStickyPosTarget;
LayerRectAbsolute mStickyScrollRangeOuter;
LayerRectAbsolute mStickyScrollRangeInner;
/* Let {L,M} be the {layer, scrollable metrics} pair that this node
* corresponds to in the layer tree. mEventRegions contains the event regions
* from L, in the case where event-regions are enabled. If event-regions are

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

@ -374,6 +374,35 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper final {
return mLayer->GetFixedPositionSides();
}
bool GetIsStickyPosition() const {
MOZ_ASSERT(IsValid());
// TODO: Bug 1610731 Implement this for WebRender.
return false;
}
ScrollableLayerGuid::ViewID GetStickyScrollContainerId() const {
MOZ_ASSERT(IsValid());
// TODO: Bug 1610731 Implement this for WebRender.
return ScrollableLayerGuid::NULL_SCROLL_ID;
}
const LayerRectAbsolute& GetStickyScrollRangeOuter() const {
MOZ_ASSERT(IsValid());
static const LayerRectAbsolute dummy;
// TODO: Bug 1610731 Implement this for WebRender.
return dummy;
}
const LayerRectAbsolute& GetStickyScrollRangeInner() const {
MOZ_ASSERT(IsValid());
static const LayerRectAbsolute dummy;
// TODO: Bug 1610731 Implement this for WebRender.
return dummy;
}
Maybe<uint64_t> GetZoomAnimationId() const {
MOZ_ASSERT(IsValid());
return mLayer->GetZoomAnimationId();