Chromium Code Reviews| 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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1899 } | 1899 } |
| 1900 | 1900 |
| 1901 if (!m_page) | 1901 if (!m_page) |
| 1902 return; | 1902 return; |
| 1903 | 1903 |
| 1904 // FIXME: This should probably be using the local root? | 1904 // FIXME: This should probably be using the local root? |
| 1905 if (m_page->mainFrame()->isLocalFrame()) | 1905 if (m_page->mainFrame()->isLocalFrame()) |
| 1906 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton ic, *m_page->deprecatedLocalMainFrame()); | 1906 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton ic, *m_page->deprecatedLocalMainFrame()); |
| 1907 | 1907 |
| 1908 if (m_continuousPaintingEnabled) { | 1908 if (m_continuousPaintingEnabled) { |
| 1909 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); | 1909 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlay->graphicsLayer()); |
| 1910 m_client->scheduleAnimation(); | 1910 m_client->scheduleAnimation(); |
| 1911 } | 1911 } |
| 1912 } | 1912 } |
| 1913 | 1913 |
| 1914 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() | 1914 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() |
| 1915 { | 1915 { |
| 1916 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame ()->view()) | 1916 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame ()->view()) |
| 1917 return; | 1917 return; |
| 1918 | 1918 |
| 1919 FrameView* view = mainFrameImpl()->frame()->view(); | 1919 FrameView* view = mainFrameImpl()->frame()->view(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1935 m_linkHighlights[i]->updateGeometry(); | 1935 m_linkHighlights[i]->updateGeometry(); |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1938 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| 1939 { | 1939 { |
| 1940 // This should only be used when compositing is not being used for this | 1940 // This should only be used when compositing is not being used for this |
| 1941 // WebView, and it is painting into the recording of its parent. | 1941 // WebView, and it is painting into the recording of its parent. |
| 1942 ASSERT(!isAcceleratedCompositingActive()); | 1942 ASSERT(!isAcceleratedCompositingActive()); |
| 1943 | 1943 |
| 1944 double paintStart = currentTime(); | 1944 double paintStart = currentTime(); |
| 1945 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, *m_page->de precatedLocalMainFrame()); | 1945 PageWidgetDelegate::paint(*m_page, m_pageOverlay.get(), canvas, rect, *m_pag e->deprecatedLocalMainFrame()); |
| 1946 double paintEnd = currentTime(); | 1946 double paintEnd = currentTime(); |
| 1947 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); | 1947 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); |
| 1948 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationM S", (paintEnd - paintStart) * 1000, 0, 120, 30); | 1948 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationM S", (paintEnd - paintStart) * 1000, 0, 120, 30); |
| 1949 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPe rSecond", pixelsPerSec / 1000000, 10, 210, 30); | 1949 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPe rSecond", pixelsPerSec / 1000000, 10, 210, 30); |
| 1950 } | 1950 } |
| 1951 | 1951 |
| 1952 #if OS(ANDROID) | 1952 #if OS(ANDROID) |
| 1953 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re ct) | 1953 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re ct) |
| 1954 { | 1954 { |
| 1955 // Note: This method exists on OS(ANDROID) and will hopefully be | 1955 // Note: This method exists on OS(ANDROID) and will hopefully be |
| (...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3647 } | 3647 } |
| 3648 | 3648 |
| 3649 if (m_client) { | 3649 if (m_client) { |
| 3650 if (m_layerTreeView) { | 3650 if (m_layerTreeView) { |
| 3651 updateLayerTreeViewport(); | 3651 updateLayerTreeViewport(); |
| 3652 } else { | 3652 } else { |
| 3653 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 3653 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
| 3654 m_client->didInvalidateRect(damagedRect); | 3654 m_client->didInvalidateRect(damagedRect); |
| 3655 } | 3655 } |
| 3656 } | 3656 } |
| 3657 if (m_pageOverlays) | 3657 if (m_pageOverlay) |
| 3658 m_pageOverlays->update(); | 3658 m_pageOverlay->update(); |
| 3659 m_devToolsEmulator->viewportChanged(); | 3659 m_devToolsEmulator->viewportChanged(); |
| 3660 } | 3660 } |
| 3661 | 3661 |
| 3662 void WebViewImpl::configureAutoResizeMode() | 3662 void WebViewImpl::configureAutoResizeMode() |
| 3663 { | 3663 { |
| 3664 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame ()->view()) | 3664 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame ()->view()) |
| 3665 return; | 3665 return; |
| 3666 | 3666 |
| 3667 if (m_shouldAutoResize) | 3667 if (m_shouldAutoResize) |
| 3668 mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_minAutoSize, m_ma xAutoSize); | 3668 mainFrameImpl()->frame()->view()->enableAutoSizeMode(m_minAutoSize, m_ma xAutoSize); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3983 m_backgroundColorOverride = color; | 3983 m_backgroundColorOverride = color; |
| 3984 updateLayerTreeBackgroundColor(); | 3984 updateLayerTreeBackgroundColor(); |
| 3985 } | 3985 } |
| 3986 | 3986 |
| 3987 void WebViewImpl::setZoomFactorOverride(float zoomFactor) | 3987 void WebViewImpl::setZoomFactorOverride(float zoomFactor) |
| 3988 { | 3988 { |
| 3989 m_zoomFactorOverride = zoomFactor; | 3989 m_zoomFactorOverride = zoomFactor; |
| 3990 setZoomLevel(zoomLevel()); | 3990 setZoomLevel(zoomLevel()); |
| 3991 } | 3991 } |
| 3992 | 3992 |
| 3993 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) | 3993 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay) |
|
dgozman
2015/07/28 16:16:57
Should we pass PageOverlay here and make client cr
sergeyv
2015/07/29 18:12:36
Done.
| |
| 3994 { | 3994 { |
| 3995 if (!m_pageOverlays) | 3995 if (m_pageOverlay && m_pageOverlay->overlay() != overlay) |
| 3996 m_pageOverlays = PageOverlayList::create(this); | 3996 return; |
| 3997 | 3997 |
| 3998 m_pageOverlays->add(overlay, zOrder); | 3998 if (!m_pageOverlay) |
| 3999 m_pageOverlay = PageOverlay::create(this, overlay); | |
| 4000 | |
| 4001 m_pageOverlay->update(); | |
| 3999 } | 4002 } |
| 4000 | 4003 |
| 4001 void WebViewImpl::setPageOverlayColor(WebColor color) | 4004 void WebViewImpl::setPageOverlayColor(WebColor color) |
| 4002 { | 4005 { |
| 4003 if (m_pageColorOverlay) { | 4006 if (m_pageColorOverlay) { |
| 4004 removePageOverlay(m_pageColorOverlay.get()); | 4007 removePageOverlay(m_pageColorOverlay.get()); |
| 4005 m_pageColorOverlay.clear(); | 4008 m_pageColorOverlay.clear(); |
| 4006 } | 4009 } |
| 4007 | 4010 |
| 4008 if (color == Color::transparent) | 4011 if (color == Color::transparent) |
| 4009 return; | 4012 return; |
| 4010 | 4013 |
| 4011 m_pageColorOverlay = adoptPtr(new ColorOverlay(color)); | 4014 m_pageColorOverlay = adoptPtr(new ColorOverlay(color)); |
| 4012 addPageOverlay(m_pageColorOverlay.get(), 0); | 4015 addPageOverlay(m_pageColorOverlay.get()); |
| 4013 } | 4016 } |
| 4014 | 4017 |
| 4015 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) | 4018 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) |
| 4016 { | 4019 { |
| 4017 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp ty()) | 4020 if (!m_pageOverlay || m_pageOverlay->overlay() != overlay) |
| 4018 m_pageOverlays = nullptr; | 4021 return; |
| 4022 | |
| 4023 m_pageOverlay->clear(); | |
| 4024 m_pageOverlay.clear(); | |
| 4019 } | 4025 } |
| 4020 | 4026 |
| 4021 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) | 4027 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) |
| 4022 { | 4028 { |
| 4023 if (!m_rootGraphicsLayer) | 4029 if (!m_rootGraphicsLayer) |
| 4024 return; | 4030 return; |
| 4025 | 4031 |
| 4026 if (!m_page->mainFrame()->isLocalFrame()) | 4032 if (!m_page->mainFrame()->isLocalFrame()) |
| 4027 return; | 4033 return; |
| 4028 | 4034 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4106 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); | 4112 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); |
| 4107 if (layer) { | 4113 if (layer) { |
| 4108 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); | 4114 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); |
| 4109 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); | 4115 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); |
| 4110 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); | 4116 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); |
| 4111 updateRootLayerTransform(); | 4117 updateRootLayerTransform(); |
| 4112 m_layerTreeView->setRootLayer(*m_rootLayer); | 4118 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4113 // We register viewport layers here since there may not be a layer | 4119 // We register viewport layers here since there may not be a layer |
| 4114 // tree view prior to this point. | 4120 // tree view prior to this point. |
| 4115 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_layerTr eeView); | 4121 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_layerTr eeView); |
| 4116 if (m_pageOverlays) | 4122 if (m_pageOverlay) |
| 4117 m_pageOverlays->update(); | 4123 m_pageOverlay->update(); |
| 4118 | 4124 |
| 4119 // TODO(enne): Work around page visibility changes not being | 4125 // TODO(enne): Work around page visibility changes not being |
| 4120 // propogated to the WebView in some circumstances. This needs to | 4126 // propogated to the WebView in some circumstances. This needs to |
| 4121 // be refreshed here when setting a new root layer to avoid being | 4127 // be refreshed here when setting a new root layer to avoid being |
| 4122 // stuck in a presumed incorrectly invisible state. | 4128 // stuck in a presumed incorrectly invisible state. |
| 4123 bool visible = page()->visibilityState() == PageVisibilityStateVisible; | 4129 bool visible = page()->visibilityState() == PageVisibilityStateVisible; |
| 4124 m_layerTreeView->setVisible(visible); | 4130 m_layerTreeView->setVisible(visible); |
| 4125 } else { | 4131 } else { |
| 4126 m_rootGraphicsLayer = nullptr; | 4132 m_rootGraphicsLayer = nullptr; |
| 4127 m_rootLayer = nullptr; | 4133 m_rootLayer = nullptr; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4426 { | 4432 { |
| 4427 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4433 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4428 } | 4434 } |
| 4429 | 4435 |
| 4430 void WebViewImpl::forceNextDrawingBufferCreationToFail() | 4436 void WebViewImpl::forceNextDrawingBufferCreationToFail() |
| 4431 { | 4437 { |
| 4432 DrawingBuffer::forceNextDrawingBufferCreationToFail(); | 4438 DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
| 4433 } | 4439 } |
| 4434 | 4440 |
| 4435 } // namespace blink | 4441 } // namespace blink |
| OLD | NEW |