diff options
Diffstat (limited to 'Source/WebCore/dom/TextEvent.h')
-rw-r--r-- | Source/WebCore/dom/TextEvent.h | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/Source/WebCore/dom/TextEvent.h b/Source/WebCore/dom/TextEvent.h index 6cc2cb02c..29eb26d0e 100644 --- a/Source/WebCore/dom/TextEvent.h +++ b/Source/WebCore/dom/TextEvent.h @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,8 +24,7 @@ * */ -#ifndef TextEvent_h -#define TextEvent_h +#pragma once #include "DictationAlternative.h" #include "TextEventInputType.h" @@ -35,23 +34,24 @@ namespace WebCore { class DocumentFragment; - class TextEvent : public UIEvent { - public: + enum class MailBlockquoteHandling; - static PassRefPtr<TextEvent> create(); - static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard); - static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace); - static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle); - static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data); - static PassRefPtr<TextEvent> createForDictation(PassRefPtr<AbstractView>, const String& data, const Vector<DictationAlternative>& dictationAlternatives); + class TextEvent final : public UIEvent { + public: + static Ref<TextEvent> create(DOMWindow*, const String& data, TextEventInputType = TextEventInputKeyboard); + static Ref<TextEvent> createForBindings(); + static Ref<TextEvent> createForPlainTextPaste(DOMWindow*, const String& data, bool shouldSmartReplace); + static Ref<TextEvent> createForFragmentPaste(DOMWindow*, RefPtr<DocumentFragment>&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); + static Ref<TextEvent> createForDrop(DOMWindow*, const String& data); + static Ref<TextEvent> createForDictation(DOMWindow*, const String& data, const Vector<DictationAlternative>& dictationAlternatives); virtual ~TextEvent(); - void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, const String& data); + WEBCORE_EXPORT void initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, const String& data); String data() const { return m_data; } - virtual EventInterface eventInterface() const override; + EventInterface eventInterface() const override; bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; } bool isComposition() const { return m_inputType == TextEventInputComposition; } @@ -59,19 +59,23 @@ namespace WebCore { bool isPaste() const { return m_inputType == TextEventInputPaste; } bool isDrop() const { return m_inputType == TextEventInputDrop; } bool isDictation() const { return m_inputType == TextEventInputDictation; } + bool isAutocompletion() const { return m_inputType == TextEventInputAutocompletion; } + bool isKeyboard() const { return m_inputType == TextEventInputKeyboard; } bool shouldSmartReplace() const { return m_shouldSmartReplace; } bool shouldMatchStyle() const { return m_shouldMatchStyle; } + MailBlockquoteHandling mailBlockquoteHandling() const { return m_mailBlockquoteHandling; } DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); } const Vector<DictationAlternative>& dictationAlternatives() const { return m_dictationAlternatives; } private: TextEvent(); - TextEvent(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard); - TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>, - bool shouldSmartReplace, bool shouldMatchStyle); - TextEvent(PassRefPtr<AbstractView>, const String& data, const Vector<DictationAlternative>& dictationAlternatives); + TextEvent(DOMWindow*, const String& data, TextEventInputType = TextEventInputKeyboard); + TextEvent(DOMWindow*, const String& data, RefPtr<DocumentFragment>&&, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling); + TextEvent(DOMWindow*, const String& data, const Vector<DictationAlternative>& dictationAlternatives); + + bool isTextEvent() const override; TextEventInputType m_inputType; String m_data; @@ -79,9 +83,10 @@ namespace WebCore { RefPtr<DocumentFragment> m_pastingFragment; bool m_shouldSmartReplace; bool m_shouldMatchStyle; + MailBlockquoteHandling m_mailBlockquoteHandling; Vector<DictationAlternative> m_dictationAlternatives; }; } // namespace WebCore -#endif // TextEvent_h +SPECIALIZE_TYPE_TRAITS_EVENT(TextEvent) |