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

Issue 624534 link

Starred by 8 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug

Blocked on:
issue 637626

Blocking:
issue 624074
issue 558575
issue 597479



Sign in to add a comment

scroll anchoring breaks devtools

Project Member Reported by skobes@chromium.org, Jun 29 2016

Issue description

Tested with trunk build on Linux.  Open dev tools, console tab, make the window smallish, generate enough output to scroll, e.g.

> for (var i = 0; i < 100; i++) console.log(i);

Try to scroll down.  The scroll position is continually reset to the top.  Works fine with scroll anchoring disabled.
 

Comment 1 by skobes@chromium.org, Jun 30 2016

Blocking: 624074

Comment 2 by ymalik@chromium.org, Jul 18 2016

Components: Blink>Scroll
Labels: Hotlist-Input-Dev
Owner: ymalik@chromium.org
Status: Started (was: Available)

Comment 3 by ymalik@chromium.org, Jul 19 2016

Status: Assigned (was: Started)

Comment 4 by ymalik@chromium.org, Jul 21 2016

Owner: skobes@chromium.org
This layout test is failing with ScrollAnchoring and looks related to this bug and may help in debugging it.

https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection.html

Comment 5 by skobes@chromium.org, Aug 17 2016

Cc: skobes@chromium.org
 Issue 629269  has been merged into this issue.

Comment 6 by skobes@chromium.org, Aug 17 2016

Status: Started (was: Assigned)
There are two problems with scroll anchoring in dev tools, both of which affect both the console and the source viewer.

(1) Scrollers inside flex boxes have LayoutBlock::layout called multiple times in a single layout pass.  During the intermediate layouts, the scroll bounds haven't settled yet.  ScrollAnchor::restore will clamp when it adjusts, so we need to defer restore() in the same way that we defer post-layout clamping with DelayScrollPositionClampScope.

(2) WebInspector.ViewportControl implements a "virtual" viewport by rendering only the visible content, with spacers above and below (_topGapElement and _bottomGapElement).  These spacers shrink and grow as you scroll, creating a feedback loop when we anchor to the bottom gap element.

I have a patch up at http://crrev.com/2220133002 for (1).  I believe (2) requires SANACLAP ( issue 637626 ).

Comment 7 by skobes@chromium.org, Aug 17 2016

Summary: scroll anchoring breaks devtools (was: scroll anchoring breaks devtools console)

Comment 9 by skobes@chromium.org, Aug 17 2016

Blockedon: 637626
Blocking: 597479
Status: Fixed (was: Started)
Status: Assigned (was: Fixed)
I think http://crrev.com/2220133002 doesn't fix this bug in entirety. I still see some adjustments in ScrollAnchor::restore.

Here's the stack for these calls:
#1 0x7f12d48178f4 blink::ScrollAnchor::restore()
#2 0x7f12d46bfd6a blink::PaintLayerScrollableArea::clampScrollPositionsAfterLayout()
#3 0x7f12d46c4a58 blink::PaintLayerScrollableArea::DelayScrollPositionClampScope::~DelayScrollPositionClampScope()
#4 0x7f12d4779797 blink::LayoutFlexibleBox::layoutBlock()
#5 0x7f12d47286ab blink::LayoutBlock::layout()
#6 0x7f12d4729eb3 blink::LayoutBlock::layoutPositionedObjects()
#7 0x7f12d472967c blink::LayoutBlock::simplifiedLayout()
#8 0x7f12d47338b6 blink::LayoutBlockFlow::layoutBlock()
#9 0x7f12d47286ab blink::LayoutBlock::layout()

It looks like we're "delayed" restoring.

I found this because these tests are still failing with scroll anchoring:
inspector/console/console-viewport-selection.html
inspector/console/console-viewport-stick-to-bottom.html

Re-opening.
Status: Started (was: Assigned)
The failure in console-viewport-stick-to-bottom.html is straightforward.  This test does the following:

1. scroll to the bottom
2. disable automatic scroll-to-bottom mode
3. grow an element above the viewport
4. assert that we aren't at the bottom anymore

The assertion in step 4 fails as a result of scroll anchoring behaving exactly as intended.  The fix is to change step 3 to grow an element after the anchor node.  This preserves the intent of the test to verify the effects of step 2.

The failure in console-viewport-selection.html is more subtle.

First, some background: the console scroller has three important DOM children: [_topGapElement, _contentElement, _bottomGapElement].  The visible items are all inside the content element.  ViewportControl "pins" the content element to the viewport by resizing the gap elements, and is conservative with DOM operations inside the content element as it scrolls - pushing and popping from the start/end of its childNodes rather than rebuilding it.

