[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
morrita at google.com
morrita at google.com
Sun Feb 20 23:13:51 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 84a352ad8e2345fd19d3b2c99a04949fb9b9bfa1
Author: morrita at google.com <morrita at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 19 04:11:18 2011 +0000
2011-01-18 MORITA Hajime <morrita at google.com>
Refactoring: EventHandler::handleTextInputEvent should accept an enum instead of bools.
https://bugs.webkit.org/show_bug.cgi?id=52608
No new tests. no behavioral change.
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/TextEvent.cpp:
(WebCore::TextEvent::create):
(WebCore::TextEvent::createForDrop):
(WebCore::TextEvent::TextEvent):
* dom/TextEvent.h:
(WebCore::TextEvent::isLineBreak):
(WebCore::TextEvent::isBackTab):
(WebCore::TextEvent::isPaste):
(WebCore::TextEvent::isDrop):
* dom/TextEventInputType.h: Added. Extracted from TextEvent::TextInputType.
* editing/EditorCommand.cpp:
(WebCore::executeInsertBacktab):
(WebCore::executeInsertLineBreak):
(WebCore::executeInsertNewline):
(WebCore::executeInsertTab):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTextInputEvent):
* page/EventHandler.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 47b95f5..00f1e21 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2011-01-18 MORITA Hajime <morrita at google.com>
+
+ Refactoring: EventHandler::handleTextInputEvent should accept an enum instead of bools.
+ https://bugs.webkit.org/show_bug.cgi?id=52608
+
+ No new tests. no behavioral change.
+
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/TextEvent.cpp:
+ (WebCore::TextEvent::create):
+ (WebCore::TextEvent::createForDrop):
+ (WebCore::TextEvent::TextEvent):
+ * dom/TextEvent.h:
+ (WebCore::TextEvent::isLineBreak):
+ (WebCore::TextEvent::isBackTab):
+ (WebCore::TextEvent::isPaste):
+ (WebCore::TextEvent::isDrop):
+ * dom/TextEventInputType.h: Added. Extracted from TextEvent::TextInputType.
+ * editing/EditorCommand.cpp:
+ (WebCore::executeInsertBacktab):
+ (WebCore::executeInsertLineBreak):
+ (WebCore::executeInsertNewline):
+ (WebCore::executeInsertTab):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleTextInputEvent):
+ * page/EventHandler.h:
+
2011-01-18 Ben Vanik <ben.vanik at gmail.com>
Reviewed by Kenneth Russell.
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index d20e975..247f880 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -1300,6 +1300,7 @@ webcore_sources += \
Source/WebCore/dom/Text.cpp \
Source/WebCore/dom/TextEvent.cpp \
Source/WebCore/dom/TextEvent.h \
+ Source/WebCore/dom/TextEventInputType.h \
Source/WebCore/dom/Text.h \
Source/WebCore/dom/TouchList.h \
Source/WebCore/dom/TransformSource.h \
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 26240b3..06288fc 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -1348,6 +1348,7 @@
'dom/Text.h',
'dom/TextEvent.cpp',
'dom/TextEvent.h',
+ 'dom/TextEventInputType.h',
'dom/Touch.cpp',
'dom/Touch.h',
'dom/TouchEvent.cpp',
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index de12297..a857242 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -1714,6 +1714,7 @@ HEADERS += \
dom/StyleElement.h \
dom/TagNodeList.h \
dom/TextEvent.h \
+ dom/TextEventInputType.h \
dom/Text.h \
dom/Touch.h \
dom/TouchEvent.h \
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index b790472..526bb06 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -46194,6 +46194,10 @@
>
</File>
<File
+ RelativePath="..\dom\TextEventInputType.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\TransformSource.h"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 215f820..df01534 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3179,6 +3179,7 @@
A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979140D6B9D0C003851B9 /* ImageData.h */; };
A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77979240D6B9E64003851B9 /* JSImageData.cpp */; };
A77979290D6B9E64003851B9 /* JSImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979250D6B9E64003851B9 /* JSImageData.h */; };
+ A77B41A012E675A90054343D /* TextEventInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = A77B419F12E675A90054343D /* TextEventInputType.h */; settings = {ATTRIBUTES = (Private, ); }; };
A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; };
A78FE13B12366B1000ACE8D0 /* SpellChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */; };
A78FE13C12366B1000ACE8D0 /* SpellChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A78FE13A12366B1000ACE8D0 /* SpellChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9552,6 +9553,7 @@
A77979150D6B9D0C003851B9 /* ImageData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ImageData.idl; sourceTree = "<group>"; };
A77979240D6B9E64003851B9 /* JSImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImageData.cpp; sourceTree = "<group>"; };
A77979250D6B9E64003851B9 /* JSImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSImageData.h; sourceTree = "<group>"; };
+ A77B419F12E675A90054343D /* TextEventInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEventInputType.h; sourceTree = "<group>"; };
A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; };
A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpellChecker.cpp; sourceTree = "<group>"; };
A78FE13A12366B1000ACE8D0 /* SpellChecker.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = SpellChecker.h; sourceTree = "<group>"; };
@@ -19085,6 +19087,7 @@
933A142B0B7D188600A53FFD /* TextEvent.cpp */,
933A142D0B7D188600A53FFD /* TextEvent.h */,
933A142C0B7D188600A53FFD /* TextEvent.idl */,
+ A77B419F12E675A90054343D /* TextEventInputType.h */,
5DB1BC6810715A6400EFAA49 /* TransformSource.h */,
5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */,
854FE72C0A2297BE0058D7AD /* Traversal.cpp */,
@@ -22145,6 +22148,7 @@
C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */,
B2C3DA490D006C1D00EF6F26 /* TextEncodingRegistry.h in Headers */,
933A14300B7D188600A53FFD /* TextEvent.h in Headers */,
+ A77B41A012E675A90054343D /* TextEventInputType.h in Headers */,
F55B3DD81251F12D003EF269 /* TextFieldInputType.h in Headers */,
93309E18099E64920056E581 /* TextGranularity.h in Headers */,
F55B3DDA1251F12D003EF269 /* TextInputType.h in Headers */,
diff --git a/Source/WebCore/dom/TextEvent.cpp b/Source/WebCore/dom/TextEvent.cpp
index 68ed4b2..b7bd1c8 100644
--- a/Source/WebCore/dom/TextEvent.cpp
+++ b/Source/WebCore/dom/TextEvent.cpp
@@ -31,21 +31,12 @@
namespace WebCore {
-TextEvent::InputType TextEvent::selectInputType(bool isLineBreak, bool isBackTab)
-{
- if (isLineBreak)
- return TextEvent::InputTypeLineBreak;
- if (isBackTab)
- return TextEvent::InputTypeBackTab;
- return TextEvent::InputTypeKeyboard;
-}
-
PassRefPtr<TextEvent> TextEvent::create()
{
return adoptRef(new TextEvent);
}
-PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEvent::InputType inputType)
+PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
{
return adoptRef(new TextEvent(view, data, inputType));
}
@@ -62,17 +53,17 @@ PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView>
PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, const String& data)
{
- return adoptRef(new TextEvent(view, data, TextEvent::InputTypeDrop));
+ return adoptRef(new TextEvent(view, data, TextEventInputDrop));
}
TextEvent::TextEvent()
- : m_inputType(TextEvent::InputTypeKeyboard)
+ : m_inputType(TextEventInputKeyboard)
, m_shouldSmartReplace(false)
, m_shouldMatchStyle(false)
{
}
-TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputType inputType)
+TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
: UIEvent(eventNames().textInputEvent, true, true, view, 0)
, m_inputType(inputType)
, m_data(data)
@@ -85,7 +76,7 @@ TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputTyp
TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment,
bool shouldSmartReplace, bool shouldMatchStyle)
: UIEvent(eventNames().textInputEvent, true, true, view, 0)
- , m_inputType(TextEvent::InputTypePaste)
+ , m_inputType(TextEventInputPaste)
, m_data(data)
, m_pastingFragment(pastingFragment)
, m_shouldSmartReplace(shouldSmartReplace)
diff --git a/Source/WebCore/dom/TextEvent.h b/Source/WebCore/dom/TextEvent.h
index f1d24e9..d770d38 100644
--- a/Source/WebCore/dom/TextEvent.h
+++ b/Source/WebCore/dom/TextEvent.h
@@ -28,23 +28,16 @@
#define TextEvent_h
#include "DocumentFragment.h"
+#include "TextEventInputType.h"
#include "UIEvent.h"
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, InputType = InputTypeKeyboard);
+ 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);
@@ -57,10 +50,10 @@ namespace WebCore {
virtual bool isTextEvent() const;
- 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 isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
+ bool isBackTab() const { return m_inputType == TextEventInputBackTab; }
+ bool isPaste() const { return m_inputType == TextEventInputPaste; }
+ bool isDrop() const { return m_inputType == TextEventInputDrop; }
bool shouldSmartReplace() const { return m_shouldSmartReplace; }
bool shouldMatchStyle() const { return m_shouldMatchStyle; }
@@ -69,11 +62,11 @@ namespace WebCore {
private:
TextEvent();
- TextEvent(PassRefPtr<AbstractView>, const String& data, InputType = InputTypeKeyboard);
+ TextEvent(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>,
bool shouldSmartReplace, bool shouldMatchStyle);
- InputType m_inputType;
+ TextEventInputType m_inputType;
String m_data;
RefPtr<DocumentFragment> m_pastingFragment;
diff --git a/Source/WebCore/dom/TextEventInputType.h b/Source/WebCore/dom/TextEventInputType.h
new file mode 100644
index 0000000..2522ec4
--- /dev/null
+++ b/Source/WebCore/dom/TextEventInputType.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * 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 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 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
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextEventInputType_h
+#define TextEventInputType_h
+
+namespace WebCore {
+
+enum TextEventInputType {
+ TextEventInputKeyboard, // any newline characters in the text are line breaks only, not paragraph separators.
+ TextEventInputLineBreak, // any tab characters in the text are backtabs.
+ TextEventInputBackTab,
+ TextEventInputPaste,
+ TextEventInputDrop,
+};
+
+} // namespace WebCore
+
+#endif // TextEventInputType_h
diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp
index 64993d5..9e5bf9f 100644
--- a/Source/WebCore/editing/EditorCommand.cpp
+++ b/Source/WebCore/editing/EditorCommand.cpp
@@ -477,7 +477,7 @@ static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const Strin
static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource, const String&)
{
- return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, false, true);
+ return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, TextEventInputBackTab);
}
static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value)
@@ -505,7 +505,7 @@ static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSour
{
switch (source) {
case CommandFromMenuOrKeyBinding:
- return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, true);
+ return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, TextEventInputLineBreak);
case CommandFromDOM:
case CommandFromDOMWithUserInterface:
// Doesn't scroll to make the selection visible, or modify the kill ring.
@@ -521,7 +521,7 @@ static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSour
static bool executeInsertNewline(Frame* frame, Event* event, EditorCommandSource, const String&)
{
Frame* targetFrame = WebCore::targetFrame(frame, event);
- return targetFrame->eventHandler()->handleTextInputEvent("\n", event, !targetFrame->editor()->canEditRichly());
+ return targetFrame->eventHandler()->handleTextInputEvent("\n", event, targetFrame->editor()->canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
}
static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorCommandSource, const String&)
@@ -544,7 +544,7 @@ static bool executeInsertParagraph(Frame* frame, Event*, EditorCommandSource, co
static bool executeInsertTab(Frame* frame, Event* event, EditorCommandSource, const String&)
{
- return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, false, false);
+ return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event);
}
static bool executeInsertText(Frame* frame, Event*, EditorCommandSource, const String& value)
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index 8c5330b..54c87e0 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -2647,12 +2647,11 @@ cleanupDrag:
}
#endif // ENABLE(DRAG_SUPPORT)
-bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, bool isLineBreak, bool isBackTab)
+bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, TextEventInputType inputType)
{
// Platforms should differentiate real commands like selectAll from text input in disguise (like insertNewline),
// and avoid dispatching text input events from keydown default handlers.
ASSERT(!underlyingEvent || !underlyingEvent->isKeyboardEvent() || static_cast<KeyboardEvent*>(underlyingEvent)->type() == eventNames().keypressEvent);
- ASSERT(!(isLineBreak && isBackTab));
if (!m_frame)
return false;
@@ -2668,7 +2667,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve
if (FrameView* view = m_frame->view())
view->resetDeferredRepaintDelay();
- RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, TextEvent::selectInputType(isLineBreak, isBackTab));
+ RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inputType);
event->setUnderlyingEvent(underlyingEvent);
ExceptionCode ec;
diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h
index 65695c2..0c18450 100644
--- a/Source/WebCore/page/EventHandler.h
+++ b/Source/WebCore/page/EventHandler.h
@@ -31,6 +31,7 @@
#include "HitTestRequest.h"
#include "PlatformMouseEvent.h"
#include "ScrollTypes.h"
+#include "TextEventInputType.h"
#include "Timer.h"
#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
@@ -173,8 +174,7 @@ public:
bool keyEvent(const PlatformKeyboardEvent&);
void defaultKeyboardEventHandler(KeyboardEvent*);
- bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0,
- bool isLineBreak = false, bool isBackTab = false);
+ bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, TextEventInputType = TextEventInputKeyboard);
void defaultTextInputEventHandler(TextEvent*);
#if ENABLE(DRAG_SUPPORT)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list