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

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

Issue 2804813002: Hide popups when handling mouse down, mouse wheel, or gesture tap in a WebFrameWidget (Closed)
Patch Set: Addressing comments 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 | « third_party/WebKit/Source/web/WebViewImpl.h ('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/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 14a28bb480ff87c985e27315634189622b7fc935..c7d534dcadcedf6493676fd8a552c782e2b2f879 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -174,7 +174,6 @@
#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/WebSettingsImpl.h"
@@ -1704,7 +1703,8 @@ PagePopup* WebViewImpl::OpenPagePopup(PagePopupClient* client) {
page_popup_->ClosePopup();
page_popup_ = nullptr;
}
- EnablePopupMouseWheelEventListener();
+ EnablePopupMouseWheelEventListener(WebLocalFrameImpl::FromFrame(
+ client->OwnerElement().GetDocument().GetFrame()->LocalFrameRoot()));
return page_popup_.Get();
}
@@ -1727,38 +1727,32 @@ void WebViewImpl::CancelPagePopup() {
page_popup_->Cancel();
}
-void WebViewImpl::EnablePopupMouseWheelEventListener() {
- // TODO(kenrb): Popup coordination for out-of-process iframes needs to be
- // added. Because of the early return here a select element
- // popup can remain visible even when the element underneath it is
- // scrolled to a new position. This is part of a larger set of issues with
- // popups.
- // See https://crbug.com/566130
- if (!MainFrameImpl())
- return;
+void WebViewImpl::EnablePopupMouseWheelEventListener(
+ WebLocalFrameImpl* local_root) {
DCHECK(!popup_mouse_wheel_event_listener_);
- Document* document = MainFrameImpl()->GetFrame()->GetDocument();
+ Document* document = local_root->GetDocument();
DCHECK(document);
// We register an empty event listener, EmptyEventListener, so that mouse
// wheel events get sent to the WebView.
popup_mouse_wheel_event_listener_ = EmptyEventListener::Create();
document->addEventListener(EventTypeNames::mousewheel,
popup_mouse_wheel_event_listener_, false);
+ local_root_with_empty_mouse_wheel_listener_ = local_root;
}
void WebViewImpl::DisablePopupMouseWheelEventListener() {
// TODO(kenrb): Concerns the same as in enablePopupMouseWheelEventListener.
// See https://crbug.com/566130
- if (!MainFrameImpl())
- return;
DCHECK(popup_mouse_wheel_event_listener_);
- Document* document = MainFrameImpl()->GetFrame()->GetDocument();
+ Document* document =
+ local_root_with_empty_mouse_wheel_listener_->GetDocument();
DCHECK(document);
// Document may have already removed the event listener, for instance, due
// to a navigation, but remove it anyway.
document->removeEventListener(EventTypeNames::mousewheel,
popup_mouse_wheel_event_listener_.Release(),
false);
+ local_root_with_empty_mouse_wheel_listener_ = nullptr;
}
LocalDOMWindow* WebViewImpl::PagePopupWindow() const {
@@ -2491,7 +2485,7 @@ WebColor WebViewImpl::BackgroundColor() const {
return view->DocumentBackgroundColor().Rgb();
}
-WebPagePopup* WebViewImpl::GetPagePopup() const {
+WebPagePopupImpl* WebViewImpl::GetPagePopup() const {
return page_popup_.Get();
}
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698