SANACLAP eliminates a feedback loop from anchoring to the bottom gap element after a programmatic scroll, which was breaking console-viewport-selection.html, but it applies no suppression when we anchor to persistent visible log items inside the content element.  In theory this is ok: both ViewportControl and ScrollAnchor are trying to preserve the item's position in scrolling-content-space.

But ViewportControl achieves this goal imperfectly, because it resizes the top gap element based on an estimate of log item height (in ConsoleViewMessage.fastHeight) which is off by 1px for single-line plain text log entries.  So when you scroll down, the visible items actually move in scrolling-content-space by a distance equal to the total height estimation error, generally 1px for each item that has left the viewport.

ScrollAnchor then "corrects" the error introduced by ViewportControl's inaccurate height estimate.  The difference is not noticeable to the user, but it produces an off-by-one diff in the output of console-viewport-selection.html.  The test can be made to pass by improving the height estimate.

Based on the above I believe no changes are needed in the scroll anchoring code.  Pending fix for both issues in http://crrev.com/2317343006.
Project Member

Comment 14 by bugdroid1@chromium.org, Sep 14 2016

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

commit 9f69ce15656df3f06add00f591f68e36348027f6
Author: skobes <skobes@chromium.org>
Date: Wed Sep 14 21:30:33 2016

Fix console viewport test failures with scroll anchoring.

Update defaultConsoleRowHeight to account for the 1px border, and grow a visible
item instead of an offscreen one when testing setStickToBottom.

See bug for detailed analysis.

BUG= 624534 

Review-Url: https://codereview.chromium.org/2317343006
Cr-Commit-Position: refs/heads/master@{#418681}

[modify] https://crrev.com/9f69ce15656df3f06add00f591f68e36348027f6/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html
[modify] https://crrev.com/9f69ce15656df3f06add00f591f68e36348027f6/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Status: Fixed (was: Started)
Cc: l...@chromium.org
 Issue 647065  has been merged into this issue.
Project Member

Comment 17 by bugdroid1@chromium.org, Sep 21 2016

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

commit 2d42a22c81372bb8f3ffb685ad6c66bcb205a3a5
Author: luoe <luoe@chromium.org>
Date: Wed Sep 21 18:22:27 2016

Remove console viewport test from expectations after fix

When scroll anchoring was promoted to experimental status, it broke viewport
related LayoutTests, so expectations were updated for their failure. Now that
the tests have been fixed, the expectations need to be updated.

Promotion CL:
https://codereview.chromium.org/2291653002

Tests fixed CL:
https://codereview.chromium.org/2317343006

BUG= 624534 

Review-Url: https://codereview.chromium.org/2357783002
Cr-Commit-Position: refs/heads/master@{#420110}

[modify] https://crrev.com/2d42a22c81372bb8f3ffb685ad6c66bcb205a3a5/third_party/WebKit/LayoutTests/TestExpectations

Project Member

Comment 18 by bugdroid1@chromium.org, Sep 21 2016

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

commit 0dc0f9e069272c917c85232446074b2719013377
Author: dewittj <dewittj@chromium.org>
Date: Wed Sep 21 19:25:48 2016

Revert of Remove console viewport test from expectations after fix (patchset #1 id:1 of https://codereview.chromium.org/2357783002/ )

Reason for revert:
console-viewport-selection.html is still failing:

https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux/builds/70720

Original issue's description:
> Remove console viewport test from expectations after fix
>
> When scroll anchoring was promoted to experimental status, it broke viewport
> related LayoutTests, so expectations were updated for their failure. Now that
> the tests have been fixed, the expectations need to be updated.
>
> Promotion CL:
> https://codereview.chromium.org/2291653002
>
> Tests fixed CL:
> https://codereview.chromium.org/2317343006
>
> BUG= 624534 
>
> Committed: https://crrev.com/2d42a22c81372bb8f3ffb685ad6c66bcb205a3a5
> Cr-Commit-Position: refs/heads/master@{#420110}

TBR=skobes@chromium.org,ymalik@chromium.org,lushnikov@chromium.org,luoe@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 624534 

Review-Url: https://codereview.chromium.org/2356263003
Cr-Commit-Position: refs/heads/master@{#420134}

[modify] https://crrev.com/0dc0f9e069272c917c85232446074b2719013377/third_party/WebKit/LayoutTests/TestExpectations

Sign in to add a comment