| 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 3963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 return; | 3974 return; |
| 3975 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; | 3975 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; |
| 3976 if (m_zoomFactorForDeviceScaleFactor) { | 3976 if (m_zoomFactorForDeviceScaleFactor) { |
| 3977 setZoomLevel(zoomLevel()); | 3977 setZoomLevel(zoomLevel()); |
| 3978 return; | 3978 return; |
| 3979 } | 3979 } |
| 3980 if (page() && m_layerTreeView) | 3980 if (page() && m_layerTreeView) |
| 3981 updateLayerTreeDeviceScaleFactor(); | 3981 updateLayerTreeDeviceScaleFactor(); |
| 3982 } | 3982 } |
| 3983 | 3983 |
| 3984 void WebViewImpl::setRootLayerTransform(const TransformationMatrix& transform) { | 3984 void WebViewImpl::setDeviceEmulationTransform( |
| 3985 if (transform == m_rootLayerTransform) | 3985 const TransformationMatrix& transform) { |
| 3986 if (transform == m_deviceEmulationTransform) |
| 3986 return; | 3987 return; |
| 3987 m_rootLayerTransform = transform; | 3988 m_deviceEmulationTransform = transform; |
| 3988 updateRootLayerTransform(); | 3989 updateDeviceEmulationTransform(); |
| 3989 } | 3990 } |
| 3990 | 3991 |
| 3991 TransformationMatrix WebViewImpl::getRootLayerTransformForTesting() const { | 3992 TransformationMatrix WebViewImpl::getDeviceEmulationTransformForTesting() |
| 3992 return m_rootLayerTransform; | 3993 const { |
| 3994 return m_deviceEmulationTransform; |
| 3993 } | 3995 } |
| 3994 | 3996 |
| 3995 void WebViewImpl::enableDeviceEmulation( | 3997 void WebViewImpl::enableDeviceEmulation( |
| 3996 const WebDeviceEmulationParams& params) { | 3998 const WebDeviceEmulationParams& params) { |
| 3997 m_devToolsEmulator->enableDeviceEmulation(params); | 3999 m_devToolsEmulator->enableDeviceEmulation(params); |
| 3998 } | 4000 } |
| 3999 | 4001 |
| 4000 void WebViewImpl::disableDeviceEmulation() { | 4002 void WebViewImpl::disableDeviceEmulation() { |
| 4001 m_devToolsEmulator->disableDeviceEmulation(); | 4003 m_devToolsEmulator->disableDeviceEmulation(); |
| 4002 } | 4004 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 | 4389 |
| 4388 // In SPv2, setRootLayer is used instead. | 4390 // In SPv2, setRootLayer is used instead. |
| 4389 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 4391 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
| 4390 | 4392 |
| 4391 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 4393 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 4392 visualViewport.attachToLayerTree(graphicsLayer); | 4394 visualViewport.attachToLayerTree(graphicsLayer); |
| 4393 if (graphicsLayer) { | 4395 if (graphicsLayer) { |
| 4394 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); | 4396 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); |
| 4395 m_visualViewportContainerLayer = visualViewport.containerLayer(); | 4397 m_visualViewportContainerLayer = visualViewport.containerLayer(); |
| 4396 m_rootLayer = m_rootGraphicsLayer->platformLayer(); | 4398 m_rootLayer = m_rootGraphicsLayer->platformLayer(); |
| 4397 updateRootLayerTransform(); | 4399 updateDeviceEmulationTransform(); |
| 4398 m_layerTreeView->setRootLayer(*m_rootLayer); | 4400 m_layerTreeView->setRootLayer(*m_rootLayer); |
| 4399 // We register viewport layers here since there may not be a layer | 4401 // We register viewport layers here since there may not be a layer |
| 4400 // tree view prior to this point. | 4402 // tree view prior to this point. |
| 4401 registerViewportLayersWithCompositor(); | 4403 registerViewportLayersWithCompositor(); |
| 4402 | 4404 |
| 4403 // TODO(enne): Work around page visibility changes not being | 4405 // TODO(enne): Work around page visibility changes not being |
| 4404 // propagated to the WebView in some circumstances. This needs to | 4406 // propagated to the WebView in some circumstances. This needs to |
| 4405 // be refreshed here when setting a new root layer to avoid being | 4407 // be refreshed here when setting a new root layer to avoid being |
| 4406 // stuck in a presumed incorrectly invisible state. | 4408 // stuck in a presumed incorrectly invisible state. |
| 4407 m_layerTreeView->setVisible(page()->isPageVisible()); | 4409 m_layerTreeView->setVisible(page()->isPageVisible()); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4569 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { | 4571 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { |
| 4570 DCHECK(page()); | 4572 DCHECK(page()); |
| 4571 DCHECK(m_layerTreeView); | 4573 DCHECK(m_layerTreeView); |
| 4572 | 4574 |
| 4573 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride | 4575 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride |
| 4574 ? m_compositorDeviceScaleFactorOverride | 4576 ? m_compositorDeviceScaleFactorOverride |
| 4575 : page()->deviceScaleFactor(); | 4577 : page()->deviceScaleFactor(); |
| 4576 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); | 4578 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); |
| 4577 } | 4579 } |
| 4578 | 4580 |
| 4579 void WebViewImpl::updateRootLayerTransform() { | 4581 void WebViewImpl::updateDeviceEmulationTransform() { |
| 4580 if (m_visualViewportContainerLayer) | 4582 if (!m_visualViewportContainerLayer) |
| 4581 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform); | 4583 return; |
| 4584 |
| 4585 // When the device emulation transform is updated, to avoid incorrect |
| 4586 // scales and fuzzy raster from the compositor, force all content to |
| 4587 // pick ideal raster scales. |
| 4588 m_visualViewportContainerLayer->setTransform(m_deviceEmulationTransform); |
| 4589 m_layerTreeView->forceRecalculateRasterScales(); |
| 4582 } | 4590 } |
| 4583 | 4591 |
| 4584 bool WebViewImpl::detectContentOnTouch( | 4592 bool WebViewImpl::detectContentOnTouch( |
| 4585 const GestureEventWithHitTestResults& targetedEvent) { | 4593 const GestureEventWithHitTestResults& targetedEvent) { |
| 4586 if (!m_page->mainFrame()->isLocalFrame()) | 4594 if (!m_page->mainFrame()->isLocalFrame()) |
| 4587 return false; | 4595 return false; |
| 4588 | 4596 |
| 4589 // Need a local copy of the hit test as | 4597 // Need a local copy of the hit test as |
| 4590 // setToShadowHostIfInUserAgentShadowRoot() will modify it. | 4598 // setToShadowHostIfInUserAgentShadowRoot() will modify it. |
| 4591 HitTestResult touchHit = targetedEvent.hitTestResult(); | 4599 HitTestResult touchHit = targetedEvent.hitTestResult(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4725 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4733 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4726 return nullptr; | 4734 return nullptr; |
| 4727 return focusedFrame; | 4735 return focusedFrame; |
| 4728 } | 4736 } |
| 4729 | 4737 |
| 4730 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4738 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4731 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4739 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4732 } | 4740 } |
| 4733 | 4741 |
| 4734 } // namespace blink | 4742 } // namespace blink |
| OLD | NEW |