2009-05-29 Xan Lopez <xlopez@igalia.com>
authorxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 May 2009 15:56:32 +0000 (15:56 +0000)
committerxan@webkit.org <xan@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 May 2009 15:56:32 +0000 (15:56 +0000)
        Reviewed by Gustavo Noronha.

        https://bugs.webkit.org/show_bug.cgi?id=26075
        [GTK] Refactor key scrolling code

        After the scrolling changes in r44177 we can now use the
        FrameView::scroll method like the other ports, keeping the magic
        constants for the scrolling amounts inside WebCore proper.

        * webkit/webkitwebview.cpp:
        (webkit_web_view_real_move_cursor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@44264 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkitwebview.cpp

index d96497e..db134c0 100644 (file)
@@ -1,3 +1,17 @@
+2009-05-29  Xan Lopez  <xlopez@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        https://bugs.webkit.org/show_bug.cgi?id=26075
+        [GTK] Refactor key scrolling code
+
+        After the scrolling changes in r44177 we can now use the
+        FrameView::scroll method like the other ports, keeping the magic
+        constants for the scrolling amounts inside WebCore proper.
+
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_real_move_cursor):
+
 2009-05-29  Gustavo Noronha Silva  <gns@gnome.org>
 
         Reviewed by Jan Alonzo.
index c6801d0..40c3822 100644 (file)
@@ -833,39 +833,48 @@ static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMov
                          step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
     g_return_val_if_fail(count == 1 || count == -1, FALSE);
 
-    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-    FrameView* view = frame->view();
+    ScrollDirection direction;
+    ScrollGranularity granularity;
 
     switch (step) {
     case GTK_MOVEMENT_DISPLAY_LINES:
+        granularity = ScrollByLine;
         if (count == 1)
-            view->scrollBy(IntSize(0, cScrollbarPixelsPerLineStep));
+            direction = ScrollDown;
         else if (count == -1)
-            view->scrollBy(IntSize(0, -cScrollbarPixelsPerLineStep));
+            direction = ScrollUp;
         break;
     case GTK_MOVEMENT_VISUAL_POSITIONS:
+        granularity = ScrollByLine;
         if (count == 1)
-            view->scrollBy(IntSize(cScrollbarPixelsPerLineStep, 0));
+            direction = ScrollRight;
         else if (count == -1)
-            view->scrollBy(IntSize(-cScrollbarPixelsPerLineStep, 0));
+            direction = ScrollLeft;
         break;
     case GTK_MOVEMENT_PAGES:
+        granularity = ScrollByPage;
         if (count == 1)
-            view->scrollBy(IntSize(0, view->visibleHeight() - cAmountToKeepWhenPaging));
+            direction = ScrollDown;
         else if (count == -1)
-            view->scrollBy(IntSize(0, -view->visibleHeight() + cAmountToKeepWhenPaging));
+            direction = ScrollUp;
         break;
     case GTK_MOVEMENT_BUFFER_ENDS:
+        granularity = ScrollByDocument;
         if (count == 1)
-            view->scrollBy(IntSize(0, view->contentsHeight()));
+            direction = ScrollDown;
         else if (count == -1)
-            view->scrollBy(IntSize(0, -view->contentsHeight()));
+            direction = ScrollUp;
         break;
     default:
         g_assert_not_reached();
+        return false;
     }
-  
-    return TRUE;
+
+    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+    if (!frame->eventHandler()->scrollOverflow(direction, granularity))
+        frame->view()->scroll(direction, granularity);
+
+    return true;
 }
 
 static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView)