2010-12-18 Antonio Gomes <agomes@rim.com>
authortonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Dec 2010 16:08:01 +0000 (16:08 +0000)
committertonikitoo@webkit.org <tonikitoo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Dec 2010 16:08:01 +0000 (16:08 +0000)
        Reviewed by Xan Lopez.

        [GTK+] Simplify spatial navigation handling in EditorClientGtk.cpp
        https://bugs.webkit.org/show_bug.cgi?id=51302

        Patch changes:
        1) The editor command for LEFT arrow key press without modifier
           from MoveBackward to MoveLeft;
        2) And similarly changes the editor command for RIGHT arrow key
          press without modifier from MoveForward to MoveRight.

        It has no implications since SelectionController::modifyMovingRight()
        handles "MoveRight" equaly to how SelectionController::modifyMovingForward()
        handles "MoveForward" when the granularity is 'CharacterGranularity'.
        The former falls back to the later in the case of other editor commands.

        Analogously, the same applies to how SelectionController::modifyMovingLeft() and
        SelectionController::modifyMovingForward() handle "MoveLeft" and "MoveBackward"
        editor commands, respectively.

        With this change we can remove the spatial navigation hack from moveCursorCallback(),
        in EditorClientGtk.cpp.

        * WebCoreSupport/EditorClientGtk.cpp:
        (WebKit::moveCursorCallback):

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

WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp

index 2feef54..bc13749 100644 (file)
@@ -1,3 +1,31 @@
+2010-12-18  Antonio Gomes  <agomes@rim.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK+] Simplify spatial navigation handling in EditorClientGtk.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=51302
+
+        Patch changes:
+        1) The editor command for LEFT arrow key press without modifier
+           from MoveBackward to MoveLeft;
+        2) And similarly changes the editor command for RIGHT arrow key
+          press without modifier from MoveForward to MoveRight.
+
+        It has no implications since SelectionController::modifyMovingRight()
+        handles "MoveRight" equaly to how SelectionController::modifyMovingForward()
+        handles "MoveForward" when granularity is 'CharacterGranularity'. The former
+        falls back to the later in the case of other editor commands.
+
+        Analogously, the same applies to how SelectionController::modifyMovingLeft() and
+        SelectionController::modifyMovingForward() handle "MoveLeft" and "MoveBackward"
+        editor commands, respectively.
+
+        With this change we can remove the spatial navigation hack from moveCursorCallback(),
+        in EditorClientGtk.cpp.
+
+        * WebCoreSupport/EditorClientGtk.cpp:
+        (WebKit::moveCursorCallback):
+
 2010-12-16  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Reviewed by Martin Robinson.
index 2a6cc87..0522f87 100644 (file)
@@ -198,7 +198,7 @@ static void deleteFromCursorCallback(GtkWidget* widget, GtkDeleteType deleteType
 static const char* const gtkMoveCommands[][4] = {
     { "MoveBackward",                                   "MoveForward",
       "MoveBackwardAndModifySelection",                 "MoveForwardAndModifySelection"             }, // Forward/backward grapheme
-    { "MoveBackward",                                   "MoveForward",
+    { "MoveLeft",                                       "MoveRight",
       "MoveBackwardAndModifySelection",                 "MoveForwardAndModifySelection"             }, // Left/right grapheme
     { "MoveWordBackward",                               "MoveWordForward",
       "MoveWordBackwardAndModifySelection",             "MoveWordForwardAndModifySelection"         }, // Forward/backward word
@@ -232,13 +232,6 @@ static void moveCursorCallback(GtkWidget* widget, GtkMovementStep step, gint cou
     if (!rawCommand)
         return;
 
-    if (isSpatialNavigationEnabled(core(client->webView())->focusController()->focusedOrMainFrame()) && step == 1) {
-        if (direction == 1)
-            rawCommand = "MoveRight";
-        else if (!direction)
-            rawCommand = "MoveLeft";
-    }
-
     for (int i = 0; i < abs(count); i++)
         client->addPendingEditorCommand(rawCommand);
 }