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

luiz at webkit.org luiz at webkit.org
Wed Dec 22 11:39:33 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 260550a6e30b7bf34f16bdb4a5396cf26264fc1c
Author: luiz at webkit.org <luiz at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 3 00:39:44 2010 +0000

    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            Classes PopupMenu and SearchPopupMenu have been made pure virtual.
    
            * platform/PopupMenu.h:
            (WebCore::PopupMenu::~PopupMenu):
            * platform/SearchPopupMenu.h:
            (WebCore::SearchPopupMenu::~SearchPopupMenu):
    
            Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use
            the new pure virtual PopupMenu and SearchPopupMenu.
    
            * rendering/RenderMenuList.cpp:
            (WebCore::RenderMenuList::adjustInnerStyle):
            (WebCore::RenderMenuList::showPopup):
            * rendering/RenderMenuList.h:
            * rendering/RenderTextControlSingleLine.cpp:
            (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine):
            (WebCore::RenderTextControlSingleLine::addSearchResult):
            (WebCore::RenderTextControlSingleLine::showPopup):
            (WebCore::RenderTextControlSingleLine::hidePopup):
            (WebCore::RenderTextControlSingleLine::updateFromElement):
            (WebCore::RenderTextControlSingleLine::valueChanged):
            * rendering/RenderTextControlSingleLine.h:
    
            Chrome and ChromeClient were made responsible for providing instances of classes
            PopupMenu and SearchPopupMenu to its users.
    
            * loader/EmptyClients.h:
            (WebCore::EmptyPopupMenu::show):
            (WebCore::EmptyPopupMenu::hide):
            (WebCore::EmptyPopupMenu::updateFromElement):
            (WebCore::EmptyPopupMenu::disconnectClient):
            (WebCore::EmptySearchPopupMenu::popupMenu):
            (WebCore::EmptySearchPopupMenu::saveRecentSearches):
            (WebCore::EmptySearchPopupMenu::loadRecentSearches):
            (WebCore::EmptySearchPopupMenu::enabled):
            (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural):
            (WebCore::EmptyChromeClient::createPopupMenu):
            (WebCore::EmptyChromeClient::createSearchPopupMenu):
            * page/Chrome.cpp:
            (WebCore::Chrome::selectItemWritingDirectionIsNatural):
            (WebCore::Chrome::createPopupMenu):
            (WebCore::Chrome::createSearchPopupMenu):
            * page/Chrome.h:
            * page/ChromeClient.h:
    
            Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited
            in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h).
            Each of new the files contain the concrete classes that inherit form PopupMenu or
            SearchPopupMenu and are specific for the corresponding platform.
    
            brew:
    
            * platform/brew/PopupMenuBrew.cpp:
            (WebCore::PopupMenuBrew::PopupMenuBrew):
            (WebCore::PopupMenuBrew::~PopupMenuBrew):
            (WebCore::PopupMenuBrew::disconnectClient):
            (WebCore::PopupMenuBrew::show):
            (WebCore::PopupMenuBrew::hide):
            (WebCore::PopupMenuBrew::updateFromElement):
            * platform/brew/PopupMenuBrew.h: Added.
            (WebCore::PopupMenuBrew::client):
            * platform/brew/SearchPopupMenuBrew.cpp:
            (WebCore::SearchPopupMenuBrew::saveRecentSearches):
            (WebCore::SearchPopupMenuBrew::loadRecentSearches):
            (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew):
            (WebCore::SearchPopupMenuBrew::enabled):
            (WebCore::SearchPopupMenuBrew::popupMenu):
            * platform/brew/SearchPopupMenuBrew.h: Added.
    
            chromium:
    
            * WebCore.gypi:
            * platform/chromium/PopupMenuChromium.cpp:
            (WebCore::PopupMenuChromium::PopupMenuChromium):
            (WebCore::PopupMenuChromium::~PopupMenuChromium):
            (WebCore::PopupMenuChromium::show):
            (WebCore::PopupMenuChromium::hide):
            (WebCore::PopupMenuChromium::updateFromElement):
            (WebCore::PopupMenuChromium::disconnectClient):
            * platform/chromium/PopupMenuChromium.h:
            (WebCore::PopupMenuChromium::client):
            * platform/chromium/SearchPopupMenuChromium.cpp:
            (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium):
            (WebCore::SearchPopupMenuChromium::popupMenu):
            (WebCore::SearchPopupMenuChromium::enabled):
            (WebCore::SearchPopupMenuChromium::saveRecentSearches):
            (WebCore::SearchPopupMenuChromium::loadRecentSearches):
            * platform/chromium/SearchPopupMenuChromium.h: Added.
    
            efl:
    
            * platform/efl/PopupMenuEfl.cpp:
            (WebCore::PopupMenuEfl::PopupMenuEfl):
            (WebCore::PopupMenuEfl::~PopupMenuEfl):
            (WebCore::PopupMenuEfl::show):
            (WebCore::PopupMenuEfl::hide):
            (WebCore::PopupMenuEfl::updateFromElement):
            (WebCore::PopupMenuEfl::disconnectClient):
            * platform/efl/PopupMenuEfl.h: Added.
            (WebCore::PopupMenuEfl::client):
            * platform/efl/SearchPopupMenuEfl.cpp:
            (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl):
            (WebCore::SearchPopupMenuEfl::popupMenu):
            (WebCore::SearchPopupMenuEfl::saveRecentSearches):
            (WebCore::SearchPopupMenuEfl::loadRecentSearches):
            (WebCore::SearchPopupMenuEfl::enabled):
            * platform/efl/SearchPopupMenuEfl.h: Added.
    
            gtk:
    
            * GNUmakefile.am:
            * platform/gtk/PopupMenuGtk.cpp:
            (WebCore::PopupMenuGtk::PopupMenuGtk):
            (WebCore::PopupMenuGtk::~PopupMenuGtk):
            (WebCore::PopupMenuGtk::show):
            (WebCore::PopupMenuGtk::hide):
            (WebCore::PopupMenuGtk::updateFromElement):
            (WebCore::PopupMenuGtk::disconnectClient):
            (WebCore::PopupMenuGtk::menuItemActivated):
            (WebCore::PopupMenuGtk::menuUnmapped):
            (WebCore::PopupMenuGtk::menuPositionFunction):
            (WebCore::PopupMenuGtk::menuRemoveItem):
            * platform/gtk/PopupMenuGtk.h: Added.
            (WebCore::PopupMenuGtk::client):
            * platform/gtk/SearchPopupMenuGtk.cpp:
            (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk):
            (WebCore::SearchPopupMenuGtk::popupMenu):
            (WebCore::SearchPopupMenuGtk::saveRecentSearches):
            (WebCore::SearchPopupMenuGtk::loadRecentSearches):
            (WebCore::SearchPopupMenuGtk::enabled):
            * platform/gtk/SearchPopupMenuGtk.h: Added.
    
            haiku:
    
            * platform/haiku/PopupMenuHaiku.cpp:
            (WebCore::HaikuPopup::HaikuPopup):
            (WebCore::HaikuPopup::~HaikuPopup):
            (WebCore::PopupMenuHaiku::PopupMenuHaiku):
            (WebCore::PopupMenuHaiku::~PopupMenuHaiku):
            (WebCore::PopupMenuHaiku::disconnectClient):
            (WebCore::PopupMenuHaiku::show):
            (WebCore::PopupMenuHaiku::hide):
            (WebCore::PopupMenuHaiku::updateFromElement):
            * platform/haiku/PopupMenuHaiku.h: Added.
            (WebCore::PopupMenuHaiku::disconnectClient):
            (WebCore::PopupMenuHaiku::client):
            * platform/haiku/SearchPopupMenuHaiku.cpp:
            (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku):
            (WebCore::SearchPopupMenuHaiku::saveRecentSearches):
            (WebCore::SearchPopupMenuHaiku::loadRecentSearches):
            (WebCore::SearchPopupMenuHaiku::enabled):
            (WebCore::SearchPopupMenuHaiku::popupMenu):
            * platform/haiku/SearchPopupMenuHaiku.h: Added.
    
            mac:
    
            * WebCore.exp.in:
            * WebCore.xcodeproj/project.pbxproj:
            * platform/mac/PopupMenuMac.h: Added.
            (WebCore::PopupMenuMac::disconnectClient):
            (WebCore::PopupMenuMac::client):
            * platform/mac/PopupMenuMac.mm:
            (WebCore::PopupMenuMac::PopupMenuMac):
            (WebCore::PopupMenuMac::~PopupMenuMac):
            (WebCore::PopupMenuMac::clear):
            (WebCore::PopupMenuMac::populate):
            (WebCore::PopupMenuMac::show):
            (WebCore::PopupMenuMac::hide):
            (WebCore::PopupMenuMac::updateFromElement):
            (WebCore::PopupMenuMac::itemWritingDirectionIsNatural):
            * platform/mac/SearchPopupMenuMac.h: Added.
            * platform/mac/SearchPopupMenuMac.mm:
            (WebCore::SearchPopupMenuMac::SearchPopupMenuMac):
            (WebCore::SearchPopupMenuMac::popupMenu):
            (WebCore::SearchPopupMenuMac::enabled):
            (WebCore::SearchPopupMenuMac::saveRecentSearches):
            (WebCore::SearchPopupMenuMac::loadRecentSearches):
    
            qt:
    
            * WebCore.pro:
            * platform/qt/PopupMenuQt.cpp:
            (WebCore::PopupMenuQt::PopupMenuQt):
            (WebCore::PopupMenuQt::~PopupMenuQt):
            (WebCore::PopupMenuQt::disconnectClient):
            (WebCore::PopupMenuQt::show):
            (WebCore::PopupMenuQt::hide):
            (WebCore::PopupMenuQt::updateFromElement):
            * platform/qt/PopupMenuQt.h: Added.
            * platform/qt/QtAbstractWebPopup.h:
            * platform/qt/SearchPopupMenuQt.cpp:
            (WebCore::SearchPopupMenuQt::SearchPopupMenuQt):
            (WebCore::SearchPopupMenuQt::popupMenu):
            (WebCore::SearchPopupMenuQt::saveRecentSearches):
            (WebCore::SearchPopupMenuQt::loadRecentSearches):
            (WebCore::SearchPopupMenuQt::enabled):
            * platform/qt/SearchPopupMenuQt.h: Added.
    
            win:
    
            * WebCore.vcproj/WebCore.vcproj:
            * platform/win/PopupMenuWin.cpp:
            (WebCore::PopupMenuWin::PopupMenuWin):
            (WebCore::PopupMenuWin::~PopupMenuWin):
            (WebCore::PopupMenuWin::disconnectClient):
            (WebCore::PopupMenuWin::popupClassName):
            (WebCore::PopupMenuWin::show):
            (WebCore::PopupMenuWin::hide):
            (WebCore::PopupMenuWin::calculatePositionAndSize):
            (WebCore::PopupMenuWin::setFocusedIndex):
            (WebCore::PopupMenuWin::visibleItems):
            (WebCore::PopupMenuWin::listIndexAtPoint):
            (WebCore::PopupMenuWin::focusedIndex):
            (WebCore::PopupMenuWin::focusFirst):
            (WebCore::PopupMenuWin::focusLast):
            (WebCore::PopupMenuWin::down):
            (WebCore::PopupMenuWin::up):
            (WebCore::PopupMenuWin::invalidateItem):
            (WebCore::PopupMenuWin::clientRect):
            (WebCore::PopupMenuWin::incrementWheelDelta):
            (WebCore::PopupMenuWin::reduceWheelDelta):
            (WebCore::PopupMenuWin::scrollToRevealSelection):
            (WebCore::PopupMenuWin::updateFromElement):
            (WebCore::PopupMenuWin::paint):
            (WebCore::PopupMenuWin::valueChanged):
            (WebCore::PopupMenuWin::invalidateScrollbarRect):
            (WebCore::PopupMenuWin::registerClass):
            (WebCore::PopupMenuWin::PopupMenuWndProc):
            (WebCore::PopupMenuWin::wndProc):
            * platform/win/PopupMenuWin.h: Added.
            (WebCore::PopupMenuWin::client):
            (WebCore::PopupMenuWin::scrollbar):
            (WebCore::PopupMenuWin::itemHeight):
            (WebCore::PopupMenuWin::windowRect):
            (WebCore::PopupMenuWin::popupHandle):
            (WebCore::PopupMenuWin::setWasClicked):
            (WebCore::PopupMenuWin::wasClicked):
            (WebCore::PopupMenuWin::setScrollOffset):
            (WebCore::PopupMenuWin::scrollOffset):
            (WebCore::PopupMenuWin::wheelDelta):
            (WebCore::PopupMenuWin::scrollbarCapturingMouse):
            (WebCore::PopupMenuWin::setScrollbarCapturingMouse):
            * platform/win/SearchPopupMenuWin.cpp:
            (WebCore::SearchPopupMenuWin::SearchPopupMenuWin):
            (WebCore::SearchPopupMenuWin::popupMenu):
            (WebCore::SearchPopupMenuWin::enabled):
            (WebCore::SearchPopupMenuWin::saveRecentSearches):
            (WebCore::SearchPopupMenuWin::loadRecentSearches):
            * platform/win/SearchPopupMenuWin.h: Added.
    
            wx:
    
            * platform/wx/PopupMenuWx.cpp:
            (WebCore::PopupMenuWx::PopupMenuWx):
            (WebCore::PopupMenuWx::~PopupMenuWx):
            (WebCore::PopupMenuWx::disconnectClient):
            (WebCore::PopupMenuWx::show):
            (WebCore::PopupMenuWx::OnMenuItemSelected):
            (WebCore::PopupMenuWx::hide):
            (WebCore::PopupMenuWx::updateFromElement):
            * platform/wx/PopupMenuWx.h: Added.
            (WebCore::PopupMenuWx::client):
            * platform/wx/SearchPopupMenuWx.cpp:
            (WebCore::SearchPopupMenuWx::SearchPopupMenuWx):
            (WebCore::SearchPopupMenuWx::saveRecentSearches):
            (WebCore::SearchPopupMenuWx::loadRecentSearches):
            (WebCore::SearchPopupMenuWx::enabled):
            (WebCore::SearchPopupMenuWx::popupMenu):
            * platform/wx/SearchPopupMenuWx.h: Added.
    
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * src/ChromeClientImpl.cpp:
            (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural):
            (WebKit::ChromeClientImpl::createPopupMenu):
            (WebKit::ChromeClientImpl::createSearchPopupMenu):
            * src/ChromeClientImpl.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebCoreSupport/ChromeClientEfl.cpp:
            (WebCore::ChromeClientEfl::selectItemWritingDirectionIsNatural):
            (WebCore::ChromeClientEfl::createPopupMenu):
            (WebCore::ChromeClientEfl::createSearchPopupMenu):
            * WebCoreSupport/ChromeClientEfl.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebCoreSupport/ChromeClientGtk.cpp:
            (WebKit::ChromeClient::selectItemWritingDirectionIsNatural):
            (WebKit::ChromeClient::createPopupMenu):
            (WebKit::ChromeClient::createSearchPopupMenu):
            * WebCoreSupport/ChromeClientGtk.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebCoreSupport/ChromeClientHaiku.cpp:
            (WebCore::ChromeClientHaiku::selectItemWritingDirectionIsNatural):
            (WebCore::ChromeClientHaiku::createPopupMenu):
            (WebCore::ChromeClientHaiku::createSearchPopupMenu):
            * WebCoreSupport/ChromeClientHaiku.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebCoreSupport/WebChromeClient.h:
            * WebCoreSupport/WebChromeClient.mm:
            (WebChromeClient::selectItemWritingDirectionIsNatural):
            (WebChromeClient::createPopupMenu):
            (WebChromeClient::createSearchPopupMenu):
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebCoreSupport/ChromeClientQt.cpp:
            (WebCore::ChromeClientQt::selectItemWritingDirectionIsNatural):
            (WebCore::ChromeClientQt::createPopupMenu):
            (WebCore::ChromeClientQt::createSearchPopupMenu):
            * WebCoreSupport/ChromeClientQt.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebCoreSupport/WebChromeClient.cpp:
            (WebChromeClient::selectItemWritingDirectionIsNatural):
            (WebChromeClient::createPopupMenu):
            (WebChromeClient::createSearchPopupMenu):
            * WebCoreSupport/WebChromeClient.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebKitSupport/ChromeClientWx.cpp:
            (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural):
            (WebCore::ChromeClientWx::createPopupMenu):
            (WebCore::ChromeClientWx::createSearchPopupMenu):
            * WebKitSupport/ChromeClientWx.h:
    2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
    
            Reviewed by Darin Fisher.
    
            PopupMenu refactoring in preparation to WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42592
    
            Classes WebPopupMenu and WebSearchPopupMenu inherit from PopupMenu and
            SearchPopupMenu respectively. At this point they are just empty implementations.
    
            * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Added.
            (WebKit::WebPopupMenu::WebPopupMenu):
            (WebKit::WebPopupMenu::~WebPopupMenu):
            (WebKit::WebPopupMenu::disconnectClient):
            (WebKit::WebPopupMenu::show):
            (WebKit::WebPopupMenu::hide):
            (WebKit::WebPopupMenu::updateFromElement):
            * WebProcess/WebCoreSupport/WebPopupMenu.h: Added.
            * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Added.
            (WebKit::WebSearchPopupMenu::WebSearchPopupMenu):
            (WebKit::WebSearchPopupMenu::popupMenu):
            (WebKit::WebSearchPopupMenu::saveRecentSearches):
            (WebKit::WebSearchPopupMenu::loadRecentSearches):
            (WebKit::WebSearchPopupMenu::enabled):
            * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Added.
    
            As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
            instances, concrete classes that inherit from ChromeClient needed to be changed to
            implement the new methods.
    
            * WebProcess/WebCoreSupport/WebChromeClient.cpp:
            (WebKit::WebChromeClient::selectItemWritingDirectionIsNatural):
            (WebKit::WebChromeClient::createPopupMenu):
            (WebKit::WebChromeClient::createSearchPopupMenu):
            * WebProcess/WebCoreSupport/WebChromeClient.h:
    
            build issues:
    
            * WebKit2.xcodeproj/project.pbxproj:
            * win/WebKit2.vcproj:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a2a4f6c..21bb0c3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,282 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        Classes PopupMenu and SearchPopupMenu have been made pure virtual.
+
+        * platform/PopupMenu.h:
+        (WebCore::PopupMenu::~PopupMenu):
+        * platform/SearchPopupMenu.h:
+        (WebCore::SearchPopupMenu::~SearchPopupMenu):
+
+        Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use
+        the new pure virtual PopupMenu and SearchPopupMenu.
+
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::adjustInnerStyle):
+        (WebCore::RenderMenuList::showPopup):
+        * rendering/RenderMenuList.h:
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine):
+        (WebCore::RenderTextControlSingleLine::addSearchResult):
+        (WebCore::RenderTextControlSingleLine::showPopup):
+        (WebCore::RenderTextControlSingleLine::hidePopup):
+        (WebCore::RenderTextControlSingleLine::updateFromElement):
+        (WebCore::RenderTextControlSingleLine::valueChanged):
+        * rendering/RenderTextControlSingleLine.h:
+
+        Chrome and ChromeClient were made responsible for providing instances of classes
+        PopupMenu and SearchPopupMenu to its users.
+
+        * loader/EmptyClients.h:
+        (WebCore::EmptyPopupMenu::show):
+        (WebCore::EmptyPopupMenu::hide):
+        (WebCore::EmptyPopupMenu::updateFromElement):
+        (WebCore::EmptyPopupMenu::disconnectClient):
+        (WebCore::EmptySearchPopupMenu::popupMenu):
+        (WebCore::EmptySearchPopupMenu::saveRecentSearches):
+        (WebCore::EmptySearchPopupMenu::loadRecentSearches):
+        (WebCore::EmptySearchPopupMenu::enabled):
+        (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural):
+        (WebCore::EmptyChromeClient::createPopupMenu):
+        (WebCore::EmptyChromeClient::createSearchPopupMenu):
+        * page/Chrome.cpp:
+        (WebCore::Chrome::selectItemWritingDirectionIsNatural):
+        (WebCore::Chrome::createPopupMenu):
+        (WebCore::Chrome::createSearchPopupMenu):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+
+        Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited
+        in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h).
+        Each of new the files contain the concrete classes that inherit form PopupMenu or
+        SearchPopupMenu and are specific for the corresponding platform.
+
+        brew:
+
+        * platform/brew/PopupMenuBrew.cpp:
+        (WebCore::PopupMenuBrew::PopupMenuBrew):
+        (WebCore::PopupMenuBrew::~PopupMenuBrew):
+        (WebCore::PopupMenuBrew::disconnectClient):
+        (WebCore::PopupMenuBrew::show):
+        (WebCore::PopupMenuBrew::hide):
+        (WebCore::PopupMenuBrew::updateFromElement):
+        * platform/brew/PopupMenuBrew.h: Added.
+        (WebCore::PopupMenuBrew::client):
+        * platform/brew/SearchPopupMenuBrew.cpp:
+        (WebCore::SearchPopupMenuBrew::saveRecentSearches):
+        (WebCore::SearchPopupMenuBrew::loadRecentSearches):
+        (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew):
+        (WebCore::SearchPopupMenuBrew::enabled):
+        (WebCore::SearchPopupMenuBrew::popupMenu):
+        * platform/brew/SearchPopupMenuBrew.h: Added.
+
+        chromium:
+
+        * WebCore.gypi:
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupMenuChromium::PopupMenuChromium):
+        (WebCore::PopupMenuChromium::~PopupMenuChromium):
+        (WebCore::PopupMenuChromium::show):
+        (WebCore::PopupMenuChromium::hide):
+        (WebCore::PopupMenuChromium::updateFromElement):
+        (WebCore::PopupMenuChromium::disconnectClient):
+        * platform/chromium/PopupMenuChromium.h:
+        (WebCore::PopupMenuChromium::client):
+        * platform/chromium/SearchPopupMenuChromium.cpp:
+        (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium):
+        (WebCore::SearchPopupMenuChromium::popupMenu):
+        (WebCore::SearchPopupMenuChromium::enabled):
+        (WebCore::SearchPopupMenuChromium::saveRecentSearches):
+        (WebCore::SearchPopupMenuChromium::loadRecentSearches):
+        * platform/chromium/SearchPopupMenuChromium.h: Added.
+
+        efl:
+
+        * platform/efl/PopupMenuEfl.cpp:
+        (WebCore::PopupMenuEfl::PopupMenuEfl):
+        (WebCore::PopupMenuEfl::~PopupMenuEfl):
+        (WebCore::PopupMenuEfl::show):
+        (WebCore::PopupMenuEfl::hide):
+        (WebCore::PopupMenuEfl::updateFromElement):
+        (WebCore::PopupMenuEfl::disconnectClient):
+        * platform/efl/PopupMenuEfl.h: Added.
+        (WebCore::PopupMenuEfl::client):
+        * platform/efl/SearchPopupMenuEfl.cpp:
+        (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl):
+        (WebCore::SearchPopupMenuEfl::popupMenu):
+        (WebCore::SearchPopupMenuEfl::saveRecentSearches):
+        (WebCore::SearchPopupMenuEfl::loadRecentSearches):
+        (WebCore::SearchPopupMenuEfl::enabled):
+        * platform/efl/SearchPopupMenuEfl.h: Added.
+
+        gtk:
+
+        * GNUmakefile.am:
+        * platform/gtk/PopupMenuGtk.cpp:
+        (WebCore::PopupMenuGtk::PopupMenuGtk):
+        (WebCore::PopupMenuGtk::~PopupMenuGtk):
+        (WebCore::PopupMenuGtk::show):
+        (WebCore::PopupMenuGtk::hide):
+        (WebCore::PopupMenuGtk::updateFromElement):
+        (WebCore::PopupMenuGtk::disconnectClient):
+        (WebCore::PopupMenuGtk::menuItemActivated):
+        (WebCore::PopupMenuGtk::menuUnmapped):
+        (WebCore::PopupMenuGtk::menuPositionFunction):
+        (WebCore::PopupMenuGtk::menuRemoveItem):
+        * platform/gtk/PopupMenuGtk.h: Added.
+        (WebCore::PopupMenuGtk::client):
+        * platform/gtk/SearchPopupMenuGtk.cpp:
+        (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk):
+        (WebCore::SearchPopupMenuGtk::popupMenu):
+        (WebCore::SearchPopupMenuGtk::saveRecentSearches):
+        (WebCore::SearchPopupMenuGtk::loadRecentSearches):
+        (WebCore::SearchPopupMenuGtk::enabled):
+        * platform/gtk/SearchPopupMenuGtk.h: Added.
+
+        haiku:
+
+        * platform/haiku/PopupMenuHaiku.cpp:
+        (WebCore::HaikuPopup::HaikuPopup):
+        (WebCore::HaikuPopup::~HaikuPopup):
+        (WebCore::PopupMenuHaiku::PopupMenuHaiku):
+        (WebCore::PopupMenuHaiku::~PopupMenuHaiku):
+        (WebCore::PopupMenuHaiku::disconnectClient):
+        (WebCore::PopupMenuHaiku::show):
+        (WebCore::PopupMenuHaiku::hide):
+        (WebCore::PopupMenuHaiku::updateFromElement):
+        * platform/haiku/PopupMenuHaiku.h: Added.
+        (WebCore::PopupMenuHaiku::disconnectClient):
+        (WebCore::PopupMenuHaiku::client):
+        * platform/haiku/SearchPopupMenuHaiku.cpp:
+        (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku):
+        (WebCore::SearchPopupMenuHaiku::saveRecentSearches):
+        (WebCore::SearchPopupMenuHaiku::loadRecentSearches):
+        (WebCore::SearchPopupMenuHaiku::enabled):
+        (WebCore::SearchPopupMenuHaiku::popupMenu):
+        * platform/haiku/SearchPopupMenuHaiku.h: Added.
+
+        mac:
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mac/PopupMenuMac.h: Added.
+        (WebCore::PopupMenuMac::disconnectClient):
+        (WebCore::PopupMenuMac::client):
+        * platform/mac/PopupMenuMac.mm:
+        (WebCore::PopupMenuMac::PopupMenuMac):
+        (WebCore::PopupMenuMac::~PopupMenuMac):
+        (WebCore::PopupMenuMac::clear):
+        (WebCore::PopupMenuMac::populate):
+        (WebCore::PopupMenuMac::show):
+        (WebCore::PopupMenuMac::hide):
+        (WebCore::PopupMenuMac::updateFromElement):
+        (WebCore::PopupMenuMac::itemWritingDirectionIsNatural):
+        * platform/mac/SearchPopupMenuMac.h: Added.
+        * platform/mac/SearchPopupMenuMac.mm:
+        (WebCore::SearchPopupMenuMac::SearchPopupMenuMac):
+        (WebCore::SearchPopupMenuMac::popupMenu):
+        (WebCore::SearchPopupMenuMac::enabled):
+        (WebCore::SearchPopupMenuMac::saveRecentSearches):
+        (WebCore::SearchPopupMenuMac::loadRecentSearches):
+
+        qt:
+
+        * WebCore.pro:
+        * platform/qt/PopupMenuQt.cpp:
+        (WebCore::PopupMenuQt::PopupMenuQt):
+        (WebCore::PopupMenuQt::~PopupMenuQt):
+        (WebCore::PopupMenuQt::disconnectClient):
+        (WebCore::PopupMenuQt::show):
+        (WebCore::PopupMenuQt::hide):
+        (WebCore::PopupMenuQt::updateFromElement):
+        * platform/qt/PopupMenuQt.h: Added.
+        * platform/qt/QtAbstractWebPopup.h:
+        * platform/qt/SearchPopupMenuQt.cpp:
+        (WebCore::SearchPopupMenuQt::SearchPopupMenuQt):
+        (WebCore::SearchPopupMenuQt::popupMenu):
+        (WebCore::SearchPopupMenuQt::saveRecentSearches):
+        (WebCore::SearchPopupMenuQt::loadRecentSearches):
+        (WebCore::SearchPopupMenuQt::enabled):
+        * platform/qt/SearchPopupMenuQt.h: Added.
+
+        win:
+
+        * WebCore.vcproj/WebCore.vcproj:
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::PopupMenuWin):
+        (WebCore::PopupMenuWin::~PopupMenuWin):
+        (WebCore::PopupMenuWin::disconnectClient):
+        (WebCore::PopupMenuWin::popupClassName):
+        (WebCore::PopupMenuWin::show):
+        (WebCore::PopupMenuWin::hide):
+        (WebCore::PopupMenuWin::calculatePositionAndSize):
+        (WebCore::PopupMenuWin::setFocusedIndex):
+        (WebCore::PopupMenuWin::visibleItems):
+        (WebCore::PopupMenuWin::listIndexAtPoint):
+        (WebCore::PopupMenuWin::focusedIndex):
+        (WebCore::PopupMenuWin::focusFirst):
+        (WebCore::PopupMenuWin::focusLast):
+        (WebCore::PopupMenuWin::down):
+        (WebCore::PopupMenuWin::up):
+        (WebCore::PopupMenuWin::invalidateItem):
+        (WebCore::PopupMenuWin::clientRect):
+        (WebCore::PopupMenuWin::incrementWheelDelta):
+        (WebCore::PopupMenuWin::reduceWheelDelta):
+        (WebCore::PopupMenuWin::scrollToRevealSelection):
+        (WebCore::PopupMenuWin::updateFromElement):
+        (WebCore::PopupMenuWin::paint):
+        (WebCore::PopupMenuWin::valueChanged):
+        (WebCore::PopupMenuWin::invalidateScrollbarRect):
+        (WebCore::PopupMenuWin::registerClass):
+        (WebCore::PopupMenuWin::PopupMenuWndProc):
+        (WebCore::PopupMenuWin::wndProc):
+        * platform/win/PopupMenuWin.h: Added.
+        (WebCore::PopupMenuWin::client):
+        (WebCore::PopupMenuWin::scrollbar):
+        (WebCore::PopupMenuWin::itemHeight):
+        (WebCore::PopupMenuWin::windowRect):
+        (WebCore::PopupMenuWin::popupHandle):
+        (WebCore::PopupMenuWin::setWasClicked):
+        (WebCore::PopupMenuWin::wasClicked):
+        (WebCore::PopupMenuWin::setScrollOffset):
+        (WebCore::PopupMenuWin::scrollOffset):
+        (WebCore::PopupMenuWin::wheelDelta):
+        (WebCore::PopupMenuWin::scrollbarCapturingMouse):
+        (WebCore::PopupMenuWin::setScrollbarCapturingMouse):
+        * platform/win/SearchPopupMenuWin.cpp:
+        (WebCore::SearchPopupMenuWin::SearchPopupMenuWin):
+        (WebCore::SearchPopupMenuWin::popupMenu):
+        (WebCore::SearchPopupMenuWin::enabled):
+        (WebCore::SearchPopupMenuWin::saveRecentSearches):
+        (WebCore::SearchPopupMenuWin::loadRecentSearches):
+        * platform/win/SearchPopupMenuWin.h: Added.
+
+        wx:
+
+        * platform/wx/PopupMenuWx.cpp:
+        (WebCore::PopupMenuWx::PopupMenuWx):
+        (WebCore::PopupMenuWx::~PopupMenuWx):
+        (WebCore::PopupMenuWx::disconnectClient):
+        (WebCore::PopupMenuWx::show):
+        (WebCore::PopupMenuWx::OnMenuItemSelected):
+        (WebCore::PopupMenuWx::hide):
+        (WebCore::PopupMenuWx::updateFromElement):
+        * platform/wx/PopupMenuWx.h: Added.
+        (WebCore::PopupMenuWx::client):
+        * platform/wx/SearchPopupMenuWx.cpp:
+        (WebCore::SearchPopupMenuWx::SearchPopupMenuWx):
+        (WebCore::SearchPopupMenuWx::saveRecentSearches):
+        (WebCore::SearchPopupMenuWx::loadRecentSearches):
+        (WebCore::SearchPopupMenuWx::enabled):
+        (WebCore::SearchPopupMenuWx::popupMenu):
+        * platform/wx/SearchPopupMenuWx.h: Added.
+
+
+
 2010-08-02  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 70034c9..852f3eb 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2476,6 +2476,7 @@ webcoregtk_sources += \
 	WebCore/platform/gtk/PasteboardHelper.h \
 	WebCore/platform/gtk/PlatformScreenGtk.cpp \
 	WebCore/platform/gtk/PopupMenuGtk.cpp \
+	WebCore/platform/gtk/PopupMenuGtk.h \
 	WebCore/platform/gtk/RenderThemeGtk.cpp \
 	WebCore/platform/gtk/RenderThemeGtk.h \
 	WebCore/platform/gtk/ScrollbarGtk.cpp \
@@ -2484,6 +2485,7 @@ webcoregtk_sources += \
 	WebCore/platform/gtk/ScrollbarThemeGtk.h \
 	WebCore/platform/gtk/ScrollViewGtk.cpp \
 	WebCore/platform/gtk/SearchPopupMenuGtk.cpp \
+	WebCore/platform/gtk/SearchPopupMenuGtk.h \
 	WebCore/platform/gtk/SharedBufferGtk.cpp \
 	WebCore/platform/gtk/SharedTimerGtk.cpp \
 	WebCore/platform/gtk/SoundGtk.cpp \
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 9b7a2b9..3b4dd1b 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -250,6 +250,7 @@ __ZN7WebCore12IconDatabase27checkIntegrityBeforeOpeningEv
 __ZN7WebCore12IconDatabase4openERKNS_6StringE
 __ZN7WebCore12IconDatabase5closeEv
 __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE
+__ZN7WebCore12PopupMenuMacC1EPNS_15PopupMenuClientE
 __ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci
 __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE
 __ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi
@@ -412,6 +413,7 @@ __ZN7WebCore17openTemporaryFileEPKcRi
 __ZN7WebCore18deprecatedParseURLERKNS_6StringE
 __ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionE
 __ZN7WebCore18pluginScriptObjectEPN3JSC9ExecStateEPNS_13JSHTMLElementE
+__ZN7WebCore18SearchPopupMenuMacC1EPNS_15PopupMenuClientE
 __ZN7WebCore19AnimationController16resumeAnimationsEPNS_8DocumentE
 __ZN7WebCore19AnimationController17suspendAnimationsEPNS_8DocumentE
 __ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKNS_6StringEd
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 84bbda6..9085656 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -2136,6 +2136,7 @@
             'platform/chromium/ScrollbarThemeChromiumMac.mm',
             'platform/chromium/ScrollbarThemeChromiumWin.cpp',
             'platform/chromium/SearchPopupMenuChromium.cpp',
+            'platform/chromium/SearchPopupMenuChromium.h',
             'platform/chromium/SharedTimerChromium.cpp',
             'platform/chromium/SoundChromiumPosix.cpp',
             'platform/chromium/SoundChromiumWin.cpp',
@@ -2628,6 +2629,7 @@
             'platform/mac/PasteboardMac.mm',
             'platform/mac/PlatformMouseEventMac.mm',
             'platform/mac/PlatformScreenMac.mm',
+            'platform/mac/PopupMenuMac.h',
             'platform/mac/PopupMenuMac.mm',
             'platform/mac/PurgeableBufferMac.cpp',
             'platform/mac/SSLKeyGeneratorMac.mm',
@@ -2635,6 +2637,7 @@
             'platform/mac/ScrollViewMac.mm',
             'platform/mac/ScrollbarThemeMac.h',
             'platform/mac/ScrollbarThemeMac.mm',
+            'platform/mac/SearchPopupMenuMac.h',
             'platform/mac/SearchPopupMenuMac.mm',
             'platform/mac/SharedBufferMac.mm',
             'platform/mac/SharedTimerMac.mm',
@@ -2785,6 +2788,7 @@
             'platform/qt/PlatformMouseEventQt.cpp',
             'platform/qt/PlatformScreenQt.cpp',
             'platform/qt/PopupMenuQt.cpp',
+            'platform/qt/PopupMenuQt.h',
             'platform/qt/QWebPopup.cpp',
             'platform/qt/QWebPopup.h',
             'platform/qt/RenderThemeQt.cpp',
@@ -2795,6 +2799,7 @@
             'platform/qt/ScrollbarThemeQt.cpp',
             'platform/qt/ScrollbarThemeQt.h',
             'platform/qt/SearchPopupMenuQt.cpp',
+            'platform/qt/SearchPopupMenuQt.h',
             'platform/qt/SharedBufferQt.cpp',
             'platform/qt/SharedTimerQt.cpp',
             'platform/qt/SoundQt.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 97f3679..5d1731f 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1711,6 +1711,7 @@ HEADERS += \
     platform/network/ResourceResponseBase.h \
     platform/PlatformTouchEvent.h \
     platform/PlatformTouchPoint.h \
+    platform/PopupMenu.h \
     platform/qt/ClipboardQt.h \
     platform/qt/QWebPageClient.h \
     platform/qt/QtAbstractWebPopup.h \
@@ -1720,6 +1721,7 @@ HEADERS += \
     platform/Scrollbar.h \
     platform/ScrollbarThemeComposite.h \
     platform/ScrollView.h \
+    platform/SearchPopupMenu.h \
     platform/SharedBuffer.h \
     platform/sql/SQLiteDatabase.h \
     platform/sql/SQLiteFileSystem.h \
@@ -3298,6 +3300,8 @@ HEADERS += \
     ../WebKit2/WebProcess/WebCoreSupport/WebErrors.h \
     ../WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h \
     ../WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h \
+    ../WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h \
+    ../WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h \
     ../WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h \
     ../WebKit2/WebProcess/WebPage/DrawingArea.h \
     ../WebKit2/WebProcess/WebPage/WebFrame.h \
@@ -3370,6 +3374,8 @@ SOURCES += \
     ../WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp \
     ../WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp \
     ../WebKit2/WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp \
+    ../WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp \
+    ../WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp \
     ../WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp \
     ../WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp \
     ../WebKit2/WebProcess/WebPage/DrawingArea.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 5aceda1..1dcb554 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -23848,6 +23848,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\platform\win\PopupMenuWin.h"
+					>
+				</File>
+				<File
 					RelativePath="..\platform\win\ScrollbarThemeSafari.cpp"
 					>
 				</File>
@@ -23868,6 +23872,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\platform\win\SearchPopupMenuWin.h"
+					>
+				</File>
+				<File
 					RelativePath="..\platform\win\SharedBufferWin.cpp"
 					>
 				</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index e4c5e17..f15bc53 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -42,7 +42,7 @@
 		065AD4F50B0C2EDA005A2B1D /* ContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		065AD4F60B0C2EDA005A2B1D /* ContextMenuController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */; };
 		065AD4F70B0C2EDA005A2B1D /* ContextMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; };
+		0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */; };
 		066C772B0AB603B700238CC4 /* FileChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 066C772A0AB603B700238CC4 /* FileChooser.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 066C772C0AB603D200238CC4 /* FileChooserMac.mm */; };
@@ -3604,12 +3604,12 @@
 		AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */; };
 		AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */; };
 		AB67D1A9097F3AE300F9392E /* RenderTextControl.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextControl.h */; };
-		AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; };
+		AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		AB7170A00B31193B0017123E /* SearchPopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB71709F0B31193B0017123E /* SearchPopupMenuMac.mm */; };
 		ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */; };
 		ABB5419E0ACDDFE4002820EB /* RenderListBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */; };
 		ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = ABB5419D0ACDDFE4002820EB /* RenderListBox.h */; };
-		ABC128770B33AA6D00C693D5 /* PopupMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */; };
+		ABC128770B33AA6D00C693D5 /* PopupMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		ABDDFE790A5C6E7000A3E11D /* RenderMenuList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */; };
 		ABDDFE7A0A5C6E7000A3E11D /* RenderMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */; };
 		ABFE7E120D32FAF60066F4D2 /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE7E100D32FAF50066F4D2 /* MediaControlElements.cpp */; };
@@ -5030,6 +5030,8 @@
 		D23CA55D0AB0EAAE005108A5 /* JSRangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */; };
 		D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */; };
 		D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA56B0AB0EB8D005108A5 /* RangeException.h */; };
+		D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D39D006C11F8E308006041F2 /* PopupMenuMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; };
 		DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; };
@@ -10752,6 +10754,8 @@
 		D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRangeException.h; sourceTree = "<group>"; };
 		D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeException.cpp; sourceTree = "<group>"; };
 		D23CA56B0AB0EB8D005108A5 /* RangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RangeException.h; sourceTree = "<group>"; };
+		D39D006C11F8E308006041F2 /* PopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopupMenuMac.h; sourceTree = "<group>"; };
+		D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenuMac.h; sourceTree = "<group>"; };
 		D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; };
 		DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; };
 		DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; };
@@ -12328,10 +12332,12 @@
 				4B2709810AF2E5E00065127F /* PasteboardMac.mm */,
 				935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */,
 				BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
+				D39D006C11F8E308006041F2 /* PopupMenuMac.h */,
 				0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */,
 				E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */,
 				447D69010FA626810015CCB1 /* RuntimeApplicationChecks.h */,
 				447D69020FA626810015CCB1 /* RuntimeApplicationChecks.mm */,
+				D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */,
 				1CE24F960D7CAF0E007E04C2 /* SchedulePairMac.mm */,
 				BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */,
 				BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */,
@@ -19988,6 +19994,8 @@
 				E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
 				97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
 				CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
+				D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */,
+				D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index eca01e8..c6a73e7 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006 Eric Seidel (eric at webkit.org)
  * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,7 +40,9 @@
 #include "FrameLoaderClient.h"
 #include "InspectorClient.h"
 #include "PluginHalterClient.h"
+#include "PopupMenu.h"
 #include "ResourceError.h"
+#include "SearchPopupMenu.h"
 
 #if USE(GLES2_RENDERING)
 #include "GLES2Context.h"
@@ -60,6 +63,25 @@
 
 namespace WebCore {
 
+class EmptyPopupMenu : public PopupMenu {
+public:
+    virtual void show(const IntRect&, FrameView*, int) {}
+    virtual void hide() {}
+    virtual void updateFromElement() {}
+    virtual void disconnectClient() {}
+};
+
+class EmptySearchPopupMenu : public SearchPopupMenu {
+public:
+    virtual PopupMenu* popupMenu() { return m_popup.get(); }
+    virtual void saveRecentSearches(const AtomicString&, const Vector<String>&) {}
+    virtual void loadRecentSearches(const AtomicString&, Vector<String>&) {}
+    virtual bool enabled() { return false; }
+
+private:
+    RefPtr<EmptyPopupMenu> m_popup;
+};
+
 class EmptyChromeClient : public ChromeClient {
 public:
     virtual ~EmptyChromeClient() { }
@@ -112,6 +134,10 @@ public:
     virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&) { return false; }
     virtual bool shouldInterruptJavaScript() { return false; }
 
+    virtual bool selectItemWritingDirectionIsNatural() { return false; }
+    virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptyPopupMenu()); }
+    virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptySearchPopupMenu()); }
+
     virtual void setStatusbarText(const String&) { }
 
     virtual bool tabsToLinks() const { return false; }
diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp
index 0c66925..bff0100 100644
--- a/WebCore/page/Chrome.cpp
+++ b/WebCore/page/Chrome.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008, 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
@@ -482,5 +482,19 @@ bool ChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect&)
     return false;
 }
 
+bool Chrome::selectItemWritingDirectionIsNatural()
+{
+    return m_client->selectItemWritingDirectionIsNatural();
+}
+
+PassRefPtr<PopupMenu> Chrome::createPopupMenu(PopupMenuClient* client) const
+{
+    return m_client->createPopupMenu(client);
+}
+
+PassRefPtr<SearchPopupMenu> Chrome::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return m_client->createSearchPopupMenu(client);
+}
 
 } // namespace WebCore
diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h
index 537468a..30edf28 100644
--- a/WebCore/page/Chrome.h
+++ b/WebCore/page/Chrome.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * 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
@@ -24,6 +25,8 @@
 #include "FileChooser.h"
 #include "FocusDirection.h"
 #include "HostWindow.h"
+#include "PopupMenu.h"
+#include "SearchPopupMenu.h"
 #include <wtf/Forward.h>
 #include <wtf/RefPtr.h>
 
@@ -44,6 +47,7 @@ namespace WebCore {
     class IntRect;
     class Node;
     class Page;
+    class PopupMenuClient;
     class String;
 #if ENABLE(NOTIFICATIONS)
     class NotificationPresenter;
@@ -144,6 +148,10 @@ namespace WebCore {
         NotificationPresenter* notificationPresenter() const; 
 #endif
 
+        bool selectItemWritingDirectionIsNatural();
+        PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+        PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+
     private:
         Page* m_page;
         ChromeClient* m_client;
diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h
index 39a41ae..28e0b4f 100644
--- a/WebCore/page/ChromeClient.h
+++ b/WebCore/page/ChromeClient.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009 Apple, Inc. All rights reserved.
+ * 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
@@ -26,7 +27,10 @@
 #include "GraphicsContext.h"
 #include "HTMLParserQuirks.h"
 #include "HostWindow.h"
+#include "PopupMenu.h"
+#include "PopupMenuClient.h"
 #include "ScrollTypes.h"
+#include "SearchPopupMenu.h"
 #include <wtf/Forward.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
@@ -54,6 +58,7 @@ namespace WebCore {
     class Node;
     class Page;
     class SecurityOrigin;
+    class PopupMenuClient;
     class String;
     class Widget;
 
@@ -262,6 +267,10 @@ namespace WebCore {
         virtual void needTouchEvents(bool) = 0;
 #endif
 
+        virtual bool selectItemWritingDirectionIsNatural() = 0;
+        virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const = 0;
+        virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0;
+
     protected:
         virtual ~ChromeClient() { }
     };
diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h
index d9d2740..8ebba03 100644
--- a/WebCore/platform/PopupMenu.h
+++ b/WebCore/platform/PopupMenu.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * 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
@@ -21,180 +21,22 @@
 #ifndef PopupMenu_h
 #define PopupMenu_h
 
-#include "IntRect.h"
-#include "PopupMenuClient.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
-#if PLATFORM(MAC)
-#include <wtf/RetainPtr.h>
-#ifdef __OBJC__
- at class NSPopUpButtonCell;
-#else
-class NSPopUpButtonCell;
-#endif
-#elif PLATFORM(WIN)
-#include "Scrollbar.h"
-#include "ScrollbarClient.h"
-#include <wtf/RefPtr.h>
-typedef struct HWND__* HWND;
-typedef struct HDC__* HDC;
-typedef struct HBITMAP__* HBITMAP;
-#elif PLATFORM(QT)
-namespace WebCore {
-class QtAbstractWebPopup;
-}
-#elif PLATFORM(GTK)
-typedef struct _GtkMenu GtkMenu;
-typedef struct _GtkMenuItem GtkMenuItem;
-typedef struct _GtkWidget GtkWidget;
-#include "GRefPtrGtk.h"
-#include <wtf/HashMap.h>
-#include <glib.h>
-#elif PLATFORM(WX)
-#ifdef __WXMSW__
-#include <wx/msw/winundef.h>
-#endif
-class wxMenu;
-#include <wx/defs.h>
-#include <wx/event.h>
-#elif PLATFORM(CHROMIUM)
-#include "PopupMenuPrivate.h"
-#elif PLATFORM(HAIKU)
-namespace WebCore {
-class PopupMenuHaiku;
-}
-#endif
-
 namespace WebCore {
 
 class FrameView;
-class Scrollbar;
+class IntRect;
 
-class PopupMenu : public RefCounted<PopupMenu>
-#if PLATFORM(WIN)
-                , private ScrollbarClient
-#endif
-#if PLATFORM(WX)
-                , public wxEvtHandler
-#endif
-{
+class PopupMenu : public RefCounted<PopupMenu> {
 public:
-    static PassRefPtr<PopupMenu> create(PopupMenuClient* client) { return adoptRef(new PopupMenu(client)); }
-    ~PopupMenu();
-    
-    void disconnectClient() { m_popupClient = 0; }
-
-    void show(const IntRect&, FrameView*, int index);
-    void hide();
-
-    void updateFromElement();
-    
-    PopupMenuClient* client() const { return m_popupClient; }
-
-    static bool itemWritingDirectionIsNatural();
-
-#if PLATFORM(WIN)
-    Scrollbar* scrollbar() const { return m_scrollbar.get(); }
-
-    static LPCTSTR popupClassName();
-
-    bool up(unsigned lines = 1);
-    bool down(unsigned lines = 1);
-
-    int itemHeight() const { return m_itemHeight; }
-    const IntRect& windowRect() const { return m_windowRect; }
-    IntRect clientRect() const;
-
-    int visibleItems() const;
-
-    int listIndexAtPoint(const IntPoint&) const;
-
-    bool setFocusedIndex(int index, bool hotTracking = false);
-    int focusedIndex() const;
-    void focusFirst();
-    void focusLast();
-
-    void paint(const IntRect& damageRect, HDC = 0);
-
-    HWND popupHandle() const { return m_popup; }
-
-    void setWasClicked(bool b = true) { m_wasClicked = b; }
-    bool wasClicked() const { return m_wasClicked; }
-
-    void setScrollOffset(int offset) { m_scrollOffset = offset; }
-    int scrollOffset() const { return m_scrollOffset; }
-
-    bool scrollToRevealSelection();
-
-    void incrementWheelDelta(int delta);
-    void reduceWheelDelta(int delta);
-    int wheelDelta() const { return m_wheelDelta; }
-
-    bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; }
-    void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; }
-#endif
-
-protected:
-    PopupMenu(PopupMenuClient*);
-    
-private:
-    PopupMenuClient* m_popupClient;
-    
-#if PLATFORM(MAC)
-    void clear();
-    void populate();
-
-    RetainPtr<NSPopUpButtonCell> m_popup;
-#elif PLATFORM(QT)
-    QtAbstractWebPopup* m_popup;
-#elif PLATFORM(WIN)
-    // ScrollBarClient
-    virtual void valueChanged(Scrollbar*);
-    virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
-    virtual bool isActive() const { return true; }
-    virtual bool scrollbarCornerPresent() const { return false; }
-
-    void calculatePositionAndSize(const IntRect&, FrameView*);
-    void invalidateItem(int index);
-
-    static LRESULT CALLBACK PopupMenuWndProc(HWND, UINT, WPARAM, LPARAM);
-    LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
-    static void registerClass();
-
-    RefPtr<Scrollbar> m_scrollbar;
-    HWND m_popup;
-    HDC m_DC;
-    HBITMAP m_bmp;
-    bool m_wasClicked;
-    IntRect m_windowRect;
-    int m_itemHeight;
-    int m_scrollOffset;
-    int m_wheelDelta;
-    int m_focusedIndex;
-    bool m_scrollbarCapturingMouse;
-    bool m_showPopup;
-#elif PLATFORM(GTK)
-    IntPoint m_menuPosition;
-    GRefPtr<GtkMenu> m_popup;
-    HashMap<GtkWidget*, int> m_indexMap;
-    static void menuItemActivated(GtkMenuItem* item, PopupMenu*);
-    static void menuUnmapped(GtkWidget*, PopupMenu*);
-    static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenu*);
-    static void menuRemoveItem(GtkWidget*, PopupMenu*);
-#elif PLATFORM(EFL) || PLATFORM(BREWMP)
-    FrameView* m_view;
-#elif PLATFORM(WX)
-    wxMenu* m_menu;
-    void OnMenuItemSelected(wxCommandEvent&);
-#elif PLATFORM(CHROMIUM)
-    PopupMenuPrivate p;
-#elif PLATFORM(HAIKU)
-    PopupMenuHaiku* m_menu;
-#endif
-
+    virtual ~PopupMenu() {}
+    virtual void show(const IntRect&, FrameView*, int index) = 0;
+    virtual void hide() = 0;
+    virtual void updateFromElement() = 0;
+    virtual void disconnectClient() = 0;
 };
 
 }
 
-#endif
+#endif // PopupMenu_h
diff --git a/WebCore/platform/SearchPopupMenu.h b/WebCore/platform/SearchPopupMenu.h
index 4285cdf..d1ecd0f 100644
--- a/WebCore/platform/SearchPopupMenu.h
+++ b/WebCore/platform/SearchPopupMenu.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * 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,24 +23,21 @@
 
 #include "PopupMenu.h"
 #include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
 class AtomicString;
 
-class SearchPopupMenu : public PopupMenu {
+class SearchPopupMenu : public RefCounted<SearchPopupMenu> {
 public:
-    static PassRefPtr<SearchPopupMenu> create(PopupMenuClient* client) { return adoptRef(new SearchPopupMenu(client)); }
-
-    void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems);
-    void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems);
-
-    bool enabled();
-    
-private:
-    SearchPopupMenu(PopupMenuClient*);
+    virtual ~SearchPopupMenu() {}
+    virtual PopupMenu* popupMenu() = 0;
+    virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) = 0;
+    virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) = 0;
+    virtual bool enabled() = 0;
 };
 
 }
 
-#endif
+#endif // SearchPopupMenu_h
diff --git a/WebCore/platform/brew/PopupMenuBrew.cpp b/WebCore/platform/brew/PopupMenuBrew.cpp
index eb03c66..18b2b45 100644
--- a/WebCore/platform/brew/PopupMenuBrew.cpp
+++ b/WebCore/platform/brew/PopupMenuBrew.cpp
@@ -4,6 +4,7 @@
  * Copyright (C) 2009-2010 ProFUSION embedded systems
  * Copyright (C) 2009-2010 Samsung Electronics
  * Copyright (C) 2010 Company 100, Inc.
+ * 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 "PopupMenuBrew.h"
 
 #include "Chrome.h"
 #include "ChromeClientBrew.h"
@@ -32,20 +33,25 @@
 
 namespace WebCore {
 
-PopupMenu::PopupMenu(PopupMenuClient* menuList)
+PopupMenuBrew::PopupMenuBrew(PopupMenuClient* menuList)
     : m_popupClient(menuList)
     , m_view(0)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuBrew::~PopupMenuBrew()
 {
     // Tell client to destroy data related to this popup since this object is
     // going away.
     hide();
 }
 
-void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
+void PopupMenuBrew::disconnectClient()
+{
+    m_popupClient = 0;
+}
+
+void PopupMenuBrew::show(const IntRect& rect, FrameView* view, int index)
 {
     ASSERT(m_popupClient);
     ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(view->frame()->page()->chrome()->client());
@@ -55,7 +61,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
     chromeClient->createSelectPopup(m_popupClient, index, rect);
 }
 
-void PopupMenu::hide()
+void PopupMenuBrew::hide()
 {
     ASSERT(m_view);
     ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(m_view->frame()->page()->chrome()->client());
@@ -64,14 +70,18 @@ void PopupMenu::hide()
     chromeClient->destroySelectPopup();
 }
 
-void PopupMenu::updateFromElement()
+void PopupMenuBrew::updateFromElement()
 {
     client()->setTextFromItem(client()->selectedIndex());
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural()
-{
-    return true;
-}
+// This code must be moved to the concrete brew ChromeClient that is not in repository.
+// I kept this code commented out here to prevent loosing the information of what
+// must be the return value for brew.
+
+// bool PopupMenuBrew::itemWritingDirectionIsNatural()
+// {
+//     return true;
+// }
 
 } // namespace WebCore
diff --git a/WebCore/platform/brew/PopupMenuBrew.h b/WebCore/platform/brew/PopupMenuBrew.h
new file mode 100644
index 0000000..0c171df
--- /dev/null
+++ b/WebCore/platform/brew/PopupMenuBrew.h
@@ -0,0 +1,53 @@
+/*
+ * 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 PopupMenuBrew_h
+#define PopupMenuBrew_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include "PopupMenuClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class FrameView;
+class Scrollbar;
+
+class PopupMenuBrew : public PopupMenu {
+public:
+    PopupMenuBrew(PopupMenuClient*);
+    ~PopupMenuBrew();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    PopupMenuClient* m_popupClient;
+    FrameView* m_view;
+};
+
+}
+
+#endif // PopupMenuBrew_h
diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.cpp b/WebCore/platform/brew/SearchPopupMenuBrew.cpp
index 780c7e5..81ca624 100644
--- a/WebCore/platform/brew/SearchPopupMenuBrew.cpp
+++ b/WebCore/platform/brew/SearchPopupMenuBrew.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Company 100, Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,29 +25,34 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
+#include "SearchPopupMenuBrew.h"
 
 namespace WebCore {
 
 // Save the past searches stored in 'searchItems' to a database associated with 'name'
-void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void SearchPopupMenuBrew::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 {
 }
 
 // Load past searches associated with 'name' from the database to 'searchItems'
-void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+void SearchPopupMenuBrew::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 {
 }
 
 // Create a search popup menu - not sure what else we have to do here
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuBrew::SearchPopupMenuBrew(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuBrew(client)))
 {
 }
 
-bool SearchPopupMenu::enabled()
+bool SearchPopupMenuBrew::enabled()
 {
     return false;
 }
 
+PopupMenu* SearchPopupMenuBrew::popupMenu()
+{
+    return m_popup.get();
+}
+
 } // namespace WebCore
diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.h b/WebCore/platform/brew/SearchPopupMenuBrew.h
new file mode 100644
index 0000000..4ce7005
--- /dev/null
+++ b/WebCore/platform/brew/SearchPopupMenuBrew.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 SearchPopupMenuBrew_h
+#define SearchPopupMenuBrew_h
+
+#include "PopupMenuBrew.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuBrew : public SearchPopupMenu {
+public:
+    SearchPopupMenuBrew(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<PopupMenuBrew> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuBrew_h
diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp
index d07ba2e..9c73a9c 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/PopupMenuChromium.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -48,7 +49,6 @@
 #include "PlatformMouseEvent.h"
 #include "PlatformScreen.h"
 #include "PlatformWheelEvent.h"
-#include "PopupMenu.h"
 #include "RenderTheme.h"
 #include "ScrollbarTheme.h"
 #include "StringTruncator.h"
@@ -1340,20 +1340,20 @@ bool PopupListBox::isPointInBounds(const IntPoint& point)
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-// PopupMenu implementation
+// PopupMenuChromium implementation
 // 
 // Note: you cannot add methods to this class, since it is defined above the 
 //       portability layer. To access methods and properties on the
 //       popup widgets, use |popupWindow| above. 
 
-PopupMenu::PopupMenu(PopupMenuClient* client) 
+PopupMenuChromium::PopupMenuChromium(PopupMenuClient* client)
     : m_popupClient(client)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuChromium::~PopupMenuChromium()
 {
-    // When the PopupMenu is destroyed, the client could already have been
+    // When the PopupMenuChromium is destroyed, the client could already have been
     // deleted.
     if (p.popup)
         p.popup->listBox()->disconnectClient();
@@ -1364,7 +1364,7 @@ PopupMenu::~PopupMenu()
 // to display, handle the input tracking and menu item selection for the popup.
 // Windows and Linux Chromium let our WebKit port handle the display, while
 // another process manages the popup window and input handling.
-void PopupMenu::show(const IntRect& r, FrameView* v, int index)
+void PopupMenuChromium::show(const IntRect& r, FrameView* v, int index)
 {
     if (!p.popup)
         p.popup = PopupContainer::create(client(), PopupContainer::Select, dropDownSettings);
@@ -1375,20 +1375,21 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
 #endif
 }
 
-void PopupMenu::hide()
+void PopupMenuChromium::hide()
 {
     if (p.popup)
         p.popup->hide();
 }
 
-void PopupMenu::updateFromElement()
+void PopupMenuChromium::updateFromElement()
 {
     p.popup->listBox()->updateFromElement();
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural() 
-{ 
-    return false; 
+
+void PopupMenuChromium::disconnectClient()
+{
+    m_popupClient = 0;
 }
 
 } // namespace WebCore
diff --git a/WebCore/platform/chromium/PopupMenuChromium.h b/WebCore/platform/chromium/PopupMenuChromium.h
index a85cf49..0d0e23c 100644
--- a/WebCore/platform/chromium/PopupMenuChromium.h
+++ b/WebCore/platform/chromium/PopupMenuChromium.h
@@ -36,6 +36,8 @@
 
 #include "FramelessScrollView.h"
 #include "IntRect.h"
+#include "PopupMenu.h"
+#include "PopupMenuPrivate.h"
 
 namespace WebCore {
 
@@ -201,6 +203,23 @@ private:
     bool m_popupOpen;
 };
 
+class PopupMenuChromium : public PopupMenu {
+public:
+    PopupMenuChromium(PopupMenuClient*);
+    ~PopupMenuChromium();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    PopupMenuClient* m_popupClient;
+    PopupMenuPrivate p;
+};
+
 } // namespace WebCore
 
 #endif
diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp
index 89bfddd..d4d4ff5 100644
--- a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp
+++ b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,29 +30,34 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
+#include "SearchPopupMenuChromium.h"
 
 #include "AtomicString.h"
 #include "NotImplemented.h"
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuChromium::SearchPopupMenuChromium(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuChromium(client)))
 {
 }
 
-bool SearchPopupMenu::enabled()
+PopupMenu* SearchPopupMenuChromium::popupMenu()
+{
+    return m_popup.get();
+}
+
+bool SearchPopupMenuChromium::enabled()
 {
     return false;
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void SearchPopupMenuChromium::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 {
     notImplemented();
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+void SearchPopupMenuChromium::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 {
     notImplemented();
 }
diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.h b/WebCore/platform/chromium/SearchPopupMenuChromium.h
new file mode 100644
index 0000000..827ff66
--- /dev/null
+++ b/WebCore/platform/chromium/SearchPopupMenuChromium.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 SearchPopupMenuChromium_h
+#define SearchPopupMenuChromium_h
+
+#include "PopupMenuChromium.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuChromium : public SearchPopupMenu {
+public:
+    SearchPopupMenuChromium(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<PopupMenuChromium> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuChromium_h
diff --git a/WebCore/platform/efl/PopupMenuEfl.cpp b/WebCore/platform/efl/PopupMenuEfl.cpp
index 9dc6986..401f24f 100644
--- a/WebCore/platform/efl/PopupMenuEfl.cpp
+++ b/WebCore/platform/efl/PopupMenuEfl.cpp
@@ -3,6 +3,7 @@
  * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
  * Copyright (C) 2009-2010 ProFUSION embedded systems
  * Copyright (C) 2009-2010 Samsung Electronics
+ * 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
@@ -22,29 +23,30 @@
  */
 
 #include "config.h"
-#include "PopupMenu.h"
+#include "PopupMenuEfl.h"
 
 #include "Chrome.h"
 #include "ChromeClientEfl.h"
 #include "FrameView.h"
 #include "NotImplemented.h"
+#include "PopupMenuClient.h"
 
 namespace WebCore {
 
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuEfl::PopupMenuEfl(PopupMenuClient* client)
     : m_popupClient(client)
     , m_view(0)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuEfl::~PopupMenuEfl()
 {
     // Tell client to destroy data related to this popup since this object is
     // going away.
     hide();
 }
 
-void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
+void PopupMenuEfl::show(const IntRect& rect, FrameView* view, int index)
 {
     ASSERT(m_popupClient);
     ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(view->frame()->page()->chrome()->client());
@@ -54,7 +56,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
     chromeClient->createSelectPopup(m_popupClient, index, rect);
 }
 
-void PopupMenu::hide()
+void PopupMenuEfl::hide()
 {
     ASSERT(m_view);
     ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(m_view->frame()->page()->chrome()->client());
@@ -63,14 +65,14 @@ void PopupMenu::hide()
     chromeClient->destroySelectPopup();
 }
 
-void PopupMenu::updateFromElement()
+void PopupMenuEfl::updateFromElement()
 {
     client()->setTextFromItem(client()->selectedIndex());
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural()
+void PopupMenuEfl::disconnectClient()
 {
-    return true;
+    m_popupClient = 0;
 }
 
 }
diff --git a/WebCore/platform/efl/PopupMenuEfl.h b/WebCore/platform/efl/PopupMenuEfl.h
new file mode 100644
index 0000000..4a2dbfc
--- /dev/null
+++ b/WebCore/platform/efl/PopupMenuEfl.h
@@ -0,0 +1,53 @@
+/*
+ * 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 PopupMenuEfl_h
+#define PopupMenuEfl_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class FrameView;
+class Scrollbar;
+class PopupMenuClient;
+
+class PopupMenuEfl : public PopupMenu {
+public:
+    PopupMenuEfl(PopupMenuClient*);
+    ~PopupMenuEfl();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    PopupMenuClient* m_popupClient;
+    FrameView* m_view;
+};
+
+}
+
+#endif // PopupMenuEfl_h
diff --git a/WebCore/platform/efl/SearchPopupMenuEfl.cpp b/WebCore/platform/efl/SearchPopupMenuEfl.cpp
index d18174f..20ecb09 100644
--- a/WebCore/platform/efl/SearchPopupMenuEfl.cpp
+++ b/WebCore/platform/efl/SearchPopupMenuEfl.cpp
@@ -2,6 +2,7 @@
  *  Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
  *  Copyright (C) 2009-2010 ProFUSION embedded systems
  *  Copyright (C) 2009-2010 Samsung Electronics
+ * 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
@@ -19,29 +20,34 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
+#include "SearchPopupMenuEfl.h"
 
 #include "NotImplemented.h"
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuEfl::SearchPopupMenuEfl(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuEfl(client)))
 {
     notImplemented();
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&)
+PopupMenu* SearchPopupMenuEfl::popupMenu()
+{
+    return m_popup.get();
+}
+
+void SearchPopupMenuEfl::saveRecentSearches(const AtomicString&, const Vector<String>&)
 {
     notImplemented();
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&)
+void SearchPopupMenuEfl::loadRecentSearches(const AtomicString&, Vector<String>&)
 {
     notImplemented();
 }
 
-bool SearchPopupMenu::enabled()
+bool SearchPopupMenuEfl::enabled()
 {
     notImplemented();
     return true;
diff --git a/WebCore/platform/efl/SearchPopupMenuEfl.h b/WebCore/platform/efl/SearchPopupMenuEfl.h
new file mode 100644
index 0000000..4ffb62e
--- /dev/null
+++ b/WebCore/platform/efl/SearchPopupMenuEfl.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 SearchPopupMenuEfl_h
+#define SearchPopupMenuEfl_h
+
+#include "PopupMenuEfl.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuEfl : public SearchPopupMenu {
+public:
+    SearchPopupMenuEfl(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<PopupMenuEfl> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuEfl_h
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 at 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
diff --git a/WebCore/platform/haiku/PopupMenuHaiku.cpp b/WebCore/platform/haiku/PopupMenuHaiku.cpp
index 5adbc66..e3edb83 100644
--- a/WebCore/platform/haiku/PopupMenuHaiku.cpp
+++ b/WebCore/platform/haiku/PopupMenuHaiku.cpp
@@ -2,6 +2,7 @@
  * This file is part of the popup menu implementation for <select> elements in WebCore.
  *
  * Copyright (C) 2010 Stephan Aßmus <superstippi at gmx.de>
+ * 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
@@ -21,7 +22,7 @@
  */
 
 #include "config.h"
-#include "PopupMenu.h"
+#include "PopupMenuHaiku.h"
 
 #include "FrameView.h"
 
@@ -72,9 +73,9 @@ private:
     PopupMenuClient* m_popupClient;
 };
 
-class PopupMenuHaiku : public BPopUpMenu {
+class HaikuPopup : public BPopUpMenu {
 public:
-    PopupMenuHaiku(PopupMenuClient* popupClient)
+    HaikuPopup(PopupMenuClient* popupClient)
         : BPopUpMenu("WebCore Popup", true, false)
         , m_popupClient(popupClient)
         , m_Handler(popupClient)
@@ -86,7 +87,7 @@ public:
         SetAsyncAutoDestruct(false);
     }
 
-    virtual ~PopupMenuHaiku()
+    virtual ~HaikuPopup()
     {
         if (be_app->Lock()) {
             be_app->RemoveHandler(&m_Handler);
@@ -153,39 +154,39 @@ private:
     PopupMenuHandler m_Handler;
 };
 
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuHaiku::PopupMenuHaiku(PopupMenuClient* client)
     : m_popupClient(client)
-    , m_menu(new PopupMenuHaiku(client))
+    , m_menu(new HaikuPopup(client))
 {
     // We don't need additional references to the client, since we completely
     // control any sub-objects we create that need it as well.
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuHaiku::~PopupMenuHaiku()
 {
     delete m_menu;
 }
 
-void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
+void PopupMenuHaiku::disconnectClient()
+{
+    m_popupClient = 0;
+}
+
+void PopupMenuHaiku::show(const IntRect& rect, FrameView* view, int index)
 {
     // The menu will update itself from the PopupMenuClient before showing.
     m_menu->show(rect, view, index);
 }
 
-void PopupMenu::hide()
+void PopupMenuHaiku::hide()
 {
     m_menu->hide();
 }
 
-void PopupMenu::updateFromElement()
+void PopupMenuHaiku::updateFromElement()
 {
     client()->setTextFromItem(m_popupClient->selectedIndex());
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural()
-{
-    return false;
-}
-
 } // namespace WebCore
 
diff --git a/WebCore/platform/haiku/PopupMenuHaiku.h b/WebCore/platform/haiku/PopupMenuHaiku.h
new file mode 100644
index 0000000..9207923
--- /dev/null
+++ b/WebCore/platform/haiku/PopupMenuHaiku.h
@@ -0,0 +1,55 @@
+/*
+ * 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 PopupMenuHaiku_h
+#define PopupMenuHaiku_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include "PopupMenuClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class FrameView;
+class HaikuPopup;
+class Scrollbar;
+
+class PopupMenuHaiku : public PopupMenu {
+public:
+    PopupMenuHaiku(PopupMenuClient*);
+    ~PopupMenuHaiku();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    PopupMenuClient* m_popupClient;
+    HaikuPopup* m_menu;
+};
+
+}
+
+#endif // PopupMenuHaiku_h
diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp
index fd5d96c..109409a 100644
--- a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp
+++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Ryan Leavengood <leavengood at gmail.com>
+ * 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
@@ -18,7 +19,7 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
+#include "SearchPopupMenuHaiku.h"
 
 #include "AtomicString.h"
 #include "NotImplemented.h"
@@ -26,26 +27,31 @@
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuHaiku::SearchPopupMenuHaiku(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuHaiku(client)))
 {
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void SearchPopupMenuHaiku::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 {
     notImplemented();
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+void SearchPopupMenuHaiku::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 {
     notImplemented();
 }
 
-bool SearchPopupMenu::enabled()
+bool SearchPopupMenuHaiku::enabled()
 {
     notImplemented();
     return false;
 }
 
+PopupMenu* SearchPopupMenuHaiku::popupMenu()
+{
+    return m_popup.get();
+}
+
 } // namespace WebCore
 
diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.h b/WebCore/platform/haiku/SearchPopupMenuHaiku.h
new file mode 100644
index 0000000..a9e8e8d
--- /dev/null
+++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.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 SearchPopupMenuHaiku_h
+#define SearchPopupMenuHaiku_h
+
+#include "PopupMenuHaiku.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuHaiku : public SearchPopupMenu {
+public:
+    SearchPopupMenuHaiku(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<PopupMenuHaiku> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuHaiku_h
diff --git a/WebCore/platform/mac/PopupMenuMac.h b/WebCore/platform/mac/PopupMenuMac.h
new file mode 100644
index 0000000..e969fff
--- /dev/null
+++ b/WebCore/platform/mac/PopupMenuMac.h
@@ -0,0 +1,58 @@
+/*
+ * 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 PopupMenuMac_h
+#define PopupMenuMac_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RetainPtr.h>
+
+class NSPopUpButtonCell;
+
+namespace WebCore {
+
+class PopupMenuClient;
+class FrameView;
+class Scrollbar;
+
+class PopupMenuMac : public PopupMenu {
+public:
+    PopupMenuMac(PopupMenuClient*);
+    ~PopupMenuMac();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    void clear();
+    void populate();
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    PopupMenuClient* m_popupClient;
+    RetainPtr<NSPopUpButtonCell> m_popup;
+};
+
+}
+
+#endif // PopupMenuMac_h
diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm
index 6c067b9..1bf500b 100644
--- a/WebCore/platform/mac/PopupMenuMac.mm
+++ b/WebCore/platform/mac/PopupMenuMac.mm
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * 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
@@ -18,7 +19,7 @@
  */
 
 #import "config.h"
-#import "PopupMenu.h"
+#import "PopupMenuMac.h"
 
 #import "AXObjectCache.h"
 #import "Chrome.h"
@@ -31,6 +32,7 @@
 #import "HTMLOptionElement.h"
 #import "HTMLSelectElement.h"
 #import "Page.h"
+#import "PopupMenuClient.h"
 #import "SimpleFontData.h"
 #import "WebCoreSystemInterface.h"
 
@@ -38,24 +40,24 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuMac::PopupMenuMac(PopupMenuClient* client)
     : m_popupClient(client)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuMac::~PopupMenuMac()
 {
     if (m_popup)
         [m_popup.get() setControlView:nil];
 }
 
-void PopupMenu::clear()
+void PopupMenuMac::clear()
 {
     if (m_popup)
         [m_popup.get() removeAllItems];
 }
 
-void PopupMenu::populate()
+void PopupMenuMac::populate()
 {
     if (m_popup)
         clear();
@@ -114,7 +116,7 @@ void PopupMenu::populate()
     [[m_popup.get() menu] setMenuChangedMessagesEnabled:messagesEnabled];
 }
 
-void PopupMenu::show(const IntRect& r, FrameView* v, int index)
+void PopupMenuMac::show(const IntRect& r, FrameView* v, int index)
 {
     populate();
     int numItems = [m_popup.get() numberOfItems];
@@ -162,7 +164,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
     RefPtr<Frame> frame = v->frame();
     NSEvent* event = [frame->eventHandler()->currentNSEvent() retain];
     
-    RefPtr<PopupMenu> protector(this);
+    RefPtr<PopupMenuMac> protector(this);
 
     RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:r]);
     [view addSubview:dummyView.get()];
@@ -194,18 +196,18 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
     [event release];
 }
 
-void PopupMenu::hide()
+void PopupMenuMac::hide()
 {
     [m_popup.get() dismissPopUp];
 }
     
-void PopupMenu::updateFromElement()
+void PopupMenuMac::updateFromElement()
 {
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural()
+void PopupMenuMac::disconnectClient()
 {
-    return true;
+    m_popupClient = 0;
 }
 
 }
diff --git a/WebCore/platform/mac/SearchPopupMenuMac.h b/WebCore/platform/mac/SearchPopupMenuMac.h
new file mode 100644
index 0000000..828b07f
--- /dev/null
+++ b/WebCore/platform/mac/SearchPopupMenuMac.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 SearchPopupMenuMac_h
+#define SearchPopupMenuMac_h
+
+#include "PopupMenuMac.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuMac : public SearchPopupMenu {
+public:
+    SearchPopupMenuMac(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<PopupMenuMac> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuMac_h
diff --git a/WebCore/platform/mac/SearchPopupMenuMac.mm b/WebCore/platform/mac/SearchPopupMenuMac.mm
index 262734d..69018ee 100644
--- a/WebCore/platform/mac/SearchPopupMenuMac.mm
+++ b/WebCore/platform/mac/SearchPopupMenuMac.mm
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.
+ * 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
@@ -18,14 +19,14 @@
  */
 
 #import "config.h"
-#import "SearchPopupMenu.h"
+#import "SearchPopupMenuMac.h"
 
 #import "AtomicString.h"
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuMac::SearchPopupMenuMac(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuMac(client)))
 {
 }
 
@@ -34,12 +35,17 @@ static NSString* autosaveKey(const String& name)
     return [@"com.apple.WebKit.searchField:" stringByAppendingString:name];
 }
 
-bool SearchPopupMenu::enabled()
+PopupMenu* SearchPopupMenuMac::popupMenu()
+{
+    return m_popup.get();
+}
+
+bool SearchPopupMenuMac::enabled()
 {
     return true;
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void SearchPopupMenuMac::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 {
     if (name.isEmpty())
         return;
@@ -56,7 +62,7 @@ void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<
     }
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+void SearchPopupMenuMac::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 {
     if (name.isEmpty())
         return;
diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp
index 315b891..5590556 100644
--- a/WebCore/platform/qt/PopupMenuQt.cpp
+++ b/WebCore/platform/qt/PopupMenuQt.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "PopupMenu.h"
+#include "PopupMenuQt.h"
 
 #include "Chrome.h"
 #include "ChromeClientQt.h"
@@ -35,18 +35,24 @@
 
 namespace WebCore {
 
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuQt::PopupMenuQt(PopupMenuClient* client)
     : m_popupClient(client)
     , m_popup(0)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuQt::~PopupMenuQt()
 {
     delete m_popup;
 }
 
-void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
+
+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());
@@ -67,19 +73,14 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index)
 
 }
 
-void PopupMenu::hide()
+void PopupMenuQt::hide()
 {
     m_popup->hide();
 }
 
-void PopupMenu::updateFromElement()
-{
-    client()->setTextFromItem(m_popupClient->selectedIndex());
-}
-
-bool PopupMenu::itemWritingDirectionIsNatural()
+void PopupMenuQt::updateFromElement()
 {
-    return false;
+    m_popupClient->setTextFromItem(m_popupClient->selectedIndex());
 }
 
 }
