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

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

@ -766,6 +766,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
const MutexAutoLock& aProofOfMapLock, const MutexAutoLock& aProofOfMapLock,
ClippedCompositionBoundsMap& aDestMap, ScrollableLayerGuid aGuid); ClippedCompositionBoundsMap& aDestMap, ScrollableLayerGuid aGuid);
ScreenMargin GetCompositorFixedLayerMargins() const;
protected: protected:
/* The input queue where input events are held until we know enough to /* 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. * 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 # 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) # 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