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

bweinstein at apple.com bweinstein at apple.com
Wed Dec 22 18:46:43 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 818cf708bf3e96580b04cb752af07da24d26cfbf
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 17 21:08:36 2010 +0000

    Text area does not update when you arrow through a <select> in WebKit2
    https://bugs.webkit.org/show_bug.cgi?id=51269
    <rdar://problem/8612853>
    
    Reviewed by Anders Carlsson.
    
    Patch by Sam Weinig.
    
    Insteaed of keeping track of the selected index of a <select> just in the UI process, we
    need to pass this information along to the web process so that the web process can draw
    the correct text in the text field at the top of the select, when the selection changes (via
    the arrows or other typing while the select is opened).
    
    When the selected item in a popup changes, the UI process sends a message to the web process, telling
    it about the new selected index. The web process gets this message, and then sets the text that
    is visible in the select element.
    
    * UIProcess/API/mac/PageClientImpl.h: CreatePopupMenuProxy now takes a WebPageProxy.
    * UIProcess/API/mac/PageClientImpl.mm:
    (WebKit::PageClientImpl::createPopupMenuProxy): Pass the WebPageProxy to create.
    * UIProcess/API/qt/qwkpage.cpp:
    (QWKPagePrivate::createPopupMenuProxy):
    * UIProcess/API/qt/qwkpage_p.h: CreatePopupMenuProxy now takes a WebPageProxy.
    * UIProcess/PageClient.h: CreatePopupMenuProxy now takes a WebPageProxy.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::valueChangedForPopupMenu): Send that the selected index changed to the
        web process.selected
    (WebKit::WebPageProxy::setTextFromItemForPopupMenu): Send that we should update the text for the
        active popup menu (with the index of the item to show).
    (WebKit::WebPageProxy::showPopupMenu): Pass the WebPageProxy to createPopupMenuProxy.
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPopupMenuProxy.h: Add a client who has virtual functions for the state changing of the
        popup menu. ShowPopupMenu doesn't take a new selected index anymore, that is handled by the client,
        and calling down to the web process.
    (WebKit::WebPopupMenuProxy::Client::~Client):
    (WebKit::WebPopupMenuProxy::WebPopupMenuProxy): Initialize the client.
    * UIProcess/mac/WebPopupMenuProxyMac.h:
    (WebKit::WebPopupMenuProxyMac::create): Takes a WebPopupMenuProxy::Client, and passes it to the constructor.
    * UIProcess/mac/WebPopupMenuProxyMac.mm:
    (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac): Update what's initialized by the constructor.
    (WebKit::WebPopupMenuProxyMac::showPopupMenu): Call through to the web process that the value changed.
    * UIProcess/qt/WebPopupMenuProxyQt.cpp:
    (WebKit::WebPopupMenuProxyQt::WebPopupMenuProxyQt): Update what's initialized by the constructor.
    * UIProcess/win/WebPopupMenuProxyWin.cpp:
    (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin): Ditto.
    (WebKit::WebPopupMenuProxyWin::showPopupMenu): Call through to the web process that the value changed.
    (WebKit::WebPopupMenuProxyWin::setFocusedIndex): Resolve a FIXME to set the text of the popup menu.
    * UIProcess/win/WebPopupMenuProxyWin.h:
    (WebKit::WebPopupMenuProxyWin::create): Take in a WebPopupMenuProxy::client, and pass it to the constructor.
    * UIProcess/win/WebView.cpp:
    (WebKit::WebView::createPopupMenuProxy): Pass the WebPageProxy to create.
    * UIProcess/win/WebView.h:
    * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
    (WebKit::WebPopupMenu::setTextForIndex): Call through to setTextFromItem to set the select text.
    * WebProcess/WebCoreSupport/WebPopupMenu.h:
    * WebProcess/WebPage/WebPage.cpp: Call through to setTextForIndex on the active popup menu.
    (WebKit::WebPage::setTextForActivePopupMenu):
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.messages.in: Add a new message.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74285 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5a0d23b..f9ac0a1 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,65 @@
+2010-12-17  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Text area does not update when you arrow through a <select> in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=51269
+        <rdar://problem/8612853>
+        
+        Patch by Sam Weinig.
+        
+        Insteaed of keeping track of the selected index of a <select> just in the UI process, we
+        need to pass this information along to the web process so that the web process can draw
+        the correct text in the text field at the top of the select, when the selection changes (via
+        the arrows or other typing while the select is opened).
+        
+        When the selected item in a popup changes, the UI process sends a message to the web process, telling
+        it about the new selected index. The web process gets this message, and then sets the text that
+        is visible in the select element.
+
+        * UIProcess/API/mac/PageClientImpl.h: CreatePopupMenuProxy now takes a WebPageProxy.
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::createPopupMenuProxy): Pass the WebPageProxy to create.
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPagePrivate::createPopupMenuProxy):
+        * UIProcess/API/qt/qwkpage_p.h: CreatePopupMenuProxy now takes a WebPageProxy.
+        * UIProcess/PageClient.h: CreatePopupMenuProxy now takes a WebPageProxy.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::valueChangedForPopupMenu): Send that the selected index changed to the 
+            web process.selected
+        (WebKit::WebPageProxy::setTextFromItemForPopupMenu): Send that we should update the text for the
+            active popup menu (with the index of the item to show).
+        (WebKit::WebPageProxy::showPopupMenu): Pass the WebPageProxy to createPopupMenuProxy.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPopupMenuProxy.h: Add a client who has virtual functions for the state changing of the
+            popup menu. ShowPopupMenu doesn't take a new selected index anymore, that is handled by the client,
+            and calling down to the web process.
+        (WebKit::WebPopupMenuProxy::Client::~Client):
+        (WebKit::WebPopupMenuProxy::WebPopupMenuProxy): Initialize the client.
+        * UIProcess/mac/WebPopupMenuProxyMac.h:
+        (WebKit::WebPopupMenuProxyMac::create): Takes a WebPopupMenuProxy::Client, and passes it to the constructor.
+        * UIProcess/mac/WebPopupMenuProxyMac.mm:
+        (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac): Update what's initialized by the constructor.
+        (WebKit::WebPopupMenuProxyMac::showPopupMenu): Call through to the web process that the value changed.
+        * UIProcess/qt/WebPopupMenuProxyQt.cpp:
+        (WebKit::WebPopupMenuProxyQt::WebPopupMenuProxyQt): Update what's initialized by the constructor.
+        * UIProcess/win/WebPopupMenuProxyWin.cpp:
+        (WebKit::WebPopupMenuProxyWin::WebPopupMenuProxyWin): Ditto.
+        (WebKit::WebPopupMenuProxyWin::showPopupMenu): Call through to the web process that the value changed.
+        (WebKit::WebPopupMenuProxyWin::setFocusedIndex): Resolve a FIXME to set the text of the popup menu.
+        * UIProcess/win/WebPopupMenuProxyWin.h:
+        (WebKit::WebPopupMenuProxyWin::create): Take in a WebPopupMenuProxy::client, and pass it to the constructor.
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::createPopupMenuProxy): Pass the WebPageProxy to create.
+        * UIProcess/win/WebView.h:
+        * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
+        (WebKit::WebPopupMenu::setTextForIndex): Call through to setTextFromItem to set the select text.
+        * WebProcess/WebCoreSupport/WebPopupMenu.h:
+        * WebProcess/WebPage/WebPage.cpp: Call through to setTextForIndex on the active popup menu.
+        (WebKit::WebPage::setTextForActivePopupMenu):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Add a new message.
+
 2010-12-17  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.h b/WebKit2/UIProcess/API/mac/PageClientImpl.h
