Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: Source/platform/PlatformKeyboardEvent.h

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to use domCode instead of native domCode Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 20 matching lines...) Expand all
31 #include "platform/PlatformExport.h" 31 #include "platform/PlatformExport.h"
32 #include "wtf/text/WTFString.h" 32 #include "wtf/text/WTFString.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 class PlatformKeyboardEvent : public PlatformEvent { 36 class PlatformKeyboardEvent : public PlatformEvent {
37 WTF_MAKE_FAST_ALLOCATED; 37 WTF_MAKE_FAST_ALLOCATED;
38 public: 38 public:
39 PlatformKeyboardEvent() 39 PlatformKeyboardEvent()
40 : PlatformEvent(PlatformEvent::KeyDown) 40 : PlatformEvent(PlatformEvent::KeyDown)
41 , m_domCode(0)
41 , m_windowsVirtualKeyCode(0) 42 , m_windowsVirtualKeyCode(0)
42 , m_nativeVirtualKeyCode(0) 43 , m_nativeVirtualKeyCode(0)
43 , m_autoRepeat(false) 44 , m_autoRepeat(false)
44 , m_isKeypad(false) 45 , m_isKeypad(false)
45 , m_isSystemKey(false) 46 , m_isSystemKey(false)
46 { 47 {
47 } 48 }
48 49
49 PlatformKeyboardEvent(Type type, const String& text, const String& unmodifie dText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtual KeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers , double timestamp) 50 PlatformKeyboardEvent(Type type, const String& text, const String& unmodifie dText, const String& keyIdentifier, long domCode, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modif iers modifiers, double timestamp)
50 : PlatformEvent(type, modifiers, timestamp) 51 : PlatformEvent(type, modifiers, timestamp)
51 , m_text(text) 52 , m_text(text)
52 , m_unmodifiedText(unmodifiedText) 53 , m_unmodifiedText(unmodifiedText)
53 , m_keyIdentifier(keyIdentifier) 54 , m_keyIdentifier(keyIdentifier)
55 , m_domCode(domCode)
54 , m_windowsVirtualKeyCode(windowsVirtualKeyCode) 56 , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
55 , m_nativeVirtualKeyCode(nativeVirtualKeyCode) 57 , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
56 , m_autoRepeat(isAutoRepeat) 58 , m_autoRepeat(isAutoRepeat)
57 , m_isKeypad(isKeypad) 59 , m_isKeypad(isKeypad)
58 , m_isSystemKey(isSystemKey) 60 , m_isSystemKey(isSystemKey)
59 { 61 {
60 } 62 }
61 63
62 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type); 64 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type);
63 65
64 // Text as as generated by processing a virtual key code with a keyboard lay out 66 // Text as as generated by processing a virtual key code with a keyboard lay out
65 // (in most cases, just a character code, but the layout can emit several 67 // (in most cases, just a character code, but the layout can emit several
66 // characters in a single keypress event on some platforms). 68 // characters in a single keypress event on some platforms).
67 // This may bear no resemblance to the ultimately inserted text if an input method 69 // This may bear no resemblance to the ultimately inserted text if an input method
68 // processes the input. 70 // processes the input.
69 // Will be null for KeyUp and RawKeyDown events. 71 // Will be null for KeyUp and RawKeyDown events.
70 String text() const { return m_text; } 72 String text() const { return m_text; }
71 73
72 // Text that would have been generated by the keyboard if no modifiers were pressed 74 // Text that would have been generated by the keyboard if no modifiers were pressed
73 // (except for Shift); useful for shortcut (accelerator) key handling. 75 // (except for Shift); useful for shortcut (accelerator) key handling.
74 // Otherwise, same as text(). 76 // Otherwise, same as text().
75 String unmodifiedText() const { return m_unmodifiedText; } 77 String unmodifiedText() const { return m_unmodifiedText; }
76 78
77 String keyIdentifier() const { return m_keyIdentifier; } 79 String keyIdentifier() const { return m_keyIdentifier; }
78 80
81 int domCode() const { return m_domCode; }
Wez 2015/01/08 01:14:47 Why do we need both domcode and code() here?
Habib Virji 2015/01/12 15:34:17 Yes, you are right. Value is already present in th
82 String code() const { return m_code; }
Wez 2015/01/08 01:14:47 Where does m_code get set?
Habib Virji 2015/01/12 15:34:17 It is getting set in WebViewImpl.cc.
83
79 // Most compatible Windows virtual key code associated with the event. 84 // Most compatible Windows virtual key code associated with the event.
80 // Zero for Char events. 85 // Zero for Char events.
81 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } 86 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
82 87
83 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } 88 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
84 89
85 bool isAutoRepeat() const { return m_autoRepeat; } 90 bool isAutoRepeat() const { return m_autoRepeat; }
86 bool isKeypad() const { return m_isKeypad; } 91 bool isKeypad() const { return m_isKeypad; }
87 bool isSystemKey() const { return m_isSystemKey; } 92 bool isSystemKey() const { return m_isSystemKey; }
88 93
89 PLATFORM_EXPORT static bool currentCapsLockState(); 94 PLATFORM_EXPORT static bool currentCapsLockState();
90 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct rlKey, bool& altKey, bool& metaKey); 95 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct rlKey, bool& altKey, bool& metaKey);
91 96
92 protected: 97 protected:
93 String m_text; 98 String m_text;
94 String m_unmodifiedText; 99 String m_unmodifiedText;
95 String m_keyIdentifier; 100 String m_keyIdentifier;
101 String m_code;
102 long m_domCode;
96 int m_windowsVirtualKeyCode; 103 int m_windowsVirtualKeyCode;
97 int m_nativeVirtualKeyCode; 104 int m_nativeVirtualKeyCode;
98 bool m_autoRepeat; 105 bool m_autoRepeat;
99 bool m_isKeypad; 106 bool m_isKeypad;
100 bool m_isSystemKey; 107 bool m_isSystemKey;
101 }; 108 };
102 109
103 } // namespace blink 110 } // namespace blink
104 111
105 #endif // PlatformKeyboardEvent_h 112 #endif // PlatformKeyboardEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698