| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/events/TextEvent.h" | 27 #include "core/events/TextEvent.h" |
| 28 | 28 |
| 29 #include "core/dom/DocumentFragment.h" | 29 #include "core/dom/DocumentFragment.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 PassRefPtrWillBeRawPtr<TextEvent> TextEvent::create() | 33 RawPtr<TextEvent> TextEvent::create() |
| 34 { | 34 { |
| 35 return adoptRefWillBeNoop(new TextEvent); | 35 return adoptRefWillBeNoop(new TextEvent); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PassRefPtrWillBeRawPtr<TextEvent> TextEvent::create(PassRefPtrWillBeRawPtr<Abstr
actView> view, const String& data, TextEventInputType inputType) | 38 RawPtr<TextEvent> TextEvent::create(RawPtr<AbstractView> view, const String& dat
a, TextEventInputType inputType) |
| 39 { | 39 { |
| 40 return adoptRefWillBeNoop(new TextEvent(view, data, inputType)); | 40 return new TextEvent(view, data, inputType); |
| 41 } | 41 } |
| 42 | 42 |
| 43 PassRefPtrWillBeRawPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtrW
illBeRawPtr<AbstractView> view, const String& data, bool shouldSmartReplace) | 43 RawPtr<TextEvent> TextEvent::createForPlainTextPaste(RawPtr<AbstractView> view,
const String& data, bool shouldSmartReplace) |
| 44 { | 44 { |
| 45 return adoptRefWillBeNoop(new TextEvent(view, data, nullptr, shouldSmartRepl
ace, false)); | 45 return new TextEvent(view, data, nullptr, shouldSmartReplace, false); |
| 46 } | 46 } |
| 47 | 47 |
| 48 PassRefPtrWillBeRawPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtrWi
llBeRawPtr<AbstractView> view, PassRefPtrWillBeRawPtr<DocumentFragment> data, bo
ol shouldSmartReplace, bool shouldMatchStyle) | 48 RawPtr<TextEvent> TextEvent::createForFragmentPaste(RawPtr<AbstractView> view, R
awPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle) |
| 49 { | 49 { |
| 50 return adoptRefWillBeNoop(new TextEvent(view, "", data, shouldSmartReplace,
shouldMatchStyle)); | 50 return new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle); |
| 51 } | 51 } |
| 52 | 52 |
| 53 PassRefPtrWillBeRawPtr<TextEvent> TextEvent::createForDrop(PassRefPtrWillBeRawPt
r<AbstractView> view, const String& data) | 53 RawPtr<TextEvent> TextEvent::createForDrop(RawPtr<AbstractView> view, const Stri
ng& data) |
| 54 { | 54 { |
| 55 return adoptRefWillBeNoop(new TextEvent(view, data, TextEventInputDrop)); | 55 return new TextEvent(view, data, TextEventInputDrop); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TextEvent::TextEvent() | 58 TextEvent::TextEvent() |
| 59 : m_inputType(TextEventInputKeyboard) | 59 : m_inputType(TextEventInputKeyboard) |
| 60 , m_shouldSmartReplace(false) | 60 , m_shouldSmartReplace(false) |
| 61 , m_shouldMatchStyle(false) | 61 , m_shouldMatchStyle(false) |
| 62 { | 62 { |
| 63 } | 63 } |
| 64 | 64 |
| 65 TextEvent::TextEvent(PassRefPtrWillBeRawPtr<AbstractView> view, const String& da
ta, TextEventInputType inputType) | 65 TextEvent::TextEvent(RawPtr<AbstractView> view, const String& data, TextEventInp
utType inputType) |
| 66 : UIEvent(EventTypeNames::textInput, true, true, view, 0) | 66 : UIEvent(EventTypeNames::textInput, true, true, view, 0) |
| 67 , m_inputType(inputType) | 67 , m_inputType(inputType) |
| 68 , m_data(data) | 68 , m_data(data) |
| 69 , m_pastingFragment(nullptr) | 69 , m_pastingFragment(nullptr) |
| 70 , m_shouldSmartReplace(false) | 70 , m_shouldSmartReplace(false) |
| 71 , m_shouldMatchStyle(false) | 71 , m_shouldMatchStyle(false) |
| 72 { | 72 { |
| 73 } | 73 } |
| 74 | 74 |
| 75 TextEvent::TextEvent(PassRefPtrWillBeRawPtr<AbstractView> view, const String& da
ta, PassRefPtrWillBeRawPtr<DocumentFragment> pastingFragment, | 75 TextEvent::TextEvent(RawPtr<AbstractView> view, const String& data, RawPtr<Docum
entFragment> pastingFragment, |
| 76 bool shouldSmartReplace, bool shouldMatchStyle) | 76 bool shouldSmartReplace, bool shouldMatchStyle) |
| 77 : UIEvent(EventTypeNames::textInput, true, true, view, 0) | 77 : UIEvent(EventTypeNames::textInput, true, true, view, 0) |
| 78 , m_inputType(TextEventInputPaste) | 78 , m_inputType(TextEventInputPaste) |
| 79 , m_data(data) | 79 , m_data(data) |
| 80 , m_pastingFragment(pastingFragment) | 80 , m_pastingFragment(pastingFragment) |
| 81 , m_shouldSmartReplace(shouldSmartReplace) | 81 , m_shouldSmartReplace(shouldSmartReplace) |
| 82 , m_shouldMatchStyle(shouldMatchStyle) | 82 , m_shouldMatchStyle(shouldMatchStyle) |
| 83 { | 83 { |
| 84 } | 84 } |
| 85 | 85 |
| 86 TextEvent::~TextEvent() | 86 TextEvent::~TextEvent() |
| 87 { | 87 { |
| 88 } | 88 } |
| 89 | 89 |
| 90 void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool can
celable, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data) | 90 void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool can
celable, RawPtr<AbstractView> view, const String& data) |
| 91 { | 91 { |
| 92 if (dispatched()) | 92 if (dispatched()) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 initUIEvent(type, canBubble, cancelable, view, 0); | 95 initUIEvent(type, canBubble, cancelable, view, 0); |
| 96 | 96 |
| 97 m_data = data; | 97 m_data = data; |
| 98 } | 98 } |
| 99 | 99 |
| 100 const AtomicString& TextEvent::interfaceName() const | 100 const AtomicString& TextEvent::interfaceName() const |
| 101 { | 101 { |
| 102 return EventNames::TextEvent; | 102 return EventNames::TextEvent; |
| 103 } | 103 } |
| 104 | 104 |
| 105 DEFINE_TRACE(TextEvent) | 105 DEFINE_TRACE(TextEvent) |
| 106 { | 106 { |
| 107 visitor->trace(m_pastingFragment); | 107 visitor->trace(m_pastingFragment); |
| 108 UIEvent::trace(visitor); | 108 UIEvent::trace(visitor); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace blink | 111 } // namespace blink |
| OLD | NEW |