Changeset 90346 in webkit


Ignore:
Timestamp:
Jul 3, 2011 1:34:14 PM (13 years ago)
Author:
robert@webkit.org
Message:

2011-07-03 Robert Hogan <robert@webkit.org>

Restore scroll position on page reloads scheduled by <meta http-equiv="refresh" content="XX"/>
https://bugs.webkit.org/show_bug.cgi?id=62482

If a <meta http-equiv="refresh"> directive schedules a page reload rather than
a redirect restore the scroll position after the reload. Do the same on location.reload().

Reviewed by Adam Barth.

  • http/tests/navigation/scrollstate-after-http-equiv-refresh-expected.txt: Added.
  • http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-2-expected.txt: Added.
  • http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-2.html: Added.
  • http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-expected.txt: Added.
  • http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier.html: Added.
  • http/tests/navigation/scrollstate-after-http-equiv-refresh.html: Added.
  • http/tests/navigation/scrollstate-after-location-reload-expected.txt: Added.
  • http/tests/navigation/scrollstate-after-location-reload.html: Added.

2011-07-03 Robert Hogan <robert@webkit.org>

Restore scroll position on page reloads scheduled by <meta http-equiv="refresh" content="XX"/>
https://bugs.webkit.org/show_bug.cgi?id=62482

If a <meta http-equiv="refresh"> directive schedules a page reload rather than
a redirect restore the scroll position after the reload. Do the same on location.reload().

Reviewed by Adam Barth.

Tests: http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-2.html

http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier.html
http/tests/navigation/scrollstate-after-http-equiv-refresh.html
http/tests/navigation/scrollstate-after-location-reload.html

  • loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): Only make the load FrameLoadTypeSame if it has not already been set as FrameLoadTypeReload*. FrameLoadTypeReload* loads are set through http-equiv refreshes, manual reloads, or location.reload() and honour the user's scroll position in the frame. A FrameLoadTypeSame is for when the frame is loading the same page again, e.g. by clicking a link.
  • loader/NavigationScheduler.cpp: (WebCore::ScheduledRedirect::fire): Tell FrameLoader::changeLocation() if this is a reload.
Location:
trunk
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90345 r90346  
     12011-07-03  Robert Hogan  <robert@webkit.org>
     2
     3        Restore scroll position on page reloads scheduled by <meta http-equiv="refresh" content="XX"/>
     4        https://bugs.webkit.org/show_bug.cgi?id=62482
     5
     6        If a <meta http-equiv="refresh"> directive schedules a page reload rather than
     7        a redirect restore the scroll position after the reload. Do the same on location.reload().
     8
     9        Reviewed by Adam Barth.
     10
     11        * http/tests/navigation/scrollstate-after-http-equiv-refresh-expected.txt: Added.
     12        * http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-2-expected.txt: Added.
     13        * http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-2.html: Added.
     14        * http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-expected.txt: Added.
     15        * http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier.html: Added.
     16        * http/tests/navigation/scrollstate-after-http-equiv-refresh.html: Added.
     17        * http/tests/navigation/scrollstate-after-location-reload-expected.txt: Added.
     18        * http/tests/navigation/scrollstate-after-location-reload.html: Added.
     19
    1202011-07-03  Dirk Schulze  <krit@webkit.org>
    221
  • trunk/Source/WebCore/ChangeLog

    r90345 r90346  
     12011-07-03  Robert Hogan  <robert@webkit.org>
     2
     3        Restore scroll position on page reloads scheduled by <meta http-equiv="refresh" content="XX"/>
     4        https://bugs.webkit.org/show_bug.cgi?id=62482
     5
     6        If a <meta http-equiv="refresh"> directive schedules a page reload rather than
     7        a redirect restore the scroll position after the reload. Do the same on location.reload().
     8
     9        Reviewed by Adam Barth.
     10
     11        Tests: http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier-2.html
     12               http/tests/navigation/scrollstate-after-http-equiv-refresh-fragment-identifier.html
     13               http/tests/navigation/scrollstate-after-http-equiv-refresh.html
     14               http/tests/navigation/scrollstate-after-location-reload.html
     15
     16        * loader/FrameLoader.cpp:
     17        (WebCore::FrameLoader::loadURL):
     18        Only make the load FrameLoadTypeSame if it has not already been set as FrameLoadTypeReload*.
     19        FrameLoadTypeReload* loads are set through http-equiv refreshes, manual reloads, or location.reload()
     20        and honour the user's scroll position in the frame. A FrameLoadTypeSame is for when the frame is loading
     21        the same page again, e.g. by clicking a link.
     22
     23        * loader/NavigationScheduler.cpp:
     24        (WebCore::ScheduledRedirect::fire): Tell FrameLoader::changeLocation() if this is a reload.
     25
    1262011-07-03  Dirk Schulze  <krit@webkit.org>
    227
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r90344 r90346  
    12181218            if (m_provisionalDocumentLoader)
    12191219                m_provisionalDocumentLoader->setIsClientRedirect(true);
    1220         } else if (sameURL)
     1220        } else if (sameURL && newLoadType != FrameLoadTypeReload && newLoadType != FrameLoadTypeReloadFromOrigin)
    12211221            // Example of this case are sites that reload the same URL with a different cookie
    12221222            // driving the generated content, or a master frame with links that drive a target
  • trunk/Source/WebCore/loader/NavigationScheduler.cpp

    r90344 r90346  
    154154
    155155    virtual bool shouldStartTimer(Frame* frame) { return frame->loader()->allAncestorsAreComplete(); }
     156
     157    virtual void fire(Frame* frame)
     158    {
     159        UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
     160        bool refresh = equalIgnoringFragmentIdentifier(frame->document()->url(), KURL(ParsedURLString, url()));
     161        frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), refresh);
     162    }
    156163};
    157164
Note: See TracChangeset for help on using the changeset viewer.