Title: [123463] trunk/Source/WebKit/chromium
Revision
123463
Author
kei...@webkit.org
Date
2012-07-24 05:38:02 -0700 (Tue, 24 Jul 2012)

Log Message

[Chromium] Page popup should close on mouse down
https://bugs.webkit.org/show_bug.cgi?id=92092

Reviewed by Kent Tamura.

Page popup should close on mouse down because some elements(e.g. <input type=color>) don't have a blur event that
we can hook to hide the page popup when the user clicks on the page.

* src/WebPagePopupImpl.h:
(WebKit::WebPagePopupImpl::hasSamePopupClient): Returns true if the given WebPagePopupImpl have the same popup client.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleMouseDown): Close all popups when the page is clicked. Checks if the
mouse down event opened the same popup we just closed.

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (123462 => 123463)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-24 12:26:48 UTC (rev 123462)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-24 12:38:02 UTC (rev 123463)
@@ -1,3 +1,19 @@
+2012-07-24  Keishi Hattori  <kei...@webkit.org>
+
+        [Chromium] Page popup should close on mouse down
+        https://bugs.webkit.org/show_bug.cgi?id=92092
+
+        Reviewed by Kent Tamura.
+
+        Page popup should close on mouse down because some elements(e.g. <input type=color>) don't have a blur event that
+        we can hook to hide the page popup when the user clicks on the page.
+
+        * src/WebPagePopupImpl.h:
+        (WebKit::WebPagePopupImpl::hasSamePopupClient): Returns true if the given WebPagePopupImpl have the same popup client.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::handleMouseDown): Close all popups when the page is clicked. Checks if the
+        mouse down event opened the same popup we just closed.
+
 2012-07-24  Anthony Scian  <asc...@rim.com>
 
         Web Inspector [JSC]: Enable initiator column in network panel.

Modified: trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h (123462 => 123463)


--- trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h	2012-07-24 12:26:48 UTC (rev 123462)
+++ trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h	2012-07-24 12:38:02 UTC (rev 123463)
@@ -63,6 +63,7 @@
     bool handleKeyEvent(const WebCore::PlatformKeyboardEvent&);
     void closePopup();
     WebWidgetClient* widgetClient() const { return m_widgetClient; }
+    bool hasSamePopupClient(WebPagePopupImpl* other) { return other && m_popupClient == other->m_popupClient; }
 
 private:
     // WebWidget functions

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (123462 => 123463)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-07-24 12:26:48 UTC (rev 123462)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-07-24 12:38:02 UTC (rev 123463)
@@ -522,13 +522,15 @@
 
 void WebViewImpl::handleMouseDown(Frame& mainFrame, const WebMouseEvent& event)
 {
-    // If there is a select popup open, close it as the user is clicking on
-    // the page (outside of the popup).  We also save it so we can prevent a
-    // click on the select element from immediately reopening the popup.
+    // If there is a popup open, close it as the user is clicking on the page (outside of the
+    // popup). We also save it so we can prevent a click on an element from immediately
+    // reopening the same popup.
     RefPtr<WebCore::PopupContainer> selectPopup;
+    RefPtr<WebPagePopupImpl> pagePopup;
     if (event.button == WebMouseEvent::ButtonLeft) {
         selectPopup = m_selectPopup;
-        hideSelectPopup();
+        pagePopup = m_pagePopup;
+        hidePopups();
         ASSERT(!m_selectPopup);
     }
 
@@ -555,6 +557,12 @@
         hideSelectPopup();
     }
 
+    if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.get())) {
+        // That click triggered a page popup that is the same as the one we just closed.
+        // It needs to be closed.
+        closePagePopup(m_pagePopup.get());
+    }
+
     // Dispatch the contextmenu event regardless of if the click was swallowed.
     // On Windows, we handle it on mouse up, not down.
 #if OS(DARWIN)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to