Bug 57898 - REGRESSION (r82185): Scroll position not restored on navigation back to a page in the page cache
Summary: REGRESSION (r82185): Scroll position not restored on navigation back to a pag...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Beth Dakin
URL:
Keywords: InRadar
Depends on: 58977
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-05 15:57 PDT by Beth Dakin
Modified: 2011-05-02 14:13 PDT (History)
11 users (show)

See Also:


Attachments
Patch (3.61 KB, patch)
2011-04-18 15:45 PDT, Beth Dakin
no flags Details | Formatted Diff | Diff
Patch that restores scroll position for cached and non-cached pages (4.35 KB, patch)
2011-04-21 23:21 PDT, Beth Dakin
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Beth Dakin 2011-04-05 15:57:32 PDT
Regression from http://trac.webkit.org/changeset/82185/trunk/Source/WebCore

* STEPS TO REPRODUCE
1. Navigate to <http://en.wikipedia.org/wiki/MathML>
2. Scroll down
3. In the same tab, navigate to >about:blank>
4. Choose History > Back

* RESULTS
The Wikipedia page is scrolled to the top.

<rdar://problem/9226652>
Comment 1 Beth Dakin 2011-04-18 15:45:56 PDT
Created attachment 90106 [details]
Patch
Comment 2 Maciej Stachowiak 2011-04-18 16:53:01 PDT
Comment on attachment 90106 [details]
Patch

r=me
Comment 3 Antonio Gomes 2011-04-18 21:12:58 PDT
Comment on attachment 90106 [details]
Patch

Why no tests? :)

It should be very easy to be tested, unless I am missing something ...
Comment 4 Beth Dakin 2011-04-19 13:39:24 PDT
(In reply to comment #3)
> (From update of attachment 90106 [details])
> Why no tests? :)
> 
> It should be very easy to be tested, unless I am missing something ...

You're right, Antonio! I wrote a test that I will commit with the change.
Comment 5 Antonio Gomes 2011-04-19 13:45:29 PDT
> > 
> > It should be very easy to be tested, unless I am missing something ...
> 
> You're right, Antonio! I wrote a test that I will commit with the change.

Perfect
Comment 6 Beth Dakin 2011-04-19 14:31:25 PDT
Committed fix and test with revision 84296.
Comment 7 WebKit Review Bot 2011-04-19 15:35:44 PDT
http://trac.webkit.org/changeset/84296 might have broken Qt Linux Release
Comment 8 Csaba Osztrogonác 2011-04-20 04:05:37 PDT
(In reply to comment #7)
> http://trac.webkit.org/changeset/84296 might have broken Qt Linux Release

new bug for it: https://bugs.webkit.org/show_bug.cgi?id=58977
Comment 9 Yong Li 2011-04-20 07:48:07 PDT
(In reply to comment #7)
> http://trac.webkit.org/changeset/84296 might have broken Qt Linux Release

Probably FrameView::resetScrollbarsAndClearContentsSize() is never called in some cases like when it loads an unreachable URL, then the cached scroll position is always (0, 0) and the real scroll position is lost. I don't think the solution is right. HistoryController and ScrollView shouldn't think that much. Who resets contents size to (0, 0) should be responsible to restore the scroll position when contents size changes back.
Comment 10 Antonio Gomes 2011-04-21 07:14:01 PDT
(In reply to comment #9)
> (In reply to comment #7)
> > http://trac.webkit.org/changeset/84296 might have broken Qt Linux Release
> 
> Probably FrameView::resetScrollbarsAndClearContentsSize() is never called in some cases like when it loads an unreachable URL, then the cached scroll position is always (0, 0) and the real scroll position is lost. I don't think the solution is right. HistoryController and ScrollView shouldn't think that much. Who resets contents size to (0, 0) should be responsible to restore the scroll position when contents size changes back.

Beth, could you reply to Yong's comment, please? It broke something important for us.
Comment 11 Beth Dakin 2011-04-21 23:07:25 PDT
Hi Yong and Antontio,

I discovered that this caused a regression in Safari as well: though my patch made pages in the page cache properly restore scroll position on reload, it regressed pages that do not go into the page cache. This pages no longer restore scroll position. 

I have a fix and a layout test that I will post shortly. Hopefully it fixes the QT test as well.
Comment 12 Beth Dakin 2011-04-21 23:21:39 PDT
Created attachment 90672 [details]
Patch that restores scroll position for cached and non-cached pages
Comment 13 mitz 2011-04-21 23:26:25 PDT
Comment on attachment 90672 [details]
Patch that restores scroll position for cached and non-cached pages

View in context: https://bugs.webkit.org/attachment.cgi?id=90672&action=review

> Source/WebCore/ChangeLog:12
> +        *not* in the page cache. This patch fixed both cached and non-cached pages by 

“fixed” or “fixes”?
Comment 14 Beth Dakin 2011-04-21 23:30:22 PDT
Thanks Dan! Committed fix with revision 84604.
Comment 15 Nico Weber 2011-05-01 10:08:13 PDT
It looks like this still happens for in-page navigations. I filed bug 59877 for this.
Comment 16 Mihai Parparita 2011-05-02 14:13:35 PDT
*** Bug 59877 has been marked as a duplicate of this bug. ***