| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 EmptyEventListener() | 287 EmptyEventListener() |
| 288 : EventListener(CPPEventListenerType) | 288 : EventListener(CPPEventListenerType) |
| 289 { | 289 { |
| 290 } | 290 } |
| 291 | 291 |
| 292 void handleEvent(ExecutionContext* executionContext, Event*) override | 292 void handleEvent(ExecutionContext* executionContext, Event*) override |
| 293 { | 293 { |
| 294 } | 294 } |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 class ColorOverlay : public WebPageOverlay { | 297 class ColorOverlay : public PageOverlay::Delegate { |
| 298 public: | 298 public: |
| 299 ColorOverlay(WebColor color) | 299 ColorOverlay(WebColor color) |
| 300 : m_color(color) | 300 : m_color(color) |
| 301 { | 301 { |
| 302 } | 302 } |
| 303 | 303 |
| 304 virtual ~ColorOverlay() | 304 virtual ~ColorOverlay() |
| 305 { | 305 { |
| 306 } | 306 } |
| 307 | 307 |
| (...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 if (!m_page) | 1890 if (!m_page) |
| 1891 return; | 1891 return; |
| 1892 | 1892 |
| 1893 // FIXME: This should probably be using the local root? | 1893 // FIXME: This should probably be using the local root? |
| 1894 if (m_page->mainFrame()->isLocalFrame()) | 1894 if (m_page->mainFrame()->isLocalFrame()) |
| 1895 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton
ic, *m_page->deprecatedLocalMainFrame()); | 1895 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton
ic, *m_page->deprecatedLocalMainFrame()); |
| 1896 | 1896 |
| 1897 if (m_continuousPaintingEnabled) { | 1897 if (m_continuousPaintingEnabled) { |
| 1898 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); | 1898 GraphicsLayer* inspectorOverlayLayer = m_inspectorOverlay ? m_inspectorO
verlay->graphicsLayer() : nullptr; |
| 1899 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, inspect
orOverlayLayer); |
| 1899 m_client->scheduleAnimation(); | 1900 m_client->scheduleAnimation(); |
| 1900 } | 1901 } |
| 1901 } | 1902 } |
| 1902 | 1903 |
| 1903 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() | 1904 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() |
| 1904 { | 1905 { |
| 1905 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) | 1906 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) |
| 1906 return; | 1907 return; |
| 1907 | 1908 |
| 1908 FrameView* view = mainFrameImpl()->frame()->view(); | 1909 FrameView* view = mainFrameImpl()->frame()->view(); |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3636 } | 3637 } |
| 3637 | 3638 |
| 3638 if (m_client) { | 3639 if (m_client) { |
| 3639 if (m_layerTreeView) { | 3640 if (m_layerTreeView) { |
| 3640 updateLayerTreeViewport(); | 3641 updateLayerTreeViewport(); |
| 3641 } else { | 3642 } else { |
| 3642 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 3643 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
| 3643 m_client->didInvalidateRect(damagedRect); | 3644 m_client->didInvalidateRect(damagedRect); |
| 3644 } | 3645 } |
| 3645 } | 3646 } |
| 3646 if (m_pageOverlays) | 3647 if (m_pageColorOverlay) |
| 3647 m_pageOverlays->update(); | 3648 m_pageColorOverlay->update(); |
| 3649 if (m_inspectorOverlay) |
| 3650 m_inspectorOverlay->updatePageOverlay(); |
| 3651 |
| 3648 m_devToolsEmulator->viewportChanged(); | 3652 m_devToolsEmulator->viewportChanged(); |
| 3649 } | 3653 } |
| 3650 | 3654 |
| 3651 void WebViewImpl::configureAutoResizeMode() | 3655 void WebViewImpl::configureAutoResizeMode() |
| 3652 { | 3656 { |
| 3653 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) | 3657 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame
()->view()) |
| 3654 return; | 3658 return; |
| 3655 | 3659 |
| 3656 if (m_shouldAutoResize) | 3660 if (m_shouldAutoResize) |
| 3657 mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_minAutoSize, m_ma
xAutoSize); | 3661 mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_minAutoSize, m_ma
xAutoSize); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3972 m_backgroundColorOverride = color; | 3976 m_backgroundColorOverride = color; |
| 3973 updateLayerTreeBackgroundColor(); | 3977 updateLayerTreeBackgroundColor(); |
| 3974 } | 3978 } |
| 3975 | 3979 |
| 3976 void WebViewImpl::setZoomFactorOverride(float zoomFactor) | 3980 void WebViewImpl::setZoomFactorOverride(float zoomFactor) |
| 3977 { | 3981 { |
| 3978 m_zoomFactorOverride = zoomFactor; | 3982 m_zoomFactorOverride = zoomFactor; |
| 3979 setZoomLevel(zoomLevel()); | 3983 setZoomLevel(zoomLevel()); |
| 3980 } | 3984 } |
| 3981 | 3985 |
| 3982 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) | |
| 3983 { | |
| 3984 if (!m_pageOverlays) | |
| 3985 m_pageOverlays = PageOverlayList::create(this); | |
| 3986 | |
| 3987 m_pageOverlays->add(overlay, zOrder); | |
| 3988 } | |
| 3989 | |
| 3990 void WebViewImpl::setPageOverlayColor(WebColor color) | 3986 void WebViewImpl::setPageOverlayColor(WebColor color) |
| 3991 { | 3987 { |
| 3992 if (m_pageColorOverlay) { | 3988 if (m_pageColorOverlay) |
| 3993 removePageOverlay(m_pageColorOverlay.get()); | |
| 3994 m_pageColorOverlay.clear(); | 3989 m_pageColorOverlay.clear(); |
| 3995 } | |
| 3996 | 3990 |
| 3997 if (color == Color::transparent) | 3991 if (color == Color::transparent) |
| 3998 return; | 3992 return; |
| 3999 | 3993 |
| 4000 m_pageColorOverlay = adoptPtr(new ColorOverlay(color)); | 3994 m_pageColorOverlay = PageOverlay::create(this, adoptPtr(new ColorOverlay(col
or))); |
| 4001 addPageOverlay(m_pageColorOverlay.get(), 0); | 3995 m_pageColorOverlay->update(); |
| 4002 } | |
| 4003 | |
| 4004 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) | |
| 4005 { | |
| 4006 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp
ty()) | |
| 4007 m_pageOverlays = nullptr; | |
| 4008 } | 3996 } |
| 4009 | 3997 |
| 4010 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) | 3998 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) |
| 4011 { | 3999 { |
| 4012 if (!m_rootGraphicsLayer) | 4000 if (!m_rootGraphicsLayer) |
| 4013 return; | 4001 return; |
| 4014 | 4002 |
| 4015 if (!m_page->mainFrame()->isLocalFrame()) | 4003 if (!m_page->mainFrame()->isLocalFrame()) |
| 4016 return; | 4004 return; |
| 4017 | 4005 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4095 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); | 4083 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); |
| 4096 if (layer) { | 4084 if (layer) { |
| 4097 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); | 4085 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); |
| 4098 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); | 4086 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); |
| 4099 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); | 4087 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); |
| 4100 updateRootLayerTransform(); | 4088 updateRootLayerTransform(); |
| 4101 m_layerTreeView->setRootLayer(*m_rootLayer); | 4089 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4102 // We register viewport layers here since there may not be a layer | 4090 // We register viewport layers here since there may not be a layer |
| 4103 // tree view prior to this point. | 4091 // tree view prior to this point. |
| 4104 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_layerTr
eeView); | 4092 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_layerTr
eeView); |
| 4105 if (m_pageOverlays) | 4093 if (m_pageColorOverlay) |
| 4106 m_pageOverlays->update(); | 4094 m_pageColorOverlay->update(); |
| 4107 | 4095 if (m_inspectorOverlay) |
| 4096 m_inspectorOverlay->updatePageOverlay(); |
| 4108 // TODO(enne): Work around page visibility changes not being | 4097 // TODO(enne): Work around page visibility changes not being |
| 4109 // propogated to the WebView in some circumstances. This needs to | 4098 // propogated to the WebView in some circumstances. This needs to |
| 4110 // be refreshed here when setting a new root layer to avoid being | 4099 // be refreshed here when setting a new root layer to avoid being |
| 4111 // stuck in a presumed incorrectly invisible state. | 4100 // stuck in a presumed incorrectly invisible state. |
| 4112 bool visible = page()->visibilityState() == PageVisibilityStateVisible; | 4101 bool visible = page()->visibilityState() == PageVisibilityStateVisible; |
| 4113 m_layerTreeView->setVisible(visible); | 4102 m_layerTreeView->setVisible(visible); |
| 4114 } else { | 4103 } else { |
| 4115 m_rootGraphicsLayer = nullptr; | 4104 m_rootGraphicsLayer = nullptr; |
| 4116 m_rootLayer = nullptr; | 4105 m_rootLayer = nullptr; |
| 4117 m_rootTransformLayer = nullptr; | 4106 m_rootTransformLayer = nullptr; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4415 { | 4404 { |
| 4416 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4405 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4417 } | 4406 } |
| 4418 | 4407 |
| 4419 void WebViewImpl::forceNextDrawingBufferCreationToFail() | 4408 void WebViewImpl::forceNextDrawingBufferCreationToFail() |
| 4420 { | 4409 { |
| 4421 DrawingBuffer::forceNextDrawingBufferCreationToFail(); | 4410 DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
| 4422 } | 4411 } |
| 4423 | 4412 |
| 4424 } // namespace blink | 4413 } // namespace blink |
| OLD | NEW |