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

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

Issue 2724543002: Renamed deviceScaleFactor() to deviceScaleFactorDeprecated() in Page (Closed)
Patch Set: Rebase Created 3 years, 9 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 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 m_zoomLevel = zoomLevel; 2885 m_zoomLevel = zoomLevel;
2886 2886
2887 float zoomFactor = 2887 float zoomFactor =
2888 m_zoomFactorOverride 2888 m_zoomFactorOverride
2889 ? m_zoomFactorOverride 2889 ? m_zoomFactorOverride
2890 : static_cast<float>(zoomLevelToZoomFactor(m_zoomLevel)); 2890 : static_cast<float>(zoomLevelToZoomFactor(m_zoomLevel));
2891 if (m_zoomFactorForDeviceScaleFactor) { 2891 if (m_zoomFactorForDeviceScaleFactor) {
2892 if (m_compositorDeviceScaleFactorOverride) { 2892 if (m_compositorDeviceScaleFactorOverride) {
2893 // Adjust the page's DSF so that DevicePixelRatio becomes 2893 // Adjust the page's DSF so that DevicePixelRatio becomes
2894 // m_zoomFactorForDeviceScaleFactor. 2894 // m_zoomFactorForDeviceScaleFactor.
2895 page()->setDeviceScaleFactor(m_zoomFactorForDeviceScaleFactor / 2895 page()->setDeviceScaleFactorDeprecated(
2896 m_compositorDeviceScaleFactorOverride); 2896 m_zoomFactorForDeviceScaleFactor /
2897 m_compositorDeviceScaleFactorOverride);
2897 zoomFactor *= m_compositorDeviceScaleFactorOverride; 2898 zoomFactor *= m_compositorDeviceScaleFactorOverride;
2898 } else { 2899 } else {
2899 page()->setDeviceScaleFactor(1.f); 2900 page()->setDeviceScaleFactorDeprecated(1.f);
2900 zoomFactor *= m_zoomFactorForDeviceScaleFactor; 2901 zoomFactor *= m_zoomFactorForDeviceScaleFactor;
2901 } 2902 }
2902 } 2903 }
2903 propagateZoomFactorToLocalFrameRoots(m_page->mainFrame(), zoomFactor); 2904 propagateZoomFactorToLocalFrameRoots(m_page->mainFrame(), zoomFactor);
2904 2905
2905 return m_zoomLevel; 2906 return m_zoomLevel;
2906 } 2907 }
2907 2908
2908 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel, 2909 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel,
2909 double maximumZoomLevel) { 2910 double maximumZoomLevel) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 if (scaleFactor == pageScaleFactor()) 3002 if (scaleFactor == pageScaleFactor())
3002 return; 3003 return;
3003 3004
3004 page()->frameHost().visualViewport().setScale(scaleFactor); 3005 page()->frameHost().visualViewport().setScale(scaleFactor);
3005 } 3006 }
3006 3007
3007 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) { 3008 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) {
3008 if (!page()) 3009 if (!page())
3009 return; 3010 return;
3010 3011
3011 page()->setDeviceScaleFactor(scaleFactor); 3012 page()->setDeviceScaleFactorDeprecated(scaleFactor);
3012 3013
3013 if (m_layerTreeView) 3014 if (m_layerTreeView)
3014 updateLayerTreeDeviceScaleFactor(); 3015 updateLayerTreeDeviceScaleFactor();
3015 } 3016 }
3016 3017
3017 void WebViewImpl::setZoomFactorForDeviceScaleFactor( 3018 void WebViewImpl::setZoomFactorForDeviceScaleFactor(
3018 float zoomFactorForDeviceScaleFactor) { 3019 float zoomFactorForDeviceScaleFactor) {
3019 m_zoomFactorForDeviceScaleFactor = zoomFactorForDeviceScaleFactor; 3020 m_zoomFactorForDeviceScaleFactor = zoomFactorForDeviceScaleFactor;
3020 if (!m_layerTreeView) 3021 if (!m_layerTreeView)
3021 return; 3022 return;
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
4017 ? m_backgroundColorOverride 4018 ? m_backgroundColorOverride
4018 : backgroundColor()); 4019 : backgroundColor());
4019 } 4020 }
4020 4021
4021 void WebViewImpl::updateLayerTreeDeviceScaleFactor() { 4022 void WebViewImpl::updateLayerTreeDeviceScaleFactor() {
4022 DCHECK(page()); 4023 DCHECK(page());
4023 DCHECK(m_layerTreeView); 4024 DCHECK(m_layerTreeView);
4024 4025
4025 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride 4026 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride
4026 ? m_compositorDeviceScaleFactorOverride 4027 ? m_compositorDeviceScaleFactorOverride
4027 : page()->deviceScaleFactor(); 4028 : page()->deviceScaleFactorDeprecated();
4028 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 4029 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
4029 } 4030 }
4030 4031
4031 void WebViewImpl::updateDeviceEmulationTransform() { 4032 void WebViewImpl::updateDeviceEmulationTransform() {
4032 if (!m_visualViewportContainerLayer) 4033 if (!m_visualViewportContainerLayer)
4033 return; 4034 return;
4034 4035
4035 // When the device emulation transform is updated, to avoid incorrect 4036 // When the device emulation transform is updated, to avoid incorrect
4036 // scales and fuzzy raster from the compositor, force all content to 4037 // scales and fuzzy raster from the compositor, force all content to
4037 // pick ideal raster scales. 4038 // pick ideal raster scales.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 } 4145 }
4145 } 4146 }
4146 4147
4147 float WebViewImpl::deviceScaleFactor() const { 4148 float WebViewImpl::deviceScaleFactor() const {
4148 // TODO(oshima): Investigate if this should return the ScreenInfo's scale 4149 // TODO(oshima): Investigate if this should return the ScreenInfo's scale
4149 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf 4150 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf
4150 // mode. 4151 // mode.
4151 if (!page()) 4152 if (!page())
4152 return 1; 4153 return 1;
4153 4154
4154 return page()->deviceScaleFactor(); 4155 return page()->deviceScaleFactorDeprecated();
4155 } 4156 }
4156 4157
4157 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const { 4158 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const {
4158 if (!mainFrameImpl()) 4159 if (!mainFrameImpl())
4159 return nullptr; 4160 return nullptr;
4160 4161
4161 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); 4162 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame());
4162 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4163 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4163 return nullptr; 4164 return nullptr;
4164 return focusedFrame; 4165 return focusedFrame;
4165 } 4166 }
4166 4167
4167 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4168 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4168 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4169 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4169 } 4170 }
4170 4171
4171 } // namespace blink 4172 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698