Changeset 185416 in webkit


Ignore:
Timestamp:
Jun 10, 2015 8:17:53 AM (9 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Move KeyBindingTranslator from platform to WebKit2 layer
https://bugs.webkit.org/show_bug.cgi?id=145840

Reviewed by Martin Robinson.

It's currently used only by WebKit2 in the UI process and it's
another file built twice because of the GTK2 plugin process.

  • PlatformGTK.cmake:

Source/WebKit2:

  • UIProcess/API/gtk/WebKitWebViewBase.cpp:
  • UIProcess/gtk/KeyBindingTranslator.cpp: Renamed from Source/WebCore/platform/gtk/KeyBindingTranslator.cpp.

(WebKit::backspaceCallback):
(WebKit::selectAllCallback):
(WebKit::cutClipboardCallback):
(WebKit::copyClipboardCallback):
(WebKit::pasteClipboardCallback):
(WebKit::toggleOverwriteCallback):
(WebKit::popupMenuCallback):
(WebKit::showHelpCallback):
(WebKit::deleteFromCursorCallback):
(WebKit::moveCursorCallback):
(WebKit::KeyBindingTranslator::KeyBindingTranslator):
(WebKit::KeyBindingTranslator::commandsForKeyEvent):

  • UIProcess/gtk/KeyBindingTranslator.h: Renamed from Source/WebCore/platform/gtk/KeyBindingTranslator.h.

(WebKit::KeyBindingTranslator::addPendingEditorCommand):

Location:
trunk/Source
Files:
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185415 r185416  
     12015-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Move KeyBindingTranslator from platform to WebKit2 layer
     4        https://bugs.webkit.org/show_bug.cgi?id=145840
     5
     6        Reviewed by Martin Robinson.
     7
     8        It's currently used only by WebKit2 in the UI process and it's
     9        another file built twice because of the GTK2 plugin process.
     10
     11        * PlatformGTK.cmake:
     12
    1132015-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/Source/WebCore/PlatformGTK.cmake

    r185358 r185416  
    221221    platform/gtk/GtkUtilities.cpp
    222222    platform/gtk/GtkVersioning.c
    223     platform/gtk/KeyBindingTranslator.cpp
    224223    platform/gtk/LocalizedStringsGtk.cpp
    225224    platform/gtk/PasteboardGtk.cpp
  • trunk/Source/WebKit2/ChangeLog

    r185415 r185416  
     12015-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Move KeyBindingTranslator from platform to WebKit2 layer
     4        https://bugs.webkit.org/show_bug.cgi?id=145840
     5
     6        Reviewed by Martin Robinson.
     7
     8        It's currently used only by WebKit2 in the UI process and it's
     9        another file built twice because of the GTK2 plugin process.
     10
     11        * PlatformGTK.cmake:
     12        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     13        * UIProcess/gtk/KeyBindingTranslator.cpp: Renamed from Source/WebCore/platform/gtk/KeyBindingTranslator.cpp.
     14        (WebKit::backspaceCallback):
     15        (WebKit::selectAllCallback):
     16        (WebKit::cutClipboardCallback):
     17        (WebKit::copyClipboardCallback):
     18        (WebKit::pasteClipboardCallback):
     19        (WebKit::toggleOverwriteCallback):
     20        (WebKit::popupMenuCallback):
     21        (WebKit::showHelpCallback):
     22        (WebKit::deleteFromCursorCallback):
     23        (WebKit::moveCursorCallback):
     24        (WebKit::KeyBindingTranslator::KeyBindingTranslator):
     25        (WebKit::KeyBindingTranslator::commandsForKeyEvent):
     26        * UIProcess/gtk/KeyBindingTranslator.h: Renamed from Source/WebCore/platform/gtk/KeyBindingTranslator.h.
     27        (WebKit::KeyBindingTranslator::addPendingEditorCommand):
     28
    1292015-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
    230
  • trunk/Source/WebKit2/PlatformGTK.cmake

    r185410 r185416  
    283283    UIProcess/gtk/GestureController.cpp
    284284    UIProcess/gtk/InputMethodFilter.cpp
     285    UIProcess/gtk/KeyBindingTranslator.cpp
    285286    UIProcess/gtk/RedirectedXCompositeWindow.cpp
    286287    UIProcess/gtk/TextCheckerGtk.cpp
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r185415 r185416  
    3232#include "DrawingAreaProxyImpl.h"
    3333#include "InputMethodFilter.h"
     34#include "KeyBindingTranslator.h"
    3435#include "NativeWebKeyboardEvent.h"
    3536#include "NativeWebMouseEvent.h"
     
    5455#include <WebCore/GtkUtilities.h>
    5556#include <WebCore/GtkVersioning.h>
    56 #include <WebCore/KeyBindingTranslator.h>
    5757#include <WebCore/NotImplemented.h>
    5858#include <WebCore/PasteboardHelper.h>
  • trunk/Source/WebKit2/UIProcess/gtk/KeyBindingTranslator.cpp

    r185415 r185416  
    2020#include "KeyBindingTranslator.h"
    2121
    22 #include "GtkVersioning.h"
    2322#include <gdk/gdkkeysyms.h>
    24 #include <wtf/HashMap.h>
    25 
    26 namespace WebCore {
    27 
    28 typedef HashMap<int, const char*> IntConstCharHashMap;
     23#include <gtk/gtk.h>
     24
     25namespace WebKit {
    2926
    3027static void backspaceCallback(GtkWidget* widget, KeyBindingTranslator* translator)
     
    117114    const char* rawCommand = gtkDeleteCommands[deleteType][direction];
    118115    if (!rawCommand)
    119       return;
     116        return;
    120117
    121118    for (int i = 0; i < abs(count); i++)
     
    186183
    187184static const KeyCombinationEntry customKeyBindings[] = {
    188     { GDK_b,         GDK_CONTROL_MASK,               "ToggleBold"    },
    189     { GDK_i,         GDK_CONTROL_MASK,               "ToggleItalic"  },
    190     { GDK_Escape,    0,                              "Cancel"        },
    191     { GDK_greater,   GDK_CONTROL_MASK,               "Cancel"        },
    192     { GDK_Tab,       0,                              "InsertTab"     },
    193     { GDK_Tab,       GDK_SHIFT_MASK,                 "InsertBacktab" },
     185    { GDK_KEY_b,         GDK_CONTROL_MASK,               "ToggleBold"    },
     186    { GDK_KEY_i,         GDK_CONTROL_MASK,               "ToggleItalic"  },
     187    { GDK_KEY_Escape,    0,                              "Cancel"        },
     188    { GDK_KEY_greater,   GDK_CONTROL_MASK,               "Cancel"        },
     189    { GDK_KEY_Tab,       0,                              "InsertTab"     },
     190    { GDK_KEY_Tab,       GDK_SHIFT_MASK,                 "InsertBacktab" },
    194191};
    195192
     
    198195    ASSERT(m_pendingEditorCommands.isEmpty());
    199196
    200     // FIXME: Move KeyBindingTranslator to WebKit layer and remove the GTK2 code.
    201 #ifdef GTK_API_VERSION_2
    202     gtk_bindings_activate_event(GTK_OBJECT(m_nativeWidget.get()), event);
    203 #else
    204197    gtk_bindings_activate_event(G_OBJECT(m_nativeWidget.get()), event);
    205 #endif
    206 
    207198    if (!m_pendingEditorCommands.isEmpty())
    208199        return WTF::move(m_pendingEditorCommands);
    209200
    210201    // Special-case enter keys for we want them to work regardless of modifier.
    211     if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter || event->keyval == GDK_ISO_Enter))
     202    if ((event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter || event->keyval == GDK_KEY_ISO_Enter))
    212203        return { "InsertNewLine" };
    213204
     
    225216}
    226217
    227 } // namespace WebCore
     218} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/gtk/KeyBindingTranslator.h

    r185415 r185416  
    2020#define KeyBindingTranslator_h
    2121
    22 #include "GRefPtrGtk.h"
     22#include <WebCore/GRefPtrGtk.h>
    2323#include <wtf/Vector.h>
    2424#include <wtf/text/WTFString.h>
     
    2626typedef struct _GdkEventKey GdkEventKey;
    2727
    28 namespace WebCore {
     28namespace WebKit {
    2929
    3030class KeyBindingTranslator {
     
    4040};
    4141
    42 } // namespace WebCore
     42} // namespace WebKit
    4343
    4444#endif
Note: See TracChangeset for help on using the changeset viewer.