diff --git a/WebCore/platform/qt/PopupMenuQt.h b/WebCore/platform/qt/PopupMenuQt.h
new file mode 100644
index 0000000..25a9f76
--- /dev/null
+++ b/WebCore/platform/qt/PopupMenuQt.h
@@ -0,0 +1,49 @@
+/*
+ * 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.h b/WebCore/platform/qt/QtAbstractWebPopup.h
index dad4997..5f6f619 100644
--- a/WebCore/platform/qt/QtAbstractWebPopup.h
+++ b/WebCore/platform/qt/QtAbstractWebPopup.h
@@ -63,7 +63,7 @@ public:
     QFont font() { return m_popupClient->menuStyle().font().font(); }
 
 private:
-    friend class PopupMenu;
+    friend class PopupMenuQt;
     PopupMenuClient* m_popupClient;
     QWebPageClient* m_pageClient;
     int m_currentIndex;
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.cpp b/WebCore/platform/qt/SearchPopupMenuQt.cpp
index 187a5de..a05d08a 100644
--- a/WebCore/platform/qt/SearchPopupMenuQt.cpp
+++ b/WebCore/platform/qt/SearchPopupMenuQt.cpp
@@ -1,5 +1,6 @@
 /*
  * 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
@@ -18,26 +19,29 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
-
-#include "AtomicString.h"
+#include "SearchPopupMenuQt.h"
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuQt::SearchPopupMenuQt(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuQt(client)))
+{
+}
+
+PopupMenu* SearchPopupMenuQt::popupMenu()
 {
+    return m_popup.get();
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&)
+void SearchPopupMenuQt::saveRecentSearches(const AtomicString&, const Vector<String>&)
 {
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&)
+void SearchPopupMenuQt::loadRecentSearches(const AtomicString&, Vector<String>&)
 {
 }
 
-bool SearchPopupMenu::enabled()
+bool SearchPopupMenuQt::enabled()
 {
     return true;
 }
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.h b/WebCore/platform/qt/SearchPopupMenuQt.h
new file mode 100644
index 0000000..0fbeafd
--- /dev/null
+++ b/WebCore/platform/qt/SearchPopupMenuQt.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 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/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp
index 4bc6dc7..aaadc53 100644
--- a/WebCore/platform/win/PopupMenuWin.cpp
+++ b/WebCore/platform/win/PopupMenuWin.cpp
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
  * Copyright (C) 2007-2009 Torch Mobile Inc.
+ * 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
@@ -20,7 +21,7 @@
  */
 
 #include "config.h"
-#include "PopupMenu.h"
+#include "PopupMenuWin.h"
 
 #include "BitmapInfo.h"
 #include "Document.h"
@@ -86,7 +87,7 @@ static void translatePoint(LPARAM& lParam, HWND from, HWND to)
     lParam = MAKELPARAM(pt.x, pt.y);
 }
 
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuWin::PopupMenuWin(PopupMenuClient* client)
     : m_popupClient(client)
     , m_scrollbar(0)
     , m_popup(0)
@@ -102,7 +103,7 @@ PopupMenu::PopupMenu(PopupMenuClient* client)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuWin::~PopupMenuWin()
 {
     if (m_bmp)
         ::DeleteObject(m_bmp);
@@ -114,12 +115,17 @@ PopupMenu::~PopupMenu()
         m_scrollbar->setParent(0);
 }
 
-LPCTSTR PopupMenu::popupClassName()
+void PopupMenuWin::disconnectClient()
+{
+    m_popupClient = 0;
+}
+
+LPCTSTR PopupMenuWin::popupClassName()
 {
     return kPopupWindowClassName;
 }
 
-void PopupMenu::show(const IntRect& r, FrameView* view, int index)
+void PopupMenuWin::show(const IntRect& r, FrameView* view, int index)
 {
     calculatePositionAndSize(r, view);
     if (clientRect().isEmpty())
@@ -267,7 +273,7 @@ void PopupMenu::show(const IntRect& r, FrameView* view, int index)
     hide();
 }
 
-void PopupMenu::hide()
+void PopupMenuWin::hide()
 {
     if (!m_showPopup)
         return;
@@ -283,7 +289,7 @@ void PopupMenu::hide()
     ::PostMessage(m_popup, WM_NULL, 0, 0);
 }
 
