Bug 1646374 - Add a new log module for scroll restoration. r=tnikkel

Depends on D79885

Differential Revision: https://phabricator.services.mozilla.com/D80038
This commit is contained in:
Kartikaya Gupta 2020-06-17 23:56:31 +00:00
Родитель 503bdb7fd3
Коммит 2592c4b45f
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -94,6 +94,9 @@
static mozilla::LazyLogModule sApzPaintSkipLog("apz.paintskip");
#define PAINT_SKIP_LOG(...) \
MOZ_LOG(sApzPaintSkipLog, LogLevel::Debug, (__VA_ARGS__))
static mozilla::LazyLogModule sScrollRestoreLog("scrollrestore");
#define SCROLLRESTORE_LOG(...) \
MOZ_LOG(sScrollRestoreLog, LogLevel::Debug, (__VA_ARGS__))
using namespace mozilla;
using namespace mozilla::dom;
@ -2326,6 +2329,8 @@ void ScrollFrameHelper::ScrollToWithOrigin(
if (aOrigin != ScrollOrigin::Restore) {
// If we're doing a non-restore scroll, we don't want to later
// override it by restoring our saved scroll position.
SCROLLRESTORE_LOG("%p: Clearing mRestorePos (cur=%d, dst=%d)\n", this,
GetScrollPosition().y, aScrollPosition.y);
mRestorePos.x = mRestorePos.y = -1;
}
@ -4673,6 +4678,13 @@ void ScrollFrameHelper::ScrollToRestoredPosition() {
// 8).
nsPoint logicalLayoutScrollPos = GetLogicalScrollPosition();
SCROLLRESTORE_LOG(
"%p: ScrollToRestoredPosition (mRestorePos.y=%d, mLastPos.y=%d, "
"layoutRestorePos.y=%d, logicalLayoutScrollPos.y=%d, "
"GetLogicalVisualViewportOffset().y=%d)\n",
this, mRestorePos.y, mLastPos.y, layoutRestorePos.y,
logicalLayoutScrollPos.y, GetLogicalVisualViewportOffset().y);
// if we didn't move, we still need to restore
if (GetLogicalVisualViewportOffset() == mLastPos ||
logicalLayoutScrollPos == mLastPos) {
@ -6677,6 +6689,8 @@ UniquePtr<PresState> ScrollFrameHelper::SaveState() const {
pt = mDestination;
allowScrollOriginDowngrade = false;
}
SCROLLRESTORE_LOG("%p: SaveState, pt.y=%d, mLastPos.y=%d, mRestorePos.y=%d\n",
this, pt.y, mLastPos.y, mRestorePos.y);
if (mRestorePos.y != -1 && pt == mLastPos) {
pt = mRestorePos;
}
@ -6705,6 +6719,8 @@ void ScrollFrameHelper::RestoreState(PresState* aState) {
mLastScrollOrigin = ScrollOrigin::Other;
mDidHistoryRestore = true;
mLastPos = mScrolledFrame ? GetLogicalVisualViewportOffset() : nsPoint(0, 0);
SCROLLRESTORE_LOG("%p: RestoreState, set mRestorePos.y=%d mLastPos.y=%d\n",
this, mRestorePos.y, mLastPos.y);
// Resolution properties should only exist on root scroll frames.
MOZ_ASSERT(mIsRoot || aState->resolution() == 1.0);