Bug 1552608 - Handle fixed layer margins in ReceiveInputEvent. r=tnikkel

Only touch events are handled at this time.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-10-07 22:22:08 +00:00
Родитель 0e413c9b53
Коммит 1e691d370f
2 изменённых файлов: 14 добавлений и 0 удалений

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

@ -1790,6 +1790,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
HitTestResult hit = GetTouchInputBlockAPZC(aInput, &touchBehaviors);
mApzcForInputBlock = hit.mTargetApzc;
mHitResultForInputBlock = hit.mHitResult;
mFixedPosSidesForInputBlock = hit.mFixedPosSides;
if (hit.mLayersId.IsValid()) {
// Check for validity because we won't get a layers id for multi-touch
// events.
@ -1881,6 +1882,12 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
return result;
}
touchData.mScreenPoint = *untransformedScreenPoint;
if (mFixedPosSidesForInputBlock != eSideBitsNone) {
RecursiveMutexAutoLock lock(mTreeLock);
touchData.mScreenPoint +=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
mFixedLayerMargins, mFixedPosSidesForInputBlock));
}
}
}
}

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

@ -859,6 +859,13 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* sync with mApzcForInputBlock.
*/
gfx::CompositorHitTestInfo mHitResultForInputBlock;
/* If the current input event block is targeting an element that is fixed to
* the viewport, the sides of the viewport to which the element is fixed.
* Such elements may have been shifted to the dynamic toolbar, and this is
* used to offset event coordinates accordingly.
* This should be in sync with mApzcForInputBlock.
*/
SideBits mFixedPosSidesForInputBlock;
/* Sometimes we want to ignore all touches except one. In such cases, this
* is set to the identifier of the touch we are not ignoring; in other cases,
* this is set to -1.