Commit b1c680b7 authored by tkent's avatar tkent Committed by Commit bot

Fix a focus issue after closing PagePopups by opening the hotdog menu.

This CL affects any PagePopups such as SELECT popup and calendar popup.

If the hotdog menu is opened while a PagePopup is shown,
WebPagePopupImpl::close() is called. In this case, we didn't clear
WebViewImpl::m_pagePopup, and the WebView didn't handle any input
events.  We should clear WebViewImmpl::m_pagePopup.

Also, WebViewImpl::setFocus(false) is called on Windows in this
case. It stopped rendering focus rings.  This CL avoids it.

BUG=568101
TEST=manual; See crbug.com/568101

Review URL: https://codereview.chromium.org/1525943002

Cr-Commit-Position: refs/heads/master@{#366929}
parent 5241acd1
......@@ -468,7 +468,12 @@ void WebPagePopupImpl::setFocus(bool enable)
void WebPagePopupImpl::close()
{
m_closing = true;
destroyPage(); // In case closePopup() was not called.
// In case closePopup() was not called.
if (m_page) {
destroyPage();
m_popupClient->didClosePopup();
m_webView->cleanupPagePopup();
}
m_widgetClient = 0;
deref();
}
......
......@@ -1734,6 +1734,11 @@ void WebViewImpl::closePagePopup(PagePopup* popup)
if (m_pagePopup.get() != popupImpl)
return;
m_pagePopup->closePopup();
cleanupPagePopup();
}
void WebViewImpl::cleanupPagePopup()
{
m_pagePopup = nullptr;
disablePopupMouseWheelEventListener();
}
......@@ -2269,6 +2274,12 @@ void WebViewImpl::mouseCaptureLost()
void WebViewImpl::setFocus(bool enable)
{
// On Windows, unnecessary setFocus(false) is called if a popup is shown and
// the hotdog menu is clicked.
// TODO(tkent): This should be fixed in Chromium.
if (!enable && m_pagePopup)
return;
m_page->focusController().setFocused(enable);
if (enable) {
m_page->focusController().setActive(true);
......
......@@ -426,6 +426,7 @@ public:
PagePopup* openPagePopup(PagePopupClient*);
void closePagePopup(PagePopup*);
void cleanupPagePopup();
LocalDOMWindow* pagePopupWindow() const;
// Returns the input event we're currently processing. This is used in some
......
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