зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1753019 - Adjust sticky position elements for the dynamic toolbar. r=botond
Use the animation id from the stacking context to find the hit-testing tree node for hit tests of elements that are sticky positioned. Then use this hit-testing tree node reference to apply APZ transforms if the sticky positioned element is stuck to the root content. Differential Revision: https://phabricator.services.mozilla.com/D150047
This commit is contained in:
Родитель
affccc0acb
Коммит
83ab6a777b
|
@ -2039,6 +2039,17 @@ void APZCTreeManager::ProcessTouchInput(InputHandlingState& aState,
|
|||
touchData.mScreenPoint -= RoundedToInt(apz::ComputeFixedMarginsOffset(
|
||||
GetCompositorFixedLayerMargins(lock),
|
||||
mTouchBlockHitResult.mFixedPosSides, mGeckoFixedLayerMargins));
|
||||
} else if (mTouchBlockHitResult.mNode &&
|
||||
mTouchBlockHitResult.mNode->GetStickyPositionAnimationId()) {
|
||||
SideBits sideBits = SideBits::eNone;
|
||||
{
|
||||
RecursiveMutexAutoLock lock(mTreeLock);
|
||||
sideBits =
|
||||
SidesStuckToRootContent(mTouchBlockHitResult.mNode.Get(lock));
|
||||
}
|
||||
MutexAutoLock lock(mMapLock);
|
||||
touchData.mScreenPoint -= RoundedToInt(apz::ComputeFixedMarginsOffset(
|
||||
GetCompositorFixedLayerMargins(lock), sideBits, ScreenMargin()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3239,6 +3250,14 @@ Maybe<ScreenIntPoint> APZCTreeManager::ConvertToGecko(
|
|||
*geckoPoint -= RoundedToInt(apz::ComputeFixedMarginsOffset(
|
||||
GetCompositorFixedLayerMargins(mapLock),
|
||||
mTouchBlockHitResult.mFixedPosSides, mGeckoFixedLayerMargins));
|
||||
} else if (mTouchBlockHitResult.mNode &&
|
||||
mTouchBlockHitResult.mNode->GetStickyPositionAnimationId()) {
|
||||
SideBits sideBits =
|
||||
SidesStuckToRootContent(mTouchBlockHitResult.mNode.Get(lock));
|
||||
|
||||
MutexAutoLock mapLock(mMapLock);
|
||||
*geckoPoint -= RoundedToInt(apz::ComputeFixedMarginsOffset(
|
||||
GetCompositorFixedLayerMargins(mapLock), sideBits, ScreenMargin()));
|
||||
}
|
||||
}
|
||||
return geckoPoint;
|
||||
|
|
|
@ -207,13 +207,15 @@ IAPZHitTester::HitTestResult WRHitTester::GetAPZCAtPoint(
|
|||
|
||||
positionedNode = BreadthFirstSearch<ReverseIterator>(
|
||||
GetRootNode(), [&](HitTestingTreeNode* aNode) {
|
||||
return aNode->GetFixedPositionAnimationId() == animationId;
|
||||
return (aNode->GetFixedPositionAnimationId() == animationId ||
|
||||
aNode->GetStickyPositionAnimationId() == animationId);
|
||||
});
|
||||
|
||||
if (positionedNode) {
|
||||
MOZ_ASSERT(positionedNode->GetLayersId() == chosenResult->mLayersId,
|
||||
"Found node layers id does not match the hit result");
|
||||
MOZ_ASSERT(positionedNode->GetFixedPositionAnimationId().isSome(),
|
||||
MOZ_ASSERT((positionedNode->GetFixedPositionAnimationId().isSome() ||
|
||||
positionedNode->GetStickyPositionAnimationId().isSome()),
|
||||
"A a matching fixed/sticky position node should be found");
|
||||
InitializeHitTestingTreeNodeAutoLock(hit.mNode, aProofOfTreeLock,
|
||||
positionedNode);
|
||||
|
|
|
@ -5250,7 +5250,8 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
|
|||
(IsScrollThumbLayer() || IsZoomingLayer() ||
|
||||
(IsFixedPositionLayer() &&
|
||||
ShouldFixedAndStickyContentGetAnimationIds()) ||
|
||||
(IsStickyPositionLayer() && HasDynamicToolbar()) ||
|
||||
(IsStickyPositionLayer() &&
|
||||
ShouldFixedAndStickyContentGetAnimationIds()) ||
|
||||
(IsRootScrollbarContainer() && HasDynamicToolbar()));
|
||||
|
||||
if (needsProp) {
|
||||
|
@ -5279,7 +5280,8 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
|
|||
if (IsZoomingLayer() ||
|
||||
((IsFixedPositionLayer() &&
|
||||
ShouldFixedAndStickyContentGetAnimationIds()) ||
|
||||
(IsStickyPositionLayer() && HasDynamicToolbar()) ||
|
||||
(IsStickyPositionLayer() &&
|
||||
ShouldFixedAndStickyContentGetAnimationIds()) ||
|
||||
(IsRootScrollbarContainer() && HasDynamicToolbar()))) {
|
||||
params.is_2d_scale_translation = true;
|
||||
params.should_snap = true;
|
||||
|
@ -5299,7 +5301,8 @@ bool nsDisplayOwnLayer::UpdateScrollData(WebRenderScrollData* aData,
|
|||
(IsScrollThumbLayer() || IsScrollbarContainer() || IsZoomingLayer() ||
|
||||
(IsFixedPositionLayer() &&
|
||||
ShouldFixedAndStickyContentGetAnimationIds()) ||
|
||||
(IsStickyPositionLayer() && HasDynamicToolbar()));
|
||||
(IsStickyPositionLayer() &&
|
||||
ShouldFixedAndStickyContentGetAnimationIds()));
|
||||
|
||||
if (!isRelevantToApz) {
|
||||
return false;
|
||||
|
@ -5319,7 +5322,7 @@ bool nsDisplayOwnLayer::UpdateScrollData(WebRenderScrollData* aData,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (IsStickyPositionLayer() && HasDynamicToolbar()) {
|
||||
if (IsStickyPositionLayer() && ShouldFixedAndStickyContentGetAnimationIds()) {
|
||||
aLayerData->SetStickyPositionAnimationId(mWrAnimationId);
|
||||
return true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче