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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "core/dom/DocumentFragment.h" | 30 #include "core/dom/DocumentFragment.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 PassRefPtr<TextEvent> TextEvent::create() | 34 PassRefPtr<TextEvent> TextEvent::create() |
35 { | 35 { |
36 return adoptRef(new TextEvent); | 36 return adoptRef(new TextEvent); |
37 } | 37 } |
38 | 38 |
39 PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const Str
ing& data, TextEventInputType inputType) | 39 PassRefPtr<TextEvent> TextEvent::create(PassRefPtrWillBeRawPtr<AbstractView> vie
w, const String& data, TextEventInputType inputType) |
40 { | 40 { |
41 return adoptRef(new TextEvent(view, data, inputType)); | 41 return adoptRef(new TextEvent(view, data, inputType)); |
42 } | 42 } |
43 | 43 |
44 PassRefPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtr<AbstractView
> view, const String& data, bool shouldSmartReplace) | 44 PassRefPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtrWillBeRawPtr<
AbstractView> view, const String& data, bool shouldSmartReplace) |
45 { | 45 { |
46 return adoptRef(new TextEvent(view, data, nullptr, shouldSmartReplace, false
)); | 46 return adoptRef(new TextEvent(view, data, nullptr, shouldSmartReplace, false
)); |
47 } | 47 } |
48 | 48 |
49 PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView>
view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMa
tchStyle) | 49 PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtrWillBeRawPtr<A
bstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, b
ool shouldMatchStyle) |
50 { | 50 { |
51 return adoptRef(new TextEvent(view, "", data, shouldSmartReplace, shouldMatc
hStyle)); | 51 return adoptRef(new TextEvent(view, "", data, shouldSmartReplace, shouldMatc
hStyle)); |
52 } | 52 } |
53 | 53 |
54 PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, co
nst String& data) | 54 PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtrWillBeRawPtr<AbstractVi
ew> view, const String& data) |
55 { | 55 { |
56 return adoptRef(new TextEvent(view, data, TextEventInputDrop)); | 56 return adoptRef(new TextEvent(view, data, TextEventInputDrop)); |
57 } | 57 } |
58 | 58 |
59 TextEvent::TextEvent() | 59 TextEvent::TextEvent() |
60 : m_inputType(TextEventInputKeyboard) | 60 : m_inputType(TextEventInputKeyboard) |
61 , m_shouldSmartReplace(false) | 61 , m_shouldSmartReplace(false) |
62 , m_shouldMatchStyle(false) | 62 , m_shouldMatchStyle(false) |
63 { | 63 { |
64 ScriptWrappable::init(this); | 64 ScriptWrappable::init(this); |
65 } | 65 } |
66 | 66 |
67 TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEven
tInputType inputType) | 67 TextEvent::TextEvent(PassRefPtrWillBeRawPtr<AbstractView> view, const String& da
ta, TextEventInputType inputType) |
68 : UIEvent(EventTypeNames::textInput, true, true, view, 0) | 68 : UIEvent(EventTypeNames::textInput, true, true, view, 0) |
69 , m_inputType(inputType) | 69 , m_inputType(inputType) |
70 , m_data(data) | 70 , m_data(data) |
71 , m_pastingFragment(nullptr) | 71 , m_pastingFragment(nullptr) |
72 , m_shouldSmartReplace(false) | 72 , m_shouldSmartReplace(false) |
73 , m_shouldMatchStyle(false) | 73 , m_shouldMatchStyle(false) |
74 { | 74 { |
75 ScriptWrappable::init(this); | 75 ScriptWrappable::init(this); |
76 } | 76 } |
77 | 77 |
78 TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefP
tr<DocumentFragment> pastingFragment, | 78 TextEvent::TextEvent(PassRefPtrWillBeRawPtr<AbstractView> view, const String& da
ta, PassRefPtr<DocumentFragment> pastingFragment, |
79 bool shouldSmartReplace, bool shouldMatchStyle) | 79 bool shouldSmartReplace, bool shouldMatchStyle) |
80 : UIEvent(EventTypeNames::textInput, true, true, view, 0) | 80 : UIEvent(EventTypeNames::textInput, true, true, view, 0) |
81 , m_inputType(TextEventInputPaste) | 81 , m_inputType(TextEventInputPaste) |
82 , m_data(data) | 82 , m_data(data) |
83 , m_pastingFragment(pastingFragment) | 83 , m_pastingFragment(pastingFragment) |
84 , m_shouldSmartReplace(shouldSmartReplace) | 84 , m_shouldSmartReplace(shouldSmartReplace) |
85 , m_shouldMatchStyle(shouldMatchStyle) | 85 , m_shouldMatchStyle(shouldMatchStyle) |
86 { | 86 { |
87 ScriptWrappable::init(this); | 87 ScriptWrappable::init(this); |
88 } | 88 } |
89 | 89 |
90 TextEvent::~TextEvent() | 90 TextEvent::~TextEvent() |
91 { | 91 { |
92 } | 92 } |
93 | 93 |
94 void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool can
celable, PassRefPtr<AbstractView> view, const String& data) | 94 void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool can
celable, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data) |
95 { | 95 { |
96 if (dispatched()) | 96 if (dispatched()) |
97 return; | 97 return; |
98 | 98 |
99 initUIEvent(type, canBubble, cancelable, view, 0); | 99 initUIEvent(type, canBubble, cancelable, view, 0); |
100 | 100 |
101 m_data = data; | 101 m_data = data; |
102 } | 102 } |
103 | 103 |
104 const AtomicString& TextEvent::interfaceName() const | 104 const AtomicString& TextEvent::interfaceName() const |
105 { | 105 { |
106 return EventNames::TextEvent; | 106 return EventNames::TextEvent; |
107 } | 107 } |
108 | 108 |
109 void TextEvent::trace(Visitor* visitor) | 109 void TextEvent::trace(Visitor* visitor) |
110 { | 110 { |
111 UIEvent::trace(visitor); | 111 UIEvent::trace(visitor); |
112 } | 112 } |
113 | 113 |
114 } // namespace WebCore | 114 } // namespace WebCore |
OLD | NEW |