Commit 851ec1e4 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2010-04-27 Jay Civelli <jcivelli@chromium.org>

        Reviewed by Darin Fisher.

        Makes clicking a select element close its associated popup if
        it is open.
        https://bugs.webkit.org/show_bug.cgi?id=38105

        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::mouseDown):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0094033c
2010-04-27 Jay Civelli <jcivelli@chromium.org>
Reviewed by Darin Fisher.
Makes clicking a select element close its associated popup if
it is open.
https://bugs.webkit.org/show_bug.cgi?id=38105
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::mouseDown):
2010-04-27 Jay Civelli <jcivelli@chromium.org>
Reviewed by Darin Fisher.
......
......@@ -326,9 +326,12 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event)
if (!mainFrameImpl() || !mainFrameImpl()->frameView())
return;
// If there is a select popup opened, close it as the user is clicking on
// the page (outside of the popup).
// 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.
RefPtr<WebCore::PopupContainer> selectPopup = m_selectPopup;
hideSelectPopup();
ASSERT(!m_selectPopup);
m_lastMouseDownPoint = WebPoint(event.x, event.y);
m_haveMouseCapture = true;
......@@ -362,6 +365,13 @@ void WebViewImpl::mouseDown(const WebMouseEvent& event)
static_cast<EditorClientImpl*>(m_page->editorClient())->
showFormAutofillForNode(clickedNode.get());
}
if (m_selectPopup && m_selectPopup == selectPopup) {
// That click triggered a select popup which is the same as the one that
// was showing before the click. It means the user clicked the select
// while the popup was showing, and as a result we first closed then
// immediately reopened the select popup. It needs to be closed.
hideSelectPopup();
}
// Dispatch the contextmenu event regardless of if the click was swallowed.
// On Windows, we handle it on mouse up, not down.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment