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

Side by Side Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Rebase to master@{#445291}. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 String message = String("Blocked ") + dialogTypeToString(dialogType) + "('" + 922 String message = String("Blocked ") + dialogTypeToString(dialogType) + "('" +
923 dialogMessage + "') during " + 923 dialogMessage + "') during " +
924 dismissalTypeToString(dismissalType) + "."; 924 dismissalTypeToString(dismissalType) + ".";
925 WebLocalFrameImpl::fromFrame(frame)->addMessageToConsole( 925 WebLocalFrameImpl::fromFrame(frame)->addMessageToConsole(
926 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 926 WebConsoleMessage(WebConsoleMessage::LevelError, message));
927 927
928 return false; 928 return false;
929 } 929 }
930 930
931 void ChromeClientImpl::setEventListenerProperties( 931 void ChromeClientImpl::setEventListenerProperties(
932 LocalFrame* frame,
932 WebEventListenerClass eventClass, 933 WebEventListenerClass eventClass,
933 WebEventListenerProperties properties) { 934 WebEventListenerProperties properties) {
934 if (WebLayerTreeView* treeView = m_webView->layerTreeView()) { 935 // |frame| might be null if called via TreeScopeAdopter::
936 // moveNodeToNewDocument() and the new document has no frame attached.
937 // Since a document without a frame cannot attach one later, it is safe to
938 // exit early.
939 if (!frame)
940 return;
941
942 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
943 WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
944 // The widget may be nullptr if the frame is provisional.
945 // TODO(dcheng): This needs to be cleaned up at some point.
946 // https://crbug.com/578349
947 if (!widget) {
948 // If we hit a provisional frame, we expect it to be during initialization
949 // in which case the |properties| should be 'nothing'.
950 DCHECK(properties == WebEventListenerProperties::Nothing);
951 return;
952 }
953
954 // This relies on widget always pointing to a WebFrameWidgetImpl when
955 // |frame| points to an OOPIF frame, i.e. |frame|'s mainFrame() is
956 // remote.
957 WebWidgetClient* client = widget->client();
958 if (WebLayerTreeView* treeView = widget->getLayerTreeView()) {
935 treeView->setEventListenerProperties(eventClass, properties); 959 treeView->setEventListenerProperties(eventClass, properties);
936 if (eventClass == WebEventListenerClass::TouchStartOrMove) { 960 if (eventClass == WebEventListenerClass::TouchStartOrMove) {
937 m_webView->hasTouchEventHandlers( 961 client->hasTouchEventHandlers(
938 properties != WebEventListenerProperties::Nothing || 962 properties != WebEventListenerProperties::Nothing ||
939 eventListenerProperties(WebEventListenerClass::TouchEndOrCancel) != 963 treeView->eventListenerProperties(
964 WebEventListenerClass::TouchEndOrCancel) !=
940 WebEventListenerProperties::Nothing); 965 WebEventListenerProperties::Nothing);
941 } else if (eventClass == WebEventListenerClass::TouchEndOrCancel) { 966 } else if (eventClass == WebEventListenerClass::TouchEndOrCancel) {
942 m_webView->hasTouchEventHandlers( 967 client->hasTouchEventHandlers(
943 properties != WebEventListenerProperties::Nothing || 968 properties != WebEventListenerProperties::Nothing ||
944 eventListenerProperties(WebEventListenerClass::TouchStartOrMove) != 969 treeView->eventListenerProperties(
970 WebEventListenerClass::TouchStartOrMove) !=
945 WebEventListenerProperties::Nothing); 971 WebEventListenerProperties::Nothing);
946 } 972 }
947 } else { 973 } else {
948 m_webView->hasTouchEventHandlers(true); 974 client->hasTouchEventHandlers(true);
949 } 975 }
950 } 976 }
951 977
978 void ChromeClientImpl::updateTouchRectsForSubframeIfNecessary(
979 LocalFrame* frame) {
980 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
981 WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
982 if (WebLayerTreeView* treeView = widget->getLayerTreeView())
983 treeView->updateTouchRectsForSubframeIfNecessary();
984 }
985
952 void ChromeClientImpl::beginLifecycleUpdates() { 986 void ChromeClientImpl::beginLifecycleUpdates() {
953 if (WebLayerTreeView* treeView = m_webView->layerTreeView()) { 987 if (WebLayerTreeView* treeView = m_webView->layerTreeView()) {
954 treeView->setDeferCommits(false); 988 treeView->setDeferCommits(false);
955 treeView->setNeedsBeginFrame(); 989 treeView->setNeedsBeginFrame();
956 } 990 }
957 } 991 }
958 992
959 WebEventListenerProperties ChromeClientImpl::eventListenerProperties( 993 WebEventListenerProperties ChromeClientImpl::eventListenerProperties(
994 LocalFrame* frame,
960 WebEventListenerClass eventClass) const { 995 WebEventListenerClass eventClass) const {
961 if (WebLayerTreeView* treeView = m_webView->layerTreeView()) 996 if (!frame)
962 return treeView->eventListenerProperties(eventClass); 997 return WebEventListenerProperties::Nothing;
963 return WebEventListenerProperties::Nothing; 998
999 WebFrameWidgetBase* widget =
1000 WebLocalFrameImpl::fromFrame(frame)->localRoot()->frameWidget();
1001
1002 if (!widget || !widget->getLayerTreeView())
1003 return WebEventListenerProperties::Nothing;
1004 return widget->getLayerTreeView()->eventListenerProperties(eventClass);
964 } 1005 }
965 1006
966 void ChromeClientImpl::setHasScrollEventHandlers(bool hasEventHandlers) { 1007 void ChromeClientImpl::setHasScrollEventHandlers(LocalFrame* frame,
967 if (WebLayerTreeView* treeView = m_webView->layerTreeView()) 1008 bool hasEventHandlers) {
968 treeView->setHaveScrollEventHandlers(hasEventHandlers); 1009 // |frame| might be null if called via TreeScopeAdopter::
969 } 1010 // moveNodeToNewDocument() and the new document has no frame attached.
1011 // Since a document without a frame cannot attach one later, it is safe to
1012 // exit early.
1013 if (!frame)
1014 return;
970 1015
971 bool ChromeClientImpl::hasScrollEventHandlers() const { 1016 WebFrameWidgetBase* widget =
972 if (WebLayerTreeView* treeView = m_webView->layerTreeView()) 1017 WebLocalFrameImpl::fromFrame(frame)->localRoot()->frameWidget();
973 return treeView->haveScrollEventHandlers(); 1018 // While a frame is shutting down, we may get called after the layerTreeView
974 return false; 1019 // is gone: in this case we always expect |hasEventHandlers| to be false.
1020 DCHECK(!widget || widget->getLayerTreeView() || !hasEventHandlers);
1021 if (widget && widget->getLayerTreeView())
1022 widget->getLayerTreeView()->setHaveScrollEventHandlers(hasEventHandlers);
975 } 1023 }
976 1024
977 void ChromeClientImpl::setTouchAction(LocalFrame* frame, 1025 void ChromeClientImpl::setTouchAction(LocalFrame* frame,
978 TouchAction touchAction) { 1026 TouchAction touchAction) {
979 DCHECK(frame); 1027 DCHECK(frame);
980 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); 1028 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
981 WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget(); 1029 WebFrameWidgetBase* widget = webFrame->localRoot()->frameWidget();
982 if (!widget) 1030 if (!widget)
983 return; 1031 return;
984 1032
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 PresentationController::provideTo(frame, client->presentationClient()); 1213 PresentationController::provideTo(frame, client->presentationClient());
1166 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { 1214 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) {
1167 provideAudioOutputDeviceClientTo(frame, 1215 provideAudioOutputDeviceClientTo(frame,
1168 new AudioOutputDeviceClientImpl(frame)); 1216 new AudioOutputDeviceClientImpl(frame));
1169 } 1217 }
1170 if (RuntimeEnabledFeatures::installedAppEnabled()) 1218 if (RuntimeEnabledFeatures::installedAppEnabled())
1171 InstalledAppController::provideTo(frame, client->installedAppClient()); 1219 InstalledAppController::provideTo(frame, client->installedAppClient());
1172 } 1220 }
1173 1221
1174 } // namespace blink 1222 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.h ('k') | third_party/WebKit/Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698