| 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 } | 988 } |
| 989 } | 989 } |
| 990 | 990 |
| 991 WTF_LOG(ScriptedAnimationController, "WebViewImpl::beginFrame: page = %d", !
m_page ? 0 : 1); | 991 WTF_LOG(ScriptedAnimationController, "WebViewImpl::beginFrame: page = %d", !
m_page ? 0 : 1); |
| 992 if (!m_page) | 992 if (!m_page) |
| 993 return; | 993 return; |
| 994 | 994 |
| 995 PageWidgetDelegate::animate(m_page.get(), validFrameTime.lastFrameTimeMonoto
nic); | 995 PageWidgetDelegate::animate(m_page.get(), validFrameTime.lastFrameTimeMonoto
nic); |
| 996 | 996 |
| 997 if (m_continuousPaintingEnabled) { | 997 if (m_continuousPaintingEnabled) { |
| 998 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO
verlays.get()); | 998 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer); |
| 999 m_client->scheduleAnimation(); | 999 m_client->scheduleAnimation(); |
| 1000 } | 1000 } |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 void WebViewImpl::didCommitFrameToCompositor() | 1003 void WebViewImpl::didCommitFrameToCompositor() |
| 1004 { | 1004 { |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 void WebViewImpl::layout() | 1007 void WebViewImpl::layout() |
| 1008 { | 1008 { |
| 1009 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 1009 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
| 1010 if (!localFrameRootTemporary()) | 1010 if (!localFrameRootTemporary()) |
| 1011 return; | 1011 return; |
| 1012 | 1012 |
| 1013 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame())
; | 1013 PageWidgetDelegate::layout(m_page.get(), localFrameRootTemporary()->frame())
; |
| 1014 updateLayerTreeBackgroundColor(); | 1014 updateLayerTreeBackgroundColor(); |
| 1015 | 1015 |
| 1016 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1016 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1017 m_linkHighlights[i]->updateGeometry(); | 1017 m_linkHighlights[i]->updateGeometry(); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) | 1020 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
| 1021 { | 1021 { |
| 1022 // This should only be used when compositing is not being used for this | 1022 // This should only be used when compositing is not being used for this |
| 1023 // WebView, and it is painting into the recording of its parent. | 1023 // WebView, and it is painting into the recording of its parent. |
| 1024 ASSERT(!isAcceleratedCompositingActive()); | 1024 ASSERT(!isAcceleratedCompositingActive()); |
| 1025 | 1025 |
| 1026 double paintStart = currentTime(); | 1026 double paintStart = currentTime(); |
| 1027 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran
sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); | 1027 PageWidgetDelegate::paint(m_page.get(), canvas, rect, isTransparent() ? Page
WidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
| 1028 double paintEnd = currentTime(); | 1028 double paintEnd = currentTime(); |
| 1029 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); | 1029 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); |
| 1030 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationM
S", (paintEnd - paintStart) * 1000, 0, 120, 30); | 1030 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationM
S", (paintEnd - paintStart) * 1000, 0, 120, 30); |
| 1031 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPe
rSecond", pixelsPerSec / 1000000, 10, 210, 30); | 1031 Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPe
rSecond", pixelsPerSec / 1000000, 10, 210, 30); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 #if OS(ANDROID) | 1034 #if OS(ANDROID) |
| 1035 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re
ct) | 1035 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re
ct) |
| 1036 { | 1036 { |
| 1037 // Note: This method exists on OS(ANDROID) and will hopefully be | 1037 // Note: This method exists on OS(ANDROID) and will hopefully be |
| 1038 // removed once the link disambiguation feature renders using | 1038 // removed once the link disambiguation feature renders using |
| 1039 // the compositor. | 1039 // the compositor. |
| 1040 ASSERT(isAcceleratedCompositingActive()); | 1040 ASSERT(isAcceleratedCompositingActive()); |
| 1041 | 1041 |
| 1042 FrameView* view = page()->mainFrame()->view(); | 1042 FrameView* view = page()->mainFrame()->view(); |
| 1043 PaintBehavior oldPaintBehavior = view->paintBehavior(); | 1043 PaintBehavior oldPaintBehavior = view->paintBehavior(); |
| 1044 view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLay
ers); | 1044 view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLay
ers); |
| 1045 | 1045 |
| 1046 PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTran
sparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); | 1046 PageWidgetDelegate::paint(m_page.get(), canvas, rect, isTransparent() ? Page
WidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
| 1047 | 1047 |
| 1048 view->setPaintBehavior(oldPaintBehavior); | 1048 view->setPaintBehavior(oldPaintBehavior); |
| 1049 } | 1049 } |
| 1050 #endif | 1050 #endif |
| 1051 | 1051 |
| 1052 void WebViewImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback
* callback) | 1052 void WebViewImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback
* callback) |
| 1053 { | 1053 { |
| 1054 ASSERT(isAcceleratedCompositingActive()); | 1054 ASSERT(isAcceleratedCompositingActive()); |
| 1055 m_layerTreeView->compositeAndReadbackAsync(callback); | 1055 m_layerTreeView->compositeAndReadbackAsync(callback); |
| 1056 } | 1056 } |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 // to the embedder. This method and all callers may be wrong. -- eseidel. | 1993 // to the embedder. This method and all callers may be wrong. -- eseidel. |
| 1994 if (localFrameRootTemporary()->frameView()) { | 1994 if (localFrameRootTemporary()->frameView()) { |
| 1995 // Enqueues the resize event. | 1995 // Enqueues the resize event. |
| 1996 localFrameRootTemporary()->frame()->document()->enqueueResizeEvent(); | 1996 localFrameRootTemporary()->frame()->document()->enqueueResizeEvent(); |
| 1997 } | 1997 } |
| 1998 | 1998 |
| 1999 if (!isAcceleratedCompositingActive()) { | 1999 if (!isAcceleratedCompositingActive()) { |
| 2000 WebRect damagedRect(0, 0, m_size.width, m_size.height); | 2000 WebRect damagedRect(0, 0, m_size.width, m_size.height); |
| 2001 m_client->didInvalidateRect(damagedRect); | 2001 m_client->didInvalidateRect(damagedRect); |
| 2002 } | 2002 } |
| 2003 | |
| 2004 if (m_pageOverlays) | |
| 2005 m_pageOverlays->update(); | |
| 2006 } | 2003 } |
| 2007 | 2004 |
| 2008 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor
) | 2005 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor
) |
| 2009 { | 2006 { |
| 2010 if (m_compositorDeviceScaleFactorOverride == deviceScaleFactor) | 2007 if (m_compositorDeviceScaleFactorOverride == deviceScaleFactor) |
| 2011 return; | 2008 return; |
| 2012 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; | 2009 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; |
| 2013 if (page() && m_layerTreeView) | 2010 if (page() && m_layerTreeView) |
| 2014 updateLayerTreeDeviceScaleFactor(); | 2011 updateLayerTreeDeviceScaleFactor(); |
| 2015 } | 2012 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 m_backgroundColorOverride = color; | 2135 m_backgroundColorOverride = color; |
| 2139 updateLayerTreeBackgroundColor(); | 2136 updateLayerTreeBackgroundColor(); |
| 2140 } | 2137 } |
| 2141 | 2138 |
| 2142 void WebViewImpl::setZoomFactorOverride(float zoomFactor) | 2139 void WebViewImpl::setZoomFactorOverride(float zoomFactor) |
| 2143 { | 2140 { |
| 2144 m_zoomFactorOverride = zoomFactor; | 2141 m_zoomFactorOverride = zoomFactor; |
| 2145 setZoomLevel(zoomLevel()); | 2142 setZoomLevel(zoomLevel()); |
| 2146 } | 2143 } |
| 2147 | 2144 |
| 2148 void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder) | |
| 2149 { | |
| 2150 if (!m_pageOverlays) | |
| 2151 m_pageOverlays = PageOverlayList::create(this); | |
| 2152 | |
| 2153 m_pageOverlays->add(overlay, zOrder); | |
| 2154 } | |
| 2155 | |
| 2156 void WebViewImpl::removePageOverlay(WebPageOverlay* overlay) | |
| 2157 { | |
| 2158 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp
ty()) | |
| 2159 m_pageOverlays = nullptr; | |
| 2160 } | |
| 2161 | |
| 2162 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) | 2145 void WebViewImpl::setOverlayLayer(GraphicsLayer* layer) |
| 2163 { | 2146 { |
| 2164 if (!m_rootGraphicsLayer) | 2147 if (!m_rootGraphicsLayer) |
| 2165 return; | 2148 return; |
| 2166 | 2149 |
| 2167 // FIXME(bokan): This path goes away after virtual viewport pinch is enabled
everywhere. | 2150 // FIXME(bokan): This path goes away after virtual viewport pinch is enabled
everywhere. |
| 2168 if (!m_rootTransformLayer) | 2151 if (!m_rootTransformLayer) |
| 2169 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos
itor()->ensureRootTransformLayer(); | 2152 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos
itor()->ensureRootTransformLayer(); |
| 2170 | 2153 |
| 2171 if (m_rootTransformLayer) { | 2154 if (m_rootTransformLayer) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2317 } else { | 2300 } else { |
| 2318 TRACE_EVENT0("blink", "WebViewImpl::setIsAcceleratedCompositingActive(tr
ue)"); | 2301 TRACE_EVENT0("blink", "WebViewImpl::setIsAcceleratedCompositingActive(tr
ue)"); |
| 2319 m_layerTreeView->setRootLayer(*m_rootLayer); | 2302 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 2320 | 2303 |
| 2321 bool visible = page()->visibilityState() == PageVisibilityStateVisible; | 2304 bool visible = page()->visibilityState() == PageVisibilityStateVisible; |
| 2322 m_layerTreeView->setVisible(visible); | 2305 m_layerTreeView->setVisible(visible); |
| 2323 updateLayerTreeDeviceScaleFactor(); | 2306 updateLayerTreeDeviceScaleFactor(); |
| 2324 updateLayerTreeBackgroundColor(); | 2307 updateLayerTreeBackgroundColor(); |
| 2325 m_layerTreeView->setHasTransparentBackground(isTransparent()); | 2308 m_layerTreeView->setHasTransparentBackground(isTransparent()); |
| 2326 m_isAcceleratedCompositingActive = true; | 2309 m_isAcceleratedCompositingActive = true; |
| 2327 if (m_pageOverlays) | |
| 2328 m_pageOverlays->update(); | |
| 2329 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); | 2310 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); |
| 2330 m_layerTreeView->setShowPaintRects(m_showPaintRects); | 2311 m_layerTreeView->setShowPaintRects(m_showPaintRects); |
| 2331 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); | 2312 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); |
| 2332 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable
d); | 2313 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable
d); |
| 2333 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneckRect
s); | 2314 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneckRect
s); |
| 2334 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic
sForGpuRasterization); | 2315 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic
sForGpuRasterization); |
| 2335 } | 2316 } |
| 2336 } | 2317 } |
| 2337 | 2318 |
| 2338 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition,
bool programmaticScroll) | 2319 void WebViewImpl::updateMainFrameScrollPosition(const IntPoint& scrollPosition,
bool programmaticScroll) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 m_layerTreeView->setVisible(visible); | 2409 m_layerTreeView->setVisible(visible); |
| 2429 } | 2410 } |
| 2430 } | 2411 } |
| 2431 | 2412 |
| 2432 bool WebViewImpl::shouldDisableDesktopWorkarounds() | 2413 bool WebViewImpl::shouldDisableDesktopWorkarounds() |
| 2433 { | 2414 { |
| 2434 return true; | 2415 return true; |
| 2435 } | 2416 } |
| 2436 | 2417 |
| 2437 } // namespace blink | 2418 } // namespace blink |
| OLD | NEW |