index 76d0e84..d4e9133 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -66,7 +66,7 @@ private:
     virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
     virtual void selectionChanged(bool, bool, bool, bool, uint64_t, uint64_t);
 
-    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy();
+    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 
     void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 850c71a..fe14b76 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -247,9 +247,9 @@ void PageClientImpl::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
     }
 }
 
-PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy()
+PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
 {
-    return WebPopupMenuProxyMac::create(m_wkView);
+    return WebPopupMenuProxyMac::create(m_wkView, page);
 }
 
 PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 3f6d15e..f089b4f 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -136,7 +136,7 @@ void QWKPagePrivate::didNotHandleKeyEvent(const NativeWebKeyboardEvent&)
 {
 }
 
-PassRefPtr<WebPopupMenuProxy> QWKPagePrivate::createPopupMenuProxy()
+PassRefPtr<WebPopupMenuProxy> QWKPagePrivate::createPopupMenuProxy(WebPageProxy*)
 {
     return WebPopupMenuProxyQt::create();
 }
diff --git a/WebKit2/UIProcess/API/qt/qwkpage_p.h b/WebKit2/UIProcess/API/qt/qwkpage_p.h
index a06019c..9c443fc 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -62,7 +62,7 @@ public:
     virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&);
     virtual void didNotHandleKeyEvent(const WebKit::NativeWebKeyboardEvent&);
     virtual void selectionChanged(bool, bool, bool, bool);
