OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "web/WebViewImpl.h" | 31 #include "web/WebViewImpl.h" |
32 | 32 |
33 #include "core/CSSValueKeywords.h" | 33 #include "core/CSSValueKeywords.h" |
34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
35 #include "core/InputTypeNames.h" | 35 #include "core/InputTypeNames.h" |
| 36 #include "core/animation/CustomCompositorAnimationManager.h" |
36 #include "core/clipboard/DataObject.h" | 37 #include "core/clipboard/DataObject.h" |
37 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
38 #include "core/dom/Fullscreen.h" | 39 #include "core/dom/Fullscreen.h" |
39 #include "core/dom/LayoutTreeBuilderTraversal.h" | 40 #include "core/dom/LayoutTreeBuilderTraversal.h" |
40 #include "core/dom/Text.h" | 41 #include "core/dom/Text.h" |
41 #include "core/editing/EditingUtilities.h" | 42 #include "core/editing/EditingUtilities.h" |
42 #include "core/editing/Editor.h" | 43 #include "core/editing/Editor.h" |
43 #include "core/editing/FrameSelection.h" | 44 #include "core/editing/FrameSelection.h" |
44 #include "core/editing/InputMethodController.h" | 45 #include "core/editing/InputMethodController.h" |
45 #include "core/editing/iterators/TextIterator.h" | 46 #include "core/editing/iterators/TextIterator.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #include "platform/ContextMenu.h" | 100 #include "platform/ContextMenu.h" |
100 #include "platform/ContextMenuItem.h" | 101 #include "platform/ContextMenuItem.h" |
101 #include "platform/Cursor.h" | 102 #include "platform/Cursor.h" |
102 #include "platform/Histogram.h" | 103 #include "platform/Histogram.h" |
103 #include "platform/KeyboardCodes.h" | 104 #include "platform/KeyboardCodes.h" |
104 #include "platform/Logging.h" | 105 #include "platform/Logging.h" |
105 #include "platform/PlatformGestureEvent.h" | 106 #include "platform/PlatformGestureEvent.h" |
106 #include "platform/PlatformKeyboardEvent.h" | 107 #include "platform/PlatformKeyboardEvent.h" |
107 #include "platform/PlatformMouseEvent.h" | 108 #include "platform/PlatformMouseEvent.h" |
108 #include "platform/RuntimeEnabledFeatures.h" | 109 #include "platform/RuntimeEnabledFeatures.h" |
| 110 #include "platform/ThreadSafeFunctional.h" |
109 #include "platform/TraceEvent.h" | 111 #include "platform/TraceEvent.h" |
110 #include "platform/UserGestureIndicator.h" | 112 #include "platform/UserGestureIndicator.h" |
| 113 #include "platform/WaitableEvent.h" |
111 #include "platform/exported/WebActiveGestureAnimation.h" | 114 #include "platform/exported/WebActiveGestureAnimation.h" |
112 #include "platform/fonts/FontCache.h" | 115 #include "platform/fonts/FontCache.h" |
113 #include "platform/graphics/Color.h" | 116 #include "platform/graphics/Color.h" |
114 #include "platform/graphics/CompositorFactory.h" | 117 #include "platform/graphics/CompositorFactory.h" |
| 118 #include "platform/graphics/CompositorMutatorClient.h" |
115 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 119 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
116 #include "platform/graphics/GraphicsContext.h" | 120 #include "platform/graphics/GraphicsContext.h" |
117 #include "platform/graphics/Image.h" | 121 #include "platform/graphics/Image.h" |
118 #include "platform/graphics/ImageBuffer.h" | 122 #include "platform/graphics/ImageBuffer.h" |
119 #include "platform/graphics/gpu/DrawingBuffer.h" | 123 #include "platform/graphics/gpu/DrawingBuffer.h" |
120 #include "platform/graphics/paint/DrawingRecorder.h" | 124 #include "platform/graphics/paint/DrawingRecorder.h" |
121 #include "platform/scroll/ScrollbarTheme.h" | 125 #include "platform/scroll/ScrollbarTheme.h" |
122 #include "platform/weborigin/SchemeRegistry.h" | 126 #include "platform/weborigin/SchemeRegistry.h" |
123 #include "public/platform/Platform.h" | 127 #include "public/platform/Platform.h" |
124 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" | 128 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" |
(...skipping 19 matching lines...) Expand all Loading... |
144 #include "public/web/WebMediaPlayerAction.h" | 148 #include "public/web/WebMediaPlayerAction.h" |
145 #include "public/web/WebNode.h" | 149 #include "public/web/WebNode.h" |
146 #include "public/web/WebPlugin.h" | 150 #include "public/web/WebPlugin.h" |
147 #include "public/web/WebPluginAction.h" | 151 #include "public/web/WebPluginAction.h" |
148 #include "public/web/WebRange.h" | 152 #include "public/web/WebRange.h" |
149 #include "public/web/WebSelection.h" | 153 #include "public/web/WebSelection.h" |
150 #include "public/web/WebTextInputInfo.h" | 154 #include "public/web/WebTextInputInfo.h" |
151 #include "public/web/WebViewClient.h" | 155 #include "public/web/WebViewClient.h" |
152 #include "public/web/WebWindowFeatures.h" | 156 #include "public/web/WebWindowFeatures.h" |
153 #include "web/CompositionUnderlineVectorBuilder.h" | 157 #include "web/CompositionUnderlineVectorBuilder.h" |
| 158 #include "web/CompositorMutatorImpl.h" |
| 159 #include "web/CompositorProxyClientImpl.h" |
154 #include "web/ContextFeaturesClientImpl.h" | 160 #include "web/ContextFeaturesClientImpl.h" |
155 #include "web/ContextMenuAllowedScope.h" | 161 #include "web/ContextMenuAllowedScope.h" |
156 #include "web/DatabaseClientImpl.h" | 162 #include "web/DatabaseClientImpl.h" |
157 #include "web/DedicatedWorkerGlobalScopeProxyProviderImpl.h" | 163 #include "web/DedicatedWorkerGlobalScopeProxyProviderImpl.h" |
158 #include "web/DevToolsEmulator.h" | 164 #include "web/DevToolsEmulator.h" |
159 #include "web/FullscreenController.h" | 165 #include "web/FullscreenController.h" |
160 #include "web/InspectorOverlay.h" | 166 #include "web/InspectorOverlay.h" |
161 #include "web/LinkHighlightImpl.h" | 167 #include "web/LinkHighlightImpl.h" |
162 #include "web/PageOverlay.h" | 168 #include "web/PageOverlay.h" |
163 #include "web/PrerendererClientImpl.h" | 169 #include "web/PrerendererClientImpl.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOve
rlay, DisplayItem::PageOverlay)) | 323 if (DrawingRecorder::useCachedDrawingIfPossible(graphicsContext, pageOve
rlay, DisplayItem::PageOverlay)) |
318 return; | 324 return; |
319 FloatRect rect(0, 0, size.width, size.height); | 325 FloatRect rect(0, 0, size.width, size.height); |
320 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayIte
m::PageOverlay, rect); | 326 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, DisplayIte
m::PageOverlay, rect); |
321 graphicsContext.fillRect(rect, m_color); | 327 graphicsContext.fillRect(rect, m_color); |
322 } | 328 } |
323 | 329 |
324 WebColor m_color; | 330 WebColor m_color; |
325 }; | 331 }; |
326 | 332 |
| 333 void createCompositorMutatorClient(std::unique_ptr<CompositorMutatorClient>* ptr
, WaitableEvent* doneEvent) |
| 334 { |
| 335 CompositorMutatorImpl* mutator = CompositorMutatorImpl::create(); |
| 336 ptr->reset(new CompositorMutatorClient(mutator, mutator->animationManager())
); |
| 337 mutator->setClient(ptr->get()); |
| 338 doneEvent->signal(); |
| 339 } |
| 340 |
327 } // namespace | 341 } // namespace |
328 | 342 |
329 // WebView ---------------------------------------------------------------- | 343 // WebView ---------------------------------------------------------------- |
330 | 344 |
331 WebView* WebView::create(WebViewClient* client) | 345 WebView* WebView::create(WebViewClient* client) |
332 { | 346 { |
333 // Pass the WebViewImpl's self-reference to the caller. | 347 // Pass the WebViewImpl's self-reference to the caller. |
334 return WebViewImpl::create(client); | 348 return WebViewImpl::create(client); |
335 } | 349 } |
336 | 350 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 , m_fullscreenController(FullscreenController::create(this)) | 449 , m_fullscreenController(FullscreenController::create(this)) |
436 , m_baseBackgroundColor(Color::white) | 450 , m_baseBackgroundColor(Color::white) |
437 , m_backgroundColorOverride(Color::transparent) | 451 , m_backgroundColorOverride(Color::transparent) |
438 , m_zoomFactorOverride(0) | 452 , m_zoomFactorOverride(0) |
439 , m_userGestureObserved(false) | 453 , m_userGestureObserved(false) |
440 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) | 454 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) |
441 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) | 455 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) |
442 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) | 456 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) |
443 , m_displayMode(WebDisplayModeBrowser) | 457 , m_displayMode(WebDisplayModeBrowser) |
444 , m_elasticOverscroll(FloatSize()) | 458 , m_elasticOverscroll(FloatSize()) |
| 459 , m_mutator(nullptr) |
445 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr
eateWebViewScheduler(this).release())) | 460 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr
eateWebViewScheduler(this).release())) |
446 , m_lastFrameTimeMonotonic(0) | 461 , m_lastFrameTimeMonotonic(0) |
447 { | 462 { |
448 Page::PageClients pageClients; | 463 Page::PageClients pageClients; |
449 pageClients.chromeClient = m_chromeClientImpl.get(); | 464 pageClients.chromeClient = m_chromeClientImpl.get(); |
450 pageClients.contextMenuClient = &m_contextMenuClientImpl; | 465 pageClients.contextMenuClient = &m_contextMenuClientImpl; |
451 pageClients.editorClient = &m_editorClientImpl; | 466 pageClients.editorClient = &m_editorClientImpl; |
452 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; | 467 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; |
453 | 468 |
454 m_page = Page::createOrdinary(pageClients); | 469 m_page = Page::createOrdinary(pageClients); |
(...skipping 4017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4472 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4487 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4473 { | 4488 { |
4474 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4489 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4475 } | 4490 } |
4476 | 4491 |
4477 void WebViewImpl::forceNextDrawingBufferCreationToFail() | 4492 void WebViewImpl::forceNextDrawingBufferCreationToFail() |
4478 { | 4493 { |
4479 DrawingBuffer::forceNextDrawingBufferCreationToFail(); | 4494 DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
4480 } | 4495 } |
4481 | 4496 |
| 4497 CompositorProxyClient* WebViewImpl::createCompositorProxyClient() |
| 4498 { |
| 4499 if (!m_mutator) { |
| 4500 std::unique_ptr<CompositorMutatorClient> mutatorClient; |
| 4501 WaitableEvent doneEvent; |
| 4502 if (WebThread* compositorThread = Platform::current()->compositorThread(
)) { |
| 4503 compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, thre
adSafeBind(&createCompositorMutatorClient, AllowCrossThreadAccess(&mutatorClient
), AllowCrossThreadAccess(&doneEvent))); |
| 4504 } else { |
| 4505 createCompositorMutatorClient(&mutatorClient, &doneEvent); |
| 4506 } |
| 4507 // TODO(flackr): Instead of waiting for this event, we may be able to ju
st set the |
| 4508 // mutator on the CompositorProxyClient directly from the compositor thr
ead before |
| 4509 // it gets used there. We still need to make sure we only create one mut
ator though. |
| 4510 doneEvent.wait(); |
| 4511 m_mutator = static_cast<CompositorMutatorImpl*>(mutatorClient->mutator()
); |
| 4512 m_layerTreeView->setMutatorClient(std::move(mutatorClient)); |
| 4513 } |
| 4514 return new CompositorProxyClientImpl(m_mutator); |
| 4515 } |
| 4516 |
4482 void WebViewImpl::updatePageOverlays() | 4517 void WebViewImpl::updatePageOverlays() |
4483 { | 4518 { |
4484 if (m_pageColorOverlay) | 4519 if (m_pageColorOverlay) |
4485 m_pageColorOverlay->update(); | 4520 m_pageColorOverlay->update(); |
4486 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4521 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4487 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4522 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4488 if (inspectorPageOverlay) | 4523 if (inspectorPageOverlay) |
4489 inspectorPageOverlay->update(); | 4524 inspectorPageOverlay->update(); |
4490 } | 4525 } |
4491 } | 4526 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4524 { | 4559 { |
4525 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4560 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4526 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4561 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4527 if (!page()) | 4562 if (!page()) |
4528 return 1; | 4563 return 1; |
4529 | 4564 |
4530 return page()->deviceScaleFactor(); | 4565 return page()->deviceScaleFactor(); |
4531 } | 4566 } |
4532 | 4567 |
4533 } // namespace blink | 4568 } // namespace blink |
OLD | NEW |