Changeset 100726 in webkit


Ignore:
Timestamp:
Nov 17, 2011 10:14:11 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Move keyIdentifierForEvasKeyName() and windowsKeyCodeForEvasKeyName() to the
EflKeyboardUtilities.cpp to use in the WebKit2
https://bugs.webkit.org/show_bug.cgi?id=62451

Patch by Eunmi Lee <eunmi15.lee@samsung.com> on 2011-11-17
Reviewed by Martin Robinson.

The keyIdentifierForEvasKeyName() and windowsKeyCodeForEvasKeyName() were static functions
in the PlatformKeyboardEventEfl.cpp. But they are also needed in the WebKit2 EFL port, so I
moved them to the separated file - EflKeyboardUtilities.cpp.

  • PlatformEfl.cmake:
  • platform/efl/EflKeyboardUtilities.cpp: Copied from Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp.

(WebCore::createKeyMap):
(WebCore::createWindowsKeyMap):
(WebCore::keyIdentifierForEvasKeyName):
(WebCore::windowsKeyCodeForEvasKeyName):

  • platform/efl/EflKeyboardUtilities.h: Added.
  • platform/efl/PlatformKeyboardEventEfl.cpp:
Location:
trunk/Source/WebCore
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r100725 r100726  
     12011-11-17  Eunmi Lee  <eunmi15.lee@samsung.com>
     2
     3        [EFL] Move keyIdentifierForEvasKeyName() and windowsKeyCodeForEvasKeyName() to the
     4        EflKeyboardUtilities.cpp to use in the WebKit2
     5        https://bugs.webkit.org/show_bug.cgi?id=62451
     6
     7        Reviewed by Martin Robinson.
     8
     9        The keyIdentifierForEvasKeyName() and windowsKeyCodeForEvasKeyName() were static functions
     10        in the PlatformKeyboardEventEfl.cpp. But they are also needed in the WebKit2 EFL port, so I
     11        moved them to the separated file - EflKeyboardUtilities.cpp.
     12
     13        * PlatformEfl.cmake:
     14        * platform/efl/EflKeyboardUtilities.cpp: Copied from Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp.
     15        (WebCore::createKeyMap):
     16        (WebCore::createWindowsKeyMap):
     17        (WebCore::keyIdentifierForEvasKeyName):
     18        (WebCore::windowsKeyCodeForEvasKeyName):
     19        * platform/efl/EflKeyboardUtilities.h: Added.
     20        * platform/efl/PlatformKeyboardEventEfl.cpp:
     21
    1222011-11-17  Martin Robinson  <mrobinson@igalia.com>
    223
  • trunk/Source/WebCore/PlatformEfl.cmake

    r100722 r100726  
    2828  platform/efl/DragDataEfl.cpp
    2929  platform/efl/DragImageEfl.cpp
     30  platform/efl/EflKeyboardUtilities.cpp
    3031  platform/efl/EventLoopEfl.cpp
    3132  platform/efl/FileSystemEfl.cpp
  • trunk/Source/WebCore/platform/efl/PlatformKeyboardEventEfl.cpp

    r95901 r100726  
    3030
    3131#include "config.h"
    32 
    3332#include "PlatformKeyboardEvent.h"
    3433
     34#include "EflKeyboardUtilities.h"
    3535#include "NotImplemented.h"
    3636#include "TextEncoding.h"
    37 #include "WindowsKeyboardCodes.h"
    38 
    3937#include <Evas.h>
    4038#include <stdio.h>
    41 #include <wtf/HashMap.h>
    42 #include <wtf/text/StringHash.h>
    43 #include <wtf/text/WTFString.h>
    4439
    4540namespace WebCore {
    46 
    47 typedef HashMap<String, String> KeyMap;
    48 typedef HashMap<String, int> WindowsKeyMap;
    49 
    50 static KeyMap gKeyMap;
    51 static WindowsKeyMap gWindowsKeyMap;
    52 
    53 static void createKeyMap()
    54 {
    55     for (unsigned int i = 1; i < 25; i++) {
    56         String key = "F" + String::number(i);
    57         gKeyMap.set(key, key);
    58     }
    59     gKeyMap.set("Alt_L", "Alt");
    60     gKeyMap.set("ISO_Level3_Shift", "Alt");
    61     gKeyMap.set("Menu", "Alt");
    62     gKeyMap.set("Shift_L", "Shift");
    63     gKeyMap.set("Shift_R", "Shift");
    64     gKeyMap.set("Down", "Down");
    65     gKeyMap.set("End", "End");
    66     gKeyMap.set("Return", "Enter");
    67     gKeyMap.set("KP_Enter", "Enter");
    68     gKeyMap.set("Home", "Home");
    69     gKeyMap.set("Insert", "Insert");
    70     gKeyMap.set("Left", "Left");
    71     gKeyMap.set("Down", "Down");
    72     gKeyMap.set("Next", "PageDown");
    73     gKeyMap.set("Prior", "PageUp");
    74     gKeyMap.set("Right", "Right");
    75     gKeyMap.set("Up", "Up");
    76     gKeyMap.set("Delete", "U+007F");
    77     gKeyMap.set("Tab", "U+0009");
    78     gKeyMap.set("ISO_Left_Tab", "U+0009");
    79 }
    80 
    81 static void createWindowsKeyMap()
    82 {
    83     gWindowsKeyMap.set("Return",     VK_RETURN);
    84     gWindowsKeyMap.set("KP_Return",  VK_RETURN);
    85     gWindowsKeyMap.set("Alt_L",      VK_MENU);
    86     gWindowsKeyMap.set("ISO_Level3_Shift", VK_MENU);
    87     gWindowsKeyMap.set("Menu",       VK_MENU);
    88     gWindowsKeyMap.set("Shift_L",    VK_SHIFT);
    89     gWindowsKeyMap.set("Shift_R",    VK_SHIFT);
    90     gWindowsKeyMap.set("Control_L",  VK_CONTROL);
    91     gWindowsKeyMap.set("Control_R",  VK_CONTROL);
    92     gWindowsKeyMap.set("Pause",      VK_PAUSE);
    93     gWindowsKeyMap.set("Break",      VK_PAUSE);
    94     gWindowsKeyMap.set("Caps_Lock",  VK_CAPITAL);
    95     gWindowsKeyMap.set("Scroll_Lock", VK_SCROLL);
    96     gWindowsKeyMap.set("Num_Lock",   VK_NUMLOCK);
    97     gWindowsKeyMap.set("Escape",     VK_ESCAPE);
    98     gWindowsKeyMap.set("Tab",        VK_TAB);
    99     gWindowsKeyMap.set("ISO_Left_Tab", VK_TAB);
    100     gWindowsKeyMap.set("BackSpace",  VK_BACK);
    101     gWindowsKeyMap.set("Space",      VK_SPACE);
    102     gWindowsKeyMap.set("Next",       VK_NEXT);
    103     gWindowsKeyMap.set("Prior",      VK_PRIOR);
    104     gWindowsKeyMap.set("Home",       VK_HOME);
    105     gWindowsKeyMap.set("End",        VK_END);
    106     gWindowsKeyMap.set("Right",      VK_RIGHT);
    107     gWindowsKeyMap.set("Left",       VK_LEFT);
    108     gWindowsKeyMap.set("Up",         VK_UP);
    109     gWindowsKeyMap.set("Down",       VK_DOWN);
    110     gWindowsKeyMap.set("Print",      VK_PRINT);
    111     gWindowsKeyMap.set("Insert",     VK_INSERT);
    112     gWindowsKeyMap.set("Delete",     VK_DELETE);
    113 
    114     gWindowsKeyMap.set("comma",        VK_OEM_COMMA);
    115     gWindowsKeyMap.set("less",         VK_OEM_COMMA);
    116     gWindowsKeyMap.set("period",       VK_OEM_PERIOD);
    117     gWindowsKeyMap.set("greater",      VK_OEM_PERIOD);
    118     gWindowsKeyMap.set("semicolon",    VK_OEM_1);
    119     gWindowsKeyMap.set("colon",        VK_OEM_1);
    120     gWindowsKeyMap.set("slash",        VK_OEM_2);
    121     gWindowsKeyMap.set("question",     VK_OEM_2);
    122     gWindowsKeyMap.set("grave",        VK_OEM_3);
    123     gWindowsKeyMap.set("asciitilde",   VK_OEM_3);
    124     gWindowsKeyMap.set("bracketleft",  VK_OEM_4);
    125     gWindowsKeyMap.set("braceleft",    VK_OEM_4);
    126     gWindowsKeyMap.set("backslash",    VK_OEM_5);
    127     gWindowsKeyMap.set("bar",          VK_OEM_5);
    128     gWindowsKeyMap.set("bracketright", VK_OEM_6);
    129     gWindowsKeyMap.set("braceright",   VK_OEM_6);
    130     gWindowsKeyMap.set("apostrophe",   VK_OEM_7);
    131     gWindowsKeyMap.set("quotedbl",     VK_OEM_7);
    132 
    133     // Alphabet
    134     const char* alphabet = "abcdefghijklmnopqrstuvwxyz";
    135     for (unsigned int i = 0; i < 26; i++) {
    136         String key(alphabet + i, 1);
    137         gWindowsKeyMap.set(key, VK_A + i);
    138     }
    139 
    140     // Digits
    141     for (unsigned int i = 0; i < 10; i++) {
    142         String key = String::number(i);
    143         gWindowsKeyMap.set(key, VK_0 + i);
    144     }
    145 
    146     // Shifted digits
    147     gWindowsKeyMap.set("exclam",    VK_1);
    148     gWindowsKeyMap.set("at",        VK_2);
    149     gWindowsKeyMap.set("numbersign", VK_3);
    150     gWindowsKeyMap.set("dollar",    VK_4);
    151     gWindowsKeyMap.set("percent",   VK_5);
    152     gWindowsKeyMap.set("asciicircum", VK_6);
    153     gWindowsKeyMap.set("ampersand", VK_7);
    154     gWindowsKeyMap.set("asterisk",  VK_8);
    155     gWindowsKeyMap.set("parenleft", VK_9);
    156     gWindowsKeyMap.set("parenright", VK_0);
    157     gWindowsKeyMap.set("minus",     VK_OEM_MINUS);
    158     gWindowsKeyMap.set("underscore", VK_OEM_MINUS);
    159     gWindowsKeyMap.set("equal",     VK_OEM_PLUS);
    160     gWindowsKeyMap.set("plus",      VK_OEM_PLUS);
    161 
    162     // F_XX
    163     for (unsigned int i = 1; i < 25; i++) {
    164         String key = "F" + String::number(i);
    165         gWindowsKeyMap.set(key, VK_F1 + i);
    166     }
    167 }
    168 
    169 static String keyIdentifierForEvasKeyName(String& keyName)
    170 {
    171     if (gKeyMap.isEmpty())
    172         createKeyMap();
    173 
    174     if (gKeyMap.contains(keyName))
    175         return gKeyMap.get(keyName);
    176 
    177     return keyName;
    178 }
    179 
    180 static int windowsKeyCodeForEvasKeyName(String& keyName)
    181 {
    182     if (gWindowsKeyMap.isEmpty())
    183         createWindowsKeyMap();
    184 
    185     if (gWindowsKeyMap.contains(keyName))
    186         return gWindowsKeyMap.get(keyName);
    187 
    188     return 0;
    189 }
    19041
    19142PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Down* event)
Note: See TracChangeset for help on using the changeset viewer.