-    virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy();
+    virtual PassRefPtr<WebKit::WebPopupMenuProxy> createPopupMenuProxy(WebKit::WebPageProxy*);
     virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy*);
 
     virtual void setFindIndicator(PassRefPtr<WebKit::FindIndicator>, bool fadeOut);
diff --git a/WebKit2/UIProcess/PageClient.h b/WebKit2/UIProcess/PageClient.h
index 3a94e45..b6bbf80 100644
--- a/WebKit2/UIProcess/PageClient.h
+++ b/WebKit2/UIProcess/PageClient.h
@@ -82,7 +82,7 @@ public:
 
     virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&) = 0;
 
-    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy() = 0;
+    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
 
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 70b4888..54ecd25 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -1448,17 +1448,24 @@ void WebPageProxy::didFailToFindString(const String& string)
     m_findClient.didFailToFindString(this, string);
 }
 
+void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
+{
+    process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
+}
+
+void WebPageProxy::setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index)
+{
+    process()->send(Messages::WebPage::SetTextForActivePopupMenu(index), m_pageID);
+}
+
 void WebPageProxy::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
 {
     if (m_activePopupMenu)
         m_activePopupMenu->hidePopupMenu();
     else
-        m_activePopupMenu = m_pageClient->createPopupMenuProxy();
+        m_activePopupMenu = m_pageClient->createPopupMenuProxy(this);
 
-    int32_t newSelectedIndex = 0;
-    m_activePopupMenu->showPopupMenu(rect, items, data, selectedIndex, newSelectedIndex);
-
-    process()->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
+    m_activePopupMenu->showPopupMenu(rect, items, data, selectedIndex);
     m_activePopupMenu = 0;
 }
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 6436d7e..4514bee 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -42,6 +42,7 @@
 #include "WebInspectorProxy.h"
 #include "WebLoaderClient.h"
 #include "WebPolicyClient.h"
+#include "WebPopupMenuProxy.h"
 #include "WebUIClient.h"
 #include <WebCore/EditAction.h>
 #include <WebCore/Editor.h>
@@ -100,7 +101,7 @@ typedef GenericCallback<WKStringRef, StringImpl*> RenderTreeExternalRepresentati
 typedef GenericCallback<WKStringRef, StringImpl*> ScriptReturnValueCallback;
 typedef GenericCallback<WKStringRef, StringImpl*> ContentsAsStringCallback;
 
-class WebPageProxy : public APIObject {
+class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
 public:
     static const Type APIType = TypePage;
 
@@ -297,6 +298,10 @@ private:
 
     virtual Type type() const { return APIType; }
 
+    // WebPopupMenuProxy::Client
+    virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex);
+    virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index);
+
     // Implemented in generated WebPageProxyMessageReceiver.cpp
     void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     CoreIPC::SyncReplyMode didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
diff --git a/WebKit2/UIProcess/WebPopupMenuProxy.h b/WebKit2/UIProcess/WebPopupMenuProxy.h
index 5b28efb..fd84928 100644
--- a/WebKit2/UIProcess/WebPopupMenuProxy.h
+++ b/WebKit2/UIProcess/WebPopupMenuProxy.h
@@ -40,18 +40,32 @@ struct PlatformPopupMenuData;
 struct WebPopupItem;
 
 class WebPopupMenuProxy : public RefCounted<WebPopupMenuProxy> {
-public:    
+public:
+    class Client {
+    protected:
+        virtual ~Client()
+        {
+        }
+
+    public:
+        virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) = 0;
+        virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) = 0;
+    };
+
     virtual ~WebPopupMenuProxy()
     {
     }
 
