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

Side by Side Diff: third_party/WebKit/Source/core/events/KeyboardEvent.h

Issue 2454073005: Add isComposing support for KeyboardEvents (Closed)
Patch Set: Fix windows and linux Created 4 years, 1 month 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) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 29 matching lines...) Expand all
40 enum KeyLocationCode { 40 enum KeyLocationCode {
41 kDomKeyLocationStandard = 0x00, 41 kDomKeyLocationStandard = 0x00,
42 kDomKeyLocationLeft = 0x01, 42 kDomKeyLocationLeft = 0x01,
43 kDomKeyLocationRight = 0x02, 43 kDomKeyLocationRight = 0x02,
44 kDomKeyLocationNumpad = 0x03 44 kDomKeyLocationNumpad = 0x03
45 }; 45 };
46 46
47 static KeyboardEvent* create() { return new KeyboardEvent; } 47 static KeyboardEvent* create() { return new KeyboardEvent; }
48 48
49 static KeyboardEvent* create(const WebKeyboardEvent& webEvent, 49 static KeyboardEvent* create(const WebKeyboardEvent& webEvent,
50 AbstractView* view) { 50 LocalDOMWindow* domWindow) {
51 return new KeyboardEvent(webEvent, view); 51 return new KeyboardEvent(webEvent, domWindow);
52 } 52 }
53 53
54 static KeyboardEvent* create(ScriptState*, 54 static KeyboardEvent* create(ScriptState*,
55 const AtomicString& type, 55 const AtomicString& type,
56 const KeyboardEventInit&); 56 const KeyboardEventInit&);
57 57
58 static KeyboardEvent* create(const AtomicString& type, 58 KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
59 bool canBubble,
60 bool cancelable,
61 AbstractView* view,
62 const String& code,
63 const String& key,
64 unsigned location,
65 PlatformEvent::Modifiers modifiers,
66 double platformTimeStamp) {
67 return new KeyboardEvent(type, canBubble, cancelable, view, code, key,
68 location, modifiers, platformTimeStamp);
69 }
70
71 ~KeyboardEvent() override; 59 ~KeyboardEvent() override;
72 60
73 void initKeyboardEvent(ScriptState*, 61 void initKeyboardEvent(ScriptState*,
74 const AtomicString& type, 62 const AtomicString& type,
75 bool canBubble, 63 bool canBubble,
76 bool cancelable, 64 bool cancelable,
77 AbstractView*, 65 AbstractView*,
78 const String& keyIdentifier, 66 const String& keyIdentifier,
79 unsigned location, 67 unsigned location,
80 bool ctrlKey, 68 bool ctrlKey,
81 bool altKey, 69 bool altKey,
82 bool shiftKey, 70 bool shiftKey,
83 bool metaKey); 71 bool metaKey);
84 72
85 const String& code() const { return m_code; } 73 const String& code() const { return m_code; }
86 const String& key() const { return m_key; } 74 const String& key() const { return m_key; }
87 75
88 unsigned location() const { return m_location; } 76 unsigned location() const { return m_location; }
89 77
90 const WebKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } 78 const WebKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
91 79
92 int keyCode() 80 int keyCode()
93 const; // key code for keydown and keyup, character for keypress 81 const; // key code for keydown and keyup, character for keypress
94 int charCode() const; // character code for keypress, 0 for keydown and keyup 82 int charCode() const; // character code for keypress, 0 for keydown and keyup
95 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; } 83 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; }
96 84
97 const AtomicString& interfaceName() const override; 85 const AtomicString& interfaceName() const override;
98 bool isKeyboardEvent() const override; 86 bool isKeyboardEvent() const override;
99 int which() const override; 87 int which() const override;
88 bool isComposing() const { return m_isComposing; }
100 89
101 DECLARE_VIRTUAL_TRACE(); 90 DECLARE_VIRTUAL_TRACE();
102 91
103 private: 92 private:
104 KeyboardEvent(); 93 KeyboardEvent();
105 KeyboardEvent(const WebKeyboardEvent&, AbstractView*); 94 KeyboardEvent(const WebKeyboardEvent&, LocalDOMWindow*);
106 KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
107 KeyboardEvent(const AtomicString& type,
108 bool canBubble,
109 bool cancelable,
110 AbstractView*,
111 const String& code,
112 const String& key,
113 unsigned location,
114 PlatformEvent::Modifiers,
115 double platformTimeStamp);
116 95
117 void initLocationModifiers(unsigned location); 96 void initLocationModifiers(unsigned location);
118 97
119 std::unique_ptr<WebKeyboardEvent> m_keyEvent; 98 std::unique_ptr<WebKeyboardEvent> m_keyEvent;
120 String m_code; 99 String m_code;
121 String m_key; 100 String m_key;
122 unsigned m_location; 101 unsigned m_location;
102 bool m_isComposing;
123 }; 103 };
124 104
125 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); 105 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent);
126 106
127 } // namespace blink 107 } // namespace blink
128 108
129 #endif // KeyboardEvent_h 109 #endif // KeyboardEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698