diff options
author | Iain Merrick <husky@google.com> | 2010-08-19 17:55:56 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-08-23 11:05:40 +0100 |
commit | f486d19d62f1bc33246748b14b14a9dfa617b57f (patch) | |
tree | 195485454c93125455a30e553a73981c3816144d /WebCore/dom/TextEvent.h | |
parent | 6ba0b43722d16bc295606bec39f396f596e4fef1 (diff) | |
download | external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.zip external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.gz external_webkit-f486d19d62f1bc33246748b14b14a9dfa617b57f.tar.bz2 |
Merge WebKit at r65615 : Initial merge by git.
Change-Id: Ifbf384f4531e3b58475a662e38195c2d9152ae79
Diffstat (limited to 'WebCore/dom/TextEvent.h')
-rw-r--r-- | WebCore/dom/TextEvent.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/WebCore/dom/TextEvent.h b/WebCore/dom/TextEvent.h index 2e2eb95..f1d24e9 100644 --- a/WebCore/dom/TextEvent.h +++ b/WebCore/dom/TextEvent.h @@ -34,10 +34,20 @@ namespace WebCore { class TextEvent : public UIEvent { public: + enum InputType { + InputTypeKeyboard, // any newline characters in the text are line breaks only, not paragraph separators. + InputTypeLineBreak, // any tab characters in the text are backtabs. + InputTypeBackTab, + InputTypePaste, + InputTypeDrop, + }; + + static InputType selectInputType(bool isLineBreak, bool isBackTab); static PassRefPtr<TextEvent> create(); - static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data); + static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data, InputType = InputTypeKeyboard); 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); virtual ~TextEvent(); @@ -47,30 +57,26 @@ namespace WebCore { virtual bool isTextEvent() const; - // If true, any newline characters in the text are line breaks only, not paragraph separators. - bool isLineBreak() const { return m_isLineBreak; } - void setIsLineBreak(bool isLineBreak) { m_isLineBreak = isLineBreak; } - - // If true, any tab characters in the text are backtabs. - bool isBackTab() const { return m_isBackTab; } - void setIsBackTab(bool isBackTab) { m_isBackTab = isBackTab; } + bool isLineBreak() const { return m_inputType == InputTypeLineBreak; } + bool isBackTab() const { return m_inputType == InputTypeBackTab; } + bool isPaste() const { return m_inputType == InputTypePaste; } + bool isDrop() const { return m_inputType == InputTypeDrop; } - bool isPaste() const { return m_isPaste; } bool shouldSmartReplace() const { return m_shouldSmartReplace; } bool shouldMatchStyle() const { return m_shouldMatchStyle; } DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); } private: TextEvent(); - TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment> = 0, - bool isPaste = false, bool shouldSmartReplace = false, bool shouldMatchStyle = false); + TextEvent(PassRefPtr<AbstractView>, const String& data, InputType = InputTypeKeyboard); + TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>, + bool shouldSmartReplace, bool shouldMatchStyle); + + InputType m_inputType; String m_data; - bool m_isLineBreak; - bool m_isBackTab; RefPtr<DocumentFragment> m_pastingFragment; - bool m_isPaste; // FIXME: Should use inputMode after it be available: http://webkit.org/b/42805 bool m_shouldSmartReplace; bool m_shouldMatchStyle; }; |