2011-01-26 MORITA Hajime <morrita@google.com>
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Feb 2011 08:28:20 +0000 (08:28 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Feb 2011 08:28:20 +0000 (08:28 +0000)
        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        Created new abstract class TextCheckerClient. The class has
        spellcheck related API which is split.
        This is the first step for sharing spell-checking codebase
        between ports. A standalone TextCheckerClient implementation
        should be done in future changes.

        No new tests. No behavioral change.

        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * accessibility/mac/AccessibilityObjectWrapper.mm:
        (AXAttributeStringSetSpelling):
        * editing/Editor.cpp: Replacing some client() call with textChecker().
        (WebCore::Editor::textChecker): Added.
        (WebCore::Editor::ignoreSpelling):
        (WebCore::Editor::learnSpelling):
        (WebCore::Editor::isSelectionMisspelled):
        (WebCore::Editor::guessesForMisspelledSelection):
        (WebCore::Editor::markMisspellingsAfterTypingToWord):
        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
        (WebCore::Editor::correctionPanelTimerFired):
        * editing/Editor.h:
        * editing/SpellChecker.cpp:
        (WebCore::SpellChecker::SpellChecker):
        * editing/TextCheckingHelper.cpp: Replacing some client() call with textChecker().
        (WebCore::TextCheckingHelper::findFirstMisspelling):
        (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
        (WebCore::TextCheckingHelper::findFirstBadGrammar):
        (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange):
        * loader/EmptyClients.h: Added EmptyTextCheckerClient.
        (WebCore::EmptyTextCheckerClient::ignoreWordInSpellDocument):
        (WebCore::EmptyTextCheckerClient::learnWord):
        (WebCore::EmptyTextCheckerClient::checkSpellingOfString):
        (WebCore::EmptyTextCheckerClient::getAutoCorrectSuggestionForMisspelledWord):
        (WebCore::EmptyTextCheckerClient::checkGrammarOfString):
        (WebCore::EmptyTextCheckerClient::checkTextOfParagraph):
        (WebCore::EmptyTextCheckerClient::getGuessesForWord):
        (WebCore::EmptyTextCheckerClient::requestCheckingOfString):
        (WebCore::EmptyEditorClient::textChecker):
        * page/EditorClient.h: Extracted TextCheckerClient.
        * page/Page.h:
        * platform/text/TextCheckerClient.h: Added.
        (WebCore::TextCheckerClient::~TextCheckerClient):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * src/EditorClientImpl.h:
        (WebKit::EditorClientImpl::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/EditorClientEfl.h:
        (WebCore::EditorClientEfl::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/EditorClientGtk.h:
        (WebKit::EditorClient::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/EditorClientHaiku.h:
        (WebCore::EditorClientHaiku::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/WebEditorClient.h:
        (WebEditorClient::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/EditorClientQt.h:
        (WebCore::EditorClientQt::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/WebEditorClient.h:
        (WebEditorClient::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebCoreSupport/EditorClientWinCE.h:
        (WebKit::EditorClientWinCE::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * WebKitSupport/EditorClientWx.h:
        (WebCore::EditorClientWx::textChecker):
2011-01-26  MORITA Hajime  <morrita@google.com>

        Reviewed by Ryosuke Niwa.

        Refactoring: Extract TextCheckerClient from EditorClient
        https://bugs.webkit.org/show_bug.cgi?id=53213

        * Shared/WebCoreArgumentCoders.h:
        * UIProcess/TextChecker.h:
        * WebProcess/WebCoreSupport/WebEditorClient.h:
        (WebKit::WebEditorClient::textChecker):
        * Scripts/webkit2/messages.py: Re-arranged the include file

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@78533 268f45cc-cd09-0410-ab3c-d52691b4dbfc

39 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/SpellChecker.cpp
Source/WebCore/editing/SpellChecker.h
Source/WebCore/editing/TextCheckingHelper.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/EditorClient.h
Source/WebCore/page/Page.h
Source/WebCore/platform/text/TextCheckerClient.h [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/EditorClientImpl.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
Source/WebKit/haiku/ChangeLog
Source/WebKit/haiku/WebCoreSupport/EditorClientHaiku.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebEditorClient.h
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebEditorClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.h
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/EditorClientWx.h
Source/WebKit2/ChangeLog
Source/WebKit2/Scripts/webkit2/messages.py
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/UIProcess/TextChecker.h
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h

index e7a70d5..3a5f4b6 100644 (file)
@@ -1,3 +1,57 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+        
+        Created new abstract class TextCheckerClient. The class has
+        spellcheck related API which is split.
+        This is the first step for sharing spell-checking codebase
+        between ports. A standalone TextCheckerClient implementation
+        should be done in future changes.
+
+        No new tests. No behavioral change.
+
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (AXAttributeStringSetSpelling):
+        * editing/Editor.cpp: Replacing some client() call with textChecker().
+        (WebCore::Editor::textChecker): Added.
+        (WebCore::Editor::ignoreSpelling):
+        (WebCore::Editor::learnSpelling):
+        (WebCore::Editor::isSelectionMisspelled):
+        (WebCore::Editor::guessesForMisspelledSelection):
+        (WebCore::Editor::markMisspellingsAfterTypingToWord):
+        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
+        (WebCore::Editor::correctionPanelTimerFired):
+        * editing/Editor.h:
+        * editing/SpellChecker.cpp:
+        (WebCore::SpellChecker::SpellChecker):
+        * editing/TextCheckingHelper.cpp: Replacing some client() call with textChecker().
+        (WebCore::TextCheckingHelper::findFirstMisspelling):
+        (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
+        (WebCore::TextCheckingHelper::findFirstBadGrammar):
+        (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange):
+        * loader/EmptyClients.h: Added EmptyTextCheckerClient.
+        (WebCore::EmptyTextCheckerClient::ignoreWordInSpellDocument):
+        (WebCore::EmptyTextCheckerClient::learnWord):
+        (WebCore::EmptyTextCheckerClient::checkSpellingOfString):
+        (WebCore::EmptyTextCheckerClient::getAutoCorrectSuggestionForMisspelledWord):
+        (WebCore::EmptyTextCheckerClient::checkGrammarOfString):
+        (WebCore::EmptyTextCheckerClient::checkTextOfParagraph):
+        (WebCore::EmptyTextCheckerClient::getGuessesForWord):
+        (WebCore::EmptyTextCheckerClient::requestCheckingOfString):
+        (WebCore::EmptyEditorClient::textChecker):
+        * page/EditorClient.h: Extracted TextCheckerClient.
+        * page/Page.h:
+        * platform/text/TextCheckerClient.h: Added.
+        (WebCore::TextCheckerClient::~TextCheckerClient):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index 796090a..7e581d6 100644 (file)
@@ -2642,6 +2642,7 @@ webcore_sources += \
        Source/WebCore/platform/text/TextBoundaries.cpp \
        Source/WebCore/platform/text/TextBoundaries.h \
        Source/WebCore/platform/text/TextBreakIterator.h \
+       Source/WebCore/platform/text/TextCheckerClient.h \
        Source/WebCore/platform/text/TextCodec.cpp \
        Source/WebCore/platform/text/TextCodec.h \
        Source/WebCore/platform/text/TextCodecLatin1.cpp \
index 126da38..5d3d165 100644 (file)
             'platform/text/TextBreakIterator.h',
             'platform/text/TextBreakIteratorICU.cpp',
             'platform/text/TextBreakIteratorInternalICU.h',
+            'platform/text/TextCheckerClient.h',
             'platform/text/TextCodec.cpp',
             'platform/text/TextCodec.h',
             'platform/text/TextCodecICU.cpp',
index 1ff5e7b..880bae3 100644 (file)
@@ -2070,6 +2070,7 @@ HEADERS += \
     page/DragController.h \
     page/EventHandler.h \
     page/EventSource.h \
+    page/EditorClient.h \
     page/FocusController.h \
     page/Frame.h \
     page/FrameTree.h \
@@ -2193,6 +2194,7 @@ HEADERS += \
     platform/KURL.h \
     platform/Length.h \
     platform/text/LineEnding.h \
+    platform/text/TextCheckerClient.h \
     platform/LinkHash.h \
     platform/Logging.h \
     platform/Language.h \
index 3fc7c70..7a08aaa 100755 (executable)
                                        RelativePath="..\platform\text\TextCodecUTF16.h"
                                        >
                                </File>
+                                       RelativePath="..\platform\text\TextCheckerClient.h"
+                                       >
+                               </File>
+                               <File
                                <File
                                        RelativePath="..\platform\text\TextDirection.h"
                                        >
index 0375a48..4f06dbc 100644 (file)
                A7D3C5240B576B4B002CA450 /* PasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5230B576B4B002CA450 /* PasteboardHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A7D6B3490F61104500B79FD1 /* WorkerScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */; };
                A7D6B34A0F61104500B79FD1 /* WorkerScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */; };
+               A7151BD812F1558F005A0F64 /* TextCheckerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A7151BD712F1558F005A0F64 /* TextCheckerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A7DBF8DD1276919C006B6008 /* TextCheckingHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7DBF8DB1276919C006B6008 /* TextCheckingHelper.cpp */; };
                A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DBF8DC1276919C006B6008 /* TextCheckingHelper.h */; };
                A7F338A311C0EFCA00A320A7 /* ShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */; };
                A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BindingSecurityBase.cpp; path = generic/BindingSecurityBase.cpp; sourceTree = "<group>"; };
                A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingSecurityBase.h; path = generic/BindingSecurityBase.h; sourceTree = "<group>"; };
                A622A8F9122C44A600A785B3 /* GenericBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericBinding.h; path = generic/GenericBinding.h; sourceTree = "<group>"; };
+               A7151BD712F1558F005A0F64 /* TextCheckerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerClient.h; sourceTree = "<group>"; };
                A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
                A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
                A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; };
                                B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */,
                                B2C3DA070D006C1D00EF6F26 /* TextBreakIteratorICU.cpp */,
                                B2C3DA080D006C1D00EF6F26 /* TextBreakIteratorInternalICU.h */,
+                               A7151BD712F1558F005A0F64 /* TextCheckerClient.h */,
                                B2C3DA090D006C1D00EF6F26 /* TextCodec.cpp */,
                                B2C3DA0A0D006C1D00EF6F26 /* TextCodec.h */,
                                B2C3DA0B0D006C1D00EF6F26 /* TextCodecICU.cpp */,
                                B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */,
                                B2C3DA360D006C1D00EF6F26 /* TextBreakIterator.h in Headers */,
                                B2C3DA380D006C1D00EF6F26 /* TextBreakIteratorInternalICU.h in Headers */,
+                               A7151BD812F1558F005A0F64 /* TextCheckerClient.h in Headers */,
                                A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */,
                                B2C3DA3A0D006C1D00EF6F26 /* TextCodec.h in Headers */,
                                B2C3DA3C0D006C1D00EF6F26 /* TextCodecICU.h in Headers */,
index 8fe3a49..a5de358 100644 (file)
@@ -42,7 +42,6 @@
 #import "AccessibilityTableRow.h"
 #import "AccessibilityTableColumn.h"
 #import "ColorMac.h"
-#import "EditorClient.h"
 #import "Frame.h"
 #import "FrameLoaderClient.h"
 #import "HTMLAnchorElement.h"
@@ -58,6 +57,7 @@
 #import "ScrollView.h"
 #import "SelectionController.h"
 #import "SimpleFontData.h"
+#import "TextCheckerClient.h"
 #import "TextIterator.h"
 #import "WebCoreFrameView.h"
 #import "WebCoreObjCExtras.h"
@@ -480,14 +480,14 @@ static void AXAttributeStringSetBlockquoteLevel(NSMutableAttributedString* attrS
 static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, Node* node, const UChar* chars, int charLength, NSRange range)
 {
     // Check the spelling directly since document->markersForNode() does not store the misspelled marking when the cursor is in a word.
-    EditorClient* client = node->document()->page()->editorClient();
     int currentPosition = 0;
     while (charLength > 0) {
         const UChar* charData = chars + currentPosition;
+        TextCheckerClient* checker = node->document()->frame()->editor()->textChecker();
 
         int misspellingLocation = -1;
         int misspellingLength = 0;
-        client->checkSpellingOfString(charData, charLength, &misspellingLocation, &misspellingLength);
+        checker->checkSpellingOfString(charData, charLength, &misspellingLocation, &misspellingLength);
         if (misspellingLocation == -1 || !misspellingLength)
             break;
         
index 99624b3..fbf0611 100644 (file)
@@ -64,6 +64,7 @@
 #include "NodeList.h"
 #include "Page.h"
 #include "Pasteboard.h"
+#include "TextCheckerClient.h"
 #include "TextCheckingHelper.h"
 #include "RemoveFormatCommand.h"
 #include "RenderBlock.h"
@@ -171,6 +172,14 @@ EditorClient* Editor::client() const
     return 0;
 }
 
+
+TextCheckerClient* Editor::textChecker() const
+{
+    if (EditorClient* owner = client())
+        return owner->textChecker();
+    return 0;
+}
+
 void Editor::handleKeyboardEvent(KeyboardEvent* event)
 {
     if (EditorClient* c = client())
@@ -1150,7 +1159,7 @@ Editor::Editor(Frame* frame)
     // This is off by default, since most editors want this behavior (this matches IE but not FF).
     , m_shouldStyleWithCSS(false)
     , m_killRing(adoptPtr(new KillRing))
-    , m_spellChecker(new SpellChecker(frame, frame->page() ? frame->page()->editorClient() : 0))
+    , m_spellChecker(new SpellChecker(frame, frame->page() ? frame->page()->editorClient()->textChecker() : 0))
     , m_correctionPanelTimer(this, &Editor::correctionPanelTimerFired)
     , m_areMarkedTextMatchesHighlighted(false)
 {
@@ -1746,7 +1755,7 @@ void Editor::ignoreSpelling()
 
     String text = selectedText();
     ASSERT(text.length());
-    client()->ignoreWordInSpellDocument(text);
+    textChecker()->ignoreWordInSpellDocument(text);
 }
 
 void Editor::learnSpelling()
@@ -1759,7 +1768,7 @@ void Editor::learnSpelling()
 
     String text = selectedText();
     ASSERT(text.length());
-    client()->learnWord(text);
+    textChecker()->learnWord(text);
 }
 
 void Editor::advanceToNextMisspelling(bool startBeforeSelection)
@@ -1949,7 +1958,7 @@ bool Editor::isSelectionMisspelled()
     
     int misspellingLocation = -1;
     int misspellingLength = 0;
-    client()->checkSpellingOfString(selectedString.characters(), length, &misspellingLocation, &misspellingLength);
+    textChecker()->checkSpellingOfString(selectedString.characters(), length, &misspellingLocation, &misspellingLength);
     
     // The selection only counts as misspelled if the selected text is exactly one misspelled word
     if (misspellingLength != length)
@@ -1993,7 +2002,7 @@ Vector<String> Editor::guessesForMisspelledSelection()
 
     Vector<String> guesses;
     if (client())
-        client()->getGuessesForWord(selectedString, String(), guesses);
+        textChecker()->getGuessesForWord(selectedString, String(), guesses);
     return guesses;
 }
 
@@ -2125,7 +2134,7 @@ void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart,
     
     // Get the misspelled word.
     const String misspelledWord = plainText(misspellingRange.get());
-    String autocorrectedString = client()->getAutoCorrectSuggestionForMisspelledWord(misspelledWord);
+    String autocorrectedString = textChecker()->getAutoCorrectSuggestionForMisspelledWord(misspelledWord);
 
     // If autocorrected word is non empty, replace the misspelled word by this word.
     if (!autocorrectedString.isEmpty()) {
@@ -2296,7 +2305,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
         if (shouldMarkSpelling && isAutomaticSpellingCorrectionEnabled())
             checkingTypes |= TextCheckingTypeCorrection;
     }
-    client()->checkTextOfParagraph(paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
+    textChecker()->checkTextOfParagraph(paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
 
 #if SUPPORT_AUTOCORRECTION_PANEL
     // If this checking is only for showing correction panel, we shouldn't bother to mark misspellings.
@@ -2510,7 +2519,7 @@ void Editor::correctionPanelTimerFired(Timer<Editor>*)
             break;
         String paragraphText = plainText(TextCheckingParagraph(m_correctionPanelInfo.rangeToBeReplaced).paragraphRange().get());
         Vector<String> suggestions;
-        client()->getGuessesForWord(m_correctionPanelInfo.replacedString, paragraphText, suggestions);
+        textChecker()->getGuessesForWord(m_correctionPanelInfo.replacedString, paragraphText, suggestions);
         if (suggestions.isEmpty()) {
             m_correctionPanelInfo.rangeToBeReplaced.clear();
             break;
@@ -3533,5 +3542,4 @@ bool Editor::selectionStartHasSpellingMarkerFor(int from, int length) const
     return false;
 }
 
-
 } // namespace WebCore
index 0a06a4a..01da7bd 100644 (file)
@@ -61,6 +61,7 @@ class Pasteboard;
 class SimpleFontData;
 class SpellChecker;
 class Text;
+class TextCheckerClient;
 class TextEvent;
 
 struct CompositionUnderline {
@@ -83,6 +84,8 @@ public:
     ~Editor();
 
     EditorClient* client() const;
+    TextCheckerClient* textChecker() const;
+
     Frame* frame() const { return m_frame; }
     DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); }
     EditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
index f14a74d..7988e41 100644 (file)
 #include "Range.h"
 #include "RenderObject.h"
 #include "Settings.h"
+#include "TextCheckerClient.h"
 #include "TextIterator.h"
 #include "htmlediting.h"
 
 namespace WebCore {
 
-SpellChecker::SpellChecker(Frame* frame, EditorClient* client)
+SpellChecker::SpellChecker(Frame* frame, TextCheckerClient* client)
     : m_frame(frame)
     , m_client(client)
     , m_requestSequence(0)
index 81bb519..d3940e5 100644 (file)
@@ -31,7 +31,7 @@
 
 namespace WebCore {
 
-class EditorClient;
+class TextCheckerClient;
 class Frame;
 class Node;
 
@@ -57,7 +57,7 @@ private:
 class SpellChecker {
     WTF_MAKE_NONCOPYABLE(SpellChecker);
 public:
-    explicit SpellChecker(Frame*, EditorClient*);
+    explicit SpellChecker(Frame*, TextCheckerClient*);
     ~SpellChecker();
 
     bool isAsynchronousEnabled() const;
@@ -73,7 +73,7 @@ private:
     void clearRequest();
 
     Frame* m_frame;
-    EditorClient* m_client;
+    TextCheckerClient* m_client;
 
     RefPtr<Node> m_requestNode;
     String m_requestText;
index b4429a6..e5553fd 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "DocumentMarkerController.h"
 #include "Range.h"
+#include "TextCheckerClient.h"
 #include "TextIterator.h"
 #include "VisiblePosition.h"
 #include "visible_units.h"
@@ -179,7 +180,7 @@ String TextCheckingHelper::findFirstMisspelling(int& firstMisspellingOffset, boo
             
             int misspellingLocation = -1;
             int misspellingLength = 0;
-            m_client->checkSpellingOfString(chars, len, &misspellingLocation, &misspellingLength);
+            m_client->textChecker()->checkSpellingOfString(chars, len, &misspellingLocation, &misspellingLength);
 
             // 5490627 shows that there was some code path here where the String constructor below crashes.
             // We don't know exactly what combination of bad input caused this, so we're making this much
@@ -274,7 +275,7 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
                 
                 Vector<TextCheckingResult> results;
                 uint64_t checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
-                m_client->checkTextOfParagraph(paragraphString.characters(), paragraphString.length(), checkingTypes, results);
+                m_client->textChecker()->checkTextOfParagraph(paragraphString.characters(), paragraphString.length(), checkingTypes, results);
                 
                 for (unsigned i = 0; i < results.size(); i++) {
                     const TextCheckingResult* result = &results[i];
@@ -422,7 +423,7 @@ String TextCheckingHelper::findFirstBadGrammar(GrammarDetail& outGrammarDetail,
         Vector<GrammarDetail> grammarDetails;
         int badGrammarPhraseLocation = -1;
         int badGrammarPhraseLength = 0;
-        m_client->checkGrammarOfString(paragraph.textCharacters() + startOffset, paragraph.textLength() - startOffset, grammarDetails, &badGrammarPhraseLocation, &badGrammarPhraseLength);
+        m_client->textChecker()->checkGrammarOfString(paragraph.textCharacters() + startOffset, paragraph.textLength() - startOffset, grammarDetails, &badGrammarPhraseLocation, &badGrammarPhraseLength);
         
         if (!badGrammarPhraseLength) {
             ASSERT(badGrammarPhraseLocation == -1);
@@ -535,14 +536,14 @@ Vector<String> TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange(bool
 
     Vector<TextCheckingResult> results;
     uint64_t checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
-    m_client->checkTextOfParagraph(paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
+    m_client->textChecker()->checkTextOfParagraph(paragraph.textCharacters(), paragraph.textLength(), checkingTypes, results);
     
     for (unsigned i = 0; i < results.size(); i++) {
         const TextCheckingResult* result = &results[i];
         if (result->type == TextCheckingTypeSpelling && paragraph.checkingRangeMatches(result->location, result->length)) {
             String misspelledWord = paragraph.checkingSubstring();
             ASSERT(misspelledWord.length());
-            m_client->getGuessesForWord(misspelledWord, String(), guesses);
+            m_client->textChecker()->getGuessesForWord(misspelledWord, String(), guesses);
             m_client->updateSpellingUIWithMisspelledWord(misspelledWord);
             misspelled = true;
             return guesses;
index 2fccc65..4cf27db 100644 (file)
@@ -37,6 +37,7 @@
 #include "DragClient.h"
 #include "EditCommand.h"
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 #include "FloatRect.h"
 #include "FocusDirection.h"
 #include "FrameLoaderClient.h"
@@ -395,6 +396,22 @@ public:
     virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext() { return PassRefPtr<FrameNetworkingContext>(); }
 };
 
+class EmptyTextCheckerClient : public TextCheckerClient {
+public:
+    virtual void ignoreWordInSpellDocument(const String&) { }
+    virtual void learnWord(const String&) { }
+    virtual void checkSpellingOfString(const UChar*, int, int*, int*) { }
+    virtual String getAutoCorrectSuggestionForMisspelledWord(const String&) { return String(); }
+    virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) { }
+
+#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+    virtual void checkTextOfParagraph(const UChar*, int, uint64_t, Vector<TextCheckingResult>&) { };
+#endif
+
+    virtual void getGuessesForWord(const String&, const String&, Vector<String>&) { }
+    virtual void requestCheckingOfString(SpellChecker*, int, const String&) { }
+};
+
 class EmptyEditorClient : public EditorClient {
     WTF_MAKE_NONCOPYABLE(EmptyEditorClient); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -489,14 +506,8 @@ public:
     virtual bool isAutomaticSpellingCorrectionEnabled() { return false; }
     virtual void toggleAutomaticSpellingCorrection() { }
 #endif
-    virtual void ignoreWordInSpellDocument(const String&) { }
-    virtual void learnWord(const String&) { }
-    virtual void checkSpellingOfString(const UChar*, int, int*, int*) { }
-    virtual String getAutoCorrectSuggestionForMisspelledWord(const String&) { return String(); }
-    virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) { }
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-    virtual void checkTextOfParagraph(const UChar*, int, uint64_t, Vector<TextCheckingResult>&) { };
-#endif
+    TextCheckerClient* textChecker() { return &m_textCheckerClient; }
+
 #if SUPPORT_AUTOCORRECTION_PANEL
     virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect&, const String&, const String&, const Vector<String>&, Editor*) { }
     virtual void dismissCorrectionPanel(ReasonForDismissingCorrectionPanel) { }
@@ -506,10 +517,12 @@ public:
     virtual void updateSpellingUIWithMisspelledWord(const String&) { }
     virtual void showSpellingUI(bool) { }
     virtual bool spellingUIIsShowing() { return false; }
-    virtual void getGuessesForWord(const String&, const String&, Vector<String>&) { }
+
     virtual void willSetInputMethodState() { }
     virtual void setInputMethodState(bool) { }
-    virtual void requestCheckingOfString(SpellChecker*, int, const String&) { }
+
+private:
+    EmptyTextCheckerClient m_textCheckerClient;
 };
 
 #if ENABLE(CONTEXT_MENUS)
index 1e5444e..692bd5d 100644 (file)
@@ -58,6 +58,7 @@ namespace WebCore {
 class ArchiveResource;
 class CSSStyleDeclaration;
 class DocumentFragment;
+class GrammarDetail;
 class EditCommand;
 class Editor;
 class Element;
@@ -67,34 +68,10 @@ class KeyboardEvent;
 class Node;
 class Range;
 class SpellChecker;
+class TextCheckerClient;
 class VisibleSelection;
 class VisiblePosition;
 
-struct GrammarDetail {
-    int location;
-    int length;
-    Vector<String> guesses;
-    String userDescription;
-};
-
-enum TextCheckingType {
-    TextCheckingTypeSpelling    = 1 << 1,
-    TextCheckingTypeGrammar     = 1 << 2,
-    TextCheckingTypeLink        = 1 << 5,
-    TextCheckingTypeQuote       = 1 << 6,
-    TextCheckingTypeDash        = 1 << 7,
-    TextCheckingTypeReplacement = 1 << 8,
-    TextCheckingTypeCorrection  = 1 << 9
-};
-
-struct TextCheckingResult {
-    TextCheckingType type;
-    int location;
-    int length;
-    Vector<GrammarDetail> details;
-    String replacement;
-};
 class EditorClient {
 public:
     virtual ~EditorClient() {  }
@@ -180,14 +157,7 @@ public:
     virtual void toggleAutomaticSpellingCorrection() = 0;
 #endif
 
-    virtual void ignoreWordInSpellDocument(const String&) = 0;
-    virtual void learnWord(const String&) = 0;
-    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
-    virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) = 0;
-    virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
-#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
-    virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) = 0;
-#endif
+    virtual TextCheckerClient* textChecker() = 0;
 
 #if SUPPORT_AUTOCORRECTION_PANEL
     virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, const Vector<String>& alternativeReplacementStrings, Editor*) = 0;
@@ -199,11 +169,8 @@ public:
     virtual void updateSpellingUIWithMisspelledWord(const String&) = 0;
     virtual void showSpellingUI(bool show) = 0;
     virtual bool spellingUIIsShowing() = 0;
-    // For spellcheckers that support multiple languages, it's often important to be able to identify the language in order to provide more accurate correction suggestions. Caller can pass in more text in "context" to aid such spellcheckers on language identification. Noramlly it's the text surrounding the "word" for which we are getting correction suggestions.
-    virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) = 0;
     virtual void willSetInputMethodState() = 0;
     virtual void setInputMethodState(bool enabled) = 0;
-    virtual void requestCheckingOfString(SpellChecker*, int, const String&) = 0;
 };
 
 }
index 071b142..5e5cbaf 100644 (file)
@@ -75,7 +75,6 @@ namespace WebCore {
     class SharedGraphicsContext3D;
     class SpeechInput;
     class SpeechInputClient;
-
 #if ENABLE(DOM_STORAGE)
     class StorageNamespace;
 #endif
diff --git a/Source/WebCore/platform/text/TextCheckerClient.h b/Source/WebCore/platform/text/TextCheckerClient.h
new file mode 100644 (file)
index 0000000..acaa02c
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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 THE COPYRIGHT
+ * OWNER 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 TextCheckerClient_h
+#define TextCheckerClient_h
+
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class SpellChecker;
+
+struct GrammarDetail {
+    int location;
+    int length;
+    Vector<String> guesses;
+    String userDescription;
+};
+
+enum TextCheckingType {
+    TextCheckingTypeSpelling    = 1 << 1,
+    TextCheckingTypeGrammar     = 1 << 2,
+    TextCheckingTypeLink        = 1 << 5,
+    TextCheckingTypeQuote       = 1 << 6,
+    TextCheckingTypeDash        = 1 << 7,
+    TextCheckingTypeReplacement = 1 << 8,
+    TextCheckingTypeCorrection  = 1 << 9
+};
+
+struct TextCheckingResult {
+    TextCheckingType type;
+    int location;
+    int length;
+    Vector<GrammarDetail> details;
+    String replacement;
+};
+
+class TextCheckerClient {
+public:
+    virtual ~TextCheckerClient() {}
+
+    virtual void ignoreWordInSpellDocument(const String&) = 0;
+    virtual void learnWord(const String&) = 0;
+    virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) = 0;
+    virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) = 0;
+    virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
+#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+    virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) = 0;
+#endif
+
+    // For spellcheckers that support multiple languages, it's often important to be able to identify the language in order to
+    // provide more accurate correction suggestions. Caller can pass in more text in "context" to aid such spellcheckers on language
+    // identification. Noramlly it's the text surrounding the "word" for which we are getting correction suggestions.
+    virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) = 0;
+    virtual void requestCheckingOfString(SpellChecker*, int, const String&) = 0;
+};
+
+}
+
+#endif // TextCheckerClient_h
index bfd0227..2ebe255 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * src/EditorClientImpl.h:
+        (WebKit::EditorClientImpl::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index d74235b..8b39a38 100644 (file)
@@ -32,6 +32,7 @@
 #define EditorClientImpl_h
 
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 #include "Timer.h"
 #include <wtf/Deque.h>
 
@@ -43,7 +44,7 @@ class SpellChecker;
 namespace WebKit {
 class WebViewImpl;
 
-class EditorClientImpl : public WebCore::EditorClient {
+class EditorClientImpl : public WebCore::EditorClient, public WebCore::TextCheckerClient {
 public:
     EditorClientImpl(WebViewImpl* webView);
 
@@ -116,6 +117,8 @@ public:
     virtual void setInputMethodState(bool enabled);
     virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&);
 
+    virtual WebCore::TextCheckerClient* textChecker() { return this; }
+
     // Shows the form autofill popup for |node| if it is an HTMLInputElement and
     // it is empty.  This is called when you press the up or down arrow in a
     // text-field or when clicking an already focused text-field.
index d656e1e..018bc34 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/EditorClientEfl.h:
+        (WebCore::EditorClientEfl::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index fd25944..6e79d44 100644 (file)
@@ -34,6 +34,7 @@
 #define EditorClientEfl_h
 
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 
 #include <wtf/Forward.h>
 
@@ -42,7 +43,7 @@ typedef struct _Evas_Object Evas_Object;
 namespace WebCore {
 class Page;
 
-class EditorClientEfl : public EditorClient {
+class EditorClientEfl : public EditorClient, public TextCheckerClient {
 public:
     EditorClientEfl(Evas_Object *view);
     ~EditorClientEfl();
@@ -116,6 +117,7 @@ public:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool enabled);
     virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {}
+    virtual TextCheckerClient* textChecker() { return this; }
 
 private:
     Evas_Object *m_view;
index 5a776d7..ca4c82e 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/EditorClientGtk.h:
+        (WebKit::EditorClient::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index 8ae123d..279474e 100644 (file)
@@ -32,6 +32,7 @@
 #define EditorClientGtk_h
 
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
@@ -47,7 +48,7 @@ class KeyboardEvent;
 
 namespace WebKit {
 
-    class EditorClient : public WebCore::EditorClient {
+class EditorClient : public WebCore::EditorClient,  public WebCore::TextCheckerClient {
     protected:
         bool m_isInRedo;
 
@@ -122,6 +123,8 @@ namespace WebKit {
         virtual void textWillBeDeletedInTextField(WebCore::Element*);
         virtual void textDidChangeInTextArea(WebCore::Element*);
 
+        virtual WebCore::TextCheckerClient* textChecker() { return this; }
+
         virtual void ignoreWordInSpellDocument(const WTF::String&);
         virtual void learnWord(const WTF::String&);
         virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
index fc5285a..995743d 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/EditorClientHaiku.h:
+        (WebCore::EditorClientHaiku::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index 4b28a84..fc7cfa4 100644 (file)
@@ -32,6 +32,7 @@
 #define EditorClientHaiku_H
 
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 #include "RefCounted.h"
 #include "Page.h"
 
@@ -40,7 +41,7 @@
 
 namespace WebCore {
 
-    class EditorClientHaiku : public EditorClient {
+class EditorClientHaiku : public EditorClient, public TextCheckerClient {
     public:
         EditorClientHaiku();
         void setPage( Page* page );
@@ -113,6 +114,7 @@ namespace WebCore {
         virtual void willSetInputMethodState();
         virtual void setInputMethodState(bool enabled);
         virtual void requestCheckingOfString(SpellChecker*, int, const String&) {}
+        virtual TextCheckerClient* textChecker() { return this; }
 
         bool isEditing() const;
 
index 18fe235..df355e2 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index 211ed3b..61b426c 100644 (file)
@@ -29,6 +29,7 @@
 
 #import <WebCore/Editor.h>
 #import <WebCore/EditorClient.h>
+#import <WebCore/TextCheckerClient.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/Forward.h>
 #import <wtf/Vector.h>
@@ -36,7 +37,7 @@
 @class WebView;
 @class WebEditorUndoTarget;
 
-class WebEditorClient : public WebCore::EditorClient {
+class WebEditorClient : public WebCore::EditorClient, public WebCore::TextCheckerClient {
 public:
     WebEditorClient(WebView *);
     virtual ~WebEditorClient();
@@ -98,6 +99,8 @@ public:
     virtual void toggleAutomaticSpellingCorrection();
 #endif
 
+    TextCheckerClient* textChecker() { return this; }
+
     virtual void respondToChangedContents();
     virtual void respondToChangedSelection();
 
index c127cd6..d57e35b 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/EditorClientQt.h:
+        (WebCore::EditorClientQt::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index c79a3a2..8d960aa 100644 (file)
@@ -31,6 +31,7 @@
 #define EditorClientQt_h
 
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 #include "RefCounted.h"
 
 #include <wtf/Forward.h>
@@ -39,7 +40,7 @@ class QWebPage;
 
 namespace WebCore {
 
-class EditorClientQt : public EditorClient {
+class EditorClientQt : public EditorClient, public TextCheckerClient {
 public:
     EditorClientQt(QWebPage* page);
     
@@ -110,6 +111,7 @@ public:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool enabled);
     virtual void requestCheckingOfString(SpellChecker*, int, const String&) {}
+    virtual TextCheckerClient* textChecker() { return this; }
 
     bool isEditing() const;
 
index dd2f349..1cfcd5b 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index de68660..8de8bf0 100644 (file)
@@ -29,6 +29,7 @@
 #include "WebKit.h"
 #pragma warning(push, 0)
 #include <WebCore/EditorClient.h>
+#include <WebCore/TextCheckerClient.h>
 #include <wtf/OwnPtr.h>
 #pragma warning(pop)
 
@@ -36,7 +37,7 @@ class WebView;
 class WebNotification;
 class WebEditorUndoTarget;
 
-class WebEditorClient : public WebCore::EditorClient {
+class WebEditorClient : public WebCore::EditorClient, public WebCore::TextCheckerClient {
 public:
     WebEditorClient(WebView*);
     ~WebEditorClient();
@@ -114,6 +115,7 @@ public:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool);
     virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {}
+    virtual WebCore::TextCheckerClient* textChecker() { return this; }
 
 private:
     WebView* m_webView;
index dd1c3f7..744b33c 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebCoreSupport/EditorClientWinCE.h:
+        (WebKit::EditorClientWinCE::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index f360caf..6122822 100644 (file)
 #define EditorClientWinCE_h
 
 #include "EditorClient.h"
+#include "TextCheckerClient.h"
 
 class WebView;
 
 namespace WebKit {
 
-class EditorClientWinCE : public WebCore::EditorClient {
+class EditorClientWinCE : public WebCore::EditorClient, public WebCore::TextCheckerClient {
 public:
     EditorClientWinCE(WebView*);
     ~EditorClientWinCE();
@@ -103,6 +104,7 @@ public:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool);
     virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {}
+    virtual WebCore::TextCheckerClient* textChecker() { return this; }
 
 private:
     WebView* m_webView;
index 5ebf645..ed417db 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * WebKitSupport/EditorClientWx.h:
+        (WebCore::EditorClientWx::textChecker):
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index b299c65..d23345b 100644 (file)
 
 #include "EditorClient.h"
 #include "Page.h"
+#include "TextCheckerClient.h"
 
 #include "WebView.h"
 #include "WebFrame.h"
 
 namespace WebCore {
 
-class EditorClientWx : public EditorClient {
+class EditorClientWx : public EditorClient, public TextCheckerClient {
 friend class ::wxWebView;
 friend class ::wxWebFrame;
 
@@ -115,6 +116,7 @@ public:
     virtual void willSetInputMethodState();
     virtual void setInputMethodState(bool enabled);
     virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {}
+    virtual TextCheckerClient* textChecker() { return this; }
 
 private:
     Page* m_page;
index aeb7983..3c30692 100644 (file)
@@ -1,3 +1,16 @@
+2011-01-26  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring: Extract TextCheckerClient from EditorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53213
+
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/TextChecker.h:
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+        (WebKit::WebEditorClient::textChecker):
+        * Scripts/webkit2/messages.py: Re-arranged the include file
+
 2011-02-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Adam Barth.
index 800dc39..f847869 100644 (file)
@@ -424,7 +424,7 @@ def headers_for_type(type):
         'WebCore::CompositionUnderline': '<WebCore/Editor.h>',
         'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>',
         'WebCore::PluginInfo': '<WebCore/PluginData.h>',
-        'WebCore::TextCheckingResult': '<WebCore/EditorClient.h>',
+        'WebCore::TextCheckingResult': '<WebCore/TextCheckerClient.h>',
         'WebKit::WebGestureEvent': '"WebEvent.h"',
         'WebKit::WebKeyboardEvent': '"WebEvent.h"',
         'WebKit::WebMouseEvent': '"WebEvent.h"',
index 62c68c7..e7802c3 100644 (file)
@@ -43,6 +43,7 @@
 #include <WebCore/ProtectionSpace.h>
 #include <WebCore/ResourceError.h>
 #include <WebCore/ResourceRequest.h>
+#include <WebCore/TextCheckerClient.h>
 #include <WebCore/ViewportArguments.h>
 #include <WebCore/WindowFeatures.h>
 #include <limits>
index fc347fe..9997d8b 100644 (file)
@@ -27,6 +27,7 @@
 #define TextChecker_h
 
 #include <WebCore/EditorClient.h>
+#include <WebCore/TextCheckerClient.h>
 
 namespace WebKit {
 
index 7ac813e..982baf3 100644 (file)
 #define WebEditorClient_h
 
 #include <WebCore/EditorClient.h>
+#include <WebCore/TextCheckerClient.h>
 
 namespace WebKit {
 
 class WebPage;
 
-class WebEditorClient : public WebCore::EditorClient {
+class WebEditorClient : public WebCore::EditorClient, public WebCore::TextCheckerClient {
 public:
     WebEditorClient(WebPage* page)
         : m_page(page)
@@ -122,6 +123,8 @@ private:
     virtual void toggleAutomaticSpellingCorrection();
 #endif
 
+    TextCheckerClient* textChecker() { return this; }
+
     virtual void ignoreWordInSpellDocument(const String&);
     virtual void learnWord(const String&);
     virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);