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

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

Issue 2559273003: Blink Compositor Animation: Introduce CompositorAnimationHost correctly. (Closed)
Patch Set: Add nullcheck for m_layerTreeView in WebViewImpl Created 4 years 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/input/EventHandler.h" 45 #include "core/input/EventHandler.h"
46 #include "core/layout/LayoutView.h" 46 #include "core/layout/LayoutView.h"
47 #include "core/layout/api/LayoutViewItem.h" 47 #include "core/layout/api/LayoutViewItem.h"
48 #include "core/layout/compositing/PaintLayerCompositor.h" 48 #include "core/layout/compositing/PaintLayerCompositor.h"
49 #include "core/page/ContextMenuController.h" 49 #include "core/page/ContextMenuController.h"
50 #include "core/page/FocusController.h" 50 #include "core/page/FocusController.h"
51 #include "core/page/Page.h" 51 #include "core/page/Page.h"
52 #include "core/page/PointerLockController.h" 52 #include "core/page/PointerLockController.h"
53 #include "platform/KeyboardCodes.h" 53 #include "platform/KeyboardCodes.h"
54 #include "platform/WebFrameScheduler.h" 54 #include "platform/WebFrameScheduler.h"
55 #include "platform/animation/CompositorAnimationHost.h"
55 #include "platform/graphics/CompositorMutatorClient.h" 56 #include "platform/graphics/CompositorMutatorClient.h"
56 #include "public/web/WebAutofillClient.h" 57 #include "public/web/WebAutofillClient.h"
57 #include "public/web/WebPlugin.h" 58 #include "public/web/WebPlugin.h"
58 #include "public/web/WebRange.h" 59 #include "public/web/WebRange.h"
59 #include "public/web/WebWidgetClient.h" 60 #include "public/web/WebWidgetClient.h"
60 #include "web/CompositionUnderlineVectorBuilder.h" 61 #include "web/CompositionUnderlineVectorBuilder.h"
61 #include "web/CompositorMutatorImpl.h" 62 #include "web/CompositorMutatorImpl.h"
62 #include "web/CompositorProxyClientImpl.h" 63 #include "web/CompositorProxyClientImpl.h"
63 #include "web/ContextMenuAllowedScope.h" 64 #include "web/ContextMenuAllowedScope.h"
64 #include "web/InspectorOverlay.h" 65 #include "web/InspectorOverlay.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 m_localRoot->setFrameWidget(nullptr); 146 m_localRoot->setFrameWidget(nullptr);
146 m_localRoot = nullptr; 147 m_localRoot = nullptr;
147 // Reset the delegate to prevent notifications being sent as we're being 148 // Reset the delegate to prevent notifications being sent as we're being
148 // deleted. 149 // deleted.
149 m_client = nullptr; 150 m_client = nullptr;
150 151
151 m_mutator = nullptr; 152 m_mutator = nullptr;
152 m_layerTreeView = nullptr; 153 m_layerTreeView = nullptr;
153 m_rootLayer = nullptr; 154 m_rootLayer = nullptr;
154 m_rootGraphicsLayer = nullptr; 155 m_rootGraphicsLayer = nullptr;
156 m_compositorAnimationHost = nullptr;
155 157
156 m_selfKeepAlive.clear(); 158 m_selfKeepAlive.clear();
157 } 159 }
158 160
159 WebSize WebFrameWidgetImpl::size() { 161 WebSize WebFrameWidgetImpl::size() {
160 return m_size; 162 return m_size;
161 } 163 }
162 164
163 void WebFrameWidgetImpl::resize(const WebSize& newSize) { 165 void WebFrameWidgetImpl::resize(const WebSize& newSize) {
164 if (m_size == newSize) 166 if (m_size == newSize)
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 return m_isAcceleratedCompositingActive; 679 return m_isAcceleratedCompositingActive;
678 } 680 }
679 681
680 void WebFrameWidgetImpl::willCloseLayerTreeView() { 682 void WebFrameWidgetImpl::willCloseLayerTreeView() {
681 if (m_layerTreeView) 683 if (m_layerTreeView)
682 page()->willCloseLayerTreeView(*m_layerTreeView); 684 page()->willCloseLayerTreeView(*m_layerTreeView);
683 685
684 setIsAcceleratedCompositingActive(false); 686 setIsAcceleratedCompositingActive(false);
685 m_mutator = nullptr; 687 m_mutator = nullptr;
686 m_layerTreeView = nullptr; 688 m_layerTreeView = nullptr;
689 m_compositorAnimationHost = nullptr;
687 m_layerTreeViewClosed = true; 690 m_layerTreeViewClosed = true;
688 } 691 }
689 692
690 void WebFrameWidgetImpl::didAcquirePointerLock() { 693 void WebFrameWidgetImpl::didAcquirePointerLock() {
691 page()->pointerLockController().didAcquirePointerLock(); 694 page()->pointerLockController().didAcquirePointerLock();
692 } 695 }
693 696
694 void WebFrameWidgetImpl::didNotAcquirePointerLock() { 697 void WebFrameWidgetImpl::didNotAcquirePointerLock() {
695 page()->pointerLockController().didNotAcquirePointerLock(); 698 page()->pointerLockController().didNotAcquirePointerLock();
696 } 699 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 return nullptr; 998 return nullptr;
996 999
997 return document->focusedElement(); 1000 return document->focusedElement();
998 } 1001 }
999 1002
1000 void WebFrameWidgetImpl::initializeLayerTreeView() { 1003 void WebFrameWidgetImpl::initializeLayerTreeView() {
1001 if (m_client) { 1004 if (m_client) {
1002 DCHECK(!m_mutator); 1005 DCHECK(!m_mutator);
1003 m_client->initializeLayerTreeView(); 1006 m_client->initializeLayerTreeView();
1004 m_layerTreeView = m_client->layerTreeView(); 1007 m_layerTreeView = m_client->layerTreeView();
1008 if (m_layerTreeView && m_layerTreeView->compositorAnimationHost()) {
1009 m_compositorAnimationHost = WTF::makeUnique<CompositorAnimationHost>(
1010 m_layerTreeView->compositorAnimationHost());
1011 }
1005 } 1012 }
1006 1013
1007 if (WebDevToolsAgentImpl* devTools = m_localRoot->devToolsAgentImpl()) 1014 if (WebDevToolsAgentImpl* devTools = m_localRoot->devToolsAgentImpl())
1008 devTools->layerTreeViewChanged(m_layerTreeView); 1015 devTools->layerTreeViewChanged(m_layerTreeView);
1009 1016
1010 page()->settings().setAcceleratedCompositingEnabled(m_layerTreeView); 1017 page()->settings().setAcceleratedCompositingEnabled(m_layerTreeView);
1011 if (m_layerTreeView) 1018 if (m_layerTreeView)
1012 page()->layerTreeViewInitialized(*m_layerTreeView); 1019 page()->layerTreeViewInitialized(*m_layerTreeView);
1013 1020
1014 // FIXME: only unittests, click to play, Android priting, and printing (for 1021 // FIXME: only unittests, click to play, Android priting, and printing (for
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 return; 1087 return;
1081 1088
1082 if (m_rootLayer) 1089 if (m_rootLayer)
1083 m_layerTreeView->setRootLayer(*m_rootLayer); 1090 m_layerTreeView->setRootLayer(*m_rootLayer);
1084 else 1091 else
1085 m_layerTreeView->clearRootLayer(); 1092 m_layerTreeView->clearRootLayer();
1086 } 1093 }
1087 1094
1088 void WebFrameWidgetImpl::attachCompositorAnimationTimeline( 1095 void WebFrameWidgetImpl::attachCompositorAnimationTimeline(
1089 CompositorAnimationTimeline* compositorTimeline) { 1096 CompositorAnimationTimeline* compositorTimeline) {
1090 if (m_layerTreeView) 1097 if (m_compositorAnimationHost)
1091 m_layerTreeView->attachCompositorAnimationTimeline( 1098 m_compositorAnimationHost->addTimeline(compositorTimeline);
1092 compositorTimeline->animationTimeline());
1093 } 1099 }
1094 1100
1095 void WebFrameWidgetImpl::detachCompositorAnimationTimeline( 1101 void WebFrameWidgetImpl::detachCompositorAnimationTimeline(
1096 CompositorAnimationTimeline* compositorTimeline) { 1102 CompositorAnimationTimeline* compositorTimeline) {
1097 if (m_layerTreeView) 1103 if (m_compositorAnimationHost)
1098 m_layerTreeView->detachCompositorAnimationTimeline( 1104 m_compositorAnimationHost->removeTimeline(compositorTimeline);
1099 compositorTimeline->animationTimeline());
1100 } 1105 }
1101 1106
1102 HitTestResult WebFrameWidgetImpl::coreHitTestResultAt( 1107 HitTestResult WebFrameWidgetImpl::coreHitTestResultAt(
1103 const WebPoint& pointInViewport) { 1108 const WebPoint& pointInViewport) {
1104 DocumentLifecycle::AllowThrottlingScope throttlingScope( 1109 DocumentLifecycle::AllowThrottlingScope throttlingScope(
1105 m_localRoot->frame()->document()->lifecycle()); 1110 m_localRoot->frame()->document()->lifecycle());
1106 FrameView* view = m_localRoot->frameView(); 1111 FrameView* view = m_localRoot->frameView();
1107 IntPoint pointInRootFrame = 1112 IntPoint pointInRootFrame =
1108 view->contentsToFrame(view->viewportToContents(pointInViewport)); 1113 view->contentsToFrame(view->viewportToContents(pointInViewport));
1109 return hitTestResultForRootFramePos(pointInRootFrame); 1114 return hitTestResultForRootFramePos(pointInRootFrame);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return nullptr; 1155 return nullptr;
1151 } 1156 }
1152 1157
1153 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const { 1158 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const {
1154 if (!m_imeAcceptEvents) 1159 if (!m_imeAcceptEvents)
1155 return nullptr; 1160 return nullptr;
1156 return focusedLocalFrameInWidget(); 1161 return focusedLocalFrameInWidget();
1157 } 1162 }
1158 1163
1159 } // namespace blink 1164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698