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

Side by Side Diff: third_party/WebKit/Source/core/events/InputEvent.cpp

Issue 1752933002: [InputEvent] Fire 'beforeinput' during typing, pressing hot keys and IME composition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dtapuska's review, also add layout tests Created 4 years, 9 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/events/InputEvent.h" 5 #include "core/events/InputEvent.h"
6 6
7 #include "core/events/EventDispatcher.h" 7 #include "core/events/EventDispatcher.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 InputEvent::InputEvent() 11 InputEvent::InputEvent()
12 { 12 {
13 } 13 }
14 14
15 InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializ er) 15 InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializ er)
16 : UIEvent(type, initializer) 16 : UIEvent(type, initializer)
17 { 17 {
18 if (initializer.hasInputType())
19 m_inputType = initializer.inputType();
20 if (initializer.hasData())
21 m_data = initializer.data();
22 }
23
24 /* static */
25 PassRefPtrWillBeRawPtr<InputEvent> InputEvent::createBeforeInput(const String& i nputType, const String& data)
26 {
27 InputEventInit inputEventInit;
28
29 inputEventInit.setBubbles(true);
30 inputEventInit.setCancelable(false);
31 inputEventInit.setInputType(inputType);
32 inputEventInit.setData(data);
33
34 return InputEvent::create(EventTypeNames::beforeinput, inputEventInit);
35 }
36
37 /* static */
38 PassRefPtrWillBeRawPtr<InputEvent> InputEvent::createCancelableBeforeInput(const String& inputType, const String& data)
39 {
40 InputEventInit inputEventInit;
41
42 inputEventInit.setBubbles(true);
43 inputEventInit.setCancelable(true);
44 inputEventInit.setInputType(inputType);
45 inputEventInit.setData(data);
46
47 return InputEvent::create(EventTypeNames::beforeinput, inputEventInit);
18 } 48 }
19 49
20 bool InputEvent::isInputEvent() const 50 bool InputEvent::isInputEvent() const
21 { 51 {
22 return true; 52 return true;
23 } 53 }
24 54
25 DEFINE_TRACE(InputEvent) 55 DEFINE_TRACE(InputEvent)
26 { 56 {
27 UIEvent::trace(visitor); 57 UIEvent::trace(visitor);
28 } 58 }
29 59
30 } // namespace blink 60 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698