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

Side by Side Diff: Source/core/events/TextEvent.h

Issue 478243002: bindings: Adds virtual ScriptWrappable::wrap method. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/events/SecurityPolicyViolationEvent.h ('k') | Source/core/events/TouchEvent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #ifndef TextEvent_h 27 #ifndef TextEvent_h
28 #define TextEvent_h 28 #define TextEvent_h
29 29
30 #include "core/events/TextEventInputType.h" 30 #include "core/events/TextEventInputType.h"
31 #include "core/events/UIEvent.h" 31 #include "core/events/UIEvent.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class DocumentFragment; 35 class DocumentFragment;
36 36
37 class TextEvent FINAL : public UIEvent { 37 class TextEvent FINAL : public UIEvent {
38 public: 38 DEFINE_WRAPPERTYPEINFO();
39 public:
40 static PassRefPtrWillBeRawPtr<TextEvent> create();
41 static PassRefPtrWillBeRawPtr<TextEvent> create(PassRefPtrWillBeRawPtr<Abstr actView>, const String& data, TextEventInputType = TextEventInputKeyboard);
42 static PassRefPtrWillBeRawPtr<TextEvent> createForPlainTextPaste(PassRefPtrW illBeRawPtr<AbstractView>, const String& data, bool shouldSmartReplace);
43 static PassRefPtrWillBeRawPtr<TextEvent> createForFragmentPaste(PassRefPtrWi llBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<DocumentFragment> data, bool sh ouldSmartReplace, bool shouldMatchStyle);
44 static PassRefPtrWillBeRawPtr<TextEvent> createForDrop(PassRefPtrWillBeRawPt r<AbstractView>, const String& data);
39 45
40 static PassRefPtrWillBeRawPtr<TextEvent> create(); 46 virtual ~TextEvent();
41 static PassRefPtrWillBeRawPtr<TextEvent> create(PassRefPtrWillBeRawPtr<A bstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
42 static PassRefPtrWillBeRawPtr<TextEvent> createForPlainTextPaste(PassRef PtrWillBeRawPtr<AbstractView>, const String& data, bool shouldSmartReplace);
43 static PassRefPtrWillBeRawPtr<TextEvent> createForFragmentPaste(PassRefP trWillBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<DocumentFragment> data, boo l shouldSmartReplace, bool shouldMatchStyle);
44 static PassRefPtrWillBeRawPtr<TextEvent> createForDrop(PassRefPtrWillBeR awPtr<AbstractView>, const String& data);
45 47
46 virtual ~TextEvent(); 48 void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable , PassRefPtrWillBeRawPtr<AbstractView>, const String& data);
47 49
48 void initTextEvent(const AtomicString& type, bool canBubble, bool cancel able, PassRefPtrWillBeRawPtr<AbstractView>, const String& data); 50 String data() const { return m_data; }
49 51
50 String data() const { return m_data; } 52 virtual const AtomicString& interfaceName() const OVERRIDE;
51 53
52 virtual const AtomicString& interfaceName() const OVERRIDE; 54 bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
55 bool isComposition() const { return m_inputType == TextEventInputComposition ; }
56 bool isPaste() const { return m_inputType == TextEventInputPaste; }
57 bool isDrop() const { return m_inputType == TextEventInputDrop; }
53 58
54 bool isLineBreak() const { return m_inputType == TextEventInputLineBreak ; } 59 bool shouldSmartReplace() const { return m_shouldSmartReplace; }
55 bool isComposition() const { return m_inputType == TextEventInputComposi tion; } 60 bool shouldMatchStyle() const { return m_shouldMatchStyle; }
56 bool isPaste() const { return m_inputType == TextEventInputPaste; } 61 DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); }
57 bool isDrop() const { return m_inputType == TextEventInputDrop; }
58 62
59 bool shouldSmartReplace() const { return m_shouldSmartReplace; } 63 virtual void trace(Visitor*) OVERRIDE;
60 bool shouldMatchStyle() const { return m_shouldMatchStyle; }
61 DocumentFragment* pastingFragment() const { return m_pastingFragment.get (); }
62 64
63 virtual void trace(Visitor*) OVERRIDE; 65 private:
66 TextEvent();
64 67
65 private: 68 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, TextEven tInputType = TextEventInputKeyboard);
66 TextEvent(); 69 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, PassRefP trWillBeRawPtr<DocumentFragment>, bool shouldSmartReplace, bool shouldMatchStyle );
67 70
68 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, Text EventInputType = TextEventInputKeyboard); 71 TextEventInputType m_inputType;
69 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, Pass RefPtrWillBeRawPtr<DocumentFragment>, 72 String m_data;
70 bool shouldSmartReplace, bool shouldMatchStyle);
71 73
72 TextEventInputType m_inputType; 74 RefPtrWillBeMember<DocumentFragment> m_pastingFragment;
73 String m_data; 75 bool m_shouldSmartReplace;
74 76 bool m_shouldMatchStyle;
75 RefPtrWillBeMember<DocumentFragment> m_pastingFragment; 77 };
76 bool m_shouldSmartReplace;
77 bool m_shouldMatchStyle;
78 };
79 78
80 inline bool isTextEvent(const Event& event) 79 inline bool isTextEvent(const Event& event)
81 { 80 {
82 return event.type() == EventTypeNames::textInput && event.hasInterface(Event Names::TextEvent); 81 return event.type() == EventTypeNames::textInput && event.hasInterface(Event Names::TextEvent);
83 } 82 }
84 83
85 DEFINE_TYPE_CASTS(TextEvent, Event, event, isTextEvent(*event), isTextEvent(even t)); 84 DEFINE_TYPE_CASTS(TextEvent, Event, event, isTextEvent(*event), isTextEvent(even t));
86 85
87 } // namespace blink 86 } // namespace blink
88 87
89 #endif // TextEvent_h 88 #endif // TextEvent_h
OLDNEW
« no previous file with comments | « Source/core/events/SecurityPolicyViolationEvent.h ('k') | Source/core/events/TouchEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698