[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:46:21 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 11f86205dfa594f59098451074edb502a310b968
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 6 11:15:40 2010 +0000

    2010-08-06  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
            https://bugs.webkit.org/show_bug.cgi?id=43427
    
            After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
            there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.
    
            PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
            assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
            to WebKit/qt/WebCoreSupport as well.
    
            All classes that previously inherited from QtAbstractWebPopup now inherit from
            QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
            instance of class QWebSelectMethod instead of QtAbstractWebPopup.
    
            * WebCore.pro:
            * platform/qt/PopupMenuQt.cpp: Removed.
            * platform/qt/PopupMenuQt.h: Removed.
            * platform/qt/QtAbstractWebPopup.cpp: Removed.
            * platform/qt/QtAbstractWebPopup.h: Removed.
            * platform/qt/SearchPopupMenuQt.cpp: Removed.
            * platform/qt/SearchPopupMenuQt.h: Removed.
    2010-08-06  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
            https://bugs.webkit.org/show_bug.cgi?id=43427
    
            After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
            there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.
    
            PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
            assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
            to WebKit/qt/WebCoreSupport as well.
    
            All classes that previously inherited from QtAbstractWebPopup now inherit from
            QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
            instance of class QWebSelectMethod instead of QtAbstractWebPopup.
    
            * WebCoreSupport/ChromeClientQt.cpp:
            (WebCore::ChromeClientQt::createSelectPopup):
            (WebCore::ChromeClientQt::createPopupMenu):
            (WebCore::ChromeClientQt::createSearchPopupMenu):
            * WebCoreSupport/ChromeClientQt.h:
            * WebCoreSupport/PopupMenuQt.cpp: Added.
            (SelectData::SelectData):
            (SelectData::itemText):
            (SelectData::itemToolTip):
            (SelectData::itemIsEnabled):
            (SelectData::itemCount):
            (SelectData::itemIsSelected):
            (SelectData::multiple):
            (SelectData::itemType):
            (WebCore::PopupMenuQt::PopupMenuQt):
            (WebCore::PopupMenuQt::~PopupMenuQt):
            (WebCore::PopupMenuQt::disconnectClient):
            (WebCore::PopupMenuQt::show):
            (WebCore::PopupMenuQt::didHide):
            (WebCore::PopupMenuQt::hide):
            (WebCore::PopupMenuQt::updateFromElement):
            (WebCore::PopupMenuQt::selectItem):
            * WebCoreSupport/PopupMenuQt.h: Added.
            * WebCoreSupport/QtFallbackWebPopup.cpp:
            (WebCore::QtFallbackWebPopupCombo::hidePopup):
            (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
            (WebCore::QtFallbackWebPopup::show):
            (WebCore::QtFallbackWebPopup::populate):
            (WebCore::QtFallbackWebPopup::activeChanged):
            (WebCore::QtFallbackWebPopup::pageClient):
            * WebCoreSupport/QtFallbackWebPopup.h:
            (WebCore::QtFallbackWebPopup::setGeometry):
            (WebCore::QtFallbackWebPopup::geometry):
            (WebCore::QtFallbackWebPopup::setFont):
            (WebCore::QtFallbackWebPopup::font):
            * WebCoreSupport/QtMaemoWebPopup.cpp:
            (WebCore::Maemo5Popup::populateList):
            (WebCore::QtMaemoWebPopup::QtMaemoWebPopup):
            (WebCore::QtMaemoWebPopup::createSingleSelectionPopup):
            (WebCore::QtMaemoWebPopup::createMultipleSelectionPopup):
            (WebCore::QtMaemoWebPopup::createPopup):
            (WebCore::QtMaemoWebPopup::show):
            (WebCore::QtMaemoWebPopup::popupClosed):
            (WebCore::QtMaemoWebPopup::itemClicked):
            (WebCore::Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup):
            (WebCore::Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup):
            * WebCoreSupport/QtMaemoWebPopup.h:
            (WebCore::Maemo5Popup::Maemo5Popup):
            * WebCoreSupport/QtPlatformPlugin.cpp:
            (WebCore::QtPlatformPlugin::createSelectInputMethod):
            * WebCoreSupport/QtPlatformPlugin.h:
            * WebCoreSupport/SearchPopupMenuQt.cpp: Added.
            (WebCore::SearchPopupMenuQt::SearchPopupMenuQt):
            (WebCore::SearchPopupMenuQt::popupMenu):
            (WebCore::SearchPopupMenuQt::saveRecentSearches):
            (WebCore::SearchPopupMenuQt::loadRecentSearches):
            (WebCore::SearchPopupMenuQt::enabled):
            * WebCoreSupport/SearchPopupMenuQt.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64829 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d71a350..bed0843 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-08-06  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
+        https://bugs.webkit.org/show_bug.cgi?id=43427
+
+        After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
+        there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.
+
+        PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
+        assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
+        to WebKit/qt/WebCoreSupport as well.
+
+        All classes that previously inherited from QtAbstractWebPopup now inherit from 
+        QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
+        instance of class QWebSelectMethod instead of QtAbstractWebPopup.
+
+        * WebCore.pro:
+        * platform/qt/PopupMenuQt.cpp: Removed.
+        * platform/qt/PopupMenuQt.h: Removed.
+        * platform/qt/QtAbstractWebPopup.cpp: Removed.
+        * platform/qt/QtAbstractWebPopup.h: Removed.
+        * platform/qt/SearchPopupMenuQt.cpp: Removed.
+        * platform/qt/SearchPopupMenuQt.h: Removed.
+
 2010-08-05  Marcus Bulach  <bulach at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 3f22a22..2a841a5 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1713,7 +1713,6 @@ HEADERS += \
     platform/PopupMenu.h \
     platform/qt/ClipboardQt.h \
     platform/qt/QWebPageClient.h \
-    platform/qt/QtAbstractWebPopup.h \
     platform/qt/QtStyleOptionWebComboBox.h \
     platform/qt/RenderThemeQt.h \
     platform/qt/ScrollbarThemeQt.h \
@@ -2150,6 +2149,8 @@ HEADERS += \
     $$PWD/../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \
     $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \
     $$PWD/../WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \
+    $$PWD/../WebKit/qt/WebCoreSupport/PopupMenuQt.h \
+    $$PWD/../WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \
     $$PWD/platform/network/qt/DnsPrefetchHelper.h
 
 SOURCES += \
@@ -2212,13 +2213,10 @@ SOURCES += \
     platform/qt/PlatformScreenQt.cpp \
     platform/qt/PlatformTouchEventQt.cpp \
     platform/qt/PlatformTouchPointQt.cpp \
-    platform/qt/PopupMenuQt.cpp \
-    platform/qt/QtAbstractWebPopup.cpp \
     platform/qt/RenderThemeQt.cpp \
     platform/qt/ScrollbarQt.cpp \
     platform/qt/ScrollbarThemeQt.cpp \
     platform/qt/ScrollViewQt.cpp \
-    platform/qt/SearchPopupMenuQt.cpp \
     platform/qt/SharedTimerQt.cpp \
     platform/qt/SoundQt.cpp \
     platform/qt/LoggingQt.cpp \
@@ -2240,7 +2238,9 @@ SOURCES += \
     ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \
     ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \
     ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \
+    ../WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \
     ../WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \
+    ../WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \
     ../WebKit/qt/Api/qwebframe.cpp \
     ../WebKit/qt/Api/qgraphicswebview.cpp \
     ../WebKit/qt/Api/qwebpage.cpp \
diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp
deleted file mode 100644
index 5590556..0000000
--- a/WebCore/platform/qt/PopupMenuQt.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * This file is part of the popup menu implementation for <select> elements in WebCore.
- *
- * Copyright (C) 2008, 2009, 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2006 Apple Computer, Inc.
- * Copyright (C) 2006 Michael Emmel mike.emmel at gmail.com 
- * Coypright (C) 2006 Nikolas Zimmermann <zimmermann at kde.org>
- *
- * 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.
- *
- */
-
-#include "config.h"
-#include "PopupMenuQt.h"
-
-#include "Chrome.h"
-#include "ChromeClientQt.h"
-#include "FrameView.h"
-#include "PopupMenuClient.h"
-#include "QWebPageClient.h"
-#include "QtAbstractWebPopup.h"
-
-namespace WebCore {
-
-PopupMenuQt::PopupMenuQt(PopupMenuClient* client)
-    : m_popupClient(client)
-    , m_popup(0)
-{
-}
-
-PopupMenuQt::~PopupMenuQt()
-{
-    delete m_popup;
-}
-
-
-void PopupMenuQt::disconnectClient()
-{
-    m_popupClient = 0;
-}
-
-void PopupMenuQt::show(const IntRect& rect, FrameView* view, int index)
-{
-    ChromeClientQt* chromeClient = static_cast<ChromeClientQt*>(
-        view->frame()->page()->chrome()->client());
-    ASSERT(chromeClient);
-
-    if (!m_popup)
-        m_popup = chromeClient->createSelectPopup();
-
-    m_popup->m_popupClient = m_popupClient;
-    m_popup->m_currentIndex = index;
-    m_popup->m_pageClient = chromeClient->platformPageClient();
-
-    QRect geometry(rect);
-    geometry.moveTopLeft(view->contentsToWindow(rect.topLeft()));
-    m_popup->m_geometry = geometry;
-
-    m_popup->show();
-
-}
-
-void PopupMenuQt::hide()
-{
-    m_popup->hide();
-}
-
-void PopupMenuQt::updateFromElement()
-{
-    m_popupClient->setTextFromItem(m_popupClient->selectedIndex());
-}
-
-}
-
-// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/PopupMenuQt.h b/WebCore/platform/qt/PopupMenuQt.h
deleted file mode 100644
index 25a9f76..0000000
--- a/WebCore/platform/qt/PopupMenuQt.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 PopupMenuQt_h
-#define PopupMenuQt_h
-
-#include "PopupMenu.h"
-
-namespace WebCore {
-
-class FrameView;
-class QtAbstractWebPopup;
-class Scrollbar;
-class PopupMenuClient;
-
-class PopupMenuQt : public PopupMenu {
-public:
-    PopupMenuQt(PopupMenuClient*);
-    ~PopupMenuQt();
-
-    virtual void show(const IntRect&, FrameView*, int index);
-    virtual void hide();
-    virtual void updateFromElement();
-    virtual void disconnectClient();
-
-private:
-    PopupMenuClient* m_popupClient;
-    QtAbstractWebPopup* m_popup;
-};
-
-}
-
-#endif // PopupMenuQt_h
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.cpp b/WebCore/platform/qt/QtAbstractWebPopup.cpp
deleted file mode 100644
index 31ab28d..0000000
--- a/WebCore/platform/qt/QtAbstractWebPopup.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- *
- */
-#include "config.h"
-#include "QtAbstractWebPopup.h"
-
-#include "PopupMenuClient.h"
-
-
-namespace WebCore {
-
-QtAbstractWebPopup::QtAbstractWebPopup()
-    : m_popupClient(0)
-    , m_pageClient(0)
-    , m_currentIndex(-1)
-{
-}
-
-QtAbstractWebPopup::~QtAbstractWebPopup()
-{
-}
-
-void QtAbstractWebPopup::popupDidHide()
-{
-    Q_ASSERT(m_popupClient);
-    m_popupClient->popupDidHide();
-}
-
-void QtAbstractWebPopup::valueChanged(int index)
-{
-    Q_ASSERT(m_popupClient);
-    m_popupClient->valueChanged(index);
-}
-
-void QtAbstractWebPopup::selectItem(int index, bool allowMultiplySelections, bool shift)
-{
-#if ENABLE(NO_LISTBOX_RENDERING)
-    ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
-    if (client) {
-        client->listBoxSelectItem(index, allowMultiplySelections, shift);
-        return;
-    }
-#endif
-    valueChanged(index);
-}
-
-bool QtAbstractWebPopup::multiple()
-{
-#if ENABLE(NO_LISTBOX_RENDERING)
-    ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
-    return client && client->multiple();
-#else
-    return false;
-#endif
-}
-
-QtAbstractWebPopup::ItemType QtAbstractWebPopup::itemType(int idx) const
-{
-    if (m_popupClient->itemIsSeparator(idx))
-        return Separator;
-    if (m_popupClient->itemIsLabel(idx))
-        return Group;
-    return Option;
-}
-
-} // namespace WebCore
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.h b/WebCore/platform/qt/QtAbstractWebPopup.h
deleted file mode 100644
index 5f6f619..0000000
--- a/WebCore/platform/qt/QtAbstractWebPopup.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2009 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 QtAbstractWebPopup_h
-#define QtAbstractWebPopup_h
-
-#include "PopupMenuClient.h"
-
-#include <QFont>
-#include <QList>
-#include <QRect>
-#include <QWidget>
-
-class QWebPageClient;
-
-namespace WebCore {
-
-class QtAbstractWebPopup {
-public:
-    enum ItemType { Option, Group, Separator };
-
-    ItemType itemType(int) const;
-    QString itemText(int idx) const { return m_popupClient->itemText(idx); }
-    QString itemToolTip(int idx) const { return m_popupClient->itemToolTip(idx); }
-    bool itemIsEnabled(int idx) const { return m_popupClient->itemIsEnabled(idx); }
-    int itemCount() const { return m_popupClient->listSize(); }
-    bool itemIsSelected(int idx) const { return m_popupClient->itemIsSelected(idx); }
-
-
-    QWebPageClient* pageClient() const { return m_pageClient; }
-    QRect geometry() const { return m_geometry; }
-    int currentIndex() const { return m_currentIndex; }
-
-    QtAbstractWebPopup();
-    virtual ~QtAbstractWebPopup();
-
-    virtual void show() = 0;
-    virtual void hide() = 0;
-
-    void popupDidHide();
-    void valueChanged(int index);
-
-    void selectItem(int index, bool allowMultiplySelections, bool shift);
-    bool multiple();
-
-
-    QFont font() { return m_popupClient->menuStyle().font().font(); }
-
-private:
-    friend class PopupMenuQt;
-    PopupMenuClient* m_popupClient;
-    QWebPageClient* m_pageClient;
-    int m_currentIndex;
-    QRect m_geometry;
-};
-
-}
-
-#endif // QtAbstractWebPopup_h
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.cpp b/WebCore/platform/qt/SearchPopupMenuQt.cpp
deleted file mode 100644
index a05d08a..0000000
--- a/WebCore/platform/qt/SearchPopupMenuQt.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright C 2006 Zack Rusin <zack at kde.org>
- * 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.
- */
-
-#include "config.h"
-#include "SearchPopupMenuQt.h"
-
-namespace WebCore {
-
-SearchPopupMenuQt::SearchPopupMenuQt(PopupMenuClient* client)
-    : m_popup(adoptRef(new PopupMenuQt(client)))
-{
-}
-
-PopupMenu* SearchPopupMenuQt::popupMenu()
-{
-    return m_popup.get();
-}
-
-void SearchPopupMenuQt::saveRecentSearches(const AtomicString&, const Vector<String>&)
-{
-}
-
-void SearchPopupMenuQt::loadRecentSearches(const AtomicString&, Vector<String>&)
-{
-}
-
-bool SearchPopupMenuQt::enabled()
-{
-    return true;
-}
-
-}
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.h b/WebCore/platform/qt/SearchPopupMenuQt.h
deleted file mode 100644
index 0fbeafd..0000000
--- a/WebCore/platform/qt/SearchPopupMenuQt.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 SearchPopupMenuQt_h
-#define SearchPopupMenuQt_h
-
-#include "PopupMenuQt.h"
-#include "SearchPopupMenu.h"
-
-namespace WebCore {
-
-class SearchPopupMenuQt : public SearchPopupMenu {
-public:
-    SearchPopupMenuQt(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<PopupMenuQt> m_popup;
-};
-
-}
-
-#endif // SearchPopupMenuQt_h
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index a2c34c9..36bf9d1 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,80 @@
+2010-08-06  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Move Qt's popup menu implementation from WebCore to WebKit layer
+        https://bugs.webkit.org/show_bug.cgi?id=43427
+
+        After PopupMenu changes in bug 42592 class QtAbstractWebPopup became unecessary and
+        there is no need to keep any Qt specific code for popup menus in WebCore/platform/qt.
+
+        PopupMenuQt has been moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport and
+        assumed the responsibilities of QtAbstractWebPopup. SearchPopupMenuQt has been moved
+        to WebKit/qt/WebCoreSupport as well.
+
+        All classes that previously inherited from QtAbstractWebPopup now inherit from
+        QWebSelectMethod and QtPlatformPlugin's method createSelectInputMethod now returns an
+        instance of class QWebSelectMethod instead of QtAbstractWebPopup.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::createSelectPopup):
+        (WebCore::ChromeClientQt::createPopupMenu):
+        (WebCore::ChromeClientQt::createSearchPopupMenu):
+        * WebCoreSupport/ChromeClientQt.h:
+        * WebCoreSupport/PopupMenuQt.cpp: Added.
+        (SelectData::SelectData):
+        (SelectData::itemText):
+        (SelectData::itemToolTip):
+        (SelectData::itemIsEnabled):
+        (SelectData::itemCount):
+        (SelectData::itemIsSelected):
+        (SelectData::multiple):
+        (SelectData::itemType):
+        (WebCore::PopupMenuQt::PopupMenuQt):
+        (WebCore::PopupMenuQt::~PopupMenuQt):
+        (WebCore::PopupMenuQt::disconnectClient):
+        (WebCore::PopupMenuQt::show):
+        (WebCore::PopupMenuQt::didHide):
+        (WebCore::PopupMenuQt::hide):
+        (WebCore::PopupMenuQt::updateFromElement):
+        (WebCore::PopupMenuQt::selectItem):
+        * WebCoreSupport/PopupMenuQt.h: Added.
+        * WebCoreSupport/QtFallbackWebPopup.cpp:
+        (WebCore::QtFallbackWebPopupCombo::hidePopup):
+        (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
+        (WebCore::QtFallbackWebPopup::show):
+        (WebCore::QtFallbackWebPopup::populate):
+        (WebCore::QtFallbackWebPopup::activeChanged):
+        (WebCore::QtFallbackWebPopup::pageClient):
+        * WebCoreSupport/QtFallbackWebPopup.h:
+        (WebCore::QtFallbackWebPopup::setGeometry):
+        (WebCore::QtFallbackWebPopup::geometry):
+        (WebCore::QtFallbackWebPopup::setFont):
+        (WebCore::QtFallbackWebPopup::font):
+        * WebCoreSupport/QtMaemoWebPopup.cpp:
+        (WebCore::Maemo5Popup::populateList):
+        (WebCore::QtMaemoWebPopup::QtMaemoWebPopup):
+        (WebCore::QtMaemoWebPopup::createSingleSelectionPopup):
+        (WebCore::QtMaemoWebPopup::createMultipleSelectionPopup):
+        (WebCore::QtMaemoWebPopup::createPopup):
+        (WebCore::QtMaemoWebPopup::show):
+        (WebCore::QtMaemoWebPopup::popupClosed):
+        (WebCore::QtMaemoWebPopup::itemClicked):
+        (WebCore::Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup):
+        (WebCore::Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup):
+        * WebCoreSupport/QtMaemoWebPopup.h:
+        (WebCore::Maemo5Popup::Maemo5Popup):
+        * WebCoreSupport/QtPlatformPlugin.cpp:
+        (WebCore::QtPlatformPlugin::createSelectInputMethod):
+        * WebCoreSupport/QtPlatformPlugin.h:
+        * WebCoreSupport/SearchPopupMenuQt.cpp: Added.
+        (WebCore::SearchPopupMenuQt::SearchPopupMenuQt):
+        (WebCore::SearchPopupMenuQt::popupMenu):
+        (WebCore::SearchPopupMenuQt::saveRecentSearches):
+        (WebCore::SearchPopupMenuQt::loadRecentSearches):
+        (WebCore::SearchPopupMenuQt::enabled):
+        * WebCoreSupport/SearchPopupMenuQt.h: Added.
+
 2010-08-06  Kenneth Rohde Christiansen  <kenneth at webkit.org>
 
         Reviewed by Antonio Gomes.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index e9e8812..0b77ea6 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -591,16 +591,16 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
 }
 #endif
 
-QtAbstractWebPopup* ChromeClientQt::createSelectPopup()
+QWebSelectMethod* ChromeClientQt::createSelectPopup() const
 {
-    QtAbstractWebPopup* result = m_platformPlugin.createSelectInputMethod();
+    QWebSelectMethod* result = m_platformPlugin.createSelectInputMethod();
     if (result)
         return result;
 
 #if defined(Q_WS_MAEMO_5)
     return new QtMaemoWebPopup;
 #elif !defined(QT_NO_COMBOBOX)
-    return new QtFallbackWebPopup;
+    return new QtFallbackWebPopup(this);
 #else
     return 0;
 #endif
@@ -633,12 +633,12 @@ bool ChromeClientQt::selectItemWritingDirectionIsNatural()
 
 PassRefPtr<PopupMenu> ChromeClientQt::createPopupMenu(PopupMenuClient* client) const
 {
-    return adoptRef(new PopupMenuQt(client));
+    return adoptRef(new PopupMenuQt(client, this));
 }
 
 PassRefPtr<SearchPopupMenu> ChromeClientQt::createSearchPopupMenu(PopupMenuClient* client) const
 {
-    return adoptRef(new SearchPopupMenuQt(client));
+    return adoptRef(new SearchPopupMenuQt(createPopupMenu(client)));
 }
 
 } // namespace WebCore
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index aab2813..c10957c 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -174,7 +174,7 @@ namespace WebCore {
         virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
         virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
 
-        QtAbstractWebPopup* createSelectPopup();
+        QWebSelectMethod* createSelectPopup() const;
 
         virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const;
 
@@ -188,7 +188,7 @@ namespace WebCore {
         bool menuBarVisible;
         QEventLoop* m_eventLoop;
 
-        QtPlatformPlugin m_platformPlugin;
+        mutable QtPlatformPlugin m_platformPlugin;
     };
 }
 
diff --git a/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp b/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
new file mode 100644
index 0000000..56a0fac
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
@@ -0,0 +1,158 @@
+/*
+ * This file is part of the popup menu implementation for <select> elements in WebCore.
+ *
+ * Copyright (C) 2008, 2009, 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel at gmail.com
+ * Coypright (C) 2006 Nikolas Zimmermann <zimmermann at kde.org>
+ *
+ * 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.
+ *
+ */
+
+#include "config.h"
+#include "PopupMenuQt.h"
+
+#include "ChromeClientQt.h"
+#include "FrameView.h"
+#include "PopupMenuClient.h"
+#include "QtFallbackWebPopup.h"
+
+#include "qwebkitplatformplugin.h"
+
+class SelectData : public QWebSelectData {
+public:
+    SelectData(WebCore::PopupMenuClient*& data) : d(data) {}
+
+    virtual ItemType itemType(int) const;
+    virtual QString itemText(int idx) const { return QString(d ? d->itemText(idx) : ""); }
+    virtual QString itemToolTip(int idx) const { return QString(d ? d->itemToolTip(idx) : ""); }
+    virtual bool itemIsEnabled(int idx) const { return d ? d->itemIsEnabled(idx) : false; }
+    virtual int itemCount() const { return d ? d->listSize() : 0; }
+    virtual bool itemIsSelected(int idx) const { return d ? d->itemIsSelected(idx) : false; }
+    virtual bool multiple() const;
+
+private:
+    WebCore::PopupMenuClient*& d;
+};
+
+bool SelectData::multiple() const
+{
+    if (!d)
+        return false;
+
+#if ENABLE(NO_LISTBOX_RENDERING)
+    WebCore::ListPopupMenuClient* client = static_cast<WebCore::ListPopupMenuClient*>(d);
+    return client && client->multiple();
+#else
+    return false;
+#endif
+}
+
+SelectData::ItemType SelectData::itemType(int idx) const
+{
+    if (!d)
+        return SelectData::Option;
+
+    if (d->itemIsSeparator(idx))
+        return SelectData::Separator;
+    if (d->itemIsLabel(idx))
+        return SelectData::Group;
+    return SelectData::Option;
+}
+
+namespace WebCore {
+
+PopupMenuQt::PopupMenuQt(PopupMenuClient* client, const ChromeClientQt* chromeClient)
+    : m_popupClient(client)
+    , m_popup(0)
+    , m_selectData(0)
+    , m_chromeClient(chromeClient)
+{
+}
+
+PopupMenuQt::~PopupMenuQt()
+{
+    delete m_selectData;
+    delete m_popup;
+}
+
+void PopupMenuQt::disconnectClient()
+{
+    m_popupClient = 0;
+}
+
+void PopupMenuQt::show(const IntRect& rect, FrameView* view, int index)
+{
+    if (!m_popupClient)
+        return;
+
+    if (!m_popup) {
+        m_popup = m_chromeClient->createSelectPopup();
+        connect(m_popup, SIGNAL(didHide()), this, SLOT(didHide()));
+        connect(m_popup, SIGNAL(selectItem(int, bool, bool)), this, SLOT(selectItem(int, bool, bool)));
+    }
+
+    if (QtFallbackWebPopup* fallback = qobject_cast<QtFallbackWebPopup*>(m_popup)) {
+        QRect geometry(rect);
+        geometry.moveTopLeft(view->contentsToWindow(rect.topLeft()));
+        fallback->setGeometry(geometry);
+        fallback->setFont(m_popupClient->menuStyle().font().font());
+    }
+
+    if (m_selectData)
+        delete m_selectData;
+    m_selectData = new SelectData(m_popupClient);
+    m_popup->show(*m_selectData);
+}
+
+void PopupMenuQt::didHide()
+{
+    if (m_popupClient)
+        m_popupClient->popupDidHide();
+}
+
+void PopupMenuQt::hide()
+{
+    if (!m_popup)
+        m_popup->hide();
+}
+
+void PopupMenuQt::updateFromElement()
+{
+    if (m_popupClient)
+        m_popupClient->setTextFromItem(m_popupClient->selectedIndex());
+}
+
+void PopupMenuQt::selectItem(int index, bool ctrl, bool shift)
+{
+    if (!m_popupClient)
+        return;
+
+#if ENABLE(NO_LISTBOX_RENDERING)
+    ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
+    if (client) {
+        client->listBoxSelectItem(index, ctrl, shift);
+        return;
+    }
+#endif
+
+    m_popupClient->valueChanged(index);
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebKit/qt/WebCoreSupport/PopupMenuQt.h b/WebKit/qt/WebCoreSupport/PopupMenuQt.h
new file mode 100644
index 0000000..837f323
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/PopupMenuQt.h
@@ -0,0 +1,59 @@
+/*
+ * 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 PopupMenuQt_h
+#define PopupMenuQt_h
+
+#include "PopupMenu.h"
+#include <QObject>
+
+class QWebSelectData;
+class QWebSelectMethod;
+
+namespace WebCore {
+
+class ChromeClientQt;
+class FrameView;
+class PopupMenuClient;
+
+class PopupMenuQt : public QObject, public PopupMenu {
+    Q_OBJECT
+public:
+    PopupMenuQt(PopupMenuClient*, const ChromeClientQt*);
+    ~PopupMenuQt();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private slots:
+    void didHide();
+    void selectItem(int index, bool ctrl, bool shift);
+
+private:
+    PopupMenuClient* m_popupClient;
+    QWebSelectMethod* m_popup;
+    QWebSelectData* m_selectData;
+    const ChromeClientQt* m_chromeClient;
+};
+
+}
+
+#endif // PopupMenuQt_h
diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
index 59ac87b..21678c7 100644
--- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
+++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
@@ -23,8 +23,7 @@
 
 #ifndef QT_NO_COMBOBOX
 
-#include "HostWindow.h"
-#include "PopupMenuClient.h"
+#include "ChromeClientQt.h"
 #include "QWebPageClient.h"
 #include "qgraphicswebview.h"
 #include <QAbstractItemView>
@@ -79,7 +78,7 @@ void QtFallbackWebPopupCombo::hidePopup()
         return;
 
     m_ownerPopup.m_popupVisible = false;
-    m_ownerPopup.popupDidHide();
+    emit m_ownerPopup.didHide();
     m_ownerPopup.destroyPopup();
 }
 
@@ -97,10 +96,10 @@ bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event)
 
 // QtFallbackWebPopup
 
-QtFallbackWebPopup::QtFallbackWebPopup()
-    : QtAbstractWebPopup()
-    , m_popupVisible(false)
+QtFallbackWebPopup::QtFallbackWebPopup(const ChromeClientQt* chromeClient)
+    : m_popupVisible(false)
     , m_combo(0)
+    , m_chromeClient(chromeClient)
 {
 }
 
@@ -109,7 +108,7 @@ QtFallbackWebPopup::~QtFallbackWebPopup()
     destroyPopup();
 }
 
-void QtFallbackWebPopup::show()
+void QtFallbackWebPopup::show(const QWebSelectData& data)
 {
     if (!pageClient())
         return;
@@ -123,8 +122,7 @@ void QtFallbackWebPopup::show()
     connect(m_combo, SIGNAL(activated(int)),
             SLOT(activeChanged(int)), Qt::QueuedConnection);
 
-    populate();
-    m_combo->setCurrentIndex(currentIndex());
+    populate(data);
 
     QRect rect = geometry();
     if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
@@ -212,7 +210,7 @@ void QtFallbackWebPopup::destroyPopup()
     }
 }
 
-void QtFallbackWebPopup::populate()
+void QtFallbackWebPopup::populate(const QWebSelectData& data)
 {
     QStandardItemModel* model = qobject_cast<QStandardItemModel*>(m_combo->model());
     Q_ASSERT(model);
@@ -220,21 +218,28 @@ void QtFallbackWebPopup::populate()
 #if !defined(Q_WS_S60)
     m_combo->setFont(font());
 #endif
-    for (int i = 0; i < itemCount(); ++i) {
-        switch (itemType(i)) {
-        case Separator:
+
+    int currentIndex = -1;
+    for (int i = 0; i < data.itemCount(); ++i) {
+        switch (data.itemType(i)) {
+        case QWebSelectData::Separator:
             m_combo->insertSeparator(i);
             break;
-        case Group:
-            m_combo->insertItem(i, itemText(i));
+        case QWebSelectData::Group:
+            m_combo->insertItem(i, data.itemText(i));
             model->item(i)->setEnabled(false);
             break;
-        case Option:
-            m_combo->insertItem(i, itemText(i));
-            model->item(i)->setEnabled(itemIsEnabled(i));
+        case QWebSelectData::Option:
+            m_combo->insertItem(i, data.itemText(i));
+            model->item(i)->setEnabled(data.itemIsEnabled(i));
+            if (data.itemIsSelected(i))
+                currentIndex = i;
             break;
         }
     }
+
+    if (currentIndex >= 0)
+        m_combo->setCurrentIndex(currentIndex);
 }
 
 void QtFallbackWebPopup::activeChanged(int index)
@@ -242,7 +247,12 @@ void QtFallbackWebPopup::activeChanged(int index)
     if (index < 0)
         return;
 
-    valueChanged(index);
+    emit selectItem(index, false, false);
+}
+
+QWebPageClient* QtFallbackWebPopup::pageClient() const
+{
+    return m_chromeClient->platformPageClient();
 }
 
 }
diff --git a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
index e6c371f..7c98fb4 100644
--- a/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
+++ b/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
@@ -20,7 +20,9 @@
 #ifndef QtFallbackWebPopup_h
 #define QtFallbackWebPopup_h
 
-#include "QtAbstractWebPopup.h"
+#include "Platform.h"
+#include "qwebkitplatformplugin.h"
+
 #include <QComboBox>
 
 #ifndef QT_NO_COMBOBOX
@@ -29,21 +31,30 @@ QT_BEGIN_NAMESPACE
 class QGraphicsProxyWidget;
 QT_END_NAMESPACE
 
+class QWebPageClient;
+
 namespace WebCore {
 
+class ChromeClientQt;
 class QtFallbackWebPopupCombo;
 
-class QtFallbackWebPopup : public QObject, public QtAbstractWebPopup {
+class QtFallbackWebPopup : public QWebSelectMethod {
     Q_OBJECT
 public:
-    QtFallbackWebPopup();
+    QtFallbackWebPopup(const ChromeClientQt*);
     ~QtFallbackWebPopup();
 
-    virtual void show();
+    virtual void show(const QWebSelectData&);
     virtual void hide();
 
     void destroyPopup();
 
+    void setGeometry(const QRect& rect) { m_geometry = rect; }
+    QRect geometry() const { return m_geometry; }
+
+    void setFont(const QFont& font) { m_font = font; }
+    QFont font() const { return m_font; }
+
 private slots:
     void activeChanged(int);
 
@@ -51,8 +62,13 @@ private:
     friend class QtFallbackWebPopupCombo;
     bool m_popupVisible;
     QtFallbackWebPopupCombo* m_combo;
+    const ChromeClientQt* m_chromeClient;
+    QRect m_geometry;
+    QFont m_font;
+
+    QWebPageClient* pageClient() const;
 
-    void populate();
+    void populate(const QWebSelectData&);
 #if ENABLE(SYMBIAN_DIALOG_PROVIDERS)
     void showS60BrowserDialog();
 #endif
diff --git a/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp
index 29a16cb..90af0c6 100644
--- a/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp
+++ b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp
@@ -41,11 +41,11 @@ void Maemo5Popup::populateList()
 {
     QListWidgetItem* listItem;
     for (int i = 0; i < m_data.itemCount(); ++i) {
-        if (m_data.itemType(i) == QtAbstractWebPopup::Option) {
+        if (m_data.itemType(i) == QWebSelectData::Option) {
             listItem = new QListWidgetItem(m_data.itemText(i));
             m_list->addItem(listItem);
             listItem->setSelected(m_data.itemIsSelected(i));
-        } else if (m_data.itemType(i) == QtAbstractWebPopup::Group) {
+        } else if (m_data.itemType(i) == QWebSelectData::Group) {
             listItem = new QListWidgetItem(m_data.itemText(i));
             m_list->addItem(listItem);
             listItem->setSelected(false);
@@ -62,8 +62,7 @@ void Maemo5Popup::onItemSelected(QListWidgetItem* item)
 }
 
 QtMaemoWebPopup::QtMaemoWebPopup()
-    : QtAbstractWebPopup()
-    , m_popup(0)
+    : m_popup(0)
 {
 }
 
@@ -73,30 +72,30 @@ QtMaemoWebPopup::~QtMaemoWebPopup()
         m_popup->deleteLater();
 }
 
-Maemo5Popup* QtMaemoWebPopup::createSingleSelectionPopup()
+Maemo5Popup* QtMaemoWebPopup::createSingleSelectionPopup(const QWebSelectData& data)
 {
-    return new Maemo5SingleSelectionPopup(*this);
+    return new Maemo5SingleSelectionPopup(data);
 }
 
-Maemo5Popup* QtMaemoWebPopup::createMultipleSelectionPopup()
+Maemo5Popup* QtMaemoWebPopup::createMultipleSelectionPopup(const QWebSelectData& data)
 {
-    return new Maemo5MultipleSelectionPopup(*this);
+    return new Maemo5MultipleSelectionPopup(data);
 }
 
-Maemo5Popup* QtMaemoWebPopup::createPopup()
+Maemo5Popup* QtMaemoWebPopup::createPopup(const QWebSelectData& data)
 {
-    Maemo5Popup* result = multiple() ? createMultipleSelectionPopup() : createSingleSelectionPopup();
+    Maemo5Popup* result = data.multiple() ? createMultipleSelectionPopup(data) : createSingleSelectionPopup(data);
     connect(result, SIGNAL(finished(int)), this, SLOT(popupClosed()));
     connect(result, SIGNAL(itemClicked(int)), this, SLOT(itemClicked(int)));
     return result;
 }
 
-void QtMaemoWebPopup::show()
+void QtMaemoWebPopup::show(const QWebSelectData& data)
 {
-    if (!pageClient() || m_popup)
+    if (m_popup)
         return;
 
-    m_popup = createPopup();
+    m_popup = createPopup(data);
     m_popup->show();
 }
 
@@ -115,15 +114,15 @@ void QtMaemoWebPopup::popupClosed()
 
     m_popup->deleteLater();
     m_popup = 0;
-    popupDidHide();
+    emit didHide();
 }
 
 void QtMaemoWebPopup::itemClicked(int idx)
 {
-    selectItem(idx, true, false);
+    emit selectItem(idx, true, false);
 }
 
-Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup(QtAbstractWebPopup& data)
+Maemo5SingleSelectionPopup::Maemo5SingleSelectionPopup(const QWebSelectData& data)
     : Maemo5Popup(data)
 {
     // we try to get the standard list title the web browser is using
@@ -170,7 +169,7 @@ private:
     QPixmap tickMark;
 };
 
-Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup(QtAbstractWebPopup& data)
+Maemo5MultipleSelectionPopup::Maemo5MultipleSelectionPopup(const QWebSelectData& data)
     : Maemo5Popup(data)
 {
     // we try to get the standard list title the web browser is using
diff --git a/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h
index a163a20..5433b75 100644
--- a/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h
+++ b/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h
@@ -20,7 +20,7 @@
 #ifndef QtMaemoWebPopup_h
 #define QtMaemoWebPopup_h
 
-#include "QtAbstractWebPopup.h"
+#include "qwebkitplatformplugin.h"
 
 #include <QDialog>
 
@@ -33,7 +33,7 @@ namespace WebCore {
 class Maemo5Popup : public QDialog {
     Q_OBJECT
 public:
-    Maemo5Popup(QtAbstractWebPopup& data) : m_data(data) {}
+    Maemo5Popup(const QWebSelectData& data) : m_data(data) {}
 
 signals:
     void itemClicked(int idx);
@@ -44,18 +44,18 @@ protected slots:
 protected:
     void populateList();
 
-    QtAbstractWebPopup& m_data;
+    const QWebSelectData& m_data;
     QListWidget* m_list;
 };
 
 
-class QtMaemoWebPopup : public QObject, public QtAbstractWebPopup {
+class QtMaemoWebPopup : public QWebSelectMethod {
     Q_OBJECT
 public:
     QtMaemoWebPopup();
     ~QtMaemoWebPopup();
 
-    virtual void show();
+    virtual void show(const QWebSelectData& data);
     virtual void hide();
 
 private slots:
@@ -65,23 +65,23 @@ private slots:
 private:
     Maemo5Popup* m_popup;
 
-    Maemo5Popup* createPopup();
-    Maemo5Popup* createSingleSelectionPopup();
-    Maemo5Popup* createMultipleSelectionPopup();
+    Maemo5Popup* createPopup(const QWebSelectData& data);
+    Maemo5Popup* createSingleSelectionPopup(const QWebSelectData& data);
+    Maemo5Popup* createMultipleSelectionPopup(const QWebSelectData& data);
 };
 
 
 class Maemo5SingleSelectionPopup : public Maemo5Popup {
     Q_OBJECT
 public:
-    Maemo5SingleSelectionPopup(QtAbstractWebPopup& data);
+    Maemo5SingleSelectionPopup(const QWebSelectData& data);
 };
 
 
 class Maemo5MultipleSelectionPopup : public Maemo5Popup {
     Q_OBJECT
 public:
-    Maemo5MultipleSelectionPopup(QtAbstractWebPopup& data);
+    Maemo5MultipleSelectionPopup(const QWebSelectData& data);
 };
 
 }
diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
index cccb07c..fd86e91 100644
--- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
+++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
@@ -29,70 +29,6 @@
 
 namespace WebCore {
 
-class SelectData : public QWebSelectData {
-public:
-    SelectData(QtAbstractWebPopup* data) : d(data) {}
-
-    virtual ItemType itemType(int) const;
-    virtual QString itemText(int index) const { return d->itemText(index); }
-    virtual QString itemToolTip(int index) const { return d->itemToolTip(index); }
-    virtual bool itemIsEnabled(int index) const { return d->itemIsEnabled(index); }
-    virtual int itemCount() const { return d->itemCount(); }
-    virtual bool itemIsSelected(int index) const { return d->itemIsSelected(index); }
-    virtual bool multiple() const { return d->multiple(); }
-
-private:
-    QtAbstractWebPopup* d;
-};
-
-QWebSelectData::ItemType SelectData::itemType(int index) const
-{
-    switch (d->itemType(index)) {
-    case QtAbstractWebPopup::Separator: return Separator;
-    case QtAbstractWebPopup::Group: return Group;
-    default: return Option;
-    }
-}
-
-SelectInputMethodWrapper::SelectInputMethodWrapper(QWebSelectMethod* plugin)
-    : m_plugin(plugin)
-    , m_selectData(0)
-{
-    m_plugin->setParent(this);
-    connect(m_plugin, SIGNAL(didHide()), this, SLOT(didHide()));
-    connect(m_plugin, SIGNAL(selectItem(int, bool, bool)), this, SLOT(selectItem(int, bool, bool)));
-}
-
-SelectInputMethodWrapper::~SelectInputMethodWrapper()
-{
-    delete m_selectData;
-}
-
-void SelectInputMethodWrapper::show()
-{
-    if (m_selectData)
-        delete m_selectData;
-    m_selectData = new SelectData(this);
-    m_plugin->show(*m_selectData);
-}
-
-void SelectInputMethodWrapper::hide()
-{
-    m_plugin->hide();
-}
-
-void SelectInputMethodWrapper::selectItem(int index, bool allowMultiplySelections, bool shift)
-{
-    QtAbstractWebPopup::selectItem(index, allowMultiplySelections, shift);
-}
-
-void SelectInputMethodWrapper::didHide()
-{
-    QtAbstractWebPopup::popupDidHide();
-}
-
-// QtPlatformPlugin
-
 bool QtPlatformPlugin::load(const QString& file)
 {
     m_loader.setFileName(file);
@@ -152,17 +88,10 @@ QWebKitPlatformPlugin* QtPlatformPlugin::plugin()
     return m_plugin;
 }
 
-QtAbstractWebPopup* QtPlatformPlugin::createSelectInputMethod()
+QWebSelectMethod* QtPlatformPlugin::createSelectInputMethod()
 {
     QWebKitPlatformPlugin* p = plugin();
-    if (!p)
-        return 0;
-
-    QWebSelectMethod* selector = p->createSelectInputMethod();
-    if (!selector)
-        return 0;
-
-    return new SelectInputMethodWrapper(selector);
+    return p ? p->createSelectInputMethod() : 0;
 }
 
 
diff --git a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
index 2de4859..9bdab75 100644
--- a/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
+++ b/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
@@ -21,8 +21,6 @@
 #ifndef QtPlatformPlugin_h
 #define QtPlatformPlugin_h
 
-#include "QtAbstractWebPopup.h"
-#include <QObject>
 #include <QPluginLoader>
 
 class QWebSelectMethod;
@@ -32,30 +30,12 @@ class QWebSelectData;
 
 namespace WebCore {
 
-class SelectInputMethodWrapper : public QObject, public QtAbstractWebPopup {
-    Q_OBJECT
-public:
-    SelectInputMethodWrapper(QWebSelectMethod* plugin);
-    ~SelectInputMethodWrapper();
-
-    virtual void show();
-    virtual void hide();
-
-private Q_SLOTS:
-    void selectItem(int index, bool allowMultiplySelections, bool shift);
-    void didHide();
-
-private:
-    QWebSelectMethod* m_plugin;
-    QWebSelectData* m_selectData;
-};
-
 class QtPlatformPlugin {
 public:
     QtPlatformPlugin() : m_loaded(false), m_plugin(0) {}
     ~QtPlatformPlugin();
 
-    QtAbstractWebPopup* createSelectInputMethod();
+    QWebSelectMethod* createSelectInputMethod();
     QWebNotificationPresenter* createNotificationPresenter();
 
     QWebKitPlatformPlugin* plugin();
diff --git a/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp b/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp
new file mode 100644
index 0000000..63437cf
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright C 2006 Zack Rusin <zack at kde.org>
+ * 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.
+ */
+
+#include "config.h"
+#include "SearchPopupMenuQt.h"
+
+namespace WebCore {
+
+SearchPopupMenuQt::SearchPopupMenuQt(PassRefPtr<PopupMenu> popup)
+    : m_popup(popup)
+{
+}
+
+PopupMenu* SearchPopupMenuQt::popupMenu()
+{
+    return m_popup.get();
+}
+
+void SearchPopupMenuQt::saveRecentSearches(const AtomicString&, const Vector<String>&)
+{
+}
+
+void SearchPopupMenuQt::loadRecentSearches(const AtomicString&, Vector<String>&)
+{
+}
+
+bool SearchPopupMenuQt::enabled()
+{
+    return true;
+}
+
+}
diff --git a/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h b/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h
new file mode 100644
index 0000000..11a9641
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h
@@ -0,0 +1,43 @@
+/*
+ * 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 SearchPopupMenuQt_h
+#define SearchPopupMenuQt_h
+
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuQt : public SearchPopupMenu {
+public:
+    SearchPopupMenuQt(PassRefPtr<PopupMenu> popup);
+
+    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<PopupMenu> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuQt_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list