Title: [101678] trunk/Source
Revision
101678
Author
commit-qu...@webkit.org
Date
2011-12-01 09:39:30 -0800 (Thu, 01 Dec 2011)

Log Message

Popup menu can get stuck in closed state when GtkMenu can't grab mouse.
https://bugs.webkit.org/show_bug.cgi?id=56466

Add a check if popup menu is not visible due to no mouse grab,
Ensure WebCore is in sync with proper state.

Patch by Wajahat Siddiqui <mdwajahatali.siddi...@motorola.com> on 2011-12-01
Reviewed by Martin Robinson.

Source/WebCore:

* platform/gtk/PopupMenuGtk.cpp:
(WebCore::PopupMenuGtk::show):

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::failedToShowPopupMenu): Added Method to send message
to WebProcess.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPopupMenuProxy.h:
* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu):
* WebProcess/WebCoreSupport/WebPopupMenu.h:
(WebKit::WebPopupMenu::client): Added Method to get WebCore::PopupMenuClient.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::failedToShowPopupMenu):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Added Message to inform WebProcess ShowPopupMenu failed.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101677 => 101678)


--- trunk/Source/WebCore/ChangeLog	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebCore/ChangeLog	2011-12-01 17:39:30 UTC (rev 101678)
@@ -1,3 +1,16 @@
+2011-12-01  Wajahat Siddiqui  <mdwajahatali.siddi...@motorola.com>
+
+        Popup menu can get stuck in closed state when GtkMenu can't grab mouse.
+        https://bugs.webkit.org/show_bug.cgi?id=56466
+
+        Add a check if popup menu is not visible due to no mouse grab,
+        Ensure WebCore is in sync with proper state.
+
+        Reviewed by Martin Robinson.
+
+        * platform/gtk/PopupMenuGtk.cpp:
+        (WebCore::PopupMenuGtk::show):
+
 2011-12-01  Eric Carlson  <eric.carl...@apple.com>
 
         When playing audio in <video>, the poster is hidden on play

Modified: trunk/Source/WebCore/platform/gtk/PopupMenuGtk.cpp (101677 => 101678)


--- trunk/Source/WebCore/platform/gtk/PopupMenuGtk.cpp	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebCore/platform/gtk/PopupMenuGtk.cpp	2011-12-01 17:39:30 UTC (rev 101678)
@@ -88,6 +88,11 @@
     menuPosition.move(0, rect.height());
 
     m_popup->popUp(rect.size(), menuPosition, size, index, gtk_get_current_event());
+
+    // GTK can refuse to actually open the menu when mouse grabs fails.
+    // Ensure WebCore does not go into some pesky state.
+    if (!gtk_widget_get_visible(m_popup->platformMenu()))
+        client()->popupDidHide();
 }
 
 void PopupMenuGtk::hide()

Modified: trunk/Source/WebKit2/ChangeLog (101677 => 101678)


--- trunk/Source/WebKit2/ChangeLog	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-01 17:39:30 UTC (rev 101678)
@@ -1,3 +1,27 @@
+2011-12-01  Wajahat Siddiqui  <mdwajahatali.siddi...@motorola.com>
+
+        Popup menu can get stuck in closed state when GtkMenu can't grab mouse.
+        https://bugs.webkit.org/show_bug.cgi?id=56466
+
+        Add a check if popup menu is not visible due to no mouse grab,
+        Ensure WebCore is in sync with proper state.
+
+        Reviewed by Martin Robinson.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::failedToShowPopupMenu): Added Method to send message
+        to WebProcess.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPopupMenuProxy.h:
+        * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
+        (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
+        * WebProcess/WebCoreSupport/WebPopupMenu.h:
+        (WebKit::WebPopupMenu::client): Added Method to get WebCore::PopupMenuClient.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::failedToShowPopupMenu):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Added Message to inform WebProcess ShowPopupMenu failed.
+
 2011-12-01  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: restore WebKit2 Safari menu items after capabilities refactoring regression.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (101677 => 101678)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-01 17:39:30 UTC (rev 101678)
@@ -2478,6 +2478,13 @@
     return m_currentlyProcessedMouseDownEvent.get();
 }
 
