New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 839292 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

[Task] (restoring scroll position) and (scrolling to anchor) are racing against each other.

Project Member Reported by arthurso...@chromium.org, May 3 2018

Issue description

When the scrolling position is restored and the URL contains an anchors (i.e. https://example.com/index.html#anchor), there is some non-determinism.
We get different results depending on which function is called first between:
- FrameLoader::ProcessFragment()
- FrameLoader::RestoreScrollPositionViewState().

Currently, a way to choose in test which function will be called first is to increase/decrease the size of the main response.
Example: https://chromium-review.googlesource.com/c/chromium/src/+/962804
______________________________________________________________________________

Description of what happens in the current code:

1) When ProcessFragment() is called first:

  a) ProcessFragment():
  Several scrollable layers are scrolled such that the anchor is
  displayed. It may includes the root one, but also some children.

  b) RestoreScrollPositionAndViewState():
  The root layer is scrolled using what is stored in the HistoryItem. It
  overrides the scroll done in a) for the root layer. Children layers
  are not overridden.

2) When RestoreScrollPositionAndViewState() is called first:

  a) RestoreScrollPositionAndViewState():
  The root layer is scrolled using what is stored in the HistoryItem.
  Children layers are not scrolled.

  b) ProcessFragment():
  Nothing happens because InitialScrollState::did_restore_from_history
  has been set to true in a). The ProcessFragment() will skip the
  fragment scroll.

At the end, the difference is that the children layers are scrolled in
1), but not in 2).
______________________________________________________________________________


 
Description: Show this description
Cc: clamy@chromium.org jam@chromium.org nasko@chromium.org
 Issue 821877  has been merged into this issue.
Description: Show this description
Project Member

Comment 4 by bugdroid1@chromium.org, May 3 2018

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

commit c13c16a87cd7bfb4b4883311cd1a2b7343311a57
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Thu May 03 14:53:33 2018

Update two scroll tests.

This updates the following tests:
- NavigationControllerBrowserTest.ReloadWithUrlAnchor
- NavigationControllerBrowserTest.ReloadWithUrlAnchorAndScroll

This two tests are making a <div> to scroll because of a navigation to
an anchor. Then the tests check the scroll position is restored after a
reload.

The issue is that it is not deterministic when the scrolled area is not
the root area. It is working consistently only because the main
resource's response is small (e.g <64ko) and
FrameLoader::ProcessFragment() is called before
FrameLoader::RestoreScrollPositionAndViewState().

This CL make the tests uses the root area instead of the <div>.

  ---

Description of what happens in the current code:

1) When ProcessFragment() is called first:

  a) ProcessFragment():
  Several scrollable layers are scrolled such that the anchor is
  displayed. It may includes the root one, but also some children.

  b) RestoreScrollPositionAndViewState():
  The root layer is scrolled using what is stored in the HistoryItem. It
  overrides the scroll done in a) for the root layer. Children layers
  are not overridden.

2) When RestoreScrollPositionAndViewState() is called first:

  a) RestoreScrollPositionAndViewState():
  The root layer is scrolled using what is stored in the HistoryItem.
  Children layers are not scrolled.

  b) ProcessFragment():
  Nothing happens because InitialScrollState::did_restore_from_history
  has been set to true in a). The ProcessFragment() will skip the
  fragment scroll.

At the end, the difference is that the children layers are scrolled in
1), but not in 2).

  ---

Bug:  821877 , 831155, 839292
Change-Id: I11c74224ba42ad58814c4d4e185d7db189551775
Reviewed-on: https://chromium-review.googlesource.com/1039827
Reviewed-by: Jianpeng Chao <chaopeng@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555727}
[modify] https://crrev.com/c13c16a87cd7bfb4b4883311cd1a2b7343311a57/content/browser/frame_host/navigation_controller_impl_browsertest.cc
[modify] https://crrev.com/c13c16a87cd7bfb4b4883311cd1a2b7343311a57/content/test/data/navigation_controller/reload-with-url-anchor.html

Cc: majidvp@chromium.org chaopeng@chromium.org

Sign in to add a comment