-void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
+void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v)
 {
     // r is in absolute document coordinates, but we want to be in screen coordinates
 
@@ -373,7 +379,7 @@ void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
     return;
 }
 
-bool PopupMenu::setFocusedIndex(int i, bool hotTracking)
+bool PopupMenuWin::setFocusedIndex(int i, bool hotTracking)
 {
     if (i < 0 || i >= client()->listSize() || i == focusedIndex())
         return false;
@@ -395,22 +401,22 @@ bool PopupMenu::setFocusedIndex(int i, bool hotTracking)
     return true;
 }
 
-int PopupMenu::visibleItems() const
+int PopupMenuWin::visibleItems() const
 {
     return clientRect().height() / m_itemHeight;
 }
 
-int PopupMenu::listIndexAtPoint(const IntPoint& point) const
+int PopupMenuWin::listIndexAtPoint(const IntPoint& point) const
 {
     return m_scrollOffset + point.y() / m_itemHeight;
 }
 
-int PopupMenu::focusedIndex() const
+int PopupMenuWin::focusedIndex() const
 {
     return m_focusedIndex;
 }
 
-void PopupMenu::focusFirst()
+void PopupMenuWin::focusFirst()
 {
     if (!client())
         return;
@@ -424,7 +430,7 @@ void PopupMenu::focusFirst()
         }
 }
 
-void PopupMenu::focusLast()
+void PopupMenuWin::focusLast()
 {
     if (!client())
         return;
@@ -438,7 +444,7 @@ void PopupMenu::focusLast()
         }
 }
 
-bool PopupMenu::down(unsigned lines)
+bool PopupMenuWin::down(unsigned lines)
 {
     if (!client())
         return false;
@@ -457,7 +463,7 @@ bool PopupMenu::down(unsigned lines)
     return setFocusedIndex(lastSelectableIndex);
 }
 
-bool PopupMenu::up(unsigned lines)
+bool PopupMenuWin::up(unsigned lines)
 {
     if (!client())
         return false;
@@ -476,7 +482,7 @@ bool PopupMenu::up(unsigned lines)
     return setFocusedIndex(lastSelectableIndex);
 }
 
-void PopupMenu::invalidateItem(int index)
+void PopupMenuWin::invalidateItem(int index)
 {
     if (!m_popup)
         return;
@@ -491,7 +497,7 @@ void PopupMenu::invalidateItem(int index)
     ::InvalidateRect(m_popup, &r, TRUE);
 }
 
-IntRect PopupMenu::clientRect() const
+IntRect PopupMenuWin::clientRect() const
 {
     IntRect clientRect = m_windowRect;
     clientRect.inflate(-popupWindowBorderWidth);
@@ -499,12 +505,12 @@ IntRect PopupMenu::clientRect() const
     return clientRect;
 }
 
-void PopupMenu::incrementWheelDelta(int delta)
+void PopupMenuWin::incrementWheelDelta(int delta)
 {
     m_wheelDelta += delta;
 }
 
-void PopupMenu::reduceWheelDelta(int delta)
+void PopupMenuWin::reduceWheelDelta(int delta)
 {
     ASSERT(delta >= 0);
     ASSERT(delta <= abs(m_wheelDelta));
@@ -517,7 +523,7 @@ void PopupMenu::reduceWheelDelta(int delta)
         return;
 }
 
-bool PopupMenu::scrollToRevealSelection()
+bool PopupMenuWin::scrollToRevealSelection()
 {
     if (!m_scrollbar)
         return false;
@@ -537,7 +543,7 @@ bool PopupMenu::scrollToRevealSelection()
     return false;
 }
 
-void PopupMenu::updateFromElement()
+void PopupMenuWin::updateFromElement()
 {
     if (!m_popup)
         return;
@@ -549,14 +555,9 @@ void PopupMenu::updateFromElement()
         ::UpdateWindow(m_popup);
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural() 
-{ 
-    return true; 
-}
-
 const int separatorPadding = 4;
 const int separatorHeight = 1;
-void PopupMenu::paint(const IntRect& damageRect, HDC hdc)
+void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)
 {
     if (!m_popup)
         return;
@@ -663,7 +664,7 @@ void PopupMenu::paint(const IntRect& damageRect, HDC hdc)
         ::ReleaseDC(m_popup, localDC);
 }
 
-void PopupMenu::valueChanged(Scrollbar* scrollBar)
+void PopupMenuWin::valueChanged(Scrollbar* scrollBar)
 {
     ASSERT(m_scrollbar);
 
@@ -699,7 +700,7 @@ void PopupMenu::valueChanged(Scrollbar* scrollBar)
     ::UpdateWindow(m_popup);
 }
 
-void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+void PopupMenuWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
 {
     IntRect scrollRect = rect;
     scrollRect.move(scrollbar->x(), scrollbar->y());
@@ -707,7 +708,7 @@ void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec
     ::InvalidateRect(m_popup, &r, false);
 }
 
-void PopupMenu::registerClass()
+void PopupMenuWin::registerClass()
 {
     static bool haveRegisteredWindowClass = false;
 
@@ -743,7 +744,7 @@ void PopupMenu::registerClass()
 }
 
 
-LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK PopupMenuWin::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 #if OS(WINCE)
     LONG longPtr = GetWindowLong(hWnd, 0);
@@ -751,7 +752,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa
     LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0);
 #endif
     
-    if (PopupMenu* popup = reinterpret_cast<PopupMenu*>(longPtr))
+    if (PopupMenuWin* popup = reinterpret_cast<PopupMenuWin*>(longPtr))
         return popup->wndProc(hWnd, message, wParam, lParam);
     
     if (message == WM_CREATE) {
@@ -771,7 +772,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa
 
 const int smoothScrollAnimationDuration = 5000;
 
-LRESULT PopupMenu::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     LRESULT lResult = 0;
 
diff --git a/WebCore/platform/win/PopupMenuWin.h b/WebCore/platform/win/PopupMenuWin.h
new file mode 100644
index 0000000..d4a4255
--- /dev/null
+++ b/WebCore/platform/win/PopupMenuWin.h
@@ -0,0 +1,123 @@
+/*
+ * 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 PopupMenuWin_h
+#define PopupMenuWin_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include "PopupMenuClient.h"
+#include "Scrollbar.h"
+#include "ScrollbarClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+typedef struct HWND__* HWND;
+typedef struct HDC__* HDC;
+typedef struct HBITMAP__* HBITMAP;
+
+namespace WebCore {
+
+class FrameView;
+class Scrollbar;
+
+class PopupMenuWin : public PopupMenu, private ScrollbarClient {
+public:
+    PopupMenuWin(PopupMenuClient*);
+    ~PopupMenuWin();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+    static LPCTSTR popupClassName();
+
+private:
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    Scrollbar* scrollbar() const { return m_scrollbar.get(); }
+
+    bool up(unsigned lines = 1);
+    bool down(unsigned lines = 1);
+
+    int itemHeight() const { return m_itemHeight; }
+    const IntRect& windowRect() const { return m_windowRect; }
+    IntRect clientRect() const;
+
+    int visibleItems() const;
+
+    int listIndexAtPoint(const IntPoint&) const;
+
+    bool setFocusedIndex(int index, bool hotTracking = false);
+    int focusedIndex() const;
+    void focusFirst();
+    void focusLast();
+
+    void paint(const IntRect& damageRect, HDC = 0);
+
+    HWND popupHandle() const { return m_popup; }
+
+    void setWasClicked(bool b = true) { m_wasClicked = b; }
+    bool wasClicked() const { return m_wasClicked; }
+
+    void setScrollOffset(int offset) { m_scrollOffset = offset; }
+    int scrollOffset() const { return m_scrollOffset; }
+
+    bool scrollToRevealSelection();
+
+    void incrementWheelDelta(int delta);
+    void reduceWheelDelta(int delta);
+    int wheelDelta() const { return m_wheelDelta; }
+
+    bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; }
+    void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; }
+
+    // ScrollBarClient
+    virtual void valueChanged(Scrollbar*);
+    virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);
+    virtual bool isActive() const { return true; }
+    virtual bool scrollbarCornerPresent() const { return false; }
+
+    void calculatePositionAndSize(const IntRect&, FrameView*);
+    void invalidateItem(int index);
+
+    static LRESULT CALLBACK PopupMenuWndProc(HWND, UINT, WPARAM, LPARAM);
+    LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+    static void registerClass();
+
+    PopupMenuClient* m_popupClient;
+    RefPtr<Scrollbar> m_scrollbar;
+    HWND m_popup;
+    HDC m_DC;
+    HBITMAP m_bmp;
+    bool m_wasClicked;
+    IntRect m_windowRect;
+    int m_itemHeight;
+    int m_scrollOffset;
+    int m_wheelDelta;
+    int m_focusedIndex;
+    bool m_scrollbarCapturingMouse;
+    bool m_showPopup;
+};
+
+}
+
+#endif // PopupMenuWin_h
diff --git a/WebCore/platform/win/SearchPopupMenuWin.cpp b/WebCore/platform/win/SearchPopupMenuWin.cpp
index f2709bb..e1bbe68 100644
--- a/WebCore/platform/win/SearchPopupMenuWin.cpp
+++ b/WebCore/platform/win/SearchPopupMenuWin.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007 Apple Inc.
+ * 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
@@ -18,19 +19,24 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
+#include "SearchPopupMenuWin.h"
 
 #include "AtomicString.h"
 #include <wtf/RetainPtr.h>
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuWin::SearchPopupMenuWin(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuWin(client)))
 {
 }
 
-bool SearchPopupMenu::enabled()
+PopupMenu* SearchPopupMenuWin::popupMenu()
+{
+    return m_popup.get();
+}
+
+bool SearchPopupMenuWin::enabled()
 {
     return true;
 }
@@ -41,7 +47,7 @@ static RetainPtr<CFStringRef> autosaveKey(const String& name)
     return RetainPtr<CFStringRef>(AdoptCF, key.createCFString());
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void SearchPopupMenuWin::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 {
     if (name.isEmpty())
         return;
@@ -61,7 +67,7 @@ void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<
     CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 {
     if (name.isEmpty())
         return;
diff --git a/WebCore/platform/win/SearchPopupMenuWin.h b/WebCore/platform/win/SearchPopupMenuWin.h
new file mode 100644
index 0000000..299a133
--- /dev/null
+++ b/WebCore/platform/win/SearchPopupMenuWin.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 SearchPopupMenuWin_h
+#define SearchPopupMenuWin_h
+
+#include "PopupMenuWin.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuWin : public SearchPopupMenu {
+public:
+    SearchPopupMenuWin(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<PopupMenuWin> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuWin_h
diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp
index 9b0deba..e88d1e5 100644
--- a/WebCore/platform/wx/PopupMenuWx.cpp
+++ b/WebCore/platform/wx/PopupMenuWx.cpp
@@ -2,6 +2,7 @@
  * This file is part of the popup menu implementation for <select> elements in WebCore.
  *
  * Copyright (C) 2008 Apple Computer, Inc.
+ * 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
@@ -21,7 +22,7 @@
  */
 
 #include "config.h"
-#include "PopupMenu.h"
+#include "PopupMenuWx.h"
 
 #include "Frame.h"
 #include "FrameView.h"
@@ -41,18 +42,23 @@ static int s_menuStartId = wxNewId();
 
 namespace WebCore {
 
-PopupMenu::PopupMenu(PopupMenuClient* client)
+PopupMenuWx::PopupMenuWx(PopupMenuClient* client)
     : m_popupClient(client)
     , m_menu(NULL)
 {
 }
 
-PopupMenu::~PopupMenu()
+PopupMenuWx::~PopupMenuWx()
 {
     delete m_menu;
 }
 
-void PopupMenu::show(const IntRect& r, FrameView* v, int index)
+void PopupMenuWx::disconnectClient()
+{
+    m_popupClient = 0;
+}
+
+void PopupMenuWx::show(const IntRect& r, FrameView* v, int index)
 {
     // just delete and recreate
     delete m_menu;
@@ -78,13 +84,13 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
                     m_menu->Append(s_menuStartId + i, client()->itemText(i));
             }
         }
-        nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this);
+        nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this);
         nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY());
-        nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this);
+        nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this);
     }
 }
 
-void PopupMenu::OnMenuItemSelected(wxCommandEvent& event)
+void PopupMenuWx::OnMenuItemSelected(wxCommandEvent& event)
 {
     if (client()) {
         client()->valueChanged(event.GetId() - s_menuStartId);
@@ -93,20 +99,15 @@ void PopupMenu::OnMenuItemSelected(wxCommandEvent& event)
     // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still?
 }
 
-void PopupMenu::hide()
+void PopupMenuWx::hide()
 {
     // we don't need to do anything here, the native control only exists during the time
     // show is called
 }
 
-void PopupMenu::updateFromElement()
+void PopupMenuWx::updateFromElement()
 {
     client()->setTextFromItem(m_popupClient->selectedIndex());
 }
 
-bool PopupMenu::itemWritingDirectionIsNatural()
-{
-    return false;
-}
-
 }
diff --git a/WebCore/platform/wx/PopupMenuWx.h b/WebCore/platform/wx/PopupMenuWx.h
new file mode 100644
index 0000000..c2573fc
--- /dev/null
+++ b/WebCore/platform/wx/PopupMenuWx.h
@@ -0,0 +1,62 @@
+/*
+ * 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 PopupMenuWx_h
+#define PopupMenuWx_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include "PopupMenuClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+#ifdef __WXMSW__
+#include <wx/msw/winundef.h>
+#endif
+class wxMenu;
+#include <wx/defs.h>
+#include <wx/event.h>
+
+namespace WebCore {
+
+class FrameView;
+class Scrollbar;
+
+class PopupMenuWx : public PopupMenu, public wxEvtHandler {
+public:
+    PopupMenuWx(PopupMenuClient*);
+    ~PopupMenuWx();
+
+    virtual void show(const IntRect&, FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    void OnMenuItemSelected(wxCommandEvent&);
+    PopupMenuClient* client() const { return m_popupClient; }
+
+    PopupMenuClient* m_popupClient;
+    wxMenu* m_menu;
+};
+
+}
+
+#endif // PopupMenuWx_h
diff --git a/WebCore/platform/wx/SearchPopupMenuWx.cpp b/WebCore/platform/wx/SearchPopupMenuWx.cpp
index dbbe339..b724cf1 100644
--- a/WebCore/platform/wx/SearchPopupMenuWx.cpp
+++ b/WebCore/platform/wx/SearchPopupMenuWx.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,32 +25,37 @@
  */
 
 #include "config.h"
-#include "SearchPopupMenu.h"
+#include "SearchPopupMenuWx.h"
 
 #include "NotImplemented.h"
 
 namespace WebCore {
 
-SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
-    : PopupMenu(client)
+SearchPopupMenuWx::SearchPopupMenuWx(PopupMenuClient* client)
+    : m_popup(adoptRef(new PopupMenuWx(client)))
 {
     notImplemented();
 }
 
-void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+void SearchPopupMenuWx::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 {
     notImplemented();
 }
 
-void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+void SearchPopupMenuWx::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 {
     notImplemented();
 }
 
-bool SearchPopupMenu::enabled()
+bool SearchPopupMenuWx::enabled()
 {
     return true;
 }
 
+PopupMenu* SearchPopupMenuWx::popupMenu()
+{
+    return m_popup.get();
+}
+
 }
 
diff --git a/WebCore/platform/wx/SearchPopupMenuWx.h b/WebCore/platform/wx/SearchPopupMenuWx.h
new file mode 100644
index 0000000..552a8fe
--- /dev/null
+++ b/WebCore/platform/wx/SearchPopupMenuWx.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 SearchPopupMenuWx_h
+#define SearchPopupMenuWx_h
+
+#include "PopupMenuWx.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuWx : public SearchPopupMenu {
+public:
+    SearchPopupMenuWx(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<PopupMenuWx> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuWx_h
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index ff16e7e..b6a97a9 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -26,6 +26,7 @@
 #include "RenderMenuList.h"
 
 #include "AXObjectCache.h"
+#include "Chrome.h"
 #include "CSSStyleSelector.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -88,8 +89,8 @@ void RenderMenuList::adjustInnerStyle()
     m_innerBlock->style()->setPaddingRight(Length(theme()->popupInternalPaddingRight(style()), Fixed));
     m_innerBlock->style()->setPaddingTop(Length(theme()->popupInternalPaddingTop(style()), Fixed));
     m_innerBlock->style()->setPaddingBottom(Length(theme()->popupInternalPaddingBottom(style()), Fixed));
-        
-    if (PopupMenu::itemWritingDirectionIsNatural()) {
+
+    if (document()->page()->chrome()->selectItemWritingDirectionIsNatural()) {
         // Items in the popup will not respect the CSS text-align and direction properties,
         // so we must adjust our own style to match.
         m_innerBlock->style()->setTextAlign(LEFT);
@@ -278,7 +279,7 @@ void RenderMenuList::showPopup()
     // inside the showPopup call and it would fail.
     createInnerBlock();
     if (!m_popup)
-        m_popup = PopupMenu::create(this);
+        m_popup = document()->page()->chrome()->createPopupMenu(this);
     SelectElement* select = toSelectElement(static_cast<Element*>(node()));
     m_popupIsVisible = true;
 
diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h
index aef8d4f..512fa9b 100644
--- a/WebCore/rendering/RenderMenuList.h
+++ b/WebCore/rendering/RenderMenuList.h
@@ -24,6 +24,7 @@
 #ifndef RenderMenuList_h
 #define RenderMenuList_h
 
+#include "PopupMenu.h"
 #include "PopupMenuClient.h"
 #include "RenderFlexibleBox.h"
 
@@ -35,7 +36,6 @@
 
 namespace WebCore {
 
-class PopupMenu;
 class RenderText;
 
 #if ENABLE(NO_LISTBOX_RENDERING)
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index f40fbf0..bcd3729 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -2,6 +2,7 @@
  * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved.
  *           (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 
  * Copyright (C) 2010 Google Inc. All rights reserved.
+ * 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,6 +24,7 @@
 #include "config.h"
 #include "RenderTextControlSingleLine.h"
 
+#include "Chrome.h"
 #include "CSSStyleSelector.h"
 #include "Event.h"
 #include "EventNames.h"
@@ -38,7 +40,6 @@
 #include "RenderLayer.h"
 #include "RenderScrollbar.h"
 #include "RenderTheme.h"
-#include "SearchPopupMenu.h"
 #include "SelectionController.h"
 #include "Settings.h"
 #include "SimpleFontData.h"
@@ -62,7 +63,7 @@ RenderTextControlSingleLine::RenderTextControlSingleLine(Node* node, bool placeh
 RenderTextControlSingleLine::~RenderTextControlSingleLine()
 {
     if (m_searchPopup) {
-        m_searchPopup->disconnectClient();
+        m_searchPopup->popupMenu()->disconnectClient();
         m_searchPopup = 0;
     }
  
@@ -107,7 +108,7 @@ void RenderTextControlSingleLine::addSearchResult()
 
     const AtomicString& name = autosaveName();
     if (!m_searchPopup)
-        m_searchPopup = SearchPopupMenu::create(this);
+        m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this);
 
     m_searchPopup->saveRecentSearches(name, m_recentSearches);
 }
@@ -125,7 +126,7 @@ void RenderTextControlSingleLine::showPopup()
         return;
 
     if (!m_searchPopup)
-        m_searchPopup = SearchPopupMenu::create(this);
+        m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this);
 
     if (!m_searchPopup->enabled())
         return;
@@ -145,14 +146,14 @@ void RenderTextControlSingleLine::showPopup()
         m_searchPopup->saveRecentSearches(name, m_recentSearches);
     }
 
-    m_searchPopup->show(absoluteBoundingBoxRect(true), document()->view(), -1);
+    m_searchPopup->popupMenu()->show(absoluteBoundingBoxRect(true), document()->view(), -1);
 }
 
 void RenderTextControlSingleLine::hidePopup()
 {
     ASSERT(node()->isHTMLElement());
     if (m_searchPopup)
-        m_searchPopup->hide();
+        m_searchPopup->popupMenu()->hide();
 }
 
 void RenderTextControlSingleLine::subtreeHasChanged()
@@ -685,7 +686,7 @@ void RenderTextControlSingleLine::updateFromElement()
     }
 
     if (m_searchPopupIsVisible)
-        m_searchPopup->updateFromElement();
+        m_searchPopup->popupMenu()->updateFromElement();
 }
 
 void RenderTextControlSingleLine::cacheSelection(int start, int end)
@@ -883,7 +884,7 @@ void RenderTextControlSingleLine::valueChanged(unsigned listIndex, bool fireEven
             const AtomicString& name = autosaveName();
             if (!name.isEmpty()) {
                 if (!m_searchPopup)
-                    m_searchPopup = SearchPopupMenu::create(this);
+                    m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this);
                 m_searchPopup->saveRecentSearches(name, m_recentSearches);
             }
         }
diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h
index 8c7e844..4bc80cf 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.h
+++ b/WebCore/rendering/RenderTextControlSingleLine.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * 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
@@ -24,6 +25,7 @@
 
 #include "PopupMenuClient.h"
 #include "RenderTextControl.h"
+#include "SearchPopupMenu.h"
 #include "Timer.h"
 
 namespace WebCore {
@@ -32,7 +34,6 @@ class InputElement;
 class InputFieldSpeechButtonElement;
 class SearchFieldCancelButtonElement;
 class SearchFieldResultsButtonElement;
-class SearchPopupMenu;
 class SpinButtonElement;
 class TextControlInnerElement;
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index f41799c..9a33ade 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::selectItemWritingDirectionIsNatural):
+        (WebKit::ChromeClientImpl::createPopupMenu):
+        (WebKit::ChromeClientImpl::createSearchPopupMenu):
+        * src/ChromeClientImpl.h:
+
 2010-08-02  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index fc08b5d..2a5c32e 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -55,6 +56,7 @@
 #include "NotificationPresenterImpl.h"
 #include "Page.h"
 #include "PopupMenuChromium.h"
+#include "SearchPopupMenuChromium.h"
 #include "ScriptController.h"
 #include "SecurityOrigin.h"
 #include "WebGeolocationService.h"
@@ -773,4 +775,19 @@ void ChromeClientImpl::exitFullscreenForNode(WebCore::Node* node)
         m_webView->client()->exitFullscreenForNode(WebNode(node));
 }
 
+bool ChromeClientImpl::selectItemWritingDirectionIsNatural()
+{
+    return false;
+}
+
+PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuChromium(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuChromium(client));
+}
+
 } // namespace WebKit
diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h
index fe19b8b..7f3febf 100644
--- a/WebKit/chromium/src/ChromeClientImpl.h
+++ b/WebKit/chromium/src/ChromeClientImpl.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -32,12 +33,15 @@
 #define ChromeClientImpl_h
 
 #include "ChromeClientChromium.h"
+#include "PopupMenu.h"
+#include "SearchPopupMenu.h"
 
 namespace WebCore {
 class AccessibilityObject;
 class FileChooser;
 class HTMLParserQuirks;
 class PopupContainer;
+class PopupMenuClient;
 class SecurityOrigin;
 struct WindowFeatures;
 }
@@ -168,6 +172,10 @@ public:
     void setCursor(const WebCursorInfo& cursor);
     void setCursorForPlugin(const WebCursorInfo& cursor);
 
+    virtual bool selectItemWritingDirectionIsNatural();
+    virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
+    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
+
 private:
     void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*);
 
diff --git a/WebKit/chromium/tests/PopupMenuTest.cpp b/WebKit/chromium/tests/PopupMenuTest.cpp
index 44b262d..50319af 100644
--- a/WebKit/chromium/tests/PopupMenuTest.cpp
+++ b/WebKit/chromium/tests/PopupMenuTest.cpp
@@ -180,7 +180,7 @@ protected:
     {
         m_webView = static_cast<WebViewImpl*>(WebView::create(&m_webviewClient, 0));
         m_webView->initializeMainFrame(&m_webFrameClient);
-        m_popupMenu = PopupMenu::create(&m_popupMenuClient);
+        m_popupMenu = adoptRef(new PopupMenuChromium(&m_popupMenuClient));
     }
 
     virtual void TearDown()
diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog
index e06bc39..80595aa 100644
--- a/WebKit/efl/ChangeLog
+++ b/WebKit/efl/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebCoreSupport/ChromeClientEfl.cpp:
+        (WebCore::ChromeClientEfl::selectItemWritingDirectionIsNatural):
+        (WebCore::ChromeClientEfl::createPopupMenu):
+        (WebCore::ChromeClientEfl::createSearchPopupMenu):
+        * WebCoreSupport/ChromeClientEfl.h:
+
 2010-08-02  Jeremy Orlow  <jorlow at chromium.org>
 
         Speculative revert of 64425 due to Chromium instability
diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
index fa4d37a..21747a1 100644
--- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
+++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
@@ -5,6 +5,7 @@
  * Copyright (C) 2008 Diego Gonzalez
  * Copyright (C) 2009-2010 ProFUSION embedded systems
  * Copyright (C) 2009-2010 Samsung Electronics
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * All rights reserved.
  *
@@ -48,6 +49,8 @@
 #include "NotImplemented.h"
 #include "PlatformString.h"
 #include "SecurityOrigin.h"
+#include "PopupMenuEfl.h"
+#include "SearchPopupMenuEfl.h"
 #include "ViewportArguments.h"
 #include "WindowFeatures.h"
 #include "ewk_private.h"
@@ -519,4 +522,19 @@ void ChromeClientEfl::didReceiveViewportArguments(Frame* frame, const ViewportAr
     ewk_view_viewport_set(m_view, arguments.width, arguments.height, arguments.initialScale, arguments.minimumScale, arguments.maximumScale, arguments.userScalable);
 }
 
+bool ChromeClientEfl::selectItemWritingDirectionIsNatural()
+{
+    return true;
+}
+
+PassRefPtr<PopupMenu> ChromeClientEfl::createPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuEfl(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientEfl::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuEfl(client));
+}
+
 }
diff --git a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
index 2f3fd3e..d939ae6 100644
--- a/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
+++ b/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
@@ -3,6 +3,7 @@
  * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
  * Copyright (C) 2009-2010 ProFUSION embedded systems
  * Copyright (C) 2009-2010 Samsung Electronics
+ * 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
@@ -138,6 +139,10 @@ public:
 
     virtual void didReceiveViewportArguments(Frame* frame, const ViewportArguments& arguments) const;
 
+    virtual bool selectItemWritingDirectionIsNatural();
+    virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+    virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+
     Evas_Object* m_view;
     KURL m_hoveredLinkURL;
 };
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index cf7e706..3d3436f 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::selectItemWritingDirectionIsNatural):
+        (WebKit::ChromeClient::createPopupMenu):
+        (WebKit::ChromeClient::createSearchPopupMenu):
+        * WebCoreSupport/ChromeClientGtk.h:
+
 2010-08-02  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
index 3eb21f8..081c942 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
@@ -4,6 +4,7 @@
  * Copyright (C) 2008 Nuanti Ltd.
  * Copyright (C) 2008 Alp Toker <alp at atoker.com>
  * Copyright (C) 2008 Gustavo Noronha Silva <gns at gnome.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 Lesser General Public
@@ -34,6 +35,9 @@
 #include "Icon.h"
 #include "KURL.h"
 #include "PlatformString.h"
+#include "PopupMenuClient.h"
+#include "PopupMenuGtk.h"
+#include "SearchPopupMenuGtk.h"
 #include "SecurityOrigin.h"
 #include "webkitgeolocationpolicydecision.h"
 #include "webkitwebview.h"
@@ -622,4 +626,19 @@ void ChromeClient::cancelGeolocationPermissionRequestForFrame(WebCore::Frame* fr
     g_signal_emit_by_name(webView, "geolocation-policy-decision-cancelled", webFrame);
 }
 
+bool ChromeClient::selectItemWritingDirectionIsNatural()
+{
+    return true;
+}
+
+PassRefPtr<WebCore::PopupMenu> ChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuGtk(client));
+}
+
+PassRefPtr<WebCore::SearchPopupMenu> ChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuGtk(client));
+}
+
 }
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
index 16a9f5d..8c667c4 100644
--- a/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Holger Hans Peter Freyther
+ * 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
@@ -22,9 +23,15 @@
 
 #include "ChromeClient.h"
 #include "KURL.h"
+#include "PopupMenu.h"
+#include "SearchPopupMenu.h"
 
 typedef struct _WebKitWebView WebKitWebView;
 
+namespace WebCore {
+class PopupMenuClient;
+}
+
 namespace WebKit {
 
     class ChromeClient : public WebCore::ChromeClient {
@@ -123,6 +130,10 @@ namespace WebKit {
         virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
         virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
 
+        virtual bool selectItemWritingDirectionIsNatural();
+        virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
+        virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
+
     private:
         WebKitWebView* m_webView;
         WebCore::KURL m_hoveredLinkURL;
diff --git a/WebKit/haiku/ChangeLog b/WebKit/haiku/ChangeLog
index 3b3de9e..9e2e24d 100644
--- a/WebKit/haiku/ChangeLog
+++ b/WebKit/haiku/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebCoreSupport/ChromeClientHaiku.cpp:
+        (WebCore::ChromeClientHaiku::selectItemWritingDirectionIsNatural):
+        (WebCore::ChromeClientHaiku::createPopupMenu):
+        (WebCore::ChromeClientHaiku::createSearchPopupMenu):
+        * WebCoreSupport/ChromeClientHaiku.h:
+
 2010-08-02  Jeremy Orlow  <jorlow at chromium.org>
 
         Speculative revert of 64425 due to Chromium instability
diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
index c3cdaa0..6c54424 100644
--- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
+++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
@@ -2,6 +2,7 @@
  * Copyright (C) 2006 Zack Rusin <zack at kde.org>
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
  * Copyright (C) 2007 Ryan Leavengood <leavengood at gmail.com> All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,6 +37,8 @@
 #include "NotImplemented.h"
 #include "PlatformString.h"
 #include "SecurityOrigin.h"
+#include "PopupMenuHaiku.h"
+#include "SearchPopupMenuHaiku.h"
 
 #include <Alert.h>
 #include <String.h>
@@ -386,5 +389,20 @@ PassOwnPtr<HTMLParserQuirks> ChromeClientHaiku::createHTMLParserQuirks()
     return 0;
 }
 
+bool ChromeClientHaiku::selectItemWritingDirectionIsNatural()
+{
+    return false;
+}
+
+PassRefPtr<PopupMenu> ChromeClientHaiku::createPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuHaiku(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientHaiku::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuHaiku(client));
+}
+
 } // namespace WebCore
 
diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
index 463d667..8201fae 100644
--- a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
+++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006 Zack Rusin <zack at kde.org>
  * Copyright (C) 2007 Ryan Leavengood <leavengood at gmail.com> All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -128,6 +129,10 @@ namespace WebCore {
 
         void exceededDatabaseQuota(Frame*, const String& databaseName);
 
+        virtual bool selectItemWritingDirectionIsNatural();
+        virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+        virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
         virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 4a8eb7b..a1d508b 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::selectItemWritingDirectionIsNatural):
+        (WebChromeClient::createPopupMenu):
+        (WebChromeClient::createSearchPopupMenu):
+
 2010-08-02  Jeremy Orlow  <jorlow at chromium.org>
 
         Speculative revert of 64425 due to Chromium instability
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h
index f454c60..50c159c 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -168,6 +168,10 @@ public:
     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
 
+    virtual bool selectItemWritingDirectionIsNatural();
+    virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
+    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
+
 private:
     WebView *m_webView;
 };
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index ac34bc0..1a3736e 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -64,12 +64,16 @@
 #import <WebCore/Page.h>
 #import <WebCore/PlatformScreen.h>
 #import <WebCore/PlatformString.h>
+#import <WebCore/PopupMenuMac.h>
 #import <WebCore/ResourceRequest.h>
+#import <WebCore/SearchPopupMenuMac.h>
 #import <WebCore/Widget.h>
 #import <WebCore/WindowFeatures.h>
 #import <wtf/PassRefPtr.h>
 #import <wtf/Vector.h>
 
+
+
 #if USE(ACCELERATED_COMPOSITING)
 #import <WebCore/GraphicsLayer.h>
 #endif
@@ -737,6 +741,21 @@ void WebChromeClient::formDidBlur(const WebCore::Node* node)
     CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node)));
 }
 
