diff options
author | Steve Block <steveblock@google.com> | 2010-08-04 11:41:34 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-08-09 12:04:44 +0100 |
commit | db14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch) | |
tree | 9f793c5b0f5e1f2aca8247158920e2c4bf962bbf /WebCore/platform/gtk | |
parent | bf916837aa84f1e4b00e6ed6268516c2acd27545 (diff) | |
download | external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2 |
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
Diffstat (limited to 'WebCore/platform/gtk')
-rw-r--r-- | WebCore/platform/gtk/KeyEventGtk.cpp | 7 | ||||
-rw-r--r-- | WebCore/platform/gtk/PopupMenuGtk.cpp | 25 | ||||
-rw-r--r-- | WebCore/platform/gtk/PopupMenuGtk.h | 67 | ||||
-rw-r--r-- | WebCore/platform/gtk/SearchPopupMenuGtk.cpp | 19 | ||||
-rw-r--r-- | WebCore/platform/gtk/SearchPopupMenuGtk.h | 44 |
5 files changed, 140 insertions, 22 deletions
diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp index 193b7e5..e9756d8 100644 --- a/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/WebCore/platform/gtk/KeyEventGtk.cpp @@ -264,15 +264,14 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) case GDK_Select: return VK_SELECT; // (29) SELECT key case GDK_Print: - return VK_PRINT; // (2A) PRINT key + return VK_SNAPSHOT; // (2C) PRINT SCREEN key case GDK_Execute: return VK_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case GDK_PrintScreen: - // return VK_SNAPSHOT; // (2C) PRINT SCREEN key case GDK_Insert: + case GDK_KP_Insert: return VK_INSERT; // (2D) INS key case GDK_Delete: + case GDK_KP_Delete: return VK_DELETE; // (2E) DEL key case GDK_Help: return VK_HELP; // (2F) HELP key diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp index bf8cfb4..ca067d9 100644 --- a/WebCore/platform/gtk/PopupMenuGtk.cpp +++ b/WebCore/platform/gtk/PopupMenuGtk.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuGtk.h" #include "FrameView.h" #include "GtkVersioning.h" @@ -34,12 +35,12 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuGtk::PopupMenuGtk(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuGtk::~PopupMenuGtk() { if (m_popup) { g_signal_handlers_disconnect_matched(m_popup.get(), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); @@ -47,7 +48,7 @@ PopupMenu::~PopupMenu() } } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuGtk::show(const IntRect& rect, FrameView* view, int index) { ASSERT(client()); @@ -110,43 +111,43 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) gtk_menu_popup(m_popup.get(), 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, 0, gtk_get_current_event_time()); } -void PopupMenu::hide() +void PopupMenuGtk::hide() { ASSERT(m_popup); gtk_menu_popdown(m_popup.get()); } -void PopupMenu::updateFromElement() +void PopupMenuGtk::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuGtk::disconnectClient() { - return true; + m_popupClient = 0; } -void PopupMenu::menuItemActivated(GtkMenuItem* item, PopupMenu* that) +void PopupMenuGtk::menuItemActivated(GtkMenuItem* item, PopupMenuGtk* that) { ASSERT(that->client()); ASSERT(that->m_indexMap.contains(GTK_WIDGET(item))); that->client()->valueChanged(that->m_indexMap.get(GTK_WIDGET(item))); } -void PopupMenu::menuUnmapped(GtkWidget*, PopupMenu* that) +void PopupMenuGtk::menuUnmapped(GtkWidget*, PopupMenuGtk* that) { ASSERT(that->client()); that->client()->popupDidHide(); } -void PopupMenu::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenu* that) +void PopupMenuGtk::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenuGtk* that) { *x = that->m_menuPosition.x(); *y = that->m_menuPosition.y(); *pushIn = true; } -void PopupMenu::menuRemoveItem(GtkWidget* widget, PopupMenu* that) +void PopupMenuGtk::menuRemoveItem(GtkWidget* widget, PopupMenuGtk* that) { ASSERT(that->m_popup); gtk_container_remove(GTK_CONTAINER(that->m_popup.get()), widget); diff --git a/WebCore/platform/gtk/PopupMenuGtk.h b/WebCore/platform/gtk/PopupMenuGtk.h new file mode 100644 index 0000000..fb4e7dd --- /dev/null +++ b/WebCore/platform/gtk/PopupMenuGtk.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuGtk_h +#define PopupMenuGtk_h + +#include "GRefPtrGtk.h" +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <glib.h> +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +typedef struct _GtkMenu GtkMenu; +typedef struct _GtkMenuItem GtkMenuItem; +typedef struct _GtkWidget GtkWidget; + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuGtk : public PopupMenu { +public: + PopupMenuGtk(PopupMenuClient*); + ~PopupMenuGtk(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + static void menuItemActivated(GtkMenuItem* item, PopupMenuGtk*); + static void menuUnmapped(GtkWidget*, PopupMenuGtk*); + static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenuGtk*); + static void menuRemoveItem(GtkWidget*, PopupMenuGtk*); + + PopupMenuClient* m_popupClient; + IntPoint m_menuPosition; + GRefPtr<GtkMenu> m_popup; + HashMap<GtkWidget*, int> m_indexMap; +}; + +} + +#endif // PopupMenuGtk_h diff --git a/WebCore/platform/gtk/SearchPopupMenuGtk.cpp b/WebCore/platform/gtk/SearchPopupMenuGtk.cpp index fbaa527..2413773 100644 --- a/WebCore/platform/gtk/SearchPopupMenuGtk.cpp +++ b/WebCore/platform/gtk/SearchPopupMenuGtk.cpp @@ -1,4 +1,6 @@ /* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -15,29 +17,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuGtk.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuGtk::SearchPopupMenuGtk(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuGtk(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +PopupMenu* SearchPopupMenuGtk::popupMenu() +{ + return m_popup.get(); +} + +void SearchPopupMenuGtk::saveRecentSearches(const AtomicString&, const Vector<String>&) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuGtk::loadRecentSearches(const AtomicString&, Vector<String>&) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuGtk::enabled() { notImplemented(); return false; diff --git a/WebCore/platform/gtk/SearchPopupMenuGtk.h b/WebCore/platform/gtk/SearchPopupMenuGtk.h new file mode 100644 index 0000000..453c63d --- /dev/null +++ b/WebCore/platform/gtk/SearchPopupMenuGtk.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuGtk_h +#define SearchPopupMenuGtk_h + +#include "PopupMenuGtk.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuGtk : public SearchPopupMenu { +public: + SearchPopupMenuGtk(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuGtk> m_popup; +}; + +} + +#endif // SearchPopupMenuGtk_h |