Unreviewed, rolling out r151632.

http://trac.webkit.org/changeset/151632
https://bugs.webkit.org/show_bug.cgi?id=117585

Debug build error ASSERT(WTF_USE_GRAMMAR_CHECKING) for non MAC
platforms

Source/WebCore:

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::createAndAppendSpellingAndGrammarSubMenu):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::checkOrEnableIfNeeded):
* platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
* platform/qt/LocalizedStringsQt.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):

Source/WebKit/gtk:

* webkit/webkitglobals.cpp:
(webkit_context_menu_item_get_action):

Source/WebKit/mac:

* WebCoreSupport/WebContextMenuClient.mm:
(fixMenusReceivedFromOldClients):

Source/WebKit2:

* 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:
(onContextMenuShow):
(TEST_F):
* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):

Source/WTF:

* wtf/Platform.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151638 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 84dbb64c
2013-06-17 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Unreviewed, rolling out r151632.
http://trac.webkit.org/changeset/151632
https://bugs.webkit.org/show_bug.cgi?id=117585
Debug build error ASSERT(WTF_USE_GRAMMAR_CHECKING) for non MAC
platforms
* wtf/Platform.h:
2013-06-14 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Context menu grammar checking items are available when GRAMMAR_CHECKING macro is off
......
......@@ -1004,9 +1004,7 @@
#endif
#if PLATFORM(MAC)
#define WTF_USE_GRAMMAR_CHECKING 1
#endif
#if PLATFORM(MAC) || PLATFORM(BLACKBERRY) || PLATFORM(EFL)
#define WTF_USE_UNIFIED_TEXT_CHECKING 1
......
2013-06-17 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Unreviewed, rolling out r151632.
http://trac.webkit.org/changeset/151632
https://bugs.webkit.org/show_bug.cgi?id=117585
Debug build error ASSERT(WTF_USE_GRAMMAR_CHECKING) for non MAC
platforms
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::createAndAppendSpellingAndGrammarSubMenu):
(WebCore::ContextMenuController::populate):
(WebCore::ContextMenuController::checkOrEnableIfNeeded):
* platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
* platform/qt/LocalizedStringsQt.cpp:
(WebCore::contextMenuItemTagSpellingMenu):
(WebCore::contextMenuItemTagShowSpellingPanel):
(WebCore::contextMenuItemTagCheckGrammarWithSpelling):
2013-06-17 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Fix make distcheck.
......@@ -448,11 +448,9 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
case ContextMenuItemTagCheckSpellingWhileTyping:
frame->editor().toggleContinuousSpellChecking();
break;
#if USE(GRAMMAR_CHECKING)
case ContextMenuItemTagCheckGrammarWithSpelling:
frame->editor().toggleGrammarChecking();
break;
#endif
#if PLATFORM(MAC)
case ContextMenuItemTagShowFonts:
frame->editor().showFontPanel();
......@@ -569,10 +567,8 @@ void ContextMenuController::createAndAppendSpellingAndGrammarSubMenu(ContextMenu
contextMenuItemTagCheckSpelling());
ContextMenuItem checkAsYouType(CheckableActionType, ContextMenuItemTagCheckSpellingWhileTyping,
contextMenuItemTagCheckSpellingWhileTyping());
#if USE(GRAMMAR_CHECKING)
ContextMenuItem grammarWithSpelling(CheckableActionType, ContextMenuItemTagCheckGrammarWithSpelling,
contextMenuItemTagCheckGrammarWithSpelling());
#endif
#if PLATFORM(MAC)
ContextMenuItem correctSpelling(CheckableActionType, ContextMenuItemTagCorrectSpellingAutomatically,
contextMenuItemTagCorrectSpellingAutomatically());
......@@ -584,9 +580,7 @@ void ContextMenuController::createAndAppendSpellingAndGrammarSubMenu(ContextMenu
appendItem(*separatorItem(), &spellingAndGrammarMenu);
#endif
appendItem(checkAsYouType, &spellingAndGrammarMenu);
#if USE(GRAMMAR_CHECKING)
appendItem(grammarWithSpelling, &spellingAndGrammarMenu);
#endif
#if PLATFORM(MAC)
appendItem(correctSpelling, &spellingAndGrammarMenu);
#endif
......@@ -801,10 +795,8 @@ void ContextMenuController::populate()
contextMenuItemTagIgnoreSpelling());
ContextMenuItem LearnSpellingItem(ActionType, ContextMenuItemTagLearnSpelling,
contextMenuItemTagLearnSpelling());
#if USE(GRAMMAR_CHECKING)
ContextMenuItem IgnoreGrammarItem(ActionType, ContextMenuItemTagIgnoreGrammar,
contextMenuItemTagIgnoreGrammar());
#endif
ContextMenuItem CutItem(ActionType, ContextMenuItemTagCut, contextMenuItemTagCut());
ContextMenuItem PasteItem(ActionType, ContextMenuItemTagPaste, contextMenuItemTagPaste());
#if PLATFORM(GTK)
......@@ -974,12 +966,8 @@ void ContextMenuController::populate()
if (misspelling) {
appendItem(IgnoreSpellingItem, m_contextMenu.get());
appendItem(LearnSpellingItem, m_contextMenu.get());
}
#if USE(GRAMMAR_CHECKING)
else
} else
appendItem(IgnoreGrammarItem, m_contextMenu.get());
#endif
appendItem(*separatorItem(), m_contextMenu.get());
haveContextMenuItemsForMisspellingOrGrammer = true;
#if PLATFORM(MAC)
......@@ -1242,13 +1230,11 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
case ContextMenuItemTagLookUpInDictionary:
shouldEnable = frame->selection()->isRange();
break;
#if USE(GRAMMAR_CHECKING)
case ContextMenuItemTagCheckGrammarWithSpelling:
if (frame->editor().isGrammarCheckingEnabled())
shouldCheck = true;
shouldEnable = true;
break;
#endif
case ContextMenuItemTagItalic: {
shouldCheck = frame->editor().selectionHasStyle(CSSPropertyFontStyle, "italic") != FalseTriState;
shouldEnable = frame->editor().canEditRichly();
......@@ -1394,9 +1380,7 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
case ContextMenuItemPDFNextPage:
case ContextMenuItemPDFPreviousPage:
case ContextMenuItemTagOpenLink:
#if USE(GRAMMAR_CHECKING)
case ContextMenuItemTagIgnoreGrammar:
#endif
case ContextMenuItemTagSpellingMenu:
case ContextMenuItemTagShowFonts:
case ContextMenuItemTagStyles:
......@@ -1426,8 +1410,6 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
shouldEnable = m_hitTestResult.mediaHasAudio();
shouldCheck = shouldEnable && m_hitTestResult.mediaMuted();
break;
default:
break;
}
item.setChecked(shouldCheck);
......
......@@ -271,38 +271,21 @@ String contextMenuItemTagOpenLink()
return WEB_UI_STRING("Open Link", "Open Link context menu item");
}
#if USE(GRAMMAR_CHECKING)
String contextMenuItemTagIgnoreGrammar()
{
return WEB_UI_STRING("Ignore Grammar", "Ignore Grammar context menu item");
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return WEB_UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item");
}
#endif
String contextMenuItemTagSpellingMenu()
{
#if USE(GRAMMAR_CHECKING)
return WEB_UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item");
#else
return WEB_UI_STRING("Spelling", "Spelling context sub-menu item");
#endif
}
String contextMenuItemTagShowSpellingPanel(bool show)
{
#if USE(GRAMMAR_CHECKING)
if (show)
return WEB_UI_STRING("Show Spelling and Grammar", "menu item title");
return WEB_UI_STRING("Hide Spelling and Grammar", "menu item title");
#else
if (show)
return WEB_UI_STRING("Show Spelling", "menu item title");
return WEB_UI_STRING("Hide Spelling", "menu item title");
#endif
}
String contextMenuItemTagCheckSpelling()
......@@ -315,6 +298,11 @@ String contextMenuItemTagCheckSpellingWhileTyping()
return WEB_UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item");
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return WEB_UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item");
}
String contextMenuItemTagFontMenu()
{
return WEB_UI_STRING("Font", "Font context sub-menu item");
......
......@@ -92,14 +92,12 @@ namespace WebCore {
String contextMenuItemTagSearchWeb();
String contextMenuItemTagLookUpInDictionary(const String& selectedString);
String contextMenuItemTagOpenLink();
#if USE(GRAMMAR_CHECKING)
String contextMenuItemTagIgnoreGrammar();
String contextMenuItemTagCheckGrammarWithSpelling();
#endif
String contextMenuItemTagSpellingMenu();
String contextMenuItemTagShowSpellingPanel(bool show);
String contextMenuItemTagCheckSpelling();
String contextMenuItemTagCheckSpellingWhileTyping();
String contextMenuItemTagCheckGrammarWithSpelling();
String contextMenuItemTagFontMenu();
String contextMenuItemTagBold();
String contextMenuItemTagItalic();
......
......@@ -258,34 +258,19 @@ String contextMenuItemTagOpenLink()
return String::fromUTF8("Open Link");
}
#if USE(GRAMMAR_CHECKING)
String contextMenuItemTagIgnoreGrammar()
{
return String::fromUTF8("Ignore Grammar");
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return String::fromUTF8("Check Grammar With Spelling");
}
#endif
String contextMenuItemTagSpellingMenu()
{
#if USE(GRAMMAR_CHECKING)
return String::fromUTF8("Spelling and Grammar");
#else
return String::fromUTF8("Spelling");
#endif
}
String contextMenuItemTagShowSpellingPanel(bool show)
{
#if USE(GRAMMAR_CHECKING)
return String::fromUTF8(show ? "Show Spelling and Grammar" : "Hide Spelling and Grammar");
#else
return String::fromUTF8(show ? "Show Spelling" : "Hide Spelling");
#endif
}
String contextMenuItemTagCheckSpelling()
......@@ -298,6 +283,11 @@ String contextMenuItemTagCheckSpellingWhileTyping()
return String::fromUTF8("Check Spelling While Typing");
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return String::fromUTF8("Check Grammar With Spelling");
}
String contextMenuItemTagFontMenu()
{
return String::fromUTF8("Font");
......
......@@ -279,34 +279,19 @@ String contextMenuItemTagOpenLink()
return String::fromUTF8(_("_Open Link"));
}
#if USE(GRAMMAR_CHECKING)
String contextMenuItemTagIgnoreGrammar()
{
return String::fromUTF8(_("Ignore _Grammar"));
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return String::fromUTF8(_("Check _Grammar With Spelling"));
}
#endif
String contextMenuItemTagSpellingMenu()
{
#if USE(GRAMMAR_CHECKING)
return String::fromUTF8(_("Spelling and _Grammar"));
#else
return String::fromUTF8(_("Spelling"));
#endif
}
String contextMenuItemTagShowSpellingPanel(bool show)
{
#if USE(GRAMMAR_CHECKING)
return String::fromUTF8(show ? _("_Show Spelling and Grammar") : _("_Hide Spelling and Grammar"));
#else
return String::fromUTF8(show ? _("_Show Spelling") : _("_Hide Spelling"));
#endif
}
String contextMenuItemTagCheckSpelling()
......@@ -319,6 +304,11 @@ String contextMenuItemTagCheckSpellingWhileTyping()
return String::fromUTF8(_("Check Spelling While _Typing"));
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return String::fromUTF8(_("Check _Grammar With Spelling"));
}
String contextMenuItemTagFontMenu()
{
return String::fromUTF8(_("_Font"));
......
......@@ -248,36 +248,20 @@ String contextMenuItemTagOpenLink()
return QCoreApplication::translate("QWebPage", "Open Link", "Open Link context menu item");
}
#if USE(GRAMMAR_CHECKING)
String contextMenuItemTagIgnoreGrammar()
{
return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Grammar context menu item");
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item");
}
#endif
String contextMenuItemTagSpellingMenu()
{
#if USE(GRAMMAR_CHECKING)
return QCoreApplication::translate("QWebPage", "Spelling", "Spelling and Grammar context sub-menu item");
#else
return QCoreApplication::translate("QWebPage", "Spelling", "Spelling context sub-menu item");
#endif
}
String contextMenuItemTagShowSpellingPanel(bool show)
{
#if USE(GRAMMAR_CHECKING)
return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") :
QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title");
#else
return show ? QCoreApplication::translate("QWebPage", "Show Spelling", "menu item title") :
QCoreApplication::translate("QWebPage", "Hide Spelling", "menu item title");
#endif
QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title");
}
String contextMenuItemTagCheckSpelling()
......@@ -290,6 +274,11 @@ String contextMenuItemTagCheckSpellingWhileTyping()
return QCoreApplication::translate("QWebPage", "Check Spelling While Typing", "Check spelling while typing context menu item");
}
String contextMenuItemTagCheckGrammarWithSpelling()
{
return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item");
}
String contextMenuItemTagFontMenu()
{
return QCoreApplication::translate("QWebPage", "Fonts", "Font context sub-menu item");
......
2013-06-17 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Unreviewed, rolling out r151632.
http://trac.webkit.org/changeset/151632
https://bugs.webkit.org/show_bug.cgi?id=117585
Debug build error ASSERT(WTF_USE_GRAMMAR_CHECKING) for non MAC
platforms
* webkit/webkitglobals.cpp:
(webkit_context_menu_item_get_action):
2013-06-14 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Context menu grammar checking items are available when GRAMMAR_CHECKING macro is off
......
......@@ -428,10 +428,8 @@ WebKitContextMenuAction webkit_context_menu_item_get_action(GtkMenuItem* item)
return WEBKIT_CONTEXT_MENU_ACTION_IGNORE_SPELLING;
case ContextMenuItemTagLearnSpelling:
return WEBKIT_CONTEXT_MENU_ACTION_LEARN_SPELLING;
#if USE(GRAMMAR_CHECKING)
case ContextMenuItemTagIgnoreGrammar:
return WEBKIT_CONTEXT_MENU_ACTION_IGNORE_GRAMMAR;
#endif
case ContextMenuItemTagFontMenu:
return WEBKIT_CONTEXT_MENU_ACTION_FONT_MENU;
case ContextMenuItemTagBold:
......
2013-06-17 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Unreviewed, rolling out r151632.
http://trac.webkit.org/changeset/151632
https://bugs.webkit.org/show_bug.cgi?id=117585
Debug build error ASSERT(WTF_USE_GRAMMAR_CHECKING) for non MAC
platforms
* WebCoreSupport/WebContextMenuClient.mm:
(fixMenusReceivedFromOldClients):
2013-06-14 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Context menu grammar checking items are available when GRAMMAR_CHECKING macro is off
......
......@@ -165,12 +165,8 @@ static void fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutab
NSString *title = [item title];
if ([title isEqualToString:contextMenuItemTagOpenLink()])
modernTag = WebMenuItemTagOpenLink;
#if USE(GRAMMAR_CHECKING)
else if ([title isEqualToString:contextMenuItemTagIgnoreGrammar()])
modernTag = WebMenuItemTagIgnoreGrammar;
else if ([title isEqualToString:contextMenuItemTagCheckGrammarWithSpelling()])
modernTag = WebMenuItemTagCheckGrammarWithSpelling;
#endif
else if ([title isEqualToString:contextMenuItemTagSpellingMenu()])
modernTag = WebMenuItemTagSpellingMenu;
else if ([title isEqualToString:contextMenuItemTagShowSpellingPanel(true)]
......@@ -180,6 +176,8 @@ static void fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutab
modernTag = WebMenuItemTagCheckSpelling;
else if ([title isEqualToString:contextMenuItemTagCheckSpellingWhileTyping()])
modernTag = WebMenuItemTagCheckSpellingWhileTyping;
else if ([title isEqualToString:contextMenuItemTagCheckGrammarWithSpelling()])
modernTag = WebMenuItemTagCheckGrammarWithSpelling;
else if ([title isEqualToString:contextMenuItemTagFontMenu()])
modernTag = WebMenuItemTagFontMenu;
else if ([title isEqualToString:contextMenuItemTagShowFonts()])
......
2013-06-17 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Unreviewed, rolling out r151632.
http://trac.webkit.org/changeset/151632
https://bugs.webkit.org/show_bug.cgi?id=117585
Debug build error ASSERT(WTF_USE_GRAMMAR_CHECKING) for non MAC
platforms
* 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:
(onContextMenuShow):
(TEST_F):
* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
2013-06-14 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Context menu grammar checking items are available when GRAMMAR_CHECKING macro is off
......
......@@ -400,12 +400,8 @@ inline WKContextMenuItemTag toAPI(WebCore::ContextMenuAction action)
return kWKContextMenuItemTagPDFPreviousPage;
case WebCore::ContextMenuItemTagOpenLink:
return kWKContextMenuItemTagOpenLink;
#if USE(GRAMMAR_CHECKING)
case WebCore::ContextMenuItemTagIgnoreGrammar:
return kWKContextMenuItemTagIgnoreGrammar;
case WebCore::ContextMenuItemTagCheckGrammarWithSpelling:
return kWKContextMenuItemTagCheckGrammarWithSpelling;
#endif
case WebCore::ContextMenuItemTagSpellingMenu:
return kWKContextMenuItemTagSpellingMenu;
case WebCore::ContextMenuItemTagShowSpellingPanel:
......@@ -414,6 +410,8 @@ inline WKContextMenuItemTag toAPI(WebCore::ContextMenuAction action)
return kWKContextMenuItemTagCheckSpelling;
case WebCore::ContextMenuItemTagCheckSpellingWhileTyping:
return kWKContextMenuItemTagCheckSpellingWhileTyping;
case WebCore::ContextMenuItemTagCheckGrammarWithSpelling:
return kWKContextMenuItemTagCheckGrammarWithSpelling;
case WebCore::ContextMenuItemTagFontMenu:
return kWKContextMenuItemTagFontMenu;
case WebCore::ContextMenuItemTagShowFonts:
......@@ -594,12 +592,8 @@ inline WebCore::ContextMenuAction toImpl(WKContextMenuItemTag tag)
return WebCore::ContextMenuItemPDFPreviousPage;
case kWKContextMenuItemTagOpenLink:
return WebCore::ContextMenuItemTagOpenLink;
#if USE(GRAMMAR_CHECKING)
case kWKContextMenuItemTagIgnoreGrammar:
return WebCore::ContextMenuItemTagIgnoreGrammar;
case kWKContextMenuItemTagCheckGrammarWithSpelling:
return WebCore::ContextMenuItemTagCheckGrammarWithSpelling;
#endif
case kWKContextMenuItemTagSpellingMenu:
return WebCore::ContextMenuItemTagSpellingMenu;
case kWKContextMenuItemTagShowSpellingPanel:
......@@ -608,6 +602,8 @@ inline WebCore::ContextMenuAction toImpl(WKContextMenuItemTag tag)
return WebCore::ContextMenuItemTagCheckSpelling;
case kWKContextMenuItemTagCheckSpellingWhileTyping:
return WebCore::ContextMenuItemTagCheckSpellingWhileTyping;
case kWKContextMenuItemTagCheckGrammarWithSpelling:
return WebCore::ContextMenuItemTagCheckGrammarWithSpelling;
case kWKContextMenuItemTagFontMenu:
return WebCore::ContextMenuItemTagFontMenu;
case kWKContextMenuItemTagShowFonts:
......
......@@ -242,12 +242,8 @@ static Ewk_Context_Menu_Item_Action getEwkActionFromWKTag(WKContextMenuItemTag a
return EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE;
case kWKContextMenuItemTagOpenLink:
return EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK;
#if USE(GRAMMAR_CHECKING)
case kWKContextMenuItemTagIgnoreGrammar:
return EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR;
case kWKContextMenuItemTagCheckGrammarWithSpelling:
return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING;
#endif
case kWKContextMenuItemTagSpellingMenu:
return EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU;
case kWKContextMenuItemTagShowSpellingPanel:
......@@ -256,6 +252,8 @@ static Ewk_Context_Menu_Item_Action getEwkActionFromWKTag(WKContextMenuItemTag a
return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING;
case kWKContextMenuItemTagCheckSpellingWhileTyping:
return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING;
case kWKContextMenuItemTagCheckGrammarWithSpelling:
return EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING;
case kWKContextMenuItemTagFontMenu:
return EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU;
case kWKContextMenuItemTagShowFonts:
......
......@@ -217,7 +217,7 @@ static void onWordIgnore(uint64_t tag, const char* word)
callbacksExecutionStats.wordIgnore = true;
}
static Eina_Bool checkSpellingItemsAvailability(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
static Eina_Bool onContextMenuShow(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
const Eina_List* contextMenuItems = ewk_context_menu_items_get(contextMenu);
......@@ -245,63 +245,6 @@ static Eina_Bool checkSpellingItemsAvailability(Ewk_View_Smart_Data*, Evas_Coord
return true;
}
static Eina_Bool checkSpellingAndGrammarSubmenuAvailability(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
const Eina_List* contextMenuItems = ewk_context_menu_items_get(contextMenu);
bool isSpellingAndGrammarSubMenuAvailable = false;
const Eina_List* listIterator;
void* itemData;
EINA_LIST_FOREACH(contextMenuItems, listIterator, itemData) {
Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(itemData);
if (ewk_context_menu_item_type_get(item) == EWK_SUBMENU_TYPE
&& ewk_context_menu_item_action_get(item) == EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU) {
isSpellingAndGrammarSubMenuAvailable = true;
break;
}
}
EXPECT_TRUE(isSpellingAndGrammarSubMenuAvailable);
wasContextMenuShown = true;
return true;
}
static Eina_Bool checkGrammarWithSpellingItemAvailability(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
const Eina_List* contextMenuItems = ewk_context_menu_items_get(contextMenu);
bool isGrammarWtihSpellingItemAvailable = false;
const Eina_List* menuIterator;
void* itemData;
EINA_LIST_FOREACH(contextMenuItems, menuIterator, itemData) {
Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(itemData);
if (ewk_context_menu_item_type_get(item) == EWK_SUBMENU_TYPE
&& ewk_context_menu_item_action_get(item) == EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU) {
Ewk_Context_Menu* spellingAndGrammarSubmenu = ewk_context_menu_item_submenu_get(item);
const Eina_List* spellingAndGrammarSubmenuItems = ewk_context_menu_items_get(spellingAndGrammarSubmenu);
const Eina_List* submenuIterator;
EINA_LIST_FOREACH(spellingAndGrammarSubmenuItems, submenuIterator, itemData) {
Ewk_Context_Menu_Item* submenuItem = static_cast<Ewk_Context_Menu_Item*>(itemData);
if (ewk_context_menu_item_action_get(submenuItem) == EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING) {
isGrammarWtihSpellingItemAvailable = true;
break;
}
}
}
}
#if USE(GRAMMAR_CHECKING)
EXPECT_TRUE(isGrammarWtihSpellingItemAvailable);
#else
EXPECT_FALSE(isGrammarWtihSpellingItemAvailable);
#endif
wasContextMenuShown = true;
return true;
}
/**
* Test whether the default language is loaded independently of
* continuous spell checking setting.
......@@ -346,7 +289,7 @@ TEST_F(EWK2UnitTestBase, ewk_text_checker_spell_checking_languages_get)
TEST_F(EWK2UnitTestBase, context_menu_spelling_items_availability)
{
ewk_text_checker_continuous_spell_checking_enabled_set(false);
ewkViewClass()->context_menu_show = checkSpellingItemsAvailability;
ewkViewClass()->context_menu_show = onContextMenuShow;
ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data()));
mouseClick(10, 20, 3 /* Right button */);
......@@ -355,35 +298,6 @@ TEST_F(EWK2UnitTestBase, context_menu_spelling_items_availability)
ecore_main_loop_iterate();
}
/**
* Test whether "Spelling and Grammar" sub menu is available.
*/
TEST_F(EWK2UnitTestBase, context_menu_spelling_submenu_availability)
{
wasContextMenuShown = false;
ewkViewClass()->context_menu_show = checkSpellingAndGrammarSubmenuAvailability;
ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data()));
mouseClick(10, 20, 3 /* Right button */);
ASSERT_TRUE(waitUntilTrue(wasContextMenuShown));
}
/**
* Test whether "Check Grammar wth Spelling" is available
* only when GRAMMAR_CHECKING is enabled.
*/
TEST_F(EWK2UnitTestBase, context_menu_grammar_item_availability)
{
wasContextMenuShown = false;
ewkViewClass()->context_menu_show = checkGrammarWithSpellingItemAvailability;
ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data()));
mouseClick(10, 20, 3 /* Right button */);
ASSERT_TRUE(waitUntilTrue(wasContextMenuShown));
}
/**
* Test setter/getter for the continuous spell checking:
* - ewk_text_checker_continuous_spell_checking_enabled_get
......
......@@ -92,10 +92,8 @@ ContextMenuAction webkitContextMenuActionGetActionTag(WebKitContextMenuAction ac
return ContextMenuItemTagIgnoreSpelling;
case WEBKIT_CONTEXT_MENU_ACTION_LEARN_SPELLING:
return ContextMenuItemTagLearnSpelling;
#if USE(GRAMMAR_CHECKING)
case WEBKIT_CONTEXT_MENU_ACTION_IGNORE_GRAMMAR:
return ContextMenuItemTagIgnoreGrammar;
#endif
case WEBKIT_CONTEXT_MENU_ACTION_FONT_MENU:
return ContextMenuItemTagFontMenu;
case WEBKIT_CONTEXT_MENU_ACTION_BOLD:
......@@ -185,10 +183,8 @@ WebKitContextMenuAction webkitContextMenuActionGetForContextMenuItem(ContextMenu
return WEBKIT_CONTEXT_MENU_ACTION_IGNORE_SPELLING;
case ContextMenuItemTagLearnSpelling:
return WEBKIT_CONTEXT_MENU_ACTION_LEARN_SPELLING;
#if USE(GRAMMAR_CHECKING)
case ContextMenuItemTagIgnoreGrammar:
return WEBKIT_CONTEXT_MENU_ACTION_IGNORE_GRAMMAR;
#endif
case ContextMenuItemTagFontMenu:
return WEBKIT_CONTEXT_MENU_ACTION_FONT_MENU;
case ContextMenuItemTagBold:
......@@ -276,10 +272,8 @@ String webkitContextMenuActionGetLabel(WebKitContextMenuAction action)
return contextMenuItemTagIgnoreSpelling();
case WEBKIT_CONTEXT_MENU_ACTION_LEARN_SPELLING:
return contextMenuItemTagLearnSpelling();
#if USE(GRAMMAR_CHECKING)
case WEBKIT_CONTEXT_MENU_ACTION_IGNORE_GRAMMAR:
return contextMenuItemTagIgnoreGrammar();
#endif
case WEBKIT_CONTEXT_MENU_ACTION_FONT_MENU:
re