+bool WebChromeClient::selectItemWritingDirectionIsNatural()
+{
+    return true;
+}
+
+PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuMac(client));
+}
+
+PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuMac(client));
+}
+
 #if USE(ACCELERATED_COMPOSITING)
 
 void WebChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer)
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 4b5ddad..b49385a 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::selectItemWritingDirectionIsNatural):
+        (WebCore::ChromeClientQt::createPopupMenu):
+        (WebCore::ChromeClientQt::createSearchPopupMenu):
+        * WebCoreSupport/ChromeClientQt.h:
+
 2010-08-02  Jeremy Orlow  <jorlow at chromium.org>
 
         Speculative revert of 64425 due to Chromium instability
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 2df8c78..a0bac72 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006 Zack Rusin <zack at kde.org>
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * All rights reserved.
  *
@@ -45,6 +46,7 @@
 #include "NotImplemented.h"
 #include "NotificationPresenterClientQt.h"
 #include "PageClientQt.h"
+#include "PopupMenuQt.h"
 #if defined(Q_WS_MAEMO_5)
 #include "QtMaemoWebPopup.h"
 #else
@@ -52,6 +54,7 @@
 #endif
 #include "QWebPageClient.h"
 #include "ScrollbarTheme.h"
+#include "SearchPopupMenuQt.h"
 #include "SecurityOrigin.h"
 #include "ViewportArguments.h"
 #include "WindowFeatures.h"
@@ -622,4 +625,19 @@ void ChromeClientQt::didReceiveViewportArguments(Frame* frame, const ViewportArg
     emit m_webPage->viewportChangeRequested(hints);
 }
 
+bool ChromeClientQt::selectItemWritingDirectionIsNatural()
+{
+    return false;
+}
+
+PassRefPtr<PopupMenu> ChromeClientQt::createPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuQt(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientQt::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuQt(client));
+}
+
 } // namespace WebCore
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 98abf5f..aab2813 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Zack Rusin <zack at kde.org>
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * All rights reserved.
  *
@@ -169,6 +170,10 @@ namespace WebCore {
         virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
         virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { }
 
+        virtual bool selectItemWritingDirectionIsNatural();
+        virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+        virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+
         QtAbstractWebPopup* createSelectPopup();
 
         virtual void didReceiveViewportArguments(Frame*, const ViewportArguments&) const;
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 4129d9d..d4a850e 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::selectItemWritingDirectionIsNatural):
+        (WebChromeClient::createPopupMenu):
+        (WebChromeClient::createSearchPopupMenu):
+        * WebCoreSupport/WebChromeClient.h:
+
 2010-08-02  Jon Honeycutt  <jhoneycutt at apple.com>
 
         Move InjectedBundle.vcproj to where the other WebKitTestRunner vcprojs live.
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
index 4e15be7..08d4ee9 100644
--- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,6 +57,8 @@
 #include <WebCore/NotImplemented.h>
 #include <WebCore/Page.h>
 #include <WebCore/SecurityOrigin.h>
+#include <WebCore/PopupMenuWin.h>
+#include <WebCore/SearchPopupMenuWin.h>
 #include <WebCore/WindowFeatures.h>
 #pragma warning(pop)
 
@@ -874,3 +877,18 @@ void WebChromeClient::exitFullscreenForNode(Node*)
 
 #endif
 
+bool WebChromeClient::selectItemWritingDirectionIsNatural()
+{
+    return true;
+}
+
+PassRefPtr<PopupMenu> WebChromeClient::createPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuWin(client));
+}
+
+PassRefPtr<SearchPopupMenu> WebChromeClient::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuWin(client));
+}
+
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h
index 7a60fb6..cea11c7 100644
--- a/WebKit/win/WebCoreSupport/WebChromeClient.h
+++ b/WebKit/win/WebCoreSupport/WebChromeClient.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -166,6 +167,10 @@ public:
     virtual WebCore::NotificationPresenter* notificationPresenter() const { return reinterpret_cast<WebCore::NotificationPresenter*>(m_notificationsDelegate.get()); }
 #endif
 
+    virtual bool selectItemWritingDirectionIsNatural();
+    virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
+    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
+
 private:
     COMPtr<IWebUIDelegate> uiDelegate();
 
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 41ae079..8dfb7e7 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -110,6 +110,7 @@
 #include <WebCore/PluginDatabase.h>
 #include <WebCore/PluginView.h>
 #include <WebCore/PopupMenu.h>
+#include <WebCore/PopupMenuWin.h>
 #include <WebCore/ProgressTracker.h>
 #include <WebCore/RenderLayer.h>
 #include <WebCore/RenderTheme.h>
@@ -1613,9 +1614,9 @@ bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel)
         TCHAR className[256];
 
         // Make sure truncation won't affect the comparison.
-        ASSERT(ARRAYSIZE(className) > _tcslen(PopupMenu::popupClassName()));
+        ASSERT(ARRAYSIZE(className) > _tcslen(PopupMenuWin::popupClassName()));
 
-        if (GetClassName(focusedWindow, className, ARRAYSIZE(className)) && !_tcscmp(className, PopupMenu::popupClassName())) {
+        if (GetClassName(focusedWindow, className, ARRAYSIZE(className)) && !_tcscmp(className, PopupMenuWin::popupClassName())) {
             // We don't let the WebView scroll here for two reasons - 1) To match Firefox behavior, 2) If we do scroll, we lose the
             // focus ring around the select menu.
             SetFocus(m_viewWindow);
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 1cd5646..362f6e5 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,20 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebKitSupport/ChromeClientWx.cpp:
+        (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural):
+        (WebCore::ChromeClientWx::createPopupMenu):
+        (WebCore::ChromeClientWx::createSearchPopupMenu):
+        * WebKitSupport/ChromeClientWx.h:
+
 2010-08-02  Jeremy Orlow  <jorlow at chromium.org>
 
         Speculative revert of 64425 due to Chromium instability
diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
index 764648c..9c90596 100644
--- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
+++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Kevin Ollivier <kevino at theolliviers.com>
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * All rights reserved.
  *
@@ -39,6 +40,8 @@
 #include "NotImplemented.h"
 #include "PlatformString.h"
 #include "SecurityOrigin.h"
+#include "PopupMenuWx.h"
+#include "SearchPopupMenuWx.h"
 #include "WindowFeatures.h"
 
 #include <stdio.h>
@@ -464,4 +467,19 @@ void ChromeClientWx::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
     notImplemented();
 }
 
+bool ChromeClientWx::selectItemWritingDirectionIsNatural()
+{
+    return false;
+}
+
+PassRefPtr<PopupMenu> ChromeClientWx::createPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new PopupMenuWx(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientWx::createSearchPopupMenu(PopupMenuClient* client) const
+{
+    return adoptRef(new SearchPopupMenuWx(client));
+}
+
 }
diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h
index 52ec0d8..5b60446 100644
--- a/WebKit/wx/WebKitSupport/ChromeClientWx.h
+++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Kevin Ollivier <kevino at theolliviers.com>
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * All rights reserved.
  *
@@ -142,6 +143,10 @@ public:
     virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
     virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { }
 
+    virtual bool selectItemWritingDirectionIsNatural();
+    virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+    virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+
 private:
     wxWebView* m_webView;
 };
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 492f0ca..989b3cb 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,44 @@
+2010-07-27  Luiz Agostini  <luiz.agostini at openbossa.org>
+
+        Reviewed by Darin Fisher.
+
+        PopupMenu refactoring in preparation to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42592
+
+        Classes WebPopupMenu and WebSearchPopupMenu inherit from PopupMenu and
+        SearchPopupMenu respectively. At this point they are just empty implementations.
+
+        * WebProcess/WebCoreSupport/WebPopupMenu.cpp: Added.
+        (WebKit::WebPopupMenu::WebPopupMenu):
+        (WebKit::WebPopupMenu::~WebPopupMenu):
+        (WebKit::WebPopupMenu::disconnectClient):
+        (WebKit::WebPopupMenu::show):
+        (WebKit::WebPopupMenu::hide):
+        (WebKit::WebPopupMenu::updateFromElement):
+        * WebProcess/WebCoreSupport/WebPopupMenu.h: Added.
+        * WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp: Added.
+        (WebKit::WebSearchPopupMenu::WebSearchPopupMenu):
+        (WebKit::WebSearchPopupMenu::popupMenu):
+        (WebKit::WebSearchPopupMenu::saveRecentSearches):
+        (WebKit::WebSearchPopupMenu::loadRecentSearches):
+        (WebKit::WebSearchPopupMenu::enabled):
+        * WebProcess/WebCoreSupport/WebSearchPopupMenu.h: Added.
+
+        As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu
+        instances, concrete classes that inherit from ChromeClient needed to be changed to
+        implement the new methods.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::selectItemWritingDirectionIsNatural):
+        (WebKit::WebChromeClient::createPopupMenu):
+        (WebKit::WebChromeClient::createSearchPopupMenu):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
+        build issues:
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+
 2010-08-02  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 15fe421..5444e43 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -266,6 +266,10 @@
 		BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA11176D01400471A52 /* WebNavigationData.cpp */; };
 		BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA71176D1CB00471A52 /* WKNavigationData.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */; };
+		D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */; };
+		D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484311FF4B6500032B39 /* WebPopupMenu.h */; };
+		D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */; };
+		D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */; };
 		E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */; };
 		E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */; };
 		E1EE55F411F8F18900CCBEE4 /* WKBundleRange.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -566,6 +570,10 @@
 		BCF69FA11176D01400471A52 /* WebNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNavigationData.cpp; sourceTree = "<group>"; };
 		BCF69FA71176D1CB00471A52 /* WKNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationData.h; sourceTree = "<group>"; };
 		BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationData.cpp; sourceTree = "<group>"; };
+		D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPopupMenu.cpp; sourceTree = "<group>"; };
+		D3B9484311FF4B6500032B39 /* WebPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPopupMenu.h; sourceTree = "<group>"; };
+		D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSearchPopupMenu.cpp; sourceTree = "<group>"; };
+		D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSearchPopupMenu.h; sourceTree = "<group>"; };
 		E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageEditorClient.h; sourceTree = "<group>"; };
 		E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageEditorClient.cpp; sourceTree = "<group>"; };
 		E1EE55F311F8F18900CCBEE4 /* WKBundleRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleRange.h; sourceTree = "<group>"; };
@@ -860,6 +868,10 @@
 				BC032D6D10F4378D0058C15A /* WebInspectorClient.h */,
 				1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */,
 				1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */,
+				D3B9484211FF4B6500032B39 /* WebPopupMenu.cpp */,
+				D3B9484311FF4B6500032B39 /* WebPopupMenu.h */,
+				D3B9484411FF4B6500032B39 /* WebSearchPopupMenu.cpp */,
+				D3B9484511FF4B6500032B39 /* WebSearchPopupMenu.h */,
 			);
 			path = WebCoreSupport;
 			sourceTree = "<group>";
@@ -1325,6 +1337,8 @@
 				BCDB86C11200FB97007254BE /* WebURL.h in Headers */,
 				BCB28CC0120233D9007D99BC /* InjectedBundleMessageKinds.h in Headers */,
 				BCCB75C61203A1CE00222D1B /* WebContextMessageKinds.h in Headers */,
+				D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */,
+				D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1526,6 +1540,8 @@
 				1AE4987911FF7FAA0048B464 /* JSNPObject.cpp in Sources */,
 				1AE49A4A11FFA8CE0048B464 /* JSNPMethod.cpp in Sources */,
 				BCDB85831200EC57007254BE /* WKType.cpp in Sources */,
+				D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */,
+				D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index e7b53c8..7e918af 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,9 +35,11 @@
 #include "WebFrameLoaderClient.h"
 #include "WebPage.h"
 #include "WebPageProxyMessageKinds.h"
+#include "WebPopupMenu.h"
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
 #include "WebProcessProxyMessageKinds.h"
+#include "WebSearchPopupMenu.h"
 #include <WebCore/FileChooser.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoader.h>
@@ -490,6 +493,21 @@ void WebChromeClient::formDidBlur(const Node*)
     notImplemented();
 }
 
+bool WebChromeClient::selectItemWritingDirectionIsNatural()
+{
+    return true;
+}
+
+PassRefPtr<WebCore::PopupMenu> WebChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
+{
+    return adoptRef(new WebPopupMenu(client));
+}
+
+PassRefPtr<WebCore::SearchPopupMenu> WebChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
+{
+    return adoptRef(new WebSearchPopupMenu(client));
+}
+
 PassOwnPtr<HTMLParserQuirks> WebChromeClient::createHTMLParserQuirks()
 {
     notImplemented();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
index d26a4ee..35b9f96 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -163,6 +164,10 @@ private:
     
     virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks();
 
+    virtual bool selectItemWritingDirectionIsNatural();
+    virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
+    virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
+
 #if USE(ACCELERATED_COMPOSITING)
     virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
     virtual void setNeedsOneShotDrawingSynchronization();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
new file mode 100644
index 0000000..d2f7d32
--- /dev/null
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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 "WebPopupMenu.h"
+
+#include <WebCore/FrameView.h>
+#include <WebCore/PopupMenuClient.h>
+
+namespace WebKit {
+
+WebPopupMenu::WebPopupMenu(WebCore::PopupMenuClient* client)
+    : m_popupClient(client)
+{
+}
+
+WebPopupMenu::~WebPopupMenu()
+{
+}
+
+
+void WebPopupMenu::disconnectClient()
+{
+    m_popupClient = 0;
+}
+
+void WebPopupMenu::show(const WebCore::IntRect& rect, WebCore::FrameView* view, int index)
+{
+
+}
+
+void WebPopupMenu::hide()
+{
+}
+
+void WebPopupMenu::updateFromElement()
+{
+}
+
+}
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
new file mode 100644
index 0000000..e2ea3a1
--- /dev/null
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
@@ -0,0 +1,48 @@
+/*
+ * 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 WebPopupMenu_h
+#define WebPopupMenu_h
+
+#include <WebCore/PopupMenu.h>
+
+namespace WebCore {
+class PopupMenuClient;
+}
+
+namespace WebKit {
+
+class WebPopupMenu : public WebCore::PopupMenu {
+public:
+    WebPopupMenu(WebCore::PopupMenuClient*);
+    ~WebPopupMenu();
+
+    virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+private:
+    WebCore::PopupMenuClient* m_popupClient;
+};
+
+}
+
+#endif // WebPopupMenu_h
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp b/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
new file mode 100644
index 0000000..7cea5ac
--- /dev/null
+++ b/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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 "WebSearchPopupMenu.h"
+
+namespace WebKit {
+
+WebSearchPopupMenu::WebSearchPopupMenu(WebCore::PopupMenuClient* client)
+    : m_popup(adoptRef(new WebPopupMenu(client)))
+{
+}
+
+WebCore::PopupMenu* WebSearchPopupMenu::popupMenu()
+{
+    return m_popup.get();
+}
+
+void WebSearchPopupMenu::saveRecentSearches(const WebCore::AtomicString&, const Vector<WebCore::String>&)
+{
+}
+
+void WebSearchPopupMenu::loadRecentSearches(const WebCore::AtomicString&, Vector<WebCore::String>&)
+{
+}
+
+bool WebSearchPopupMenu::enabled()
+{
+    return false;
+}
+
+}
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h b/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h
new file mode 100644
index 0000000..53b6fb5
--- /dev/null
+++ b/WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.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 WebSearchPopupMenu_h
+#define WebSearchPopupMenu_h
+
+#include <WebCore/SearchPopupMenu.h>
+#include "WebPopupMenu.h"
+
+namespace WebKit {
+
+class WebSearchPopupMenu : public WebCore::SearchPopupMenu {
+public:
+    WebSearchPopupMenu(WebCore::PopupMenuClient*);
+
+    virtual WebCore::PopupMenu* popupMenu();
+    virtual void saveRecentSearches(const WebCore::AtomicString& name, const Vector<WebCore::String>& searchItems);
+    virtual void loadRecentSearches(const WebCore::AtomicString& name, Vector<WebCore::String>& searchItems);
+    virtual bool enabled();
+
+private:
+    RefPtr<WebPopupMenu> m_popup;
+};
+
+}
+
+#endif // WebSearchPopupMenu_h
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index a3842fd..9c50ca2 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -583,6 +583,22 @@
 					RelativePath="..\WebProcess\WebCoreSupport\WebInspectorClient.h"
 					>
 				</File>
+				<File
+					RelativePath="..\WebProcess\WebCoreSupport\WebPopupMenu.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\WebCoreSupport\WebPopupMenu.h"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\WebCoreSupport\WebSearchPopupMenu.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\WebCoreSupport\WebSearchPopupMenu.h"
+					>
+				</File>
 				<Filter
 					Name="win"
 					>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list