[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:23:43 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 05382ec4198a2f2d8e81d71181b432fbeccd9466
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 18 06:12:07 2010 +0000

    2010-02-17  Kwang Yul Seo  <skyul at company100.net>
    
            Reviewed by Eric Seidel.
    
            [BREWMP] Port PlatformKeyboardEvent
            https://bugs.webkit.org/show_bug.cgi?id=34794
    
            Retrieve the type, key code, text and modifiers from BREW's keyboard event.
    
            * platform/PlatformKeyboardEvent.h:
            * platform/brew/PlatformKeyboardEventBrew.cpp: Added.
            (WebCore::keyIdentifierForBrewKeyCode):
            (WebCore::windowsKeyCodeForKeyEvent):
            (WebCore::singleCharacterString):
            (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
            (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
            (WebCore::PlatformKeyboardEvent::currentCapsLockState):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54930 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1df3fc5..25d0a05 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-02-17  Kwang Yul Seo  <skyul at company100.net>
+
+        Reviewed by Eric Seidel.
+
+        [BREWMP] Port PlatformKeyboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=34794
+
+        Retrieve the type, key code, text and modifiers from BREW's keyboard event.
+
+        * platform/PlatformKeyboardEvent.h:
+        * platform/brew/PlatformKeyboardEventBrew.cpp: Added.
+        (WebCore::keyIdentifierForBrewKeyCode):
+        (WebCore::windowsKeyCodeForKeyEvent):
+        (WebCore::singleCharacterString):
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
+        (WebCore::PlatformKeyboardEvent::currentCapsLockState):
+
 2010-02-17  Hayato Ito  <hayato at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/platform/PlatformKeyboardEvent.h b/WebCore/platform/PlatformKeyboardEvent.h
index 5d847c8..ed472da 100644
--- a/WebCore/platform/PlatformKeyboardEvent.h
+++ b/WebCore/platform/PlatformKeyboardEvent.h
@@ -63,6 +63,12 @@ class wxKeyEvent;
 class BMessage;
 #endif
 
+#if PLATFORM(BREWMP)
+typedef unsigned short    uint16;
+typedef unsigned long int uint32;
+#define AEEEvent uint16
+#endif
+
 namespace WebCore {
 
     class PlatformKeyboardEvent : public FastAllocBase {
@@ -157,6 +163,10 @@ namespace WebCore {
         PlatformKeyboardEvent(BMessage*);
 #endif
 
+#if PLATFORM(BREWMP)
+        PlatformKeyboardEvent(AEEEvent, uint16, uint32, Type);
+#endif
+
 #if PLATFORM(WIN) || PLATFORM(CHROMIUM)
         bool isSystemKey() const { return m_isSystemKey; }
 #endif
diff --git a/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp b/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp
new file mode 100644
index 0000000..758d15c
--- /dev/null
+++ b/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2010 Company 100, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformKeyboardEvent.h"
+
+#include "KeyboardCodes.h"
+#include "NotImplemented.h"
+
+#include <AEEEvent.h>
+#include <AEEStdDef.h>
+#include <AEEVCodes.h>
+
+namespace WebCore {
+
+static String keyIdentifierForBrewKeyCode(int16 keyCode)
+{
+    switch (keyCode) {
+    case AVK_LALT:
+    case AVK_RALT:
+        return "Alt";
+    case AVK_LCTRL:
+    case AVK_RCTRL:
+        return "Control";
+    case AVK_LSHIFT:
+    case AVK_RSHIFT:
+        return "Shift";
+    case AVK_CAPLK:
+        return "CapsLock";
+    case AVK_FUNCTION1:
+        return "F1";
+    case AVK_FUNCTION2:
+        return "F2";
+    case AVK_FUNCTION3:
+        return "F3";
+    case AVK_FUNCTION4:
+        return "F4";
+    case AVK_FUNCTION5:
+        return "F5";
+    case AVK_FUNCTION6:
+        return "F6";
+    case AVK_FUNCTION7:
+        return "F7";
+    case AVK_FUNCTION8:
+        return "F8";
+    case AVK_FUNCTION9:
+        return "F9";
+    case AVK_FUNCTION10:
+        return "F10";
+    case AVK_FUNCTION11:
+        return "F11";
+    case AVK_FUNCTION12:
+        return "F12";
+    case AVK_PRSCRN:
+        return "PrintScreen";
+    case AVK_LEFT:
+        return "Left";
+    case AVK_RIGHT:
+        return "Right";
+    case AVK_UP:
+        return "Up";
+    case AVK_DOWN:
+        return "Down";
+    case AVK_TXINSERT:
+        return "Insert";
+    case AVK_ENTER:
+        return "Enter";
+    case AVK_TXHOME:
+        return "Home";
+    case AVK_TXDELETE:
+        // Standard says that DEL becomes U+007F.
+        return "U+007F";
+    case AVK_TXEND:
+        return "End";
+    case AVK_TXPGUP:
+        return "PageUp";
+    case AVK_TXPGDOWN:
+        return "PageDown";
+    default:
+        return String::format("U+%04X", toASCIIUpper(keyCode));
+    }
+}
+
+static int windowsKeyCodeForKeyEvent(uint16 code)
+{
+    switch (code) {
+    case AVK_A:
+        return VK_BACK; // (08) BACKSPACE key
+    case AVK_ENTER:
+        return VK_RETURN; // (0D) Return key
+    case AVK_SPACE:
+        return VK_SPACE; // (20) SPACEBAR
+    case AVK_TXPGUP:
+        return VK_PRIOR; // (21) PAGE UP key
+    case AVK_TXPGDOWN:
+        return VK_NEXT; // (22) PAGE DOWN key
+    case AVK_TXEND:
+        return VK_END; // (23) END key
+    case AVK_TXHOME:
+        return VK_HOME; // (24) HOME key
+    case AVK_LEFT:
+        return VK_LEFT; // (25) LEFT ARROW key
+    case AVK_UP:
+        return VK_UP; // (26) UP ARROW key
+    case AVK_RIGHT:
+        return VK_RIGHT; // (27) RIGHT ARROW key
+    case AVK_DOWN:
+        return VK_DOWN; // (28) DOWN ARROW key
+    case AVK_TXINSERT:
+        return VK_INSERT; // (2D) INS key
+    case AVK_TXDELETE:
+        return VK_DELETE; // (2E) DEL key
+    default:
+        return 0;
+    }
+}
+
+static inline String singleCharacterString(UChar c)
+{
+    return String(&c, 1);
+}
+
+PlatformKeyboardEvent::PlatformKeyboardEvent(AEEEvent event, uint16 code, uint32 modifiers, Type type)
+    : m_type(type)
+    , m_text((type == Char) ? singleCharacterString(code) : String())
+    , m_unmodifiedText((type == Char) ? singleCharacterString(code) : String())
+    , m_keyIdentifier((type == Char) ? String() : keyIdentifierForBrewKeyCode(code))
+    , m_autoRepeat(modifiers & KB_AUTOREPEAT)
+    , m_windowsVirtualKeyCode((type == RawKeyDown || type == KeyUp) ? windowsKeyCodeForKeyEvent(code) : 0)
+    , m_nativeVirtualKeyCode(code)
+    , m_isKeypad(false)
+    , m_shiftKey(modifiers & (KB_LSHIFT | KB_RSHIFT))
+    , m_ctrlKey(modifiers & (KB_LCTRL | KB_RCTRL))
+    , m_altKey(modifiers & (KB_LALT | KB_RALT))
+    , m_metaKey(false)
+{
+}
+
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
+{
+    // No KeyDown events on BREW to disambiguate.
+    ASSERT_NOT_REACHED();
+}
+
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace WebCore
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list