Changeset 74376 in webkit
- Timestamp:
- Dec 20, 2010 4:35:16 PM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r74359 r74376 1 2010-12-20 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Add a TextChecker class, hook up spelling and grammar toggling 6 https://bugs.webkit.org/show_bug.cgi?id=51363 7 8 * UIProcess/API/mac/WKView.mm: 9 (-[WKView validateUserInterfaceItem:]): 10 (-[WKView toggleContinuousSpellChecking:]): 11 (-[WKView toggleGrammarChecking:]): 12 * UIProcess/TextChecker.h: Added. 13 * UIProcess/WebPageProxy.cpp: 14 (WebKit::WebPageProxy::unmarkAllMisspellings): 15 (WebKit::WebPageProxy::unmarkAllBadGrammar): 16 * UIProcess/WebPageProxy.h: 17 * UIProcess/mac/TextCheckerMac.mm: Added. 18 (WebKit::TextChecker::isContinuousSpellCheckingAllowed): 19 (WebKit::TextChecker::isContinuousSpellCheckingEnabled): 20 (WebKit::TextChecker::setContinuousSpellCheckingEnabled): 21 (WebKit::TextChecker::isGrammarCheckingEnabled): 22 (WebKit::TextChecker::setGrammarCheckingEnabled): 23 * UIProcess/qt/TextCheckerQt.cpp: Added. 24 (WebKit::TextChecker::isContinuousSpellCheckingAllowed): 25 (WebKit::TextChecker::isContinuousSpellCheckingEnabled): 26 (WebKit::TextChecker::setContinuousSpellCheckingEnabled): 27 (WebKit::TextChecker::isGrammarCheckingEnabled): 28 (WebKit::TextChecker::setGrammarCheckingEnabled): 29 * UIProcess/win/TextCheckerWin.cpp: Added. 30 (WebKit::TextChecker::isContinuousSpellCheckingAllowed): 31 (WebKit::TextChecker::isContinuousSpellCheckingEnabled): 32 (WebKit::TextChecker::setContinuousSpellCheckingEnabled): 33 (WebKit::TextChecker::isGrammarCheckingEnabled): 34 (WebKit::TextChecker::setGrammarCheckingEnabled): 35 * WebKit2.pro: 36 * WebKit2.xcodeproj/project.pbxproj: 37 * WebProcess/WebPage/WebPage.cpp: 38 (WebKit::WebPage::unmarkAllMisspellings): 39 (WebKit::WebPage::unmarkAllBadGrammar): 40 * WebProcess/WebPage/WebPage.h: 41 * WebProcess/WebPage/WebPage.messages.in: 42 * win/WebKit2.vcproj: 43 1 44 2010-12-20 Anders Carlsson <andersca@apple.com> 2 45 -
trunk/WebKit2/UIProcess/API/mac/WKView.mm
r74330 r74376 39 39 #import "PageClientImpl.h" 40 40 #import "RunLoop.h" 41 #import "TextChecker.h" 41 42 #import "WKTextInputWindowController.h" 42 43 #import "WebContext.h" … … 312 313 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item 313 314 { 314 String commandName = commandNameForSelector([item action]);315 315 NSMenuItem *menuItem = (NSMenuItem *)item; 316 316 if (![menuItem isKindOfClass:[NSMenuItem class]]) 317 317 return NO; // FIXME: We need to be able to handle other user interface elements. 318 318 319 SEL action = [item action]; 320 321 if (action == @selector(toggleContinuousSpellChecking:)) { 322 bool checkMark = false; 323 bool returnValue = false; 324 if (TextChecker::isContinuousSpellCheckingAllowed()) 325 checkMark = TextChecker::isContinuousSpellCheckingEnabled(); 326 returnValue = true; 327 328 [menuItem setState:checkMark ? NSOnState : NSOffState]; 329 return returnValue; 330 } 331 332 if (action == @selector(toggleGrammarChecking:)) { 333 bool checkMark = TextChecker::isGrammarCheckingEnabled(); 334 [menuItem setState:checkMark ? NSOnState : NSOffState]; 335 return YES; 336 } 337 338 String commandName = commandNameForSelector([item action]); 339 319 340 if (_data->_menuItemsMap.find(commandName) == _data->_menuItemsMap.end()) { 320 341 _data->_menuItemsMap.add(commandName, menuItem); … … 323 344 324 345 return YES; 346 } 347 348 - (IBAction)toggleContinuousSpellChecking:(id)sender 349 { 350 bool spellCheckingEnabled = !TextChecker::isContinuousSpellCheckingEnabled(); 351 TextChecker::setContinuousSpellCheckingEnabled(spellCheckingEnabled); 352 353 if (!spellCheckingEnabled) 354 _data->_page->unmarkAllMisspellings(); 355 } 356 357 - (void)toggleGrammarChecking:(id)sender 358 { 359 bool grammarCheckingEnabled = !TextChecker::isGrammarCheckingEnabled(); 360 TextChecker::setGrammarCheckingEnabled(grammarCheckingEnabled); 361 362 if (!grammarCheckingEnabled) 363 _data->_page->unmarkAllBadGrammar(); 325 364 } 326 365 -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r74296 r74376 1544 1544 } 1545 1545 1546 void WebPageProxy::unmarkAllMisspellings() 1547 { 1548 process()->send(Messages::WebPage::UnmarkAllMisspellings(), m_pageID); 1549 } 1550 1551 void WebPageProxy::unmarkAllBadGrammar() 1552 { 1553 process()->send(Messages::WebPage::UnmarkAllBadGrammar(), m_pageID); 1554 } 1555 1546 1556 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo) 1547 1557 { -
trunk/WebKit2/UIProcess/WebPageProxy.h
r74296 r74376 295 295 #endif 296 296 297 void unmarkAllMisspellings(); 298 void unmarkAllBadGrammar(); 299 297 300 private: 298 301 WebPageProxy(WebContext*, WebPageGroup*, uint64_t pageID); -
trunk/WebKit2/WebKit2.pro
r74139 r74376 329 329 UIProcess/ProcessModel.h \ 330 330 UIProcess/ResponsivenessTimer.h \ 331 UIProcess/TextChecker.h \ 331 332 UIProcess/TiledDrawingAreaProxy.h \ 332 333 UIProcess/VisitedLinkProvider.h \ … … 556 557 UIProcess/qt/TiledDrawingAreaProxyQt.cpp \ 557 558 UIProcess/qt/TiledDrawingAreaTileQt.cpp \ 559 UIProcess/qt/TextCheckerQt.cpp \ 558 560 UIProcess/qt/WebContextMenuProxyQt.cpp \ 559 561 UIProcess/qt/WebContextQt.cpp \ -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r74139 r74376 156 156 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; }; 157 157 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; 158 1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; }; 159 1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */; }; 158 160 1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */; }; 159 161 1AA479B012A5A436008236C3 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; … … 808 810 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; }; 809 811 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; 812 1AA417C912C00CCA002BE67B /* TextChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextChecker.h; sourceTree = "<group>"; }; 813 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextCheckerMac.mm; sourceTree = "<group>"; }; 810 814 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessMac.mm; sourceTree = "<group>"; }; 811 815 1AA56F2811E92BC80061B882 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; }; … … 1898 1902 BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */, 1899 1903 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */, 1904 1AA417C912C00CCA002BE67B /* TextChecker.h */, 1900 1905 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */, 1901 1906 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */, … … 2306 2311 BC2651F511825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm */, 2307 2312 0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */, 2313 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */, 2308 2314 1A1C648611F415B700553C19 /* WebContextMac.mm */, 2309 2315 51ACBB9E127A8F2C00D203B9 /* WebContextMenuProxyMac.h */, … … 2757 2763 1A4A9C5612B816CF008FE984 /* NetscapePluginModule.h in Headers */, 2758 2764 1A4A9F3312B844E2008FE984 /* PluginQuirks.h in Headers */, 2765 1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */, 2759 2766 ); 2760 2767 runOnlyForDeploymentPostprocessing = 0; … … 3179 3186 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */, 3180 3187 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */, 3188 1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */, 3181 3189 ); 3182 3190 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r74296 r74376 1127 1127 } 1128 1128 1129 void WebPage::unmarkAllMisspellings() 1130 { 1131 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 1132 if (Document* document = frame->document()) 1133 document->markers()->removeMarkers(DocumentMarker::Spelling); 1134 } 1135 } 1136 1137 void WebPage::unmarkAllBadGrammar() 1138 { 1139 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 1140 if (Document* document = frame->document()) 1141 document->markers()->removeMarkers(DocumentMarker::Grammar); 1142 } 1143 } 1144 1129 1145 void WebPage::setTextForActivePopupMenu(int32_t index) 1130 1146 { -
trunk/WebKit2/WebProcess/WebPage/WebPage.h
r74296 r74376 344 344 void didCancelForOpenPanel(); 345 345 346 void unmarkAllMisspellings(); 347 void unmarkAllBadGrammar(); 348 346 349 #if ENABLE(CONTEXT_MENUS) 347 350 void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&); -
trunk/WebKit2/WebProcess/WebPage/WebPage.messages.in
r74296 r74376 98 98 DidCancelForOpenPanel() 99 99 100 # Speling and grammer. 101 UnmarkAllMisspellings() 102 UnmarkAllBadGrammar() 103 100 104 SetWindowResizerSize(WebCore::IntSize intersectsView) 101 105 -
trunk/WebKit2/win/WebKit2.vcproj
r74141 r74376 1916 1916 </File> 1917 1917 <File 1918 RelativePath="..\UIProcess\TextChecker.h" 1919 > 1920 </File> 1921 <File 1918 1922 RelativePath="..\UIProcess\VisitedLinkProvider.cpp" 1919 1923 > … … 2506 2510 > 2507 2511 </File> 2512 <File 2513 RelativePath="..\UIProcess\win\TextCheckerWin.cpp" 2514 > 2515 </File> 2508 2516 <File 2509 2517 RelativePath="..\UIProcess\win\WebContextMenuProxyWin.cpp"
Note: See TracChangeset
for help on using the changeset viewer.