Bug 1519285 - Remove FrameMetrics::mVisualViewportOffset. r=kats

It is now redundant with mScrollOffset which always stores the
visual scroll offset.

Differential Revision: https://phabricator.services.mozilla.com/D87162
This commit is contained in:
Botond Ballo 2020-08-18 05:12:37 +00:00
Родитель aa190d473c
Коммит d0d6c1480e
7 изменённых файлов: 11 добавлений и 32 удалений

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

@ -110,7 +110,6 @@ struct FrameMetrics {
mExtraResolution(),
mPaintRequestTime(),
mScrollUpdateType(eNone),
mVisualViewportOffset(0, 0),
mVisualScrollUpdateType(eNone),
mIsRootContent(false),
mIsRelative(false),
@ -141,7 +140,6 @@ struct FrameMetrics {
mExtraResolution == aOther.mExtraResolution &&
mPaintRequestTime == aOther.mPaintRequestTime &&
mScrollUpdateType == aOther.mScrollUpdateType &&
mVisualViewportOffset == aOther.mVisualViewportOffset &&
mVisualScrollUpdateType == aOther.mVisualScrollUpdateType &&
mIsRootContent == aOther.mIsRootContent &&
mIsRelative == aOther.mIsRelative &&
@ -531,13 +529,6 @@ struct FrameMetrics {
}
bool IsScrollInfoLayer() const { return mIsScrollInfoLayer; }
void SetVisualViewportOffset(const CSSPoint& aVisualViewportOffset) {
mVisualViewportOffset = aVisualViewportOffset;
}
const CSSPoint& GetVisualViewportOffset() const {
return mVisualViewportOffset;
}
void SetVisualScrollUpdateType(ScrollOffsetUpdateType aUpdateType) {
mVisualScrollUpdateType = aUpdateType;
}
@ -722,16 +713,9 @@ struct FrameMetrics {
// if the APZC receiving this metrics should update its local copy.
ScrollOffsetUpdateType mScrollUpdateType;
// These fields are used when the main thread wants to set a visual viewport
// offset that's distinct from the layout viewport offset.
// In this case, mVisualScrollUpdateType is set to eMainThread, and
// mVisualViewportOffset is set to desired visual viewport offset (relative
// to the document, like mScrollOffset).
// TODO: Get rid of mVisualViewportOffset: between mViewport.TopLeft() and
// mScrollOffset, we have enough storage for the two scroll offsets.
// However, to avoid confusion, that first requires refactoring
// existing to consistently use the two fields for those two purposes.
CSSPoint mVisualViewportOffset;
// Theis field is set to eMainThread when the main thread wants APZ to
// scroll to a visual viewport offset that's distinct from the layout
// viewport offset.
ScrollOffsetUpdateType mVisualScrollUpdateType;
// 'fixed layer margins' on the main-thread. This is only used for the

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

@ -224,7 +224,6 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m,
AppendToString(aStream, m.GetCompositionBounds(), "{ [cb=");
AppendToString(aStream, m.GetScrollableRect(), "] [sr=");
AppendToString(aStream, m.GetVisualScrollOffset(), "] [s=");
AppendToString(aStream, m.GetVisualViewportOffset(), "] [vs=");
if (m.GetDoSmoothScroll()) {
AppendToString(aStream, m.GetSmoothScrollOffset(), "] [ss=");
}

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

@ -3785,12 +3785,12 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForScrollThumb(
// viewport offset that the main thread does not (yet) know about. We want
// asyncScrollY to be
// asyncScrollY = -(GetEffectiveScrollOffset -
// mLastContentPaintMetrics.GetVisualViewportOffset()) * effectiveZoom
// mLastContentPaintMetrics.GetVisualScrollOffset()) * effectiveZoom
// because the main thread positions the scrollbars at the visual viewport
// offset that it knows about. (aMetrics is mLastContentPaintMetrics)
asyncScrollY -= ((aMetrics.GetLayoutViewport().TopLeft() -
aMetrics.GetVisualViewportOffset()) *
aMetrics.GetVisualScrollOffset()) *
effectiveZoom)
.y;
}
@ -3839,7 +3839,7 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForScrollThumb(
if (gfxPlatform::UseDesktopZoomingScrollbars()) {
asyncScrollX -= ((aMetrics.GetLayoutViewport().TopLeft() -
aMetrics.GetVisualViewportOffset()) *
aMetrics.GetVisualScrollOffset()) *
effectiveZoom)
.x;
}

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

@ -4244,7 +4244,7 @@ CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
AsyncTransformConsumer aMode,
const RecursiveMutexAutoLock& aProofOfLock) const {
if (aMode == eForCompositing && mScrollMetadata.IsApzForceDisabled()) {
return mLastContentPaintMetrics.GetVisualViewportOffset();
return mLastContentPaintMetrics.GetVisualScrollOffset();
}
if (aMode == eForCompositing) {
return mSampledState.front().GetScrollOffset();
@ -4831,8 +4831,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(
if (visualScrollOffsetUpdated) {
APZC_LOG("%p updating visual scroll offset from %s to %s\n", this,
ToString(Metrics().GetVisualScrollOffset()).c_str(),
ToString(aLayerMetrics.GetVisualViewportOffset()).c_str());
Metrics().ClampAndSetScrollOffset(aLayerMetrics.GetVisualViewportOffset());
ToString(aLayerMetrics.GetVisualScrollOffset()).c_str());
Metrics().ClampAndSetScrollOffset(aLayerMetrics.GetVisualScrollOffset());
// The rest of this branch largely follows the code in the
// |if (scrollOffsetUpdated)| branch above.

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

@ -475,7 +475,7 @@ TEST_F(APZCBasicTester, ResumeInterruptedTouchDrag_Bug1592435) {
mainThreadOffset = scrollOffsetBeforeInterruption;
mainThreadOffset.y -= 5;
metadata = apzc->GetScrollMetadata();
metadata.GetMetrics().SetVisualViewportOffset(mainThreadOffset);
metadata.GetMetrics().SetVisualScrollOffset(mainThreadOffset);
metadata.GetMetrics().SetScrollGeneration(2);
metadata.GetMetrics().SetVisualScrollUpdateType(FrameMetrics::eMainThread);
apzc->NotifyLayersUpdated(metadata, false, true);

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

@ -210,7 +210,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aMsg, aParam.mExtraResolution);
WriteParam(aMsg, aParam.mPaintRequestTime);
WriteParam(aMsg, aParam.mScrollUpdateType);
WriteParam(aMsg, aParam.mVisualViewportOffset);
WriteParam(aMsg, aParam.mVisualScrollUpdateType);
WriteParam(aMsg, aParam.mFixedLayerMargins);
WriteParam(aMsg, aParam.mPureRelativeOffset);
@ -243,7 +242,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aMsg, aIter, &aResult->mExtraResolution) &&
ReadParam(aMsg, aIter, &aResult->mPaintRequestTime) &&
ReadParam(aMsg, aIter, &aResult->mScrollUpdateType) &&
ReadParam(aMsg, aIter, &aResult->mVisualViewportOffset) &&
ReadParam(aMsg, aIter, &aResult->mVisualScrollUpdateType) &&
ReadParam(aMsg, aIter, &aResult->mFixedLayerMargins) &&
ReadParam(aMsg, aIter, &aResult->mPureRelativeOffset) &&

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

@ -9282,8 +9282,6 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
: layoutScrollOffset;
metrics.SetVisualScrollOffset(visualScrollOffset);
metrics.SetBaseScrollOffset(apzScrollPosition);
// FIXME: This is redundant now.
metrics.SetVisualViewportOffset(visualScrollOffset);
if (aIsRootContent) {
if (aLayerManager->GetIsFirstPaint() &&
@ -9296,7 +9294,7 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
if (const Maybe<PresShell::VisualScrollUpdate>& visualUpdate =
presShell->GetPendingVisualScrollUpdate()) {
metrics.SetVisualViewportOffset(
metrics.SetVisualScrollOffset(
CSSPoint::FromAppUnits(visualUpdate->mVisualScrollOffset));
metrics.SetVisualScrollUpdateType(visualUpdate->mUpdateType);
presShell->AcknowledgePendingVisualScrollUpdate();