Chromium Code Reviews| 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..0e2f7e51f078bbc13b148d6435686a99f19c5d6e 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,38 @@ void WebViewImpl::CancelPagePopup() { |
| page_popup_->Cancel(); |
| } |
| -void WebViewImpl::EnablePopupMouseWheelEventListener() { |
| +void WebViewImpl::EnablePopupMouseWheelEventListener( |
| + WebLocalFrameImpl* local_root) { |
| // TODO(kenrb): Popup coordination for out-of-process iframes needs to be |
|
kenrb
2017/04/18 19:25:53
I think this comment can be entirely removed. Ther
EhsanK
2017/04/20 15:23:09
Acknowledged.
|
| // 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; |
| 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 +2491,7 @@ WebColor WebViewImpl::BackgroundColor() const { |
| return view->DocumentBackgroundColor().Rgb(); |
| } |
| -WebPagePopup* WebViewImpl::GetPagePopup() const { |
| +WebPagePopupImpl* WebViewImpl::GetPagePopup() const { |
| return page_popup_.Get(); |
| } |