Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2390923002: Fix blurry content after disabling dev tools emulation (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::getRootLayerTransformForTesting() const {
3992 return m_rootLayerTransform; 3993 return m_deviceEmulationTransform;
3993 } 3994 }
3994 3995
3995 void WebViewImpl::enableDeviceEmulation( 3996 void WebViewImpl::enableDeviceEmulation(
3996 const WebDeviceEmulationParams& params) { 3997 const WebDeviceEmulationParams& params) {
3997 m_devToolsEmulator->enableDeviceEmulation(params); 3998 m_devToolsEmulator->enableDeviceEmulation(params);
3998 } 3999 }
3999 4000
4000 void WebViewImpl::disableDeviceEmulation() { 4001 void WebViewImpl::disableDeviceEmulation() {
4001 m_devToolsEmulator->disableDeviceEmulation(); 4002 m_devToolsEmulator->disableDeviceEmulation();
4002 } 4003 }
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
4387 4388
4388 // In SPv2, setRootLayer is used instead. 4389 // In SPv2, setRootLayer is used instead.
4389 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 4390 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
4390 4391
4391 VisualViewport& visualViewport = page()->frameHost().visualViewport(); 4392 VisualViewport& visualViewport = page()->frameHost().visualViewport();
4392 visualViewport.attachToLayerTree(graphicsLayer); 4393 visualViewport.attachToLayerTree(graphicsLayer);
4393 if (graphicsLayer) { 4394 if (graphicsLayer) {
4394 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); 4395 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer();
4395 m_visualViewportContainerLayer = visualViewport.containerLayer(); 4396 m_visualViewportContainerLayer = visualViewport.containerLayer();
4396 m_rootLayer = m_rootGraphicsLayer->platformLayer(); 4397 m_rootLayer = m_rootGraphicsLayer->platformLayer();
4397 updateRootLayerTransform(); 4398 updateDeviceEmulationTransform();
4398 m_layerTreeView->setRootLayer(*m_rootLayer); 4399 m_layerTreeView->setRootLayer(*m_rootLayer);
4399 // We register viewport layers here since there may not be a layer 4400 // We register viewport layers here since there may not be a layer
4400 // tree view prior to this point. 4401 // tree view prior to this point.
4401 registerViewportLayersWithCompositor(); 4402 registerViewportLayersWithCompositor();
4402 4403
4403 // TODO(enne): Work around page visibility changes not being 4404 // TODO(enne): Work around page visibility changes not being
4404 // propagated to the WebView in some circumstances. This needs to 4405 // propagated to the WebView in some circumstances. This needs to
4405 // be refreshed here when setting a new root layer to avoid being 4406 // be refreshed here when setting a new root layer to avoid being
4406 // stuck in a presumed incorrectly invisible state. 4407 // stuck in a presumed incorrectly invisible state.
4407 m_layerTreeView->setVisible(page()->isPageVisible()); 4408 m_layerTreeView->setVisible(page()->isPageVisible());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4569 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { 4570 void WebViewImpl::updateLayerTreeDeviceScaleFactor() {
4570 DCHECK(page()); 4571 DCHECK(page());
4571 DCHECK(m_layerTreeView); 4572 DCHECK(m_layerTreeView);
4572 4573
4573 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride 4574 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride
4574 ? m_compositorDeviceScaleFactorOverride 4575 ? m_compositorDeviceScaleFactorOverride
4575 : page()->deviceScaleFactor(); 4576 : page()->deviceScaleFactor();
4576 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 4577 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
4577 } 4578 }
4578 4579
4579 void WebViewImpl::updateRootLayerTransform() { 4580 void WebViewImpl::updateDeviceEmulationTransform() {
enne (OOO) 2016/10/03 23:27:30 Renamed this as devtools is the only consumer of t
4580 if (m_visualViewportContainerLayer) 4581 if (!m_visualViewportContainerLayer)
4581 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform); 4582 return;
4583
4584 // When the device emulation transform is updated, to avoid incorrect
4585 // scales and fuzzy raster from the compositor, force all content to
4586 // pick ideal raster scales.
4587 m_visualViewportContainerLayer->setTransform(m_deviceEmulationTransform);
4588 m_layerTreeView->forceRecalculateRasterScales();
4582 } 4589 }
4583 4590
4584 bool WebViewImpl::detectContentOnTouch( 4591 bool WebViewImpl::detectContentOnTouch(
4585 const GestureEventWithHitTestResults& targetedEvent) { 4592 const GestureEventWithHitTestResults& targetedEvent) {
4586 if (!m_page->mainFrame()->isLocalFrame()) 4593 if (!m_page->mainFrame()->isLocalFrame())
4587 return false; 4594 return false;
4588 4595
4589 // Need a local copy of the hit test as 4596 // Need a local copy of the hit test as
4590 // setToShadowHostIfInUserAgentShadowRoot() will modify it. 4597 // setToShadowHostIfInUserAgentShadowRoot() will modify it.
4591 HitTestResult touchHit = targetedEvent.hitTestResult(); 4598 HitTestResult touchHit = targetedEvent.hitTestResult();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4725 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4732 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4726 return nullptr; 4733 return nullptr;
4727 return focusedFrame; 4734 return focusedFrame;
4728 } 4735 }
4729 4736
4730 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4737 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4731 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4738 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4732 } 4739 }
4733 4740
4734 } // namespace blink 4741 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/public/platform/WebLayerTreeView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698