New issue
Advanced search Search tips

Issue 734679 link

Starred by 10 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 6
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment

Serialize and restore the scroll anchor when restoring scroll offset

Project Member Reported by pnoland@chromium.org, Jun 19 2017

Issue description

Chrome should use the previously calculated scroll anchor when restoring scroll position. This will prevent jumps during page (re)load and make scroll restoration more accurate. 

Design doc: https://docs.google.com/document/d/1YaxJ0cxFADA_xqUhGgHkVFgwzf6KXHaxB9hPksim7nc/edit?usp=sharing

Changes to API surface: none

Support in other browsers: none, although Firefox has expressed interest
 
Description: Show this description

Comment 2 by skobes@chromium.org, Jul 10 2017

Cc: skobes@chromium.org
 Issue 602047  has been merged into this issue.
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc

commit 2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc
Author: Patrick Noland <pnoland@google.com>
Date: Thu Nov 09 00:52:31 2017

Scroll anchor serialization skeleton

Plumb serialization/restore logic for the scroll anchor selector, offset, and
simhash.
Add declarations of SerializeAnchor, RestoreAnchor, and SerializedAnchor
struct.
Add dummy implementations of serialize/restore.
Add a runtime flag.

BUG= 734679 
R=skobes@chromium.org,creis@chromium.org

Change-Id: I68171d0ed3a63e44e4afc6ec8766170beb4508e0
Reviewed-on: https://chromium-review.googlesource.com/611058
Commit-Queue: Patrick Noland <pnoland@google.com>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Ojan Vafai <ojan@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515039}
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/content/common/page_state.mojom
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/content/common/page_state_serialization.cc
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/content/common/page_state_serialization.h
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/content/common/page_state_serialization_unittest.cc
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/content/renderer/history_serialization.cc
[add] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/content/test/data/page_state/serialized_v27.dat
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/exported/WebHistoryItem.cpp
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/frame/LocalFrameView.h
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/layout/ScrollAnchor.h
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/loader/FrameLoader.cpp
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/loader/FrameLoader.h
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/loader/HistoryItem.cpp
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/core/loader/HistoryItem.h
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/Source/platform/runtime_enabled_features.json5
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/public/BUILD.gn
[add] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/public/platform/WebScrollAnchorData.h
[modify] https://crrev.com/2352f5672ed01cdbdd6f9fecb3fdd1a625a9fbfc/third_party/WebKit/public/web/WebHistoryItem.h

Project Member

Comment 4 by bugdroid1@chromium.org, Dec 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/67c9bb0231cdd947c3662385a8d710e26fe870d1

commit 67c9bb0231cdd947c3662385a8d710e26fe870d1
Author: Patrick Noland <pnoland@google.com>
Date: Fri Dec 08 21:59:44 2017

Implement serialization of scroll anchor selector and position

Calculate the scroll anchor selector by choosing the least specific simple
selector at each level in the traversal to the root of the tree, and
appending these selectors together with the child combinator. The root is
the first ancestor with an id; if there is no ancestor with an id, the
root of the document is used.

Calculate the relative offset using ComputeRelativeOffset.

Add histograms measuring the time to compute the selector and the
selector's length.

R: skobes@chromium.org, ojan@chromium.org

Bug:  734679 
Change-Id: I7fa045b68d1aa1c08debf41533d5ae579ad72a79
Reviewed-on: https://chromium-review.googlesource.com/780684
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Patrick Noland <pnoland@google.com>
Cr-Commit-Position: refs/heads/master@{#522895}
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/third_party/WebKit/Source/core/layout/ScrollAnchor.h
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/third_party/WebKit/Source/core/loader/FrameLoader.cpp
[modify] https://crrev.com/67c9bb0231cdd947c3662385a8d710e26fe870d1/tools/metrics/histograms/histograms.xml

Project Member

Comment 5 by bugdroid1@chromium.org, Jan 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d06c2a715238df8738e5c9ae368121e393d95893

commit d06c2a715238df8738e5c9ae368121e393d95893
Author: Patrick Noland <pnoland@google.com>
Date: Fri Jan 05 21:30:28 2018

Implement serialized scroll anchor restoration

Restore the serialized scroll anchor by:
1) Identifying the element located by the selector
2) Scrolling the element into the relative position specified
3) Running FindAnchor

This change also accounts for a couple bugs found in testing.
First, pseudo-elements can't be part of selectors, making successful
serialization impossible if the scroll anchor is one.
Second, anchor_object isn't always convertible to an Element. Conversely,
the generated selector no longer always directly locates the
anchor_object. The code now respects these truths.

R=skobes@chromium.org

Bug:  734679 
Change-Id: I470bca147fda4eb0927989ec4912b86522999ee0
Reviewed-on: https://chromium-review.googlesource.com/843464
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Patrick Noland <pnoland@google.com>
Cr-Commit-Position: refs/heads/master@{#527387}
[modify] https://crrev.com/d06c2a715238df8738e5c9ae368121e393d95893/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/d06c2a715238df8738e5c9ae368121e393d95893/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
[modify] https://crrev.com/d06c2a715238df8738e5c9ae368121e393d95893/third_party/WebKit/Source/core/layout/ScrollAnchor.h
[modify] https://crrev.com/d06c2a715238df8738e5c9ae368121e393d95893/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
[modify] https://crrev.com/d06c2a715238df8738e5c9ae368121e393d95893/tools/metrics/histograms/enums.xml
[modify] https://crrev.com/d06c2a715238df8738e5c9ae368121e393d95893/tools/metrics/histograms/histograms.xml

Comment 6 by skobes@chromium.org, Jan 18 2018

 Issue 802932  has been merged into this issue.
Status: Fixed (was: Started)

Sign in to add a comment