Bug 1610731 - Incorporate the top/bottom margins set by reftests. r=botond

This makes the existing test for this codepath start passing on geckoview-qr.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Taeleman 2020-04-04 01:02:23 +00:00
Родитель 48fbcfcf46
Коммит 1219331fcf
3 изменённых файлов: 23 добавлений и 10 удалений

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

@ -817,7 +817,8 @@ void APZCTreeManager::SampleForWebRender(
if (info.mScrollDirection == ScrollDirection::eHorizontal) {
ScreenPoint translation =
AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, SideBits::eBottom, ScreenMargin());
GetCompositorFixedLayerMargins(), SideBits::eBottom,
ScreenMargin());
LayerToParentLayerMatrix4x4 transform =
LayerToParentLayerMatrix4x4::Translation(ViewAs<ParentLayerPixel>(
@ -831,7 +832,7 @@ void APZCTreeManager::SampleForWebRender(
for (const FixedPositionInfo& info : mFixedPositionInfo) {
ScreenPoint translation =
AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, info.mFixedPosSides,
GetCompositorFixedLayerMargins(), info.mFixedPosSides,
mGeckoFixedLayerMargins);
LayerToParentLayerMatrix4x4 transform =
@ -2085,7 +2086,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
MutexAutoLock lock(mMapLock);
touchData.mScreenPoint -=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
GetCompositorFixedLayerMargins(), mFixedPosSidesForInputBlock,
mGeckoFixedLayerMargins));
}
}
@ -3373,7 +3374,7 @@ Maybe<ScreenIntPoint> APZCTreeManager::ConvertToGecko(
MutexAutoLock mapLock(mMapLock);
*geckoPoint -=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
GetCompositorFixedLayerMargins(), mFixedPosSidesForInputBlock,
mGeckoFixedLayerMargins));
}
}
@ -3447,8 +3448,8 @@ bool APZCTreeManager::IsStuckToRootContentAtBottom(
return false;
}
// Currently we only support the dyanmic toolbar at bottom.
if ((aNode->GetFixedPosSides() & SideBits::eBottom) == SideBits::eNone) {
// We support the dynamic toolbar at top and bottom.
if ((aNode->GetFixedPosSides() & SideBits::eTopBottom) == SideBits::eNone) {
return false;
}
@ -3543,7 +3544,7 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForNode(
MutexAutoLock mapLock(mMapLock);
translation = ViewAs<ParentLayerPixel>(
AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, aNode->GetFixedPosSides(),
GetCompositorFixedLayerMargins(), aNode->GetFixedPosSides(),
mGeckoFixedLayerMargins),
PixelCastJustification::ScreenIsParentLayerForRoot);
}
@ -3556,8 +3557,8 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForNode(
MutexAutoLock mapLock(mMapLock);
translation = ViewAs<ParentLayerPixel>(
AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins,
aNode->GetFixedPosSides() & SideBits::eBottom,
GetCompositorFixedLayerMargins(),
aNode->GetFixedPosSides() & SideBits::eTopBottom,
// For sticky layers, we don't need to factor
// mGeckoFixedLayerMargins because Gecko doesn't shift the
// position of sticky elements for dynamic toolbar movements.
@ -3606,6 +3607,16 @@ already_AddRefed<GeckoContentController> APZCTreeManager::GetContentController(
return controller.forget();
}
ScreenMargin APZCTreeManager::GetCompositorFixedLayerMargins() const {
RecursiveMutexAutoLock lock(mTreeLock);
ScreenMargin result = mCompositorFixedLayerMargins;
if (StaticPrefs::apz_fixed_margin_override_enabled()) {
result.top = StaticPrefs::apz_fixed_margin_override_top();
result.bottom = StaticPrefs::apz_fixed_margin_override_bottom();
}
return result;
}
bool APZCTreeManager::GetAPZTestData(LayersId aLayersId,
APZTestData* aOutData) {
AssertOnUpdaterThread();

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

@ -766,6 +766,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
const MutexAutoLock& aProofOfMapLock,
ClippedCompositionBoundsMap& aDestMap, ScrollableLayerGuid aGuid);
ScreenMargin GetCompositorFixedLayerMargins() const;
protected:
/* The input queue where input events are held until we know enough to
* figure out where they're going. Protected so gtests can access it.

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

@ -98,4 +98,4 @@ fuzzy-if(!webrender,111-112,600-600) pref(apz.allow_zooming,true) == async-scrol
# for this test, apz.allow_zooming is needed to ensure we take the containerless scrolling codepath that creates
# an async zoom container (since we are testing a regression in that codepath)
skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) fails-if(geckoview&&webrender) == dynamic-toolbar-fixed-bottom-1.html dynamic-toolbar-fixed-bottom-1-ref.html
skip-if(!Android) pref(apz.allow_zooming,true) test-pref(apz.fixed-margin-override.enabled,true) test-pref(apz.fixed-margin-override.bottom,50) == dynamic-toolbar-fixed-bottom-1.html dynamic-toolbar-fixed-bottom-1-ref.html