OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 #include "core/frame/Settings.h" | 41 #include "core/frame/Settings.h" |
42 #include "core/frame/VisualViewport.h" | 42 #include "core/frame/VisualViewport.h" |
43 #include "core/input/EventHandler.h" | 43 #include "core/input/EventHandler.h" |
44 #include "core/layout/LayoutView.h" | 44 #include "core/layout/LayoutView.h" |
45 #include "core/layout/api/LayoutViewItem.h" | 45 #include "core/layout/api/LayoutViewItem.h" |
46 #include "core/layout/compositing/PaintLayerCompositor.h" | 46 #include "core/layout/compositing/PaintLayerCompositor.h" |
47 #include "core/page/ContextMenuController.h" | 47 #include "core/page/ContextMenuController.h" |
48 #include "core/page/FocusController.h" | 48 #include "core/page/FocusController.h" |
49 #include "core/page/Page.h" | 49 #include "core/page/Page.h" |
50 #include "platform/KeyboardCodes.h" | 50 #include "platform/KeyboardCodes.h" |
| 51 #include "platform/graphics/CompositorMutatorClient.h" |
51 #include "public/platform/WebFrameScheduler.h" | 52 #include "public/platform/WebFrameScheduler.h" |
52 #include "public/web/WebWidgetClient.h" | 53 #include "public/web/WebWidgetClient.h" |
| 54 #include "web/CompositorMutatorImpl.h" |
53 #include "web/CompositorProxyClientImpl.h" | 55 #include "web/CompositorProxyClientImpl.h" |
54 #include "web/ContextMenuAllowedScope.h" | 56 #include "web/ContextMenuAllowedScope.h" |
55 #include "web/WebDevToolsAgentImpl.h" | 57 #include "web/WebDevToolsAgentImpl.h" |
56 #include "web/WebInputEventConversion.h" | 58 #include "web/WebInputEventConversion.h" |
57 #include "web/WebLocalFrameImpl.h" | 59 #include "web/WebLocalFrameImpl.h" |
58 #include "web/WebPluginContainerImpl.h" | 60 #include "web/WebPluginContainerImpl.h" |
59 #include "web/WebRemoteFrameImpl.h" | 61 #include "web/WebRemoteFrameImpl.h" |
60 #include "web/WebViewFrameWidget.h" | 62 #include "web/WebViewFrameWidget.h" |
61 | 63 |
62 namespace blink { | 64 namespace blink { |
(...skipping 20 matching lines...) Expand all Loading... |
83 // static | 85 // static |
84 WebFrameWidgetsSet& WebFrameWidgetImpl::allInstances() | 86 WebFrameWidgetsSet& WebFrameWidgetImpl::allInstances() |
85 { | 87 { |
86 DEFINE_STATIC_LOCAL(WebFrameWidgetsSet, allInstances, ()); | 88 DEFINE_STATIC_LOCAL(WebFrameWidgetsSet, allInstances, ()); |
87 return allInstances; | 89 return allInstances; |
88 } | 90 } |
89 | 91 |
90 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l
ocalRoot) | 92 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l
ocalRoot) |
91 : m_client(client) | 93 : m_client(client) |
92 , m_localRoot(toWebLocalFrameImpl(localRoot)) | 94 , m_localRoot(toWebLocalFrameImpl(localRoot)) |
| 95 , m_mutator(nullptr) |
93 , m_layerTreeView(nullptr) | 96 , m_layerTreeView(nullptr) |
94 , m_rootLayer(nullptr) | 97 , m_rootLayer(nullptr) |
95 , m_rootGraphicsLayer(nullptr) | 98 , m_rootGraphicsLayer(nullptr) |
96 , m_isAcceleratedCompositingActive(false) | 99 , m_isAcceleratedCompositingActive(false) |
97 , m_layerTreeViewClosed(false) | 100 , m_layerTreeViewClosed(false) |
98 , m_suppressNextKeypressEvent(false) | 101 , m_suppressNextKeypressEvent(false) |
99 , m_ignoreInputEvents(false) | 102 , m_ignoreInputEvents(false) |
100 , m_isTransparent(false) | 103 , m_isTransparent(false) |
101 , m_selfKeepAlive(this) | 104 , m_selfKeepAlive(this) |
102 { | 105 { |
(...skipping 23 matching lines...) Expand all Loading... |
126 WebDevToolsAgentImpl::webFrameWidgetImplClosed(this); | 129 WebDevToolsAgentImpl::webFrameWidgetImplClosed(this); |
127 DCHECK(allInstances().contains(this)); | 130 DCHECK(allInstances().contains(this)); |
128 allInstances().remove(this); | 131 allInstances().remove(this); |
129 | 132 |
130 m_localRoot->setFrameWidget(nullptr); | 133 m_localRoot->setFrameWidget(nullptr); |
131 m_localRoot = nullptr; | 134 m_localRoot = nullptr; |
132 // Reset the delegate to prevent notifications being sent as we're being | 135 // Reset the delegate to prevent notifications being sent as we're being |
133 // deleted. | 136 // deleted. |
134 m_client = nullptr; | 137 m_client = nullptr; |
135 | 138 |
| 139 m_mutator = nullptr; |
136 m_layerTreeView = nullptr; | 140 m_layerTreeView = nullptr; |
137 m_rootLayer = nullptr; | 141 m_rootLayer = nullptr; |
138 m_rootGraphicsLayer = nullptr; | 142 m_rootGraphicsLayer = nullptr; |
139 | 143 |
140 m_selfKeepAlive.clear(); | 144 m_selfKeepAlive.clear(); |
141 } | 145 } |
142 | 146 |
143 WebSize WebFrameWidgetImpl::size() | 147 WebSize WebFrameWidgetImpl::size() |
144 { | 148 { |
145 return m_size; | 149 return m_size; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (m_layerTreeView) { | 402 if (m_layerTreeView) { |
399 m_layerTreeView->setNeedsBeginFrame(); | 403 m_layerTreeView->setNeedsBeginFrame(); |
400 return; | 404 return; |
401 } | 405 } |
402 if (m_client) | 406 if (m_client) |
403 m_client->scheduleAnimation(); | 407 m_client->scheduleAnimation(); |
404 } | 408 } |
405 | 409 |
406 CompositorProxyClient* WebFrameWidgetImpl::createCompositorProxyClient() | 410 CompositorProxyClient* WebFrameWidgetImpl::createCompositorProxyClient() |
407 { | 411 { |
408 return new CompositorProxyClientImpl(); | 412 if (!m_mutator) { |
| 413 std::unique_ptr<CompositorMutatorClient> mutatorClient = CompositorMutat
orImpl::createClient(); |
| 414 m_mutator = static_cast<CompositorMutatorImpl*>(mutatorClient->mutator()
); |
| 415 m_layerTreeView->setMutatorClient(std::move(mutatorClient)); |
| 416 } |
| 417 return new CompositorProxyClientImpl(m_mutator); |
409 } | 418 } |
410 | 419 |
411 void WebFrameWidgetImpl::applyViewportDeltas( | 420 void WebFrameWidgetImpl::applyViewportDeltas( |
412 const WebFloatSize& visualViewportDelta, | 421 const WebFloatSize& visualViewportDelta, |
413 const WebFloatSize& mainFrameDelta, | 422 const WebFloatSize& mainFrameDelta, |
414 const WebFloatSize& elasticOverscrollDelta, | 423 const WebFloatSize& elasticOverscrollDelta, |
415 float pageScaleDelta, | 424 float pageScaleDelta, |
416 float topControlsDelta) | 425 float topControlsDelta) |
417 { | 426 { |
418 // FIXME: To be implemented. | 427 // FIXME: To be implemented. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 { | 627 { |
619 return m_isAcceleratedCompositingActive; | 628 return m_isAcceleratedCompositingActive; |
620 } | 629 } |
621 | 630 |
622 void WebFrameWidgetImpl::willCloseLayerTreeView() | 631 void WebFrameWidgetImpl::willCloseLayerTreeView() |
623 { | 632 { |
624 if (m_layerTreeView) | 633 if (m_layerTreeView) |
625 page()->willCloseLayerTreeView(*m_layerTreeView); | 634 page()->willCloseLayerTreeView(*m_layerTreeView); |
626 | 635 |
627 setIsAcceleratedCompositingActive(false); | 636 setIsAcceleratedCompositingActive(false); |
| 637 m_mutator = nullptr; |
628 m_layerTreeView = nullptr; | 638 m_layerTreeView = nullptr; |
629 m_layerTreeViewClosed = true; | 639 m_layerTreeViewClosed = true; |
630 } | 640 } |
631 | 641 |
632 void WebFrameWidgetImpl::didChangeWindowResizerRect() | 642 void WebFrameWidgetImpl::didChangeWindowResizerRect() |
633 { | 643 { |
634 if (m_localRoot->frameView()) | 644 if (m_localRoot->frameView()) |
635 m_localRoot->frameView()->windowResizerRectChanged(); | 645 m_localRoot->frameView()->windowResizerRectChanged(); |
636 } | 646 } |
637 | 647 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 Document* document = frame->document(); | 1000 Document* document = frame->document(); |
991 if (!document) | 1001 if (!document) |
992 return nullptr; | 1002 return nullptr; |
993 | 1003 |
994 return document->focusedElement(); | 1004 return document->focusedElement(); |
995 } | 1005 } |
996 | 1006 |
997 void WebFrameWidgetImpl::initializeLayerTreeView() | 1007 void WebFrameWidgetImpl::initializeLayerTreeView() |
998 { | 1008 { |
999 if (m_client) { | 1009 if (m_client) { |
| 1010 DCHECK(!m_mutator); |
1000 m_client->initializeLayerTreeView(); | 1011 m_client->initializeLayerTreeView(); |
1001 m_layerTreeView = m_client->layerTreeView(); | 1012 m_layerTreeView = m_client->layerTreeView(); |
1002 } | 1013 } |
1003 | 1014 |
1004 if (WebDevToolsAgentImpl* devTools = m_localRoot->devToolsAgentImpl()) | 1015 if (WebDevToolsAgentImpl* devTools = m_localRoot->devToolsAgentImpl()) |
1005 devTools->layerTreeViewChanged(m_layerTreeView); | 1016 devTools->layerTreeViewChanged(m_layerTreeView); |
1006 | 1017 |
1007 page()->settings().setAcceleratedCompositingEnabled(m_layerTreeView); | 1018 page()->settings().setAcceleratedCompositingEnabled(m_layerTreeView); |
1008 if (m_layerTreeView) | 1019 if (m_layerTreeView) |
1009 page()->layerTreeViewInitialized(*m_layerTreeView); | 1020 page()->layerTreeViewInitialized(*m_layerTreeView); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 | 1110 |
1100 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p
osInRootFrame) | 1111 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p
osInRootFrame) |
1101 { | 1112 { |
1102 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo
tFrame)); | 1113 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo
tFrame)); |
1103 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP
oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); | 1114 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP
oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); |
1104 result.setToShadowHostIfInUserAgentShadowRoot(); | 1115 result.setToShadowHostIfInUserAgentShadowRoot(); |
1105 return result; | 1116 return result; |
1106 } | 1117 } |
1107 | 1118 |
1108 } // namespace blink | 1119 } // namespace blink |
OLD | NEW |