Skip to content
  • g.czajkowski@samsung.com's avatar
    Context menu grammar checking items are available when GRAMMAR_CHECKING macro is off · 9facbdb9
    g.czajkowski@samsung.com authored
    https://bugs.webkit.org/show_bug.cgi?id=117585
    
    Reviewed by Anders Carlsson.
    
    Source/WebCore:
    
    Do not add "Check Grammar With Spelling" and "Ignore Grammar" to the context menu
    when GRAMMAR_CHECKING is off.
    Replace "Spelling and Grammar" with "Spelling" as the sub menu title and "Show/Hide Spelling
    and Grammar" with "Show/Hide Spelling" when GRAMMAR_CHECKING is off.
    
    Additionally, guard grammar checking in context menu code to not necessarily
    compile it.
    
    No new layout tests because every port has a different way of showing
    spelling/grammar context menu items.
    
    * page/ContextMenuController.cpp:
    (WebCore::ContextMenuController::contextMenuItemSelected):
    (WebCore::ContextMenuController::createAndAppendSpellingAndGrammarSubMenu):
    (WebCore::ContextMenuController::populate):
    (WebCore::ContextMenuController::checkOrEnableIfNeeded):
    * platform/LocalizedStrings.cpp:
    (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
    (WebCore::contextMenuItemTagSpellingMenu):
    (WebCore::contextMenuItemTagShowSpellingPanel):
    * platform/LocalizedStrings.h:
    * platform/efl/LocalizedStringsEfl.cpp:
    (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
    (WebCore::contextMenuItemTagSpellingMenu):
    (WebCore::contextMenuItemTagShowSpellingPanel):
    * platform/gtk/LocalizedStringsGtk.cpp:
    (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
    (WebCore::contextMenuItemTagSpellingMenu):
    (WebCore::contextMenuItemTagShowSpellingPanel):
    * platform/qt/LocalizedStringsQt.cpp:
    (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
    (WebCore::contextMenuItemTagSpellingMenu):
    (WebCore::contextMenuItemTagShowSpellingPanel):
    
    Source/WebKit/gtk:
    
    Add GRAMMAR_CHECKING guard to the context menu grammar items.
    
    * webkit/webkitglobals.cpp:
    (webkit_context_menu_item_get_action):
    
    Source/WebKit/mac:
    
    Add GRAMMAR_CHECKING guard to the context menu grammar items.
    
    * WebCoreSupport/WebContextMenuClient.mm:
    (fixMenusReceivedFromOldClients):
    
    Source/WebKit2:
    
    Add GRAMMAR_CHECKING guard to the context menu grammar items.
    
    * Shared/API/c/WKSharedAPICast.h:
    (WebKit::toAPI):
    (WebKit::toImpl):
    * UIProcess/API/efl/ewk_context_menu_item.cpp:
    (getEwkActionFromWKTag):
    * UIProcess/API/efl/tests/test_ewk2_text_checker.cpp:
    (checkSpellingItemsAvailability):
    Change callback name, to be consistent with a newly added.
    
    (checkSpellingAndGrammarSubmenuAvailability):
    (checkGrammarWithSpellingItemAvailability):
    Add two unit tests for EFL to check whether context menu grammar items are
    available only when GRAMMAR_CHECKING macro is enabled.
    
    * UIProcess/API/gtk/WebKitContextMenuActions.cpp:
    (webkitContextMenuActionGetActionTag):
    (webkitContextMenuActionGetForContextMenuItem):
    (webkitContextMenuActionGetLabel):
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::contextMenuItemSelected):
    
    Source/WTF:
    
    Enable GRAMMAR_CHECKING for WebKit ports that use/implement it.
    
    * wtf/Platform.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    9facbdb9