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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp
index 91b8108..4b41a05 100644
--- a/Source/WebCore/loader/NavigationScheduler.cpp
+++ b/Source/WebCore/loader/NavigationScheduler.cpp
@@ -153,6 +153,13 @@
     }
 
     virtual bool shouldStartTimer(Frame* frame) { return frame->loader()->allAncestorsAreComplete(); }
+
+    virtual void fire(Frame* frame)
+    {
+        UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
+        bool refresh = equalIgnoringFragmentIdentifier(frame->document()->url(), KURL(ParsedURLString, url()));
+        frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), refresh);
+    }
 };
 
 class ScheduledLocationChange : public ScheduledURLNavigation {