From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/dom/TextEvent.cpp | 51 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'Source/WebCore/dom/TextEvent.cpp') diff --git a/Source/WebCore/dom/TextEvent.cpp b/Source/WebCore/dom/TextEvent.cpp index cdc668de4..9571d364f 100644 --- a/Source/WebCore/dom/TextEvent.cpp +++ b/Source/WebCore/dom/TextEvent.cpp @@ -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 @@ -28,73 +28,77 @@ #include "TextEvent.h" #include "DocumentFragment.h" +#include "Editor.h" +#include "EventNames.h" namespace WebCore { -PassRefPtr TextEvent::create() +Ref TextEvent::createForBindings() { - return adoptRef(new TextEvent); + return adoptRef(*new TextEvent); } -PassRefPtr TextEvent::create(PassRefPtr view, const String& data, TextEventInputType inputType) +Ref TextEvent::create(DOMWindow* view, const String& data, TextEventInputType inputType) { - return adoptRef(new TextEvent(view, data, inputType)); + return adoptRef(*new TextEvent(view, data, inputType)); } -PassRefPtr TextEvent::createForPlainTextPaste(PassRefPtr view, const String& data, bool shouldSmartReplace) +Ref TextEvent::createForPlainTextPaste(DOMWindow* view, const String& data, bool shouldSmartReplace) { - return adoptRef(new TextEvent(view, data, 0, shouldSmartReplace, false)); + return adoptRef(*new TextEvent(view, data, 0, shouldSmartReplace, false, MailBlockquoteHandling::RespectBlockquote)); } -PassRefPtr TextEvent::createForFragmentPaste(PassRefPtr view, PassRefPtr data, bool shouldSmartReplace, bool shouldMatchStyle) +Ref TextEvent::createForFragmentPaste(DOMWindow* view, RefPtr&& data, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) { - return adoptRef(new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle)); + return adoptRef(*new TextEvent(view, emptyString(), WTFMove(data), shouldSmartReplace, shouldMatchStyle, mailBlockquoteHandling)); } -PassRefPtr TextEvent::createForDrop(PassRefPtr view, const String& data) +Ref TextEvent::createForDrop(DOMWindow* view, const String& data) { - return adoptRef(new TextEvent(view, data, TextEventInputDrop)); + return adoptRef(*new TextEvent(view, data, TextEventInputDrop)); } -PassRefPtr TextEvent::createForDictation(PassRefPtr view, const String& data, const Vector& dictationAlternatives) +Ref TextEvent::createForDictation(DOMWindow* view, const String& data, const Vector& dictationAlternatives) { - return adoptRef(new TextEvent(view, data, dictationAlternatives)); + return adoptRef(*new TextEvent(view, data, dictationAlternatives)); } TextEvent::TextEvent() : m_inputType(TextEventInputKeyboard) , m_shouldSmartReplace(false) , m_shouldMatchStyle(false) + , m_mailBlockquoteHandling(MailBlockquoteHandling::RespectBlockquote) { } -TextEvent::TextEvent(PassRefPtr view, const String& data, TextEventInputType inputType) +TextEvent::TextEvent(DOMWindow* view, const String& data, TextEventInputType inputType) : UIEvent(eventNames().textInputEvent, true, true, view, 0) , m_inputType(inputType) , m_data(data) - , m_pastingFragment(0) , m_shouldSmartReplace(false) , m_shouldMatchStyle(false) + , m_mailBlockquoteHandling(MailBlockquoteHandling::RespectBlockquote) { } -TextEvent::TextEvent(PassRefPtr view, const String& data, PassRefPtr pastingFragment, - bool shouldSmartReplace, bool shouldMatchStyle) +TextEvent::TextEvent(DOMWindow* view, const String& data, RefPtr&& pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle, MailBlockquoteHandling mailBlockquoteHandling) : UIEvent(eventNames().textInputEvent, true, true, view, 0) , m_inputType(TextEventInputPaste) , m_data(data) - , m_pastingFragment(pastingFragment) + , m_pastingFragment(WTFMove(pastingFragment)) , m_shouldSmartReplace(shouldSmartReplace) , m_shouldMatchStyle(shouldMatchStyle) + , m_mailBlockquoteHandling(mailBlockquoteHandling) { } -TextEvent::TextEvent(PassRefPtr view, const String& data, const Vector& dictationAlternatives) +TextEvent::TextEvent(DOMWindow* view, const String& data, const Vector& dictationAlternatives) : UIEvent(eventNames().textInputEvent, true, true, view, 0) , m_inputType(TextEventInputDictation) , m_data(data) , m_shouldSmartReplace(false) , m_shouldMatchStyle(false) + , m_mailBlockquoteHandling(MailBlockquoteHandling::RespectBlockquote) , m_dictationAlternatives(dictationAlternatives) { } @@ -103,7 +107,7 @@ TextEvent::~TextEvent() { } -void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr view, const String& data) +void TextEvent::initTextEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, const String& data) { if (dispatched()) return; @@ -118,4 +122,9 @@ EventInterface TextEvent::eventInterface() const return TextEventInterfaceType; } +bool TextEvent::isTextEvent() const +{ + return true; +} + } // namespace WebCore -- cgit v1.2.1