| Index: third_party/WebKit/Source/web/ChromeClientImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
|
| index fdf98e225a76fee5f677b8c67bd3d3bf9359201c..572ef67babf3bc4c93867e142426fe958dff7570 100644
|
| --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
|
| @@ -929,26 +929,60 @@ bool ChromeClientImpl::shouldOpenModalDialogDuringPageDismissal(
|
| }
|
|
|
| void ChromeClientImpl::setEventListenerProperties(
|
| + LocalFrame* frame,
|
| WebEventListenerClass eventClass,
|
| WebEventListenerProperties properties) {
|
| - if (WebLayerTreeView* treeView = m_webView->layerTreeView()) {
|
| + // |frame| might be null if called via TreeScopeAdopter::
|
| + // moveNodeToNewDocument() and the new document has no frame attached.
|
| + // Since a document without a frame cannot attach one later, it is safe to
|
| + // exit early.
|
| + if (!frame)
|
| + return;
|
| +
|
| + WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
|
| + WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
|
| + // The widget may be nullptr if the frame is provisional.
|
| + // TODO(dcheng): This needs to be cleaned up at some point.
|
| + // https://crbug.com/578349
|
| + if (!widget) {
|
| + // If we hit a provisional frame, we expect it to be during initialization
|
| + // in which case the |properties| should be 'nothing'.
|
| + DCHECK(properties == WebEventListenerProperties::Nothing);
|
| + return;
|
| + }
|
| +
|
| + // This relies on widget always pointing to a WebFrameWidgetImpl when
|
| + // |frame| points to an OOPIF frame, i.e. |frame|'s mainFrame() is
|
| + // remote.
|
| + WebWidgetClient* client = widget->client();
|
| + if (WebLayerTreeView* treeView = widget->getLayerTreeView()) {
|
| treeView->setEventListenerProperties(eventClass, properties);
|
| if (eventClass == WebEventListenerClass::TouchStartOrMove) {
|
| - m_webView->hasTouchEventHandlers(
|
| + client->hasTouchEventHandlers(
|
| properties != WebEventListenerProperties::Nothing ||
|
| - eventListenerProperties(WebEventListenerClass::TouchEndOrCancel) !=
|
| + treeView->eventListenerProperties(
|
| + WebEventListenerClass::TouchEndOrCancel) !=
|
| WebEventListenerProperties::Nothing);
|
| } else if (eventClass == WebEventListenerClass::TouchEndOrCancel) {
|
| - m_webView->hasTouchEventHandlers(
|
| + client->hasTouchEventHandlers(
|
| properties != WebEventListenerProperties::Nothing ||
|
| - eventListenerProperties(WebEventListenerClass::TouchStartOrMove) !=
|
| + treeView->eventListenerProperties(
|
| + WebEventListenerClass::TouchStartOrMove) !=
|
| WebEventListenerProperties::Nothing);
|
| }
|
| } else {
|
| - m_webView->hasTouchEventHandlers(true);
|
| + client->hasTouchEventHandlers(true);
|
| }
|
| }
|
|
|
| +void ChromeClientImpl::updateTouchRectsForSubframeIfNecessary(
|
| + LocalFrame* frame) {
|
| + WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
|
| + WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
|
| + if (WebLayerTreeView* treeView = widget->getLayerTreeView())
|
| + treeView->updateTouchRectsForSubframeIfNecessary();
|
| +}
|
| +
|
| void ChromeClientImpl::beginLifecycleUpdates() {
|
| if (WebLayerTreeView* treeView = m_webView->layerTreeView()) {
|
| treeView->setDeferCommits(false);
|
| @@ -957,21 +991,35 @@ void ChromeClientImpl::beginLifecycleUpdates() {
|
| }
|
|
|
| WebEventListenerProperties ChromeClientImpl::eventListenerProperties(
|
| + LocalFrame* frame,
|
| WebEventListenerClass eventClass) const {
|
| - if (WebLayerTreeView* treeView = m_webView->layerTreeView())
|
| - return treeView->eventListenerProperties(eventClass);
|
| - return WebEventListenerProperties::Nothing;
|
| -}
|
| + if (!frame)
|
| + return WebEventListenerProperties::Nothing;
|
|
|
| -void ChromeClientImpl::setHasScrollEventHandlers(bool hasEventHandlers) {
|
| - if (WebLayerTreeView* treeView = m_webView->layerTreeView())
|
| - treeView->setHaveScrollEventHandlers(hasEventHandlers);
|
| + WebFrameWidgetBase* widget =
|
| + WebLocalFrameImpl::fromFrame(frame)->localRoot()->frameWidget();
|
| +
|
| + if (!widget || !widget->getLayerTreeView())
|
| + return WebEventListenerProperties::Nothing;
|
| + return widget->getLayerTreeView()->eventListenerProperties(eventClass);
|
| }
|
|
|
| -bool ChromeClientImpl::hasScrollEventHandlers() const {
|
| - if (WebLayerTreeView* treeView = m_webView->layerTreeView())
|
| - return treeView->haveScrollEventHandlers();
|
| - return false;
|
| +void ChromeClientImpl::setHasScrollEventHandlers(LocalFrame* frame,
|
| + bool hasEventHandlers) {
|
| + // |frame| might be null if called via TreeScopeAdopter::
|
| + // moveNodeToNewDocument() and the new document has no frame attached.
|
| + // Since a document without a frame cannot attach one later, it is safe to
|
| + // exit early.
|
| + if (!frame)
|
| + return;
|
| +
|
| + WebFrameWidgetBase* widget =
|
| + WebLocalFrameImpl::fromFrame(frame)->localRoot()->frameWidget();
|
| + // While a frame is shutting down, we may get called after the layerTreeView
|
| + // is gone: in this case we always expect |hasEventHandlers| to be false.
|
| + DCHECK(!widget || widget->getLayerTreeView() || !hasEventHandlers);
|
| + if (widget && widget->getLayerTreeView())
|
| + widget->getLayerTreeView()->setHaveScrollEventHandlers(hasEventHandlers);
|
| }
|
|
|
| void ChromeClientImpl::setTouchAction(LocalFrame* frame,
|
|
|