Changeset 74989 in webkit
- Timestamp:
- Jan 4, 2011 11:49:18 AM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r74988 r74989 1 2011-01-04 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by John Sullivan. 4 5 Add more spelling/grammar related methods 6 https://bugs.webkit.org/show_bug.cgi?id=51886 7 8 * UIProcess/API/mac/WKView.mm: 9 (-[WKView validateUserInterfaceItem:]): 10 Handle more selectors. 11 12 (-[WKView showGuessPanel:]): 13 Add stub. 14 15 (-[WKView checkSpelling:]): 16 Ditto. 17 18 (-[WKView toggleAutomaticSpellingCorrection:]): 19 Toggle automatic spelling correction. 20 21 * UIProcess/TextChecker.h: 22 Add setAutomaticSpellingCorrectionEnabled and isAutomaticSpellingCorrectionEnabled. 23 24 * UIProcess/mac/TextCheckerMac.mm: 25 (WebKit::TextChecker::setAutomaticSpellingCorrectionEnabled): 26 (WebKit::TextChecker::isAutomaticSpellingCorrectionEnabled): 27 Update the toggle. 28 29 * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: 30 * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: 31 Add a Radar URL for the localization FIXMEs. 32 1 33 2011-01-04 Brent Fulgham <bfulgham@webkit.org> 2 34 -
trunk/WebKit2/UIProcess/API/mac/WKView.mm
r74893 r74989 55 55 #import <wtf/RetainPtr.h> 56 56 57 // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized 58 #define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str] 59 57 60 @interface NSApplication (Details) 58 61 - (void)speakString:(NSString *)string; … … 331 334 SEL action = [item action]; 332 335 333 if (action == @selector(stopSpeaking:)) 334 return [NSApp isSpeaking]; 336 if (action == @selector(showGuessPanel:)) { 337 if (NSMenuItem *menuItem = ::menuItem(item)) { 338 BOOL panelShowing = [[[NSSpellChecker sharedSpellChecker] spellingPanel] isVisible]; 339 [menuItem setTitle:panelShowing 340 ? UI_STRING("Hide Spelling and Grammar", "menu item title") 341 : UI_STRING("Show Spelling and Grammar", "menu item title")]; 342 } 343 return _data->_page->selectionState().isContentEditable; 344 } 345 346 if (action == @selector(checkSpelling:)) 347 return _data->_page->selectionState().isContentEditable; 335 348 336 349 if (action == @selector(toggleContinuousSpellChecking:)) { … … 346 359 return YES; 347 360 } 361 362 if (action == @selector(toggleAutomaticSpellingCorrection:)) { 363 bool checked = TextChecker::isAutomaticSpellingCorrectionEnabled(); 364 [menuItem(item) setState:checked ? NSOnState : NSOffState]; 365 return _data->_page->selectionState().isContentEditable; 366 } 367 368 if (action == @selector(stopSpeaking:)) 369 return [NSApp isSpeaking]; 348 370 349 371 // Next, handle editor commands. Start by returning YES for anything that is not an editor command. … … 391 413 } 392 414 415 - (IBAction)showGuessPanel:(id)sender 416 { 417 // FIXME (WebKit2) <rdar://problem/8245958> Make Spelling/Grammar checking work in WebKit2 418 } 419 420 - (IBAction)checkSpelling:(id)sender 421 { 422 // FIXME (WebKit2) <rdar://problem/8245958> Make Spelling/Grammar checking work in WebKit2 423 } 424 393 425 - (IBAction)toggleContinuousSpellChecking:(id)sender 394 426 { … … 407 439 if (!grammarCheckingEnabled) 408 440 _data->_page->unmarkAllBadGrammar(); 441 } 442 443 - (IBAction)toggleAutomaticSpellingCorrection:(id)sender 444 { 445 TextChecker::setAutomaticSpellingCorrectionEnabled(!TextChecker::isAutomaticSpellingCorrectionEnabled()); 409 446 } 410 447 -
trunk/WebKit2/UIProcess/TextChecker.h
r74376 r74989 37 37 static bool isGrammarCheckingEnabled(); 38 38 static void setGrammarCheckingEnabled(bool); 39 40 static void setAutomaticSpellingCorrectionEnabled(bool); 41 static bool isAutomaticSpellingCorrectionEnabled(); 39 42 }; 40 43 -
trunk/WebKit2/UIProcess/mac/TextCheckerMac.mm
r74376 r74989 30 30 static bool continuousSpellCheckingEnabled; 31 31 static bool grammarCheckingEnabled; 32 static bool automaticSpellingCorrectionEnabled; 32 33 33 34 bool TextChecker::isContinuousSpellCheckingAllowed() … … 73 74 } 74 75 76 void TextChecker::setAutomaticSpellingCorrectionEnabled(bool isAutomaticSpellingCorrectionEnabled) 77 { 78 if (automaticSpellingCorrectionEnabled == isAutomaticSpellingCorrectionEnabled) 79 return; 80 81 automaticSpellingCorrectionEnabled = isAutomaticSpellingCorrectionEnabled; 82 [[NSSpellChecker sharedSpellChecker] updatePanels]; 83 } 84 85 bool TextChecker::isAutomaticSpellingCorrectionEnabled() 86 { 87 return automaticSpellingCorrectionEnabled; 88 } 89 75 90 } // namespace WebKit -
trunk/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
r74941 r74989 42 42 #endif 43 43 44 // FIXME : Implement localization.44 // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized 45 45 #define UI_STRING(string, description) String::fromUTF8(string, strlen(string)) 46 46 #define UI_STRING_KEY(string, key, description) String::fromUTF8(string, strlen(string)) -
trunk/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
r71033 r74989 41 41 static NSString * const WebKitErrorPlugInPageURLStringKey = @"WebKitErrorPlugInPageURLStringKey"; 42 42 43 // FIXME (WebKit2) <rdar://problem/8728860> WebKit2 needs to be localized 43 44 #define UI_STRING(__str, __desc) [NSString stringWithUTF8String:__str] 44 45
Note: See TracChangeset
for help on using the changeset viewer.