+#if PLATFORM(GTK)
+void WebPageProxy::failedToShowPopupMenu()
+{
+    process()->send(Messages::WebPage::FailedToShowPopupMenu(), m_pageID);
+}
+#endif
+
 void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData& data)
 {
     if (m_activePopupMenu) {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (101677 => 101678)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-12-01 17:39:30 UTC (rev 101678)
@@ -595,6 +595,9 @@
     virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex);
     virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index);
     virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
+#if PLATFORM(GTK)
+    virtual void failedToShowPopupMenu();
+#endif    
 
     // Implemented in generated WebPageProxyMessageReceiver.cpp
     void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);

Modified: trunk/Source/WebKit2/UIProcess/WebPopupMenuProxy.h (101677 => 101678)


--- trunk/Source/WebKit2/UIProcess/WebPopupMenuProxy.h	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/UIProcess/WebPopupMenuProxy.h	2011-12-01 17:39:30 UTC (rev 101678)
@@ -53,6 +53,9 @@
         virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) = 0;
         virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) = 0;
         virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() = 0;
+#if PLATFORM(GTK)
+        virtual void failedToShowPopupMenu() = 0;
+#endif        
     };
 
     virtual ~WebPopupMenuProxy()

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp (101677 => 101678)


--- trunk/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2011-12-01 17:39:30 UTC (rev 101678)
@@ -87,6 +87,13 @@
     gulong unmapHandler = g_signal_connect(m_popup->platformMenu(), "unmap", G_CALLBACK(menuUnmapped), this);
     m_popup->popUp(rect.size(), menuPosition, size, selectedIndex, m_client->currentlyProcessedMouseDownEvent() ? m_client->currentlyProcessedMouseDownEvent()->nativeEvent() : 0);
 
+    // PopupMenu can fail to open when there is no mouse grab.
+    // Ensure WebCore does not go into some pesky state.
+    if (!gtk_widget_get_visible(m_popup->platformMenu())) {
+       m_client->failedToShowPopupMenu();
+       return;
+    }
+
     // WebPageProxy expects the menu to run in a nested run loop, since it invalidates the
     // menu right after calling WebPopupMenuProxy::showPopupMenu().
     m_runLoop = g_main_loop_new(0, FALSE);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h (101677 => 101678)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h	2011-12-01 17:39:30 UTC (rev 101678)
@@ -48,6 +48,9 @@
     void disconnectFromPage() { m_page = 0; }
     void didChangeSelectedIndex(int newIndex);
     void setTextForIndex(int newIndex);
+#if PLATFORM(GTK)    
+    WebCore::PopupMenuClient* client() const { return m_popupClient; }
+#endif
 
     virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index) OVERRIDE;
     virtual void hide() OVERRIDE;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (101677 => 101678)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-01 17:39:30 UTC (rev 101678)
@@ -2151,6 +2151,16 @@
     m_activePopupMenu->setTextForIndex(index);
 }
 
+#if PLATFORM(GTK)
+void WebPage::failedToShowPopupMenu()
+{
+    if (!m_activePopupMenu)
+        return;
+
+    m_activePopupMenu->client()->popupDidHide();
+}
+#endif
+
 void WebPage::didSelectItemFromActiveContextMenu(const WebContextMenuItemData& item)
 {
     if (!m_contextMenu)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (101677 => 101678)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-12-01 17:39:30 UTC (rev 101678)
@@ -576,6 +576,10 @@
     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
     void setTextForActivePopupMenu(int32_t index);
 
+#if PLATFORM(GTK)    
+    void failedToShowPopupMenu();
+#endif    
+
     void didChooseFilesForOpenPanel(const Vector<String>&);
     void didCancelForOpenPanel();
 #if ENABLE(WEB_PROCESS_SANDBOX)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (101677 => 101678)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2011-12-01 17:36:31 UTC (rev 101677)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2011-12-01 17:39:30 UTC (rev 101678)
@@ -145,6 +145,9 @@
     # Popup menu.
     DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
     SetTextForActivePopupMenu(int32_t index);
+#if PLATFORM(GTK)    
+    FailedToShowPopupMenu();
+#endif    
     
     # Context menu.
     DidSelectItemFromActiveContextMenu(WebKit::WebContextMenuItemData menuItem);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to