[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
andersca at apple.com
andersca at apple.com
Fri Jan 21 14:55:04 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit e95efb104e3a4a9a15286240116644c5706fbca0
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 4 19:49:18 2011 +0000
2011-01-04 Anders Carlsson <andersca at apple.com>
Reviewed by John Sullivan.
Add more spelling/grammar related methods
https://bugs.webkit.org/show_bug.cgi?id=51886
* UIProcess/API/mac/WKView.mm:
(-[WKView validateUserInterfaceItem:]):
Handle more selectors.
(-[WKView showGuessPanel:]):
Add stub.
(-[WKView checkSpelling:]):
Ditto.
(-[WKView toggleAutomaticSpellingCorrection:]):
Toggle automatic spelling correction.
* UIProcess/TextChecker.h:
Add setAutomaticSpellingCorrectionEnabled and isAutomaticSpellingCorrectionEnabled.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::setAutomaticSpellingCorrectionEnabled):
(WebKit::TextChecker::isAutomaticSpellingCorrectionEnabled):
Update the toggle.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
* WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
Add a Radar URL for the localization FIXMEs.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c6ff100..b24d28e 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,35 @@
+2011-01-04 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by John Sullivan.
+
+ Add more spelling/grammar related methods
+ https://bugs.webkit.org/show_bug.cgi?id=51886
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView validateUserInterfaceItem:]):
+ Handle more selectors.
+
+ (-[WKView showGuessPanel:]):
+ Add stub.
+
+ (-[WKView checkSpelling:]):
+ Ditto.
+
+ (-[WKView toggleAutomaticSpellingCorrection:]):
+ Toggle automatic spelling correction.
+
+ * UIProcess/TextChecker.h:
+ Add setAutomaticSpellingCorrectionEnabled and isAutomaticSpellingCorrectionEnabled.
+
+ * UIProcess/mac/TextCheckerMac.mm:
+ (WebKit::TextChecker::setAutomaticSpellingCorrectionEnabled):
+ (WebKit::TextChecker::isAutomaticSpellingCorrectionEnabled):
+ Update the toggle.
+
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
+ Add a Radar URL for the localization FIXMEs.
+
2011-01-04 Brent Fulgham <bfulgham at webkit.org>
Unreviewed build fix.
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 02b7c67..03ccdaa 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -54,6 +54,9 @@
#import <wtf/RefPtr.h>
#import <wtf/RetainPtr.h>
+// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
+#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str]
+
@interface NSApplication (Details)
- (void)speakString:(NSString *)string;
@end
@@ -330,8 +333,18 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
{
SEL action = [item action];
- if (action == @selector(stopSpeaking:))
- return [NSApp isSpeaking];
+ if (action == @selector(showGuessPanel:)) {
+ if (NSMenuItem *menuItem = ::menuItem(item)) {
+ BOOL panelShowing = [[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible];
+ [menuItem setTitle:panelShowing
+ ? UI_STRING("Hide Spelling and Grammar", "menu item title")
+ : UI_STRING("Show Spelling and Grammar", "menu item title")];
+ }
+ return _data->_page->selectionState().isContentEditable;
+ }
+
+ if (action == @selector(checkSpelling:))
+ return _data->_page->selectionState().isContentEditable;
if (action == @selector(toggleContinuousSpellChecking:)) {
bool enabled = TextChecker::isContinuousSpellCheckingAllowed();
@@ -346,6 +359,15 @@ static NSToolbarItem *toolbarItem(id <NSValidatedUserInterfaceItem> item)
return YES;
}
+ if (action == @selector(toggleAutomaticSpellingCorrection:)) {
+ bool checked = TextChecker::isAutomaticSpellingCorrectionEnabled();
+ [menuItem(item) setState:checked ? NSOnState : NSOffState];
+ return _data->_page->selectionState().isContentEditable;
+ }
+
+ if (action == @selector(stopSpeaking:))
+ return [NSApp isSpeaking];
+
// Next, handle editor commands. Start by returning YES for anything that is not an editor command.
// Returning YES is the default thing to do in an AppKit validate method for any selector that is not recognized.
String commandName = commandNameForSelector([item action]);
@@ -390,6 +412,16 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
[NSApp stopSpeaking:sender];
}
+- (IBAction)showGuessPanel:(id)sender
+{
+ // FIXME (WebKit2) <rdar://problem/8245958> Make Spelling/Grammar checking work in WebKit2
+}
+
+- (IBAction)checkSpelling:(id)sender
+{
+ // FIXME (WebKit2) <rdar://problem/8245958> Make Spelling/Grammar checking work in WebKit2
+}
+
- (IBAction)toggleContinuousSpellChecking:(id)sender
{
bool spellCheckingEnabled = !TextChecker::isContinuousSpellCheckingEnabled();
@@ -408,6 +440,11 @@ static void speakString(WKStringRef string, WKErrorRef error, void*)
_data->_page->unmarkAllBadGrammar();
}
+- (IBAction)toggleAutomaticSpellingCorrection:(id)sender
+{
+ TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::isAutomaticSpellingCorrectionEnabled());
+}
+
// Events
// Override this so that AppKit will send us arrow keys as key down events so we can
diff --git a/WebKit2/UIProcess/TextChecker.h b/WebKit2/UIProcess/TextChecker.h
index c7e8521..1e76091 100644
--- a/WebKit2/UIProcess/TextChecker.h
+++ b/WebKit2/UIProcess/TextChecker.h
@@ -36,6 +36,9 @@ public:
static bool isGrammarCheckingEnabled();
static void setGrammarCheckingEnabled(bool);
+
+ static void setAutomaticSpellingCorrectionEnabled(bool);
+ static bool isAutomaticSpellingCorrectionEnabled();
};
} // namespace WebKit
diff --git a/WebKit2/UIProcess/mac/TextCheckerMac.mm b/WebKit2/UIProcess/mac/TextCheckerMac.mm
index 9579c93..10e8e84 100644
--- a/WebKit2/UIProcess/mac/TextCheckerMac.mm
+++ b/WebKit2/UIProcess/mac/TextCheckerMac.mm
@@ -29,6 +29,7 @@ namespace WebKit {
static bool continuousSpellCheckingEnabled;
static bool grammarCheckingEnabled;
+static bool automaticSpellingCorrectionEnabled;
bool TextChecker::isContinuousSpellCheckingAllowed()
{
@@ -72,4 +73,18 @@ void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
// because grammar checking only occurs on code paths that already preflight spell checking appropriately.
}
+void TextChecker::setAutomaticSpellingCorrectionEnabled(bool isAutomaticSpellingCorrectionEnabled)
+{
+ if (automaticSpellingCorrectionEnabled == isAutomaticSpellingCorrectionEnabled)
+ return;
+
+ automaticSpellingCorrectionEnabled = isAutomaticSpellingCorrectionEnabled;
+ [[NSSpellChecker sharedSpellChecker] updatePanels];
+}
+
+bool TextChecker::isAutomaticSpellingCorrectionEnabled()
+{
+ return automaticSpellingCorrectionEnabled;
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index 40f0032..1730613 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -41,7 +41,7 @@
#include <wtf/RetainPtr.h>
#endif
-// FIXME: Implement localization.
+// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
#define UI_STRING(string, description) String::fromUTF8(string, strlen(string))
#define UI_STRING_KEY(string, key, description) String::fromUTF8(string, strlen(string))
diff --git a/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm b/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
index 50656fb..549d7ee 100644
--- a/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
+++ b/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
@@ -40,6 +40,7 @@ static NSString * const WebKitErrorMIMETypeKey = @"WebKitErrorMIME
static NSString * const WebKitErrorPlugInNameKey = @"WebKitErrorPlugInNameKey";
static NSString * const WebKitErrorPlugInPageURLStringKey = @"WebKitErrorPlugInPageURLStringKey";
+// FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized
#define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str]
// Policy errors
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list