Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 2804813002: Hide popups when handling mouse down, mouse wheel, or gesture tap in a WebFrameWidget (Closed)
Patch Set: Make sure a new popup is not generated Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/site_per_process_interactive_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
index fa53cf4be94d6f5fdaa592e667ebd34d4fd8f577..15da3f1e668340bdf0cfc23618e94af127f3a143 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -71,6 +71,7 @@
#include "web/WebInputEventConversion.h"
#include "web/WebInputMethodControllerImpl.h"
#include "web/WebLocalFrameImpl.h"
+#include "web/WebPagePopupImpl.h"
#include "web/WebPluginContainerImpl.h"
#include "web/WebRemoteFrameImpl.h"
#include "web/WebViewFrameWidget.h"
@@ -768,6 +769,14 @@ void WebFrameWidgetImpl::handleMouseLeave(LocalFrame& mainFrame,
void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame,
const WebMouseEvent& event) {
+ RefPtr<WebPagePopupImpl> pagePopup;
+ if (event.button == WebMouseEvent::Button::Left) {
+ // The mouse down has been outside of any open popups so we should cancel
+ // the current page popup for this process.
dcheng 2017/04/07 06:32:01 Nit: I prefer the original comment (since it also
EhsanK 2017/04/07 16:16:12 Acknowledged.
+ pagePopup = static_cast<WebPagePopupImpl*>(view()->pagePopup());
dcheng 2017/04/07 06:32:01 Let's take advantage of the fact that view() alrea
EhsanK 2017/04/07 16:16:12 Yes good idea. Thanks!
+ view()->hidePopups();
+ }
+
// Take capture on a mouse down on a plugin so we can send it mouse events.
// If the hit node is a plugin but a scrollbar is over it don't start mouse
// capture because it will interfere with the scrollbar receiving events.
@@ -792,6 +801,15 @@ void WebFrameWidgetImpl::handleMouseDown(LocalFrame& mainFrame,
m_mouseCaptureGestureToken =
mainFrame.eventHandler().takeLastMouseDownGestureToken();
+ WebPagePopupImpl* pagePopupImpl =
dcheng 2017/04/07 06:32:01 Nit: Call this currentPagePopup
EhsanK 2017/04/07 16:16:12 Or I can just remove it now that view()->pagePopup
+ static_cast<WebPagePopupImpl*>(view()->pagePopup());
+ if (pagePopupImpl && pagePopupImpl == pagePopup &&
+ pagePopupImpl->hasSamePopupClient(pagePopup.get())) {
+ // That click triggered a page popup that is the same as the one we just
+ // closed. It needs to be closed.
+ view()->hidePopups();
dcheng 2017/04/07 06:32:01 The logic in WebViewImpl calls cancel() -- is it O
EhsanK 2017/04/07 16:16:12 hidePopups() simply calls cancelPagePopup(). That
+ }
+
// Dispatch the contextmenu event regardless of if the click was swallowed.
if (!page()->settings().getShowContextMenuOnMouseUp()) {
#if OS(MACOSX)
« no previous file with comments | « chrome/browser/site_per_process_interactive_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698