OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 namespace WebCore { | 33 namespace WebCore { |
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 public: |
39 | 39 |
40 static PassRefPtrWillBeRawPtr<TextEvent> create(); | 40 static PassRefPtrWillBeRawPtr<TextEvent> create(); |
41 static PassRefPtrWillBeRawPtr<TextEvent> create(PassRefPtrWillBeRawPtr<A
bstractView>, const String& data, TextEventInputType = TextEventInputKeyboard); | 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); | 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); | 43 static PassRefPtrWillBeRawPtr<TextEvent> createForFragmentPaste(PassRefP
trWillBeRawPtr<AbstractView>, PassRefPtr<DocumentFragment> data, bool shouldSmar
tReplace, bool shouldMatchStyle); |
44 static PassRefPtrWillBeRawPtr<TextEvent> createForDrop(PassRefPtrWillBeR
awPtr<AbstractView>, const String& data); | 44 static PassRefPtrWillBeRawPtr<TextEvent> createForDrop(PassRefPtrWillBeR
awPtr<AbstractView>, const String& data); |
45 | 45 |
46 virtual ~TextEvent(); | 46 virtual ~TextEvent(); |
47 | 47 |
48 void initTextEvent(const AtomicString& type, bool canBubble, bool cancel
able, PassRefPtrWillBeRawPtr<AbstractView>, const String& data); | 48 void initTextEvent(const AtomicString& type, bool canBubble, bool cancel
able, PassRefPtrWillBeRawPtr<AbstractView>, const String& data); |
49 | 49 |
50 String data() const { return m_data; } | 50 String data() const { return m_data; } |
51 | 51 |
52 virtual const AtomicString& interfaceName() const OVERRIDE; | 52 virtual const AtomicString& interfaceName() const OVERRIDE; |
53 | 53 |
54 bool isLineBreak() const { return m_inputType == TextEventInputLineBreak
; } | 54 bool isLineBreak() const { return m_inputType == TextEventInputLineBreak
; } |
55 bool isComposition() const { return m_inputType == TextEventInputComposi
tion; } | 55 bool isComposition() const { return m_inputType == TextEventInputComposi
tion; } |
56 bool isPaste() const { return m_inputType == TextEventInputPaste; } | 56 bool isPaste() const { return m_inputType == TextEventInputPaste; } |
57 bool isDrop() const { return m_inputType == TextEventInputDrop; } | 57 bool isDrop() const { return m_inputType == TextEventInputDrop; } |
58 | 58 |
59 bool shouldSmartReplace() const { return m_shouldSmartReplace; } | 59 bool shouldSmartReplace() const { return m_shouldSmartReplace; } |
60 bool shouldMatchStyle() const { return m_shouldMatchStyle; } | 60 bool shouldMatchStyle() const { return m_shouldMatchStyle; } |
61 DocumentFragment* pastingFragment() const { return m_pastingFragment.get
(); } | 61 DocumentFragment* pastingFragment() const { return m_pastingFragment.get
(); } |
62 | 62 |
63 virtual void trace(Visitor*) OVERRIDE; | 63 virtual void trace(Visitor*) OVERRIDE; |
64 | 64 |
65 private: | 65 private: |
66 TextEvent(); | 66 TextEvent(); |
67 | 67 |
68 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, Text
EventInputType = TextEventInputKeyboard); | 68 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, Text
EventInputType = TextEventInputKeyboard); |
69 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, Pass
RefPtrWillBeRawPtr<DocumentFragment>, | 69 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, Pass
RefPtr<DocumentFragment>, |
70 bool shouldSmartReplace, bool shouldMatchStyle); | 70 bool shouldSmartReplace, bool shouldMatchStyle); |
71 | 71 |
72 TextEventInputType m_inputType; | 72 TextEventInputType m_inputType; |
73 String m_data; | 73 String m_data; |
74 | 74 |
75 RefPtrWillBeMember<DocumentFragment> m_pastingFragment; | 75 RefPtr<DocumentFragment> m_pastingFragment; |
76 bool m_shouldSmartReplace; | 76 bool m_shouldSmartReplace; |
77 bool m_shouldMatchStyle; | 77 bool m_shouldMatchStyle; |
78 }; | 78 }; |
79 | 79 |
80 inline bool isTextEvent(const Event& event) | 80 inline bool isTextEvent(const Event& event) |
81 { | 81 { |
82 return event.type() == EventTypeNames::textInput && event.hasInterface(Event
Names::TextEvent); | 82 return event.type() == EventTypeNames::textInput && event.hasInterface(Event
Names::TextEvent); |
83 } | 83 } |
84 | 84 |
85 DEFINE_TYPE_CASTS(TextEvent, Event, event, isTextEvent(*event), isTextEvent(even
t)); | 85 DEFINE_TYPE_CASTS(TextEvent, Event, event, isTextEvent(*event), isTextEvent(even
t)); |
86 | 86 |
87 } // namespace WebCore | 87 } // namespace WebCore |
88 | 88 |
89 #endif // TextEvent_h | 89 #endif // TextEvent_h |
OLD | NEW |