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 e7a70d58102619adfac8829b7c01b3b925f43028..3a5f4b6272701cb8d8aef56b05fa4bca91b62bf4 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 796090a5701af9537220918920f501023b751354..7e581d6814936dd345851b70d7680c3c2c4df368 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 126da3854463acebe2f22925c406820b2ace8011..5d3d1652297f1f462d98a3fcb72ef1b9adbd80e2 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 1ff5e7bc054657059c92ced2cb385c2055a97364..880bae3c353d5c555187af68902575d119b07b44 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 3fc7c70547d512bf1e7b1ab16d03bd230db79b55..7a08aaa560ec59efa532383bb397e4c4e9ed740c 100755 (executable)
                                        RelativePath="..\platform\text\TextCodecUTF16.h"
                                        >
                                </File>
+                                       RelativePath="..\platform\text\TextCheckerClient.h"
+                                       >
+                               </File>
+                               <File
                                <File
                                        RelativePath="..\platform\text\TextDirection.h"
                                        >
index 0375a48274c1711475d67ab49f4bc143d0d69ff1..4f06dbc21bd202255df58b31ebba47386c3f34ea 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 8fe3a4998a250095c4e1f0edaaf76a75fa81dd52..a5de3585e0ee026f9a00e739e9c9d5dd9386210b 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 99624b32b42fd077f3dc2a6f9c47a42e06c77e75..fbf0611f9588871e7ec2ef0faf62b0cff609e5c6 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 0a06a4aff6c7e4b925207984135a3b96bd7c0534..01da7bde058cc15b7c60a39566263ddf512c1c4f 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 f14a74d67643f2787c40e41780b7c771a1398a03..7988e41610a519b6a5cb2630c610ebea8fae5f21 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 81bb519bfc1790477a5abf13c6c57c77e0126c8b..d3940e504faa46a965c73804b59cf711f76dcbf8 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 b4429a646fbc6bf692383188ede1672271be3aaa..e5553fd10292fe587f0e2330d165e8e17728e41d 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 2fccc656abcda18d7d2d05e4ebeb31725e75e5c3..4cf27dbba8235a6fe4348dad5b91e4f3e6343470 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 1e5444efa471599361a1e9464adc36fd778d3ddf..692bd5dd884be14861228114ad55075b6d208fea 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 071b1427d6d77cf90bff5c004cd829fe33300a32..5e5cbaff2600fbfb409b67bbaacd654dc6d9abf4 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 bfd0227d68caca51e183178cd97a7f1bf2518b81..2ebe25504432c020b2ecde7f93bdee7100137ddb 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 d74235bb0747f902afab91595e0a934d757567d8..8b39a383ed65cadaf283792d0d461e6b7d62f878 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 d656e1e956e2421c034ad031c05515572181908f..018bc3474f996a0edb0d5a54c8e661ba0696d600 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 fd259440acc95ab4674b4ab75705f2130313c1f9..6e79d44ff9908ef69c8e6981987251e03fc92a19 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 5a776d7c3e3d82e98e2ed0468b9ad6e01db9f222..ca4c82e602c544f82efc3fbe431653eef2ca6f76 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 8ae123d66d7f325792be7acc6b1cb799b30d5418..279474edda9f2639d9940119de410fcf23ae3667 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 fc5285a13ce5dcd8782f3d159d9e718f8ef8ffbc..995743d4b214a02bb2ac8698b0219023e759e6c0 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 4b28a847eeee0781c3441e513935b9b72f0754a6..fc7cfa4b7f5b204910309267519b1217393a45dc 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 18fe235785077b9ac19b7825ffe2ba16392f16b1..df355e2b6fd7f59f6e8d0976128d9da6aa5e9185 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 211ed3b0613336b012a3211e229571a2d94d1ab2..61b426c14a64844121d60a90d552b7e6b0515265 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 c127cd6359d8894f19d459bae3932f5eabe1c97b..d57e35b5ba7f57a46787904ed0a00d41a3a3e6c4 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 c79a3a24a6e429dfab89c1a2195f93aaa72c23bb..8d960aac11041511886242cf4ca5e50ba3a3259b 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 dd2f3494f81fed2e250cd3030aed26745c3b59ae..1cfcd5b28c42c4f5bbb30d6b9a285fa49915b61e 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 de6866038a7c78c26ff6829893f489c0f3584110..8de8bf0cbf658622a99042ca97c89c689e0ff48b 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 dd1c3f7e54de12efa953cdae27bc0647fa264a28..744b33cdf5c63e087f538c37b2a4eb4104c79f43 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 f360caf87bce5d62a4b90988c9994729dc13f1f2..6122822ff9a78e3475cb63bb599fdbc89d993461 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 5ebf64556ee254518f6bc4428ebdf6387f783ab0..ed417dbe31b03a891fc25f80cdb5e1a8b71b299f 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 b299c651e2cbbfa4c7c664c6e3546b9b93b00cc3..d23345b4ad91c27db4bc2a06f674b24ad2c8acc0 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 aeb79837aba543eb224ac98e6573446e5630b51d..3c30692e381771cb8a32c329c4a805d3675d09bb 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 800dc39b0fecb3951fdc5fc48dfe04c920b2cc1b..f847869fbd6945e5e02d414592b7ebb56118284b 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 62c68c761e5cfc4065a1b341f53a4a2fe4eb5660..e7802c3726f2ce30ced8141219db84c2c9e619b8 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 fc347fe547bd277a0bf2c6f995e34512386ff929..9997d8bdc93621406f8d5416c4bde5276131944f 100644 (file)
@@ -27,6 +27,7 @@
 #define TextChecker_h
 
 #include <WebCore/EditorClient.h>
+#include <WebCore/TextCheckerClient.h>
 
 namespace WebKit {
 
index 7ac813e0daffc4556bb0e1358a03724f96969aae..982baf3ca3ac5e2f9b00340ce248252aeb4205ea 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);