| 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 4164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4175 void WebViewImpl::setTabsToLinks(bool enable) | 4175 void WebViewImpl::setTabsToLinks(bool enable) |
| 4176 { | 4176 { |
| 4177 m_tabsToLinks = enable; | 4177 m_tabsToLinks = enable; |
| 4178 } | 4178 } |
| 4179 | 4179 |
| 4180 bool WebViewImpl::tabsToLinks() const | 4180 bool WebViewImpl::tabsToLinks() const |
| 4181 { | 4181 { |
| 4182 return m_tabsToLinks; | 4182 return m_tabsToLinks; |
| 4183 } | 4183 } |
| 4184 | 4184 |
| 4185 void WebViewImpl::registerViewportLayersWithCompositor() |
| 4186 { |
| 4187 DCHECK(m_layerTreeView); |
| 4188 DCHECK(!page()->deprecatedLocalMainFrame()->contentLayoutItem().isNull()); |
| 4189 |
| 4190 PaintLayerCompositor* compositor = |
| 4191 page()->deprecatedLocalMainFrame()->contentLayoutItem().compositor(); |
| 4192 |
| 4193 DCHECK(compositor); |
| 4194 |
| 4195 // Get the outer viewport scroll layer. |
| 4196 WebLayer* scrollLayer = |
| 4197 compositor->scrollLayer() |
| 4198 ? compositor->scrollLayer()->platformLayer() |
| 4199 : nullptr; |
| 4200 |
| 4201 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 4202 |
| 4203 // TODO(bokan): This was moved here from when registerViewportLayers was a |
| 4204 // part of VisualViewport and maybe doesn't belong here. See comment inside |
| 4205 // the mehtod. |
| 4206 visualViewport.setScrollLayerOnScrollbars(scrollLayer); |
| 4207 |
| 4208 m_layerTreeView->registerViewportLayers( |
| 4209 visualViewport.overscrollElasticityLayer()->platformLayer(), |
| 4210 visualViewport.pageScaleLayer()->platformLayer(), |
| 4211 visualViewport.scrollLayer()->platformLayer(), |
| 4212 scrollLayer); |
| 4213 } |
| 4214 |
| 4185 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) | 4215 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) |
| 4186 { | 4216 { |
| 4187 if (!m_layerTreeView) | 4217 if (!m_layerTreeView) |
| 4188 return; | 4218 return; |
| 4189 | 4219 |
| 4190 // In SPv2, we attach layers via PaintArtifactCompositor, rather than | 4220 // In SPv2, we attach layers via PaintArtifactCompositor, rather than |
| 4191 // supplying a root GraphicsLayer from PaintLayerCompositor. | 4221 // supplying a root GraphicsLayer from PaintLayerCompositor. |
| 4192 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 4222 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 4193 | 4223 |
| 4194 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 4224 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 4195 visualViewport.attachToLayerTree(layer); | 4225 visualViewport.attachToLayerTree(layer); |
| 4196 if (layer) { | 4226 if (layer) { |
| 4197 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); | 4227 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); |
| 4198 m_visualViewportContainerLayer = visualViewport.containerLayer(); | 4228 m_visualViewportContainerLayer = visualViewport.containerLayer(); |
| 4199 m_rootLayer = m_rootGraphicsLayer->platformLayer(); | 4229 m_rootLayer = m_rootGraphicsLayer->platformLayer(); |
| 4200 updateRootLayerTransform(); | 4230 updateRootLayerTransform(); |
| 4201 m_layerTreeView->setRootLayer(*m_rootLayer); | 4231 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4202 // We register viewport layers here since there may not be a layer | 4232 // We register viewport layers here since there may not be a layer |
| 4203 // tree view prior to this point. | 4233 // tree view prior to this point. |
| 4204 visualViewport.registerLayersWithTreeView(m_layerTreeView); | 4234 registerViewportLayersWithCompositor(); |
| 4205 updatePageOverlays(); | 4235 updatePageOverlays(); |
| 4206 // TODO(enne): Work around page visibility changes not being | 4236 // TODO(enne): Work around page visibility changes not being |
| 4207 // propagated to the WebView in some circumstances. This needs to | 4237 // propagated to the WebView in some circumstances. This needs to |
| 4208 // be refreshed here when setting a new root layer to avoid being | 4238 // be refreshed here when setting a new root layer to avoid being |
| 4209 // stuck in a presumed incorrectly invisible state. | 4239 // stuck in a presumed incorrectly invisible state. |
| 4210 m_layerTreeView->setVisible(page()->isPageVisible()); | 4240 m_layerTreeView->setVisible(page()->isPageVisible()); |
| 4211 } else { | 4241 } else { |
| 4212 m_rootGraphicsLayer = nullptr; | 4242 m_rootGraphicsLayer = nullptr; |
| 4213 m_visualViewportContainerLayer = nullptr; | 4243 m_visualViewportContainerLayer = nullptr; |
| 4214 m_rootLayer = nullptr; | 4244 m_rootLayer = nullptr; |
| 4215 // This means that we're transitioning to a new page. Suppress | 4245 // This means that we're transitioning to a new page. Suppress |
| 4216 // commits until Blink generates invalidations so we don't | 4246 // commits until Blink generates invalidations so we don't |
| 4217 // attempt to paint too early in the next page load. | 4247 // attempt to paint too early in the next page load. |
| 4218 m_layerTreeView->setDeferCommits(true); | 4248 m_layerTreeView->setDeferCommits(true); |
| 4219 m_layerTreeView->clearRootLayer(); | 4249 m_layerTreeView->clearRootLayer(); |
| 4220 visualViewport.clearLayersForTreeView(m_layerTreeView); | 4250 m_layerTreeView->clearViewportLayers(); |
| 4221 } | 4251 } |
| 4222 } | 4252 } |
| 4223 | 4253 |
| 4224 void WebViewImpl::invalidateRect(const IntRect& rect) | 4254 void WebViewImpl::invalidateRect(const IntRect& rect) |
| 4225 { | 4255 { |
| 4226 if (m_layerTreeView) | 4256 if (m_layerTreeView) |
| 4227 updateLayerTreeViewport(); | 4257 updateLayerTreeViewport(); |
| 4228 else if (m_client) | 4258 else if (m_client) |
| 4229 m_client->didInvalidateRect(rect); | 4259 m_client->didInvalidateRect(rect); |
| 4230 } | 4260 } |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4533 { | 4563 { |
| 4534 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4564 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
| 4535 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4565 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
| 4536 if (!page()) | 4566 if (!page()) |
| 4537 return 1; | 4567 return 1; |
| 4538 | 4568 |
| 4539 return page()->deviceScaleFactor(); | 4569 return page()->deviceScaleFactor(); |
| 4540 } | 4570 } |
| 4541 | 4571 |
| 4542 } // namespace blink | 4572 } // namespace blink |
| OLD | NEW |