Diff
Modified: trunk/Source/WebCore/ChangeLog (110864 => 110865)
--- trunk/Source/WebCore/ChangeLog 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/ChangeLog 2012-03-15 18:28:53 UTC (rev 110865)
@@ -1,3 +1,43 @@
+2012-03-15 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Implement unicode submenu items
+ https://bugs.webkit.org/show_bug.cgi?id=81117
+
+ Reviewed by Martin Robinson.
+
+ * loader/EmptyClients.h:
+ (WebCore::EmptyEditorClient::shouldShowUnicodeMenu): Just return
+ false.
+ * page/ContextMenuController.cpp:
+ (WebCore::insertUnicodeCharacter): Helper function to insert a
+ unicode character.
+ (WebCore::ContextMenuController::contextMenuItemSelected):
+ Implement unicode menu items using insertUnicodeCharacter() to
+ insert the apropriate unicode character.
+ (WebCore::ContextMenuController::createAndAppendUnicodeSubMenu):
+ Create the unicode submenu.
+ (WebCore::ContextMenuController::populate): Add unicode submenu
+ item for editable content.
+ (WebCore::ContextMenuController::checkOrEnableIfNeeded): Add
+ unicode submenu items to the switch.
+ * page/ContextMenuController.h:
+ * page/EditorClient.h:
+ (EditorClient): Add shouldShowUnicodeMenu() for GTK platform.
+ * platform/ContextMenuItem.h:
+ * platform/LocalizedStrings.h:
+ * platform/gtk/LocalizedStringsGtk.cpp:
+ (WebCore::contextMenuItemTagUnicodeInsertLRMMark): Add localized
+ string for the unicode menu item.
+ (WebCore::contextMenuItemTagUnicodeInsertRLMMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertLREMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertRLEMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertLROMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertRLOMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertPDFMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertZWSMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertZWJMark): Ditto.
+ (WebCore::contextMenuItemTagUnicodeInsertZWNJMark): Ditto.
+
2012-03-15 Vsevolod Vlasov <vse...@chromium.org>
Web Inspector: MainScriptMapping should detect snippet scripts by means of sourceURL set before evaluation.
Modified: trunk/Source/WebCore/loader/EmptyClients.h (110864 => 110865)
--- trunk/Source/WebCore/loader/EmptyClients.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -517,6 +517,9 @@
virtual bool isAutomaticSpellingCorrectionEnabled() { return false; }
virtual void toggleAutomaticSpellingCorrection() { }
#endif
+#if PLATFORM(GTK)
+ virtual bool shouldShowUnicodeMenu() { return false; }
+#endif
TextCheckerClient* textChecker() { return &m_textCheckerClient; }
#if USE(AUTOCORRECTION_PANEL)
Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (110864 => 110865)
--- trunk/Source/WebCore/page/ContextMenuController.cpp 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp 2012-03-15 18:28:53 UTC (rev 110865)
@@ -65,11 +65,16 @@
#include "ResourceRequest.h"
#include "Settings.h"
#include "TextIterator.h"
+#include "TypingCommand.h"
#include "UserTypingGestureIndicator.h"
#include "WindowFeatures.h"
#include "markup.h"
#include <wtf/unicode/Unicode.h>
+#if PLATFORM(GTK)
+#include <wtf/gobject/GOwnPtr.h>
+#endif
+
using namespace WTF;
using namespace Unicode;
@@ -181,6 +186,17 @@
}
}
+#if PLATFORM(GTK)
+static void insertUnicodeCharacter(UChar character, Frame* frame)
+{
+ String text(&character, 1);
+ if (!frame->editor()->shouldInsertText(text, frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped))
+ return;
+
+ TypingCommand::insertText(frame->document(), text, 0, TypingCommand::TextCompositionNone);
+}
+#endif
+
void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
{
ASSERT(item->type() == ActionType || item->type() == CheckableActionType);
@@ -284,6 +300,36 @@
case ContextMenuItemTagDelete:
frame->editor()->performDelete();
break;
+ case ContextMenuItemTagUnicodeInsertLRMMark:
+ insertUnicodeCharacter(leftToRightMark, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertRLMMark:
+ insertUnicodeCharacter(rightToLeftMark, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertLREMark:
+ insertUnicodeCharacter(leftToRightEmbed, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertRLEMark:
+ insertUnicodeCharacter(rightToLeftEmbed, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertLROMark:
+ insertUnicodeCharacter(leftToRightOverride, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertRLOMark:
+ insertUnicodeCharacter(rightToLeftOverride, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertPDFMark:
+ insertUnicodeCharacter(popDirectionalFormatting, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertZWSMark:
+ insertUnicodeCharacter(zeroWidthSpace, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertZWJMark:
+ insertUnicodeCharacter(zeroWidthJoiner, frame);
+ break;
+ case ContextMenuItemTagUnicodeInsertZWNJMark:
+ insertUnicodeCharacter(zeroWidthNonJoiner, frame);
+ break;
#endif
#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
case ContextMenuItemTagSelectAll:
@@ -530,8 +576,39 @@
#endif
-#if !PLATFORM(GTK)
+#if PLATFORM(GTK)
+void ContextMenuController::createAndAppendUnicodeSubMenu(ContextMenuItem& unicodeMenuItem)
+{
+ ContextMenu unicodeMenu;
+
+ ContextMenuItem leftToRightMarkMenuItem(ActionType, ContextMenuItemTagUnicodeInsertLRMMark, contextMenuItemTagUnicodeInsertLRMMark());
+ ContextMenuItem rightToLeftMarkMenuItem(ActionType, ContextMenuItemTagUnicodeInsertRLMMark, contextMenuItemTagUnicodeInsertRLMMark());
+ ContextMenuItem leftToRightEmbedMenuItem(ActionType, ContextMenuItemTagUnicodeInsertLREMark, contextMenuItemTagUnicodeInsertLREMark());
+ ContextMenuItem rightToLeftEmbedMenuItem(ActionType, ContextMenuItemTagUnicodeInsertRLEMark, contextMenuItemTagUnicodeInsertRLEMark());
+ ContextMenuItem leftToRightOverrideMenuItem(ActionType, ContextMenuItemTagUnicodeInsertLROMark, contextMenuItemTagUnicodeInsertLROMark());
+ ContextMenuItem rightToLeftOverrideMenuItem(ActionType, ContextMenuItemTagUnicodeInsertRLOMark, contextMenuItemTagUnicodeInsertRLOMark());
+ ContextMenuItem popDirectionalFormattingMenuItem(ActionType, ContextMenuItemTagUnicodeInsertPDFMark, contextMenuItemTagUnicodeInsertPDFMark());
+ ContextMenuItem zeroWidthSpaceMenuItem(ActionType, ContextMenuItemTagUnicodeInsertZWSMark, contextMenuItemTagUnicodeInsertZWSMark());
+ ContextMenuItem zeroWidthJoinerMenuItem(ActionType, ContextMenuItemTagUnicodeInsertZWJMark, contextMenuItemTagUnicodeInsertZWJMark());
+ ContextMenuItem zeroWidthNonJoinerMenuItem(ActionType, ContextMenuItemTagUnicodeInsertZWNJMark, contextMenuItemTagUnicodeInsertZWNJMark());
+
+ appendItem(leftToRightMarkMenuItem, &unicodeMenu);
+ appendItem(rightToLeftMarkMenuItem, &unicodeMenu);
+ appendItem(leftToRightEmbedMenuItem, &unicodeMenu);
+ appendItem(rightToLeftEmbedMenuItem, &unicodeMenu);
+ appendItem(leftToRightOverrideMenuItem, &unicodeMenu);
+ appendItem(rightToLeftOverrideMenuItem, &unicodeMenu);
+ appendItem(popDirectionalFormattingMenuItem, &unicodeMenu);
+ appendItem(zeroWidthSpaceMenuItem, &unicodeMenu);
+ appendItem(zeroWidthJoinerMenuItem, &unicodeMenu);
+ appendItem(zeroWidthNonJoinerMenuItem, &unicodeMenu);
+
+ unicodeMenuItem.setSubMenu(&unicodeMenu);
+}
+
+#else
+
void ContextMenuController::createAndAppendWritingDirectionSubMenu(ContextMenuItem& writingDirectionMenuItem)
{
ContextMenu writingDirectionMenu;
@@ -943,7 +1020,15 @@
createAndAppendSpeechSubMenu(SpeechMenuItem);
appendItem(SpeechMenuItem, m_contextMenu.get());
#endif
-#if !PLATFORM(GTK)
+#if PLATFORM(GTK)
+ EditorClient* client = frame->editor()->client();
+ if (client && client->shouldShowUnicodeMenu()) {
+ ContextMenuItem UnicodeMenuItem(SubmenuType, ContextMenuItemTagUnicode, contextMenuItemTagUnicode());
+ createAndAppendUnicodeSubMenu(UnicodeMenuItem);
+ appendItem(*separatorItem(), m_contextMenu.get());
+ appendItem(UnicodeMenuItem, m_contextMenu.get());
+ }
+#else
ContextMenuItem WritingDirectionMenuItem(SubmenuType, ContextMenuItemTagWritingDirectionMenu,
contextMenuItemTagWritingDirectionMenu());
createAndAppendWritingDirectionSubMenu(WritingDirectionMenuItem);
@@ -1062,6 +1147,16 @@
break;
case ContextMenuItemTagInputMethods:
case ContextMenuItemTagUnicode:
+ case ContextMenuItemTagUnicodeInsertLRMMark:
+ case ContextMenuItemTagUnicodeInsertRLMMark:
+ case ContextMenuItemTagUnicodeInsertLREMark:
+ case ContextMenuItemTagUnicodeInsertRLEMark:
+ case ContextMenuItemTagUnicodeInsertLROMark:
+ case ContextMenuItemTagUnicodeInsertRLOMark:
+ case ContextMenuItemTagUnicodeInsertPDFMark:
+ case ContextMenuItemTagUnicodeInsertZWSMark:
+ case ContextMenuItemTagUnicodeInsertZWJMark:
+ case ContextMenuItemTagUnicodeInsertZWNJMark:
shouldEnable = true;
break;
#endif
Modified: trunk/Source/WebCore/page/ContextMenuController.h (110864 => 110865)
--- trunk/Source/WebCore/page/ContextMenuController.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/page/ContextMenuController.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -85,6 +85,9 @@
void createAndAppendTextDirectionSubMenu(ContextMenuItem&);
void createAndAppendSubstitutionsSubMenu(ContextMenuItem&);
void createAndAppendTransformationsSubMenu(ContextMenuItem&);
+#if PLATFORM(GTK)
+ void createAndAppendUnicodeSubMenu(ContextMenuItem&);
+#endif
Page* m_page;
ContextMenuClient* m_client;
Modified: trunk/Source/WebCore/page/EditorClient.h (110864 => 110865)
--- trunk/Source/WebCore/page/EditorClient.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/page/EditorClient.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -140,6 +140,10 @@
virtual void toggleAutomaticSpellingCorrection() = 0;
#endif
+#if PLATFORM(GTK)
+ virtual bool shouldShowUnicodeMenu() = 0;
+#endif
+
virtual TextCheckerClient* textChecker() = 0;
enum AutocorrectionResponseType {
Modified: trunk/Source/WebCore/platform/ContextMenuItem.h (110864 => 110865)
--- trunk/Source/WebCore/platform/ContextMenuItem.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/platform/ContextMenuItem.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -77,6 +77,16 @@
#if PLATFORM(GTK)
ContextMenuItemTagInputMethods,
ContextMenuItemTagUnicode,
+ ContextMenuItemTagUnicodeInsertLRMMark,
+ ContextMenuItemTagUnicodeInsertRLMMark,
+ ContextMenuItemTagUnicodeInsertLREMark,
+ ContextMenuItemTagUnicodeInsertRLEMark,
+ ContextMenuItemTagUnicodeInsertLROMark,
+ ContextMenuItemTagUnicodeInsertRLOMark,
+ ContextMenuItemTagUnicodeInsertPDFMark,
+ ContextMenuItemTagUnicodeInsertZWSMark,
+ ContextMenuItemTagUnicodeInsertZWJMark,
+ ContextMenuItemTagUnicodeInsertZWNJMark,
#endif
ContextMenuItemTagSpellingGuess,
ContextMenuItemTagNoGuessesFound,
Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (110864 => 110865)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -69,6 +69,16 @@
String contextMenuItemTagDelete();
String contextMenuItemTagInputMethods();
String contextMenuItemTagUnicode();
+ String contextMenuItemTagUnicodeInsertLRMMark();
+ String contextMenuItemTagUnicodeInsertRLMMark();
+ String contextMenuItemTagUnicodeInsertLREMark();
+ String contextMenuItemTagUnicodeInsertRLEMark();
+ String contextMenuItemTagUnicodeInsertLROMark();
+ String contextMenuItemTagUnicodeInsertRLOMark();
+ String contextMenuItemTagUnicodeInsertPDFMark();
+ String contextMenuItemTagUnicodeInsertZWSMark();
+ String contextMenuItemTagUnicodeInsertZWJMark();
+ String contextMenuItemTagUnicodeInsertZWNJMark();
#endif
#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
String contextMenuItemTagSelectAll();
Modified: trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp (110864 => 110865)
--- trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2012-03-15 18:28:53 UTC (rev 110865)
@@ -342,6 +342,56 @@
return String::fromUTF8(_("Inspect _Element"));
}
+String contextMenuItemTagUnicodeInsertLRMMark()
+{
+ return String::fromUTF8(_("LRM _Left-to-right mark"));
+}
+
+String contextMenuItemTagUnicodeInsertRLMMark()
+{
+ return String::fromUTF8(_("RLM _Right-to-left mark"));
+}
+
+String contextMenuItemTagUnicodeInsertLREMark()
+{
+ return String::fromUTF8(_("LRE Left-to-right _embedding"));
+}
+
+String contextMenuItemTagUnicodeInsertRLEMark()
+{
+ return String::fromUTF8(_("RLE Right-to-left e_mbedding"));
+}
+
+String contextMenuItemTagUnicodeInsertLROMark()
+{
+ return String::fromUTF8(_("LRO Left-to-right _override"));
+}
+
+String contextMenuItemTagUnicodeInsertRLOMark()
+{
+ return String::fromUTF8(_("RLO Right-to-left o_verride"));
+}
+
+String contextMenuItemTagUnicodeInsertPDFMark()
+{
+ return String::fromUTF8(_("PDF _Pop directional formatting"));
+}
+
+String contextMenuItemTagUnicodeInsertZWSMark()
+{
+ return String::fromUTF8(_("ZWS _Zero width space"));
+}
+
+String contextMenuItemTagUnicodeInsertZWJMark()
+{
+ return String::fromUTF8(_("ZWJ Zero width _joiner"));
+}
+
+String contextMenuItemTagUnicodeInsertZWNJMark()
+{
+ return String::fromUTF8(_("ZWNJ Zero width _non-joiner"));
+}
+
String searchMenuNoRecentSearchesText()
{
return String::fromUTF8(_("No recent searches"));
Modified: trunk/Source/WebKit/gtk/ChangeLog (110864 => 110865)
--- trunk/Source/WebKit/gtk/ChangeLog 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit/gtk/ChangeLog 2012-03-15 18:28:53 UTC (rev 110865)
@@ -1,3 +1,20 @@
+2012-03-15 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Implement unicode submenu items
+ https://bugs.webkit.org/show_bug.cgi?id=81117
+
+ Reviewed by Martin Robinson.
+
+ * WebCoreSupport/ContextMenuClientGtk.cpp:
+ (WebKit::getUnicodeMenuItemPosition): Helper function to get the
+ position of the unicode menu item in the default context menu.
+ (WebKit::ContextMenuClient::getCustomMenuFromDefaultItems): Remove
+ code to build the unicode menu, since it's now built by WebCore.
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::shouldShowUnicodeMenu): Check whether
+ unicode menu should be shown based on gtk-show-unicode-menu GtkSetting.
+ * WebCoreSupport/EditorClientGtk.h:
+
2012-03-13 Adam Barth <aba...@webkit.org> && Benjamin Poulain <bpoul...@apple.com>
Always enable ENABLE(CLIENT_BASED_GEOLOCATION)
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp (110864 => 110865)
--- trunk/Source/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp 2012-03-15 18:28:53 UTC (rev 110865)
@@ -24,6 +24,7 @@
#include "ContextMenuController.h"
#include "HitTestResult.h"
#include "KURL.h"
+#include "LocalizedStrings.h"
#include "NotImplemented.h"
#include "Page.h"
#include "webkitwebviewprivate.h"
@@ -70,60 +71,22 @@
return menuitem;
}
-// Values taken from gtktextutil.c
-typedef struct {
- const char *label;
- gunichar ch;
-} GtkUnicodeMenuEntry;
-static const GtkUnicodeMenuEntry bidi_menu_entries[] = {
- { N_("LRM _Left-to-right mark"), 0x200E },
- { N_("RLM _Right-to-left mark"), 0x200F },
- { N_("LRE Left-to-right _embedding"), 0x202A },
- { N_("RLE Right-to-left e_mbedding"), 0x202B },
- { N_("LRO Left-to-right _override"), 0x202D },
- { N_("RLO Right-to-left o_verride"), 0x202E },
- { N_("PDF _Pop directional formatting"), 0x202C },
- { N_("ZWS _Zero width space"), 0x200B },
- { N_("ZWJ Zero width _joiner"), 0x200D },
- { N_("ZWNJ Zero width _non-joiner"), 0x200C }
-};
-
-static void insertControlCharacter(GtkWidget* widget)
+static int getUnicodeMenuItemPosition(GtkMenu* menu)
{
- // GtkUnicodeMenuEntry* entry = (GtkUnicodeMenuEntry*)g_object_get_data(G_OBJECT(widget), "gtk-unicode-menu-entry");
- notImplemented();
-}
-
-static GtkWidget* unicodeMenuItem(WebKitWebView* webView)
-{
- if (gtk_major_version > 2 || (gtk_major_version == 2 && gtk_minor_version >= 10)) {
- GtkSettings* settings = webView ? gtk_widget_get_settings(GTK_WIDGET(webView)) : gtk_settings_get_default();
-
- gboolean showMenu = TRUE;
- if (settings)
- g_object_get(settings, "gtk-show-unicode-menu", &showMenu, NULL);
- if (!showMenu)
- return 0;
+ GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu)));
+ int unicodeMenuItemPosition = -1;
+ GList* iter;
+ int i = 0;
+ for (iter = items.get(), i = 0; iter; iter = g_list_next(iter), ++i) {
+ GtkMenuItem* item = GTK_MENU_ITEM(iter->data);
+ if (GTK_IS_SEPARATOR_MENU_ITEM(item))
+ continue;
+ if (String::fromUTF8(gtk_menu_item_get_label(item)) == contextMenuItemTagUnicode()) {
+ unicodeMenuItemPosition = i;
+ break;
+ }
}
-
- GtkWidget* menuitem = gtk_image_menu_item_new_with_mnemonic(
- _("_Insert Unicode Control Character"));
-
- GtkWidget* unicodeContextMenu = gtk_menu_new();
- unsigned i;
- for (i = 0; i < G_N_ELEMENTS(bidi_menu_entries); i++) {
- GtkWidget* menuitem = gtk_menu_item_new_with_mnemonic(_(bidi_menu_entries[i].label));
- g_object_set_data(G_OBJECT(menuitem), "gtk-unicode-menu-entry", (gpointer)&bidi_menu_entries[i]);
- g_signal_connect(menuitem, "activate", G_CALLBACK(insertControlCharacter), 0);
- gtk_widget_show(menuitem);
- gtk_menu_shell_append(GTK_MENU_SHELL(unicodeContextMenu), menuitem);
- // FIXME: Make the item sensitive as insertControlCharacter() is implemented
- gtk_widget_set_sensitive(menuitem, FALSE);
- }
-
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), unicodeContextMenu);
-
- return menuitem;
+ return unicodeMenuItemPosition;
}
PlatformMenuDescription ContextMenuClient::getCustomMenuFromDefaultItems(ContextMenu* menu)
@@ -134,26 +97,21 @@
HitTestResult result = core(webView)->contextMenuController()->hitTestResult();
if (result.isContentEditable()) {
-
GtkWidget* imContextMenu = inputMethodsMenuItem(webView);
- GtkWidget* unicodeContextMenu = unicodeMenuItem(webView);
+ if (!imContextMenu)
+ return gtkmenu;
- if (imContextMenu || unicodeContextMenu) {
+ // Place the im context menu item right before the unicode menu item
+ // if it's present.
+ int unicodeMenuItemPosition = getUnicodeMenuItemPosition(gtkmenu);
+ if (unicodeMenuItemPosition == -1) {
GtkWidget* separator = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(gtkmenu), separator);
gtk_widget_show(separator);
}
- if (imContextMenu) {
- gtk_menu_shell_append(GTK_MENU_SHELL(gtkmenu), imContextMenu);
- gtk_widget_show(imContextMenu);
- }
-
- if (unicodeContextMenu) {
- gtk_menu_shell_append(GTK_MENU_SHELL(gtkmenu), unicodeContextMenu);
- gtk_widget_show(unicodeContextMenu);
- }
-
+ gtk_menu_shell_insert(GTK_MENU_SHELL(gtkmenu), imContextMenu, unicodeMenuItemPosition);
+ gtk_widget_show(imContextMenu);
}
return gtkmenu;
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp (110864 => 110865)
--- trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp 2012-03-15 18:28:53 UTC (rev 110865)
@@ -133,6 +133,21 @@
#endif
}
+bool EditorClient::shouldShowUnicodeMenu()
+{
+ if (gtk_major_version > 2 || (gtk_major_version == 2 && gtk_minor_version >= 10)) {
+ GtkSettings* settings = gtk_widget_get_settings(GTK_WIDGET(m_webView));
+ if (!settings)
+ return true;
+
+ gboolean enabled;
+ g_object_get(settings, "gtk-show-unicode-menu", &enabled, NULL);
+ return enabled;
+ }
+
+ return true;
+}
+
bool EditorClient::shouldDeleteRange(Range* range)
{
gboolean accept = TRUE;
Modified: trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h (110864 => 110865)
--- trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -137,6 +137,8 @@
virtual void willSetInputMethodState();
virtual void setInputMethodState(bool enabled);
+ virtual bool shouldShowUnicodeMenu();
+
private:
#if ENABLE(SPELLCHECK)
TextCheckerClientGtk m_textCheckerClient;
Modified: trunk/Source/WebKit2/ChangeLog (110864 => 110865)
--- trunk/Source/WebKit2/ChangeLog 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit2/ChangeLog 2012-03-15 18:28:53 UTC (rev 110865)
@@ -1,3 +1,17 @@
+2012-03-15 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [GTK] Implement unicode submenu items
+ https://bugs.webkit.org/show_bug.cgi?id=81117
+
+ Reviewed by Martin Robinson.
+
+ * WebProcess/WebCoreSupport/WebEditorClient.h:
+ * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
+ (WebKit::WebEditorClient::shouldShowUnicodeMenu): Implement
+ shouldShowUnicodeMenu() returning always true. When ContextMenu
+ API is implemented for GTK+ the UI process will decide whether to
+ show the unicode menu or not.
+
2012-03-15 Andras Becsi <andras.be...@nokia.com>
[Qt][WK2] Fix bounce-back behaviour for panning
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (110864 => 110865)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h 2012-03-15 18:28:53 UTC (rev 110865)
@@ -148,6 +148,9 @@
virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel) OVERRIDE;
virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const String& replacedString, const String& replacementString) OVERRIDE;
#endif
+#if PLATFORM(GTK)
+ virtual bool shouldShowUnicodeMenu() OVERRIDE;
+#endif
WebPage* m_page;
};
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp (110864 => 110865)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp 2012-03-15 18:26:11 UTC (rev 110864)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp 2012-03-15 18:28:53 UTC (rev 110865)
@@ -194,5 +194,9 @@
#endif
}
+bool WebEditorClient::shouldShowUnicodeMenu()
+{
+ return true;
+}
}