Title: [123479] trunk/Source/WebKit/chromium
- Revision
- 123479
- Author
- kei...@webkit.org
- Date
- 2012-07-24 08:31:29 -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 (123478 => 123479)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-07-24 15:25:21 UTC (rev 123478)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-07-24 15:31:29 UTC (rev 123479)
@@ -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 Jochen Eisinger <joc...@chromium.org>
Unreviewed. Rolled DEPS.
Modified: trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h (123478 => 123479)
--- trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h 2012-07-24 15:25:21 UTC (rev 123478)
+++ trunk/Source/WebKit/chromium/src/WebPagePopupImpl.h 2012-07-24 15:31:29 UTC (rev 123479)
@@ -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 (123478 => 123479)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-07-24 15:25:21 UTC (rev 123478)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-07-24 15:31:29 UTC (rev 123479)
@@ -522,14 +522,23 @@
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;
+#if ENABLE(PAGE_POPUP)
+ RefPtr<WebPagePopupImpl> pagePopup;
+#endif
if (event.button == WebMouseEvent::ButtonLeft) {
selectPopup = m_selectPopup;
- hideSelectPopup();
+#if ENABLE(PAGE_POPUP)
+ pagePopup = m_pagePopup;
+#endif
+ hidePopups();
ASSERT(!m_selectPopup);
+#if ENABLE(PAGE_POPUP)
+ ASSERT(!m_pagePopup);
+#endif
}
m_lastMouseDownPoint = WebPoint(event.x, event.y);
@@ -555,6 +564,14 @@
hideSelectPopup();
}
+#if ENABLE(PAGE_POPUP)
+ 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());
+ }
+#endif
+
// 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