| 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 19 matching lines...) Expand all Loading... |
| 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 DEFINE_WRAPPERTYPEINFO(); | 38 DEFINE_WRAPPERTYPEINFO(); |
| 39 public: | 39 public: |
| 40 static PassRefPtrWillBeRawPtr<TextEvent> create(); | 40 static RawPtr<TextEvent> create(); |
| 41 static PassRefPtrWillBeRawPtr<TextEvent> create(PassRefPtrWillBeRawPtr<Abstr
actView>, const String& data, TextEventInputType = TextEventInputKeyboard); | 41 static RawPtr<TextEvent> create(RawPtr<AbstractView>, const String& data, Te
xtEventInputType = TextEventInputKeyboard); |
| 42 static PassRefPtrWillBeRawPtr<TextEvent> createForPlainTextPaste(PassRefPtrW
illBeRawPtr<AbstractView>, const String& data, bool shouldSmartReplace); | 42 static RawPtr<TextEvent> createForPlainTextPaste(RawPtr<AbstractView>, const
String& data, bool shouldSmartReplace); |
| 43 static PassRefPtrWillBeRawPtr<TextEvent> createForFragmentPaste(PassRefPtrWi
llBeRawPtr<AbstractView>, PassRefPtrWillBeRawPtr<DocumentFragment> data, bool sh
ouldSmartReplace, bool shouldMatchStyle); | 43 static RawPtr<TextEvent> createForFragmentPaste(RawPtr<AbstractView>, RawPtr
<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle); |
| 44 static PassRefPtrWillBeRawPtr<TextEvent> createForDrop(PassRefPtrWillBeRawPt
r<AbstractView>, const String& data); | 44 static RawPtr<TextEvent> createForDrop(RawPtr<AbstractView>, const String& d
ata); |
| 45 | 45 |
| 46 ~TextEvent() override; | 46 ~TextEvent() override; |
| 47 | 47 |
| 48 void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable
, PassRefPtrWillBeRawPtr<AbstractView>, const String& data); | 48 void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable
, RawPtr<AbstractView>, const String& data); |
| 49 | 49 |
| 50 String data() const { return m_data; } | 50 String data() const { return m_data; } |
| 51 | 51 |
| 52 const AtomicString& interfaceName() const override; | 52 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 == TextEventInputComposition
; } | 55 bool isComposition() const { return m_inputType == TextEventInputComposition
; } |
| 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 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 TextEvent(); | 66 TextEvent(); |
| 67 | 67 |
| 68 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, TextEven
tInputType = TextEventInputKeyboard); | 68 TextEvent(RawPtr<AbstractView>, const String& data, TextEventInputType = Tex
tEventInputKeyboard); |
| 69 TextEvent(PassRefPtrWillBeRawPtr<AbstractView>, const String& data, PassRefP
trWillBeRawPtr<DocumentFragment>, bool shouldSmartReplace, bool shouldMatchStyle
); | 69 TextEvent(RawPtr<AbstractView>, const String& data, RawPtr<DocumentFragment>
, bool shouldSmartReplace, bool shouldMatchStyle); |
| 70 | 70 |
| 71 TextEventInputType m_inputType; | 71 TextEventInputType m_inputType; |
| 72 String m_data; | 72 String m_data; |
| 73 | 73 |
| 74 RefPtrWillBeMember<DocumentFragment> m_pastingFragment; | 74 Member<DocumentFragment> m_pastingFragment; |
| 75 bool m_shouldSmartReplace; | 75 bool m_shouldSmartReplace; |
| 76 bool m_shouldMatchStyle; | 76 bool m_shouldMatchStyle; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 inline bool isTextEvent(const Event& event) | 79 inline bool isTextEvent(const Event& event) |
| 80 { | 80 { |
| 81 return event.type() == EventTypeNames::textInput && event.hasInterface(Event
Names::TextEvent); | 81 return event.type() == EventTypeNames::textInput && event.hasInterface(Event
Names::TextEvent); |
| 82 } | 82 } |
| 83 | 83 |
| 84 DEFINE_TYPE_CASTS(TextEvent, Event, event, isTextEvent(*event), isTextEvent(even
t)); | 84 DEFINE_TYPE_CASTS(TextEvent, Event, event, isTextEvent(*event), isTextEvent(even
t)); |
| 85 | 85 |
| 86 } // namespace blink | 86 } // namespace blink |
| 87 | 87 |
| 88 #endif // TextEvent_h | 88 #endif // TextEvent_h |
| OLD | NEW |