| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 #include "public/web/WebViewClient.h" | 146 #include "public/web/WebViewClient.h" |
| 147 #include "public/web/WebWindowFeatures.h" | 147 #include "public/web/WebWindowFeatures.h" |
| 148 #include "web/CompositionUnderlineVectorBuilder.h" | 148 #include "web/CompositionUnderlineVectorBuilder.h" |
| 149 #include "web/ContextFeaturesClientImpl.h" | 149 #include "web/ContextFeaturesClientImpl.h" |
| 150 #include "web/DatabaseClientImpl.h" | 150 #include "web/DatabaseClientImpl.h" |
| 151 #include "web/DevToolsEmulator.h" | 151 #include "web/DevToolsEmulator.h" |
| 152 #include "web/FullscreenController.h" | 152 #include "web/FullscreenController.h" |
| 153 #include "web/GraphicsLayerFactoryChromium.h" | 153 #include "web/GraphicsLayerFactoryChromium.h" |
| 154 #include "web/InspectorOverlayImpl.h" | 154 #include "web/InspectorOverlayImpl.h" |
| 155 #include "web/LinkHighlightImpl.h" | 155 #include "web/LinkHighlightImpl.h" |
| 156 #include "web/PageOverlay.h" |
| 156 #include "web/PrerendererClientImpl.h" | 157 #include "web/PrerendererClientImpl.h" |
| 157 #include "web/ResizeViewportAnchor.h" | 158 #include "web/ResizeViewportAnchor.h" |
| 158 #include "web/RotationViewportAnchor.h" | 159 #include "web/RotationViewportAnchor.h" |
| 159 #include "web/SpeechRecognitionClientProxy.h" | 160 #include "web/SpeechRecognitionClientProxy.h" |
| 160 #include "web/StorageQuotaClientImpl.h" | 161 #include "web/StorageQuotaClientImpl.h" |
| 161 #include "web/ValidationMessageClientImpl.h" | 162 #include "web/ValidationMessageClientImpl.h" |
| 162 #include "web/ViewportAnchor.h" | 163 #include "web/ViewportAnchor.h" |
| 163 #include "web/WebDevToolsAgentImpl.h" | 164 #include "web/WebDevToolsAgentImpl.h" |
| 164 #include "web/WebInputEventConversion.h" | 165 #include "web/WebInputEventConversion.h" |
| 165 #include "web/WebLocalFrameImpl.h" | 166 #include "web/WebLocalFrameImpl.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 EmptyEventListener() | 288 EmptyEventListener() |
| 288 : EventListener(CPPEventListenerType) | 289 : EventListener(CPPEventListenerType) |
| 289 { | 290 { |
| 290 } | 291 } |
| 291 | 292 |
| 292 void handleEvent(ExecutionContext* executionContext, Event*) override | 293 void handleEvent(ExecutionContext* executionContext, Event*) override |
| 293 { | 294 { |
| 294 } | 295 } |
| 295 }; | 296 }; |
| 296 | 297 |
| 297 class ColorOverlay : public WebPageOverlay { | 298 class ColorOverlay : public PageOverlay::Delegate { |
| 298 public: | 299 public: |
| 299 ColorOverlay(WebColor color) | 300 ColorOverlay(WebColor color) |
| 300 : m_color(color) | 301 : m_color(color) |
| 301 { | 302 { |
| 302 } | 303 } |
| 303 | 304 |
| 304 virtual ~ColorOverlay() | 305 virtual ~ColorOverlay() |
| 305 { | 306 { |
| 306 } | 307 } |
| 307 | 308 |
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 } | 1894 } |
| 1894 | 1895 |
| 1895 if (!m_page) | 1896 if (!m_page) |
| 1896 return; | 1897 return; |
| 1897 | 1898 |
| 1898 // FIXME: This should probably be using the local root? | 1899 // FIXME: This should probably be using the local root? |
| 1899 if (m_page->mainFrame()->isLocalFrame()) | 1900 if (m_page->mainFrame()->isLocalFrame()) |
| 1900 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton
ic, *m_page->deprecatedLocalMainFrame()); | 1901 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton
ic, *m_page->deprecatedLocalMainFrame()); |
| 1901 | 1902 |
| 1902 if (m_continuousPaintingEnabled) { | 1903 if (m_continuousPaintingEnabled) { |
| 1903 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); | 1904 GraphicsLayer* inspectorOverlayLayer = nullptr; |
| 1905 if (m_inspectorOverlay) { |
| 1906 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(
); |
| 1907 if (inspectorPageOverlay) |
| 1908 inspectorOverlayLayer = inspectorPageOverlay->graphicsLayer(); |
| 1909 } |
| 1910 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, inspect
orOverlayLayer); |
| 1904 m_client->scheduleAnimation(); | 1911 m_client->scheduleAnimation(); |
| 1905 } | 1912 } |
| 1906 } | 1913 } |
| 1907 | 1914 |
| 1908 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() | 1915 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() |
| 1909 { | 1916 { |
| 1910 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) | 1917 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) |
| 1911 return; | 1918 return; |
| 1912 | 1919 |
| 1913 FrameView* view = mainFrameImpl()->frame()->view(); | 1920 FrameView* view = mainFrameImpl()->frame()->view(); |
| (...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 } | 3659 } |
| 3653 | 3660 |
| 3654 if (m_client) { | 3661 if (m_client) { |
| 3655 if (m_layerTreeView) { | 3662 if (m_layerTreeView) { |
| 3656 updateLayerTreeViewport(); | 3663 updateLayerTreeViewport(); |
| 3657 } else { | 3664 } else { |
| 3658 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 3665 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
| 3659 m_client->didInvalidateRect(damagedRect); | 3666 m_client->didInvalidateRect(damagedRect); |
| 3660 } | 3667 } |
| 3661 } | 3668 } |
| 3662 if (m_pageOverlays) | 3669 updatePageOverlays(); |
| 3663 m_pageOverlays->update(); | |
| 3664 m_devToolsEmulator->viewportChanged(); | 3670 m_devToolsEmulator->viewportChanged(); |
| 3665 } | 3671 } |
| 3666 | 3672 |
| 3667 void WebViewImpl::configureAutoResizeMode() | 3673 void WebViewImpl::configureAutoResizeMode() |
| 3668 { | 3674 { |
| 3669 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) | 3675 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) |
| 3670 return; | 3676 return; |
| 3671 | 3677 |
| 3672 if (m_shouldAutoResize) | 3678 if (m_shouldAutoResize) |
| 3673 mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_minAutoSize, m_ma
xAutoSize); | 3679 mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_minAutoSize, m_ma
xAutoSize); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3988 m_backgroundColorOverride = color; | 3994 m_backgroundColorOverride = color; |
| 3989 updateLayerTreeBackgroundColor(); | 3995 updateLayerTreeBackgroundColor(); |
| 3990 } | 3996 } |
| 3991 | 3997 |
| 3992 void WebViewImpl::setZoomFactorOverride(float zoomFactor) | 3998 void WebViewImpl::setZoomFactorOverride(float zoomFactor) |
| 3993 { | 3999 { |
| 3994 m_zoomFactorOverride = zoomFactor; | 4000 m_zoomFactorOverride = zoomFactor; |
| 3995 setZoomLevel(zoomLevel()); | 4001 setZoomLevel(zoomLevel()); |
| 3996 } | 4002 } |
| 3997 | 4003 |
| 3998 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) | |
| 3999 { | |
| 4000 if (!m_pageOverlays) | |
| 4001 m_pageOverlays = PageOverlayList::create(this); | |
| 4002 | |
| 4003 m_pageOverlays->add(overlay, zOrder); | |
| 4004 } | |
| 4005 | |
| 4006 void WebViewImpl::setPageOverlayColor(WebColor color) | 4004 void WebViewImpl::setPageOverlayColor(WebColor color) |
| 4007 { | 4005 { |
| 4008 if (m_pageColorOverlay) { | 4006 if (m_pageColorOverlay) |
| 4009 removePageOverlay(m_pageColorOverlay.get()); | |
| 4010 m_pageColorOverlay.clear(); | 4007 m_pageColorOverlay.clear(); |
| 4011 } | |
| 4012 | 4008 |
| 4013 if (color == Color::transparent) | 4009 if (color == Color::transparent) |
| 4014 return; | 4010 return; |
| 4015 | 4011 |
| 4016 m_pageColorOverlay = adoptPtr(new ColorOverlay(color)); | 4012 m_pageColorOverlay = PageOverlay::create(this, adoptPtr(new ColorOverlay(col
or))); |
| 4017 addPageOverlay(m_pageColorOverlay.get(), 0); | 4013 m_pageColorOverlay->update(); |
| 4018 } | |
| 4019 | |
| 4020 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) | |
| 4021 { | |
| 4022 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp
ty()) | |
| 4023 m_pageOverlays = nullptr; | |
| 4024 } | 4014 } |
| 4025 | 4015 |
| 4026 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) | 4016 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) |
| 4027 { | 4017 { |
| 4028 if (!m_rootGraphicsLayer) | 4018 if (!m_rootGraphicsLayer) |
| 4029 return; | 4019 return; |
| 4030 | 4020 |
| 4031 if (!m_page->mainFrame()->isLocalFrame()) | 4021 if (!m_page->mainFrame()->isLocalFrame()) |
| 4032 return; | 4022 return; |
| 4033 | 4023 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4111 visualViewport.attachToLayerTree(layer, graphicsLayerFactory()); | 4101 visualViewport.attachToLayerTree(layer, graphicsLayerFactory()); |
| 4112 if (layer) { | 4102 if (layer) { |
| 4113 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); | 4103 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); |
| 4114 m_rootLayer = visualViewport.rootGraphicsLayer()->platformLayer(); | 4104 m_rootLayer = visualViewport.rootGraphicsLayer()->platformLayer(); |
| 4115 m_rootTransformLayer = visualViewport.rootGraphicsLayer(); | 4105 m_rootTransformLayer = visualViewport.rootGraphicsLayer(); |
| 4116 updateRootLayerTransform(); | 4106 updateRootLayerTransform(); |
| 4117 m_layerTreeView->setRootLayer(*m_rootLayer); | 4107 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4118 // We register viewport layers here since there may not be a layer | 4108 // We register viewport layers here since there may not be a layer |
| 4119 // tree view prior to this point. | 4109 // tree view prior to this point. |
| 4120 page()->frameHost().visualViewport().registerLayersWithTreeView(m_layerT
reeView); | 4110 page()->frameHost().visualViewport().registerLayersWithTreeView(m_layerT
reeView); |
| 4121 if (m_pageOverlays) | 4111 updatePageOverlays(); |
| 4122 m_pageOverlays->update(); | |
| 4123 | |
| 4124 // TODO(enne): Work around page visibility changes not being | 4112 // TODO(enne): Work around page visibility changes not being |
| 4125 // propogated to the WebView in some circumstances. This needs to | 4113 // propogated to the WebView in some circumstances. This needs to |
| 4126 // be refreshed here when setting a new root layer to avoid being | 4114 // be refreshed here when setting a new root layer to avoid being |
| 4127 // stuck in a presumed incorrectly invisible state. | 4115 // stuck in a presumed incorrectly invisible state. |
| 4128 bool visible = page()->visibilityState() == PageVisibilityStateVisible; | 4116 bool visible = page()->visibilityState() == PageVisibilityStateVisible; |
| 4129 m_layerTreeView->setVisible(visible); | 4117 m_layerTreeView->setVisible(visible); |
| 4130 } else { | 4118 } else { |
| 4131 m_rootGraphicsLayer = nullptr; | 4119 m_rootGraphicsLayer = nullptr; |
| 4132 m_rootLayer = nullptr; | 4120 m_rootLayer = nullptr; |
| 4133 m_rootTransformLayer = nullptr; | 4121 m_rootTransformLayer = nullptr; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4430 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4418 void WebViewImpl::forceNextWebGLContextCreationToFail() |
| 4431 { | 4419 { |
| 4432 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4420 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4433 } | 4421 } |
| 4434 | 4422 |
| 4435 void WebViewImpl::forceNextDrawingBufferCreationToFail() | 4423 void WebViewImpl::forceNextDrawingBufferCreationToFail() |
| 4436 { | 4424 { |
| 4437 DrawingBuffer::forceNextDrawingBufferCreationToFail(); | 4425 DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
| 4438 } | 4426 } |
| 4439 | 4427 |
| 4428 void WebViewImpl::updatePageOverlays() |
| 4429 { |
| 4430 if (m_pageColorOverlay) |
| 4431 m_pageColorOverlay->update(); |
| 4432 if (m_inspectorOverlay) { |
| 4433 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); |
| 4434 if (inspectorPageOverlay) |
| 4435 inspectorPageOverlay->update(); |
| 4436 } |
| 4437 } |
| 4438 |
| 4440 } // namespace blink | 4439 } // namespace blink |
| OLD | NEW |