Reviewed by Geoff Garen.
Moved spelling-related methods from bridge to EditorClient. Added one not-yet-used
grammar-related method.
* bridge/EditorClient.h:
declare isContinuousSpellCheckingEnabled(), spellCheckerDocumentTag(), and new
isGrammarCheckingEnabled()
* bridge/mac/WebCoreFrameBridge.h:
removed bridge equivalents
* bridge/mac/FrameMac.mm:
(WebCore::FrameMac::advanceToNextMisspelling):
convert bridge-using code to editor()->client()-using code
(WebCore::FrameMac::markMisspellingsInAdjacentWords):
ditto
(WebCore::FrameMac::markMisspellings):
ditto
(WebCore::FrameMac::respondToChangedSelection):
ditto
* editing/Editor.h:
* editing/Editor.cpp:
(WebCore::Editor::client):
new method, returns EditorClient pointer. In an ideal world all the code that needed to
access the EditorClient would be in Editor.cpp, and we wouldn't need this accessor.
But for now it's too tricky to extricate the spelling-related code from FrameMac.mm.
WebKit:
Reviewed by Geoff Garen.
Moved spelling-related methods from bridge to EditorClient. Added one not-yet-used
grammar-related method.
* WebCoreSupport/WebEditorClient.h:
declare overrides of isContinuousSpellCheckingEnabled(), spellCheckerDocumentTag(), and new
isGrammarCheckingEnabled()
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::isContinuousSpellCheckingEnabled):
implement by calling through to WebView
(WebEditorClient::isGrammarCheckingEnabled):
ditto
(WebEditorClient::spellCheckerDocumentTag):
ditto
* WebCoreSupport/WebFrameBridge.mm:
removed bridge equivalents of these methods
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17457
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-10-30 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Moved spelling-related methods from bridge to EditorClient. Added one not-yet-used
+ grammar-related method.
+
+ * bridge/EditorClient.h:
+ declare isContinuousSpellCheckingEnabled(), spellCheckerDocumentTag(), and new
+ isGrammarCheckingEnabled()
+
+ * bridge/mac/WebCoreFrameBridge.h:
+ removed bridge equivalents
+
+ * bridge/mac/FrameMac.mm:
+ (WebCore::FrameMac::advanceToNextMisspelling):
+ convert bridge-using code to editor()->client()-using code
+ (WebCore::FrameMac::markMisspellingsInAdjacentWords):
+ ditto
+ (WebCore::FrameMac::markMisspellings):
+ ditto
+ (WebCore::FrameMac::respondToChangedSelection):
+ ditto
+
+ * editing/Editor.h:
+ * editing/Editor.cpp:
+ (WebCore::Editor::client):
+ new method, returns EditorClient pointer. In an ideal world all the code that needed to
+ access the EditorClient would be in Editor.cpp, and we wouldn't need this accessor.
+ But for now it's too tricky to extricate the spelling-related code from FrameMac.mm.
+
2006-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin.
virtual bool shouldDeleteRange(Range *range) = 0;
virtual bool shouldShowDeleteInterface(HTMLElement*) = 0;
+
+ virtual bool isContinuousSpellCheckingEnabled() = 0;
+ virtual bool isGrammarCheckingEnabled() = 0;
+ virtual int spellCheckerDocumentTag() = 0;
// virtual bool shouldBeginEditingInRange(Range *range) = 0;
// virtual bool shouldEndEditingInRange(Range *range) = 0;
int len = it.length();
if (len > 1 || !DeprecatedChar(chars[0]).isSpace()) {
NSString *chunk = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(chars) length:len freeWhenDone:NO];
- NSRange misspelling = [checker checkSpellingOfString:chunk startingAt:0 language:nil wrap:NO inSpellDocumentWithTag:[_bridge spellCheckerDocumentTag] wordCount:NULL];
+ NSRange misspelling = [checker checkSpellingOfString:chunk startingAt:0 language:nil wrap:NO inSpellDocumentWithTag:editor()->client()->spellCheckerDocumentTag() wordCount:NULL];
[chunk release];
if (misspelling.length > 0) {
// Build up result range and string. Note the misspelling may span many text nodes,
void FrameMac::markMisspellingsInAdjacentWords(const VisiblePosition &p)
{
- if (![_bridge isContinuousSpellCheckingEnabled])
+ if (!editor()->client()->isContinuousSpellCheckingEnabled())
return;
markMisspellings(Selection(startOfWord(p, LeftWordIfOnBoundary), endOfWord(p, RightWordIfOnBoundary)));
}
// This function is called with a selection already expanded to word boundaries.
// Might be nice to assert that here.
- if (![_bridge isContinuousSpellCheckingEnabled])
+ if (!editor()->client()->isContinuousSpellCheckingEnabled())
return;
RefPtr<Range> searchRange(selection.toRange());
int startIndex = 0;
// Loop over the chunk to find each misspelling in it.
while (startIndex < len) {
- NSRange misspelling = [checker checkSpellingOfString:chunk startingAt:startIndex language:nil wrap:NO inSpellDocumentWithTag:[_bridge spellCheckerDocumentTag] wordCount:NULL];
+ NSRange misspelling = [checker checkSpellingOfString:chunk startingAt:startIndex language:nil wrap:NO inSpellDocumentWithTag:editor()->client()->spellCheckerDocumentTag() wordCount:NULL];
if (misspelling.length == 0)
break;
else {
void FrameMac::respondToChangedSelection(const Selection &oldSelection, bool closeTyping)
{
if (document()) {
- if ([_bridge isContinuousSpellCheckingEnabled]) {
+ if (editor()->client()->isContinuousSpellCheckingEnabled()) {
Selection oldAdjacentWords;
// If this is a change in selection resulting from a delete operation, oldSelection may no longer
- (void)windowObjectCleared;
-- (int)spellCheckerDocumentTag;
-- (BOOL)isContinuousSpellCheckingEnabled;
-
- (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
- (void)willPopupMenu:(NSMenu *)menu;
return 0;
}
+EditorClient* Editor::client() const
+{
+ return m_client.get();
+}
+
bool Editor::canCopy()
{
return false;
Editor(Frame*, PassRefPtr<EditorClient>);
~Editor();
+ EditorClient* client() const;
+
void cut();
void copy();
void paste();
+2006-10-30 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Geoff Garen.
+
+ Moved spelling-related methods from bridge to EditorClient. Added one not-yet-used
+ grammar-related method.
+
+ * WebCoreSupport/WebEditorClient.h:
+ declare overrides of isContinuousSpellCheckingEnabled(), spellCheckerDocumentTag(), and new
+ isGrammarCheckingEnabled()
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::isContinuousSpellCheckingEnabled):
+ implement by calling through to WebView
+ (WebEditorClient::isGrammarCheckingEnabled):
+ ditto
+ (WebEditorClient::spellCheckerDocumentTag):
+ ditto
+
+ * WebCoreSupport/WebFrameBridge.mm:
+ removed bridge equivalents of these methods
+
2006-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth.
~WebEditorClient();
void setWebView(WebView* webView);
+
+ bool isGrammarCheckingEnabled();
+ bool isContinuousSpellCheckingEnabled();
+ int spellCheckerDocumentTag();
bool shouldDeleteRange(WebCore::Range*);
bool shouldShowDeleteInterface(WebCore::HTMLElement*);
m_webView = webView;
}
+bool WebEditorClient::isContinuousSpellCheckingEnabled()
+{
+ return [m_webView isContinuousSpellCheckingEnabled];
+}
+
+bool WebEditorClient::isGrammarCheckingEnabled()
+{
+#ifdef BUILDING_ON_TIGER
+ return false;
+#else
+ return [m_webView isGrammarCheckingEnabled];
+#endif
+}
+
+int WebEditorClient::spellCheckerDocumentTag()
+{
+ return [m_webView spellCheckerDocumentTag];
+}
+
bool WebEditorClient::shouldDeleteRange(WebCore::Range* range)
{
return [[m_webView _editingDelegateForwarder] webView:m_webView
}
}
-- (int)spellCheckerDocumentTag
-{
- return [[self webView] spellCheckerDocumentTag];
-}
-
-- (BOOL)isContinuousSpellCheckingEnabled
-{
- return [[self webView] isContinuousSpellCheckingEnabled];
-}
-
- (BOOL)_compareDashboardRegions:(NSDictionary *)regions
{
return [lastDashboardRegions isEqualToDictionary:regions];