-
sullivan authored
Reviewed by Darin WebCore part of fix for: <rdar://problem/4817188> Context menu for bad grammar should include suggestions and "Ignore Grammar" The context menu mechanism is currently in flux; the old mechanism is still in place, but an up-and-coming new mechanism is waiting in the wings. I updated both of them, but couldn't test the new mechanism because it doesn't work well enough yet. Also, some of this code should move from Frame to Editor, but that will wait for another checkin. * page/Frame.h: added pure virtual function declarations for isSelectionUngrammatical() and guessesForUngrammaticalSelection() * bridge/mac/FrameMac.h: added virtual functions declarations for isSelectionUngrammatical() and guessesForUngrammaticalSelection() * bridge/mac/FrameMac.mm: (WebCore::FrameMac::isSelectionMisspelled): now updates spelling panel (whether or not it's showing), since this is now needed to make -[NSSSpellChecker ignoreWord:inSpellDocumentWithTag:] work correctly (WebCore::isRangeUngrammatical): new function, helper used by both isSelectionUngrammatical() and guessesForUngrammaticalSelection() (WebCore::FrameMac::isSelectionUngrammatical): new function, calls isRangeUngrammatical (WebCore::FrameMac::guessesForUngrammaticalSelection): ditto * platform/ContextMenu.cpp: (WebCore::ContextMenu::populate): now considers bad grammar as well as misspellings * platform/ContextMenuItem.h: added ContextMenuItemTagIgnoreGrammar WebKit: Reviewed by Darin WebKit part of fix for: <rdar://problem/4817188> Context menu for bad grammar should include suggestions and "Ignore Grammar" The context menu mechanism is currently in flux; the old mechanism is still in place, but an up-and-coming new mechanism is waiting in the wings. I updated both of them, but couldn't test the new mechanism because it doesn't work well enough yet. Most of this WebKit code can be deleted when the new mechanism is in place. * WebView/WebUIDelegatePrivate.h: added WebMenuItemTagIgnoreGrammar * DefaultDelegates/WebDefaultContextMenuDelegate.m: (-[WebDefaultUIDelegate menuItemWithTag:target:representedObject:]): added case for WebMenuItemTagIgnoreGrammar (-[WebDefaultUIDelegate editingContextMenuItemsForElement:defaultMenuItems:]): now considers adding grammar-related items as well as spelling-related items * WebView/WebHTMLViewPrivate.h: declared _isSelectionUngrammatical * WebView/WebHTMLView.m: (-[WebHTMLView _isSelectionUngrammatical]): new method, calls through to WebCore (-[WebHTMLView _ignoreGrammarFromMenu:]): new method, calls _ignoreSpellingFromMenu: since NSSpellChecker has one method for both * English.lproj/Localizable.strings: updated for "Ignore Grammar" menu item title git-svn-id: http://svn.webkit.org/repository/webkit/trunk@18021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6265c783