-    virtual void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex, int32_t& newSelectedIndex) = 0;
+    virtual void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
     virtual void hidePopupMenu() = 0;
 
 protected:
-    WebPopupMenuProxy()
+    WebPopupMenuProxy(Client* client)
+        : m_client(client)
     {
     }
+
+    Client* m_client;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h b/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
index 6834c6d..85339d6 100644
--- a/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
+++ b/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
@@ -43,17 +43,17 @@ class WebPageProxy;
 
 class WebPopupMenuProxyMac : public WebPopupMenuProxy {
 public:
-    static PassRefPtr<WebPopupMenuProxyMac> create(WKView* webView)
+    static PassRefPtr<WebPopupMenuProxyMac> create(WKView* webView, WebPopupMenuProxy::Client* client)
     {
-        return adoptRef(new WebPopupMenuProxyMac(webView));
+        return adoptRef(new WebPopupMenuProxyMac(webView, client));
     }
     ~WebPopupMenuProxyMac();
 
-    virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex, int32_t& newSelectedIndex);
+    virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
     virtual void hidePopupMenu();
 
 private:
-    WebPopupMenuProxyMac(WKView*);
+    WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client);
 
     void populate(const Vector<WebPopupItem>&);
 
diff --git a/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm b/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
index f15c01d..481e8c5 100644
--- a/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
+++ b/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
@@ -35,8 +35,9 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView* webView)
-    : m_webView(webView)
+WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView* webView, WebPopupMenuProxy::Client* client)
+    : WebPopupMenuProxy(client)
+    , m_webView(webView)
 {
 }
 
@@ -70,7 +71,7 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items)
     }
 }
 
-void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex, int32_t& newSelectedIndex)
+void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
 {
     populate(items);
 
@@ -96,7 +97,7 @@ void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, const Vector<WebPo
     [m_popup.get() dismissPopUp];
     [dummyView.get() removeFromSuperview];
 
-    newSelectedIndex = [m_popup.get() indexOfSelectedItem];
+    m_client->valueChangedForPopupMenu(this, [m_popup.get() indexOfSelectedItem]);
 }
 
 void WebPopupMenuProxyMac::hidePopupMenu()
diff --git a/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp b/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
index 87c0898..5e13499 100644
--- a/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
+++ b/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
@@ -33,6 +33,7 @@ using namespace WebCore;
 namespace WebKit {
 
 WebPopupMenuProxyQt::WebPopupMenuProxyQt()
+    : WebPopupMenuProxy(0)
 {
 }
 
@@ -40,7 +41,7 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt()
 {
 }
 
-void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex, int32_t& newSelectedIndex)
+void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
 {
 }
 
diff --git a/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp b/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
index 76d40d8..64b9fb5 100644
--- a/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
+++ b/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
@@ -158,8 +158,9 @@ bool WebPopupMenuProxyWin::registerWindowClass()
     return !!::RegisterClassEx(&wcex);
 }
 
-WebPopupMenuProxyWin::WebPopupMenuProxyWin(WebView* webView)
-    : m_webView(webView)
+WebPopupMenuProxyWin::WebPopupMenuProxyWin(WebView* webView, WebPopupMenuProxy::Client* client)
+    : WebPopupMenuProxy(client)
+    , m_webView(webView)
     , m_newSelectedIndex(0)
     , m_popup(0)
     , m_DC(0)
@@ -186,7 +187,7 @@ WebPopupMenuProxyWin::~WebPopupMenuProxyWin()
         m_scrollbar->setParent(0);
 }
 
-void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex, int32_t& newSelectedIndex)
+void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
 {
     m_items = items;
     m_data = data;
@@ -322,7 +323,7 @@ void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, const Vector<WebPo
     m_showPopup = false;
     ::ShowWindow(m_popup, SW_HIDE);
 
-    newSelectedIndex = m_newSelectedIndex;
+    m_client->valueChangedForPopupMenu(this, m_newSelectedIndex);
 }
 
 void WebPopupMenuProxyWin::hidePopupMenu()
@@ -846,9 +847,8 @@ bool WebPopupMenuProxyWin::setFocusedIndex(int i, bool hotTracking)
 
     m_focusedIndex = i;
 
-    // FIXME: If we are not hotTracking, we need to send a message back to the WebProcess to
-    // call the popupMenuClient's setTextFromItem function of this index.  This will update
-    // the currently displayed item at the top of the list.
+    if (!hotTracking)
+        m_client->setTextFromItemForPopupMenu(this, i);
 
     if (!scrollToRevealSelection())
         ::UpdateWindow(m_popup);
diff --git a/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h b/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
index 07e3767..7a53c2c 100644
--- a/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
+++ b/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
@@ -42,19 +42,19 @@ class WebView;
 
 class WebPopupMenuProxyWin : public WebPopupMenuProxy, private WebCore::ScrollbarClient  {
 public:
-    static PassRefPtr<WebPopupMenuProxyWin> create(WebView* webView)
+    static PassRefPtr<WebPopupMenuProxyWin> create(WebView* webView, WebPopupMenuProxy::Client* client)
     {
-        return adoptRef(new WebPopupMenuProxyWin(webView));
+        return adoptRef(new WebPopupMenuProxyWin(webView, client));
     }
     ~WebPopupMenuProxyWin();
 
-    virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex, int32_t& newSelectedIndex);
+    virtual void showPopupMenu(const WebCore::IntRect&, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
     virtual void hidePopupMenu();
 
     void hide() { hidePopupMenu(); }
 
 private:
-    WebPopupMenuProxyWin(WebView*);
+    WebPopupMenuProxyWin(WebView*, WebPopupMenuProxy::Client*);
 
     WebCore::Scrollbar* scrollbar() const { return m_scrollbar.get(); }
 
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index 5d99262..6c5c31d 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -926,9 +926,9 @@ void WebView::didNotHandleKeyEvent(const NativeWebKeyboardEvent& event)
     ::DefWindowProcW(event.nativeEvent()->hwnd, event.nativeEvent()->message, event.nativeEvent()->wParam, event.nativeEvent()->lParam);
 }
 
-PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy()
+PassRefPtr<WebPopupMenuProxy> WebView::createPopupMenuProxy(WebPageProxy* page)
 {
-    return WebPopupMenuProxyWin::create(this);
+    return WebPopupMenuProxyWin::create(this, page);
 }
 
 PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy* page)
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index 2141076..ffe9e64 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -118,7 +118,7 @@ private:
     virtual void didNotHandleKeyEvent(const NativeWebKeyboardEvent&);
     virtual void selectionChanged(bool, bool, bool, bool);
     virtual void compositionSelectionChanged(bool);
-    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy();
+    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
 
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
index 782c549..ea0ad2d 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp
@@ -63,6 +63,14 @@ void WebPopupMenu::didChangeSelectedIndex(int newIndex)
         m_popupClient->valueChanged(newIndex);
 }
 
+void WebPopupMenu::setTextForIndex(int index)
+{
+    if (!m_popupClient)
+        return;
+
+    m_popupClient->setTextFromItem(index);
+}
+
 Vector<WebPopupItem> WebPopupMenu::populateItems()
 {
     size_t size = m_popupClient->listSize();
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
index d1e7a97..3083c94 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h
@@ -45,6 +45,7 @@ public:
 
     void disconnectFromPage() { m_page = 0; }
     void didChangeSelectedIndex(int newIndex);
+    void setTextForIndex(int newIndex);
 
     virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index);
     virtual void hide();
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 097dfde..22754c1 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -1116,6 +1116,14 @@ void WebPage::didCancelForOpenPanel()
     m_activeOpenPanelResultListener = 0;
 }
 
+void WebPage::setTextForActivePopupMenu(int32_t index)
+{
+    if (!m_activePopupMenu)
+        return;
+
+    m_activePopupMenu->setTextForIndex(index);
+}
+
 void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItemData& item)
 {
     ASSERT(m_contextMenu);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index a369c97..d921930 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -337,6 +337,7 @@ private:
 #endif
 
     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
+    void setTextForActivePopupMenu(int32_t index);
 
     void didChooseFilesForOpenPanel(const Vector<String>&);
     void didCancelForOpenPanel();
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 9f47a99..e7cea12 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -87,6 +87,7 @@ messages -> WebPage {
 
     # Popup menu.
     DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
+    SetTextForActivePopupMenu(int32_t index);
     
     # Context menu.
     DidSelectItemFromActiveContextMenu(WebKit::WebContextMenuItemData menuItem);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list