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

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

Issue 1737733002: [DevTools] Handle emulated device scale factor and original device scale factor properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/externs.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 , m_chromeClientImpl(ChromeClientImpl::create(this)) 403 , m_chromeClientImpl(ChromeClientImpl::create(this))
404 , m_contextMenuClientImpl(this) 404 , m_contextMenuClientImpl(this)
405 , m_dragClientImpl(this) 405 , m_dragClientImpl(this)
406 , m_editorClientImpl(this) 406 , m_editorClientImpl(this)
407 , m_spellCheckerClientImpl(this) 407 , m_spellCheckerClientImpl(this)
408 , m_storageClientImpl(this) 408 , m_storageClientImpl(this)
409 , m_shouldAutoResize(false) 409 , m_shouldAutoResize(false)
410 , m_zoomLevel(0) 410 , m_zoomLevel(0)
411 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) 411 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier))
412 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) 412 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier))
413 , m_zoomFactorForDeviceScaleFactor(1.f) 413 , m_zoomFactorForDeviceScaleFactor(0.f)
414 , m_maximumLegibleScale(1) 414 , m_maximumLegibleScale(1)
415 , m_doubleTapZoomPageScaleFactor(0) 415 , m_doubleTapZoomPageScaleFactor(0)
416 , m_doubleTapZoomPending(false) 416 , m_doubleTapZoomPending(false)
417 , m_enableFakePageScaleAnimationForTesting(false) 417 , m_enableFakePageScaleAnimationForTesting(false)
418 , m_fakePageScaleAnimationPageScaleFactor(0) 418 , m_fakePageScaleAnimationPageScaleFactor(0)
419 , m_fakePageScaleAnimationUseAnchor(false) 419 , m_fakePageScaleAnimationUseAnchor(false)
420 , m_doingDragAndDrop(false) 420 , m_doingDragAndDrop(false)
421 , m_ignoreInputEvents(false) 421 , m_ignoreInputEvents(false)
422 , m_compositorDeviceScaleFactorOverride(0) 422 , m_compositorDeviceScaleFactorOverride(0)
423 , m_rootLayerScale(1) 423 , m_rootLayerScale(1)
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 m_zoomLevel = zoomLevel; 3048 m_zoomLevel = zoomLevel;
3049 3049
3050 // TODO(nasko): Setting zoom level needs to be refactored to support 3050 // TODO(nasko): Setting zoom level needs to be refactored to support
3051 // out-of-process iframes. See https://crbug.com/528407. 3051 // out-of-process iframes. See https://crbug.com/528407.
3052 if (mainFrame()->isWebRemoteFrame()) 3052 if (mainFrame()->isWebRemoteFrame())
3053 return m_zoomLevel; 3053 return m_zoomLevel;
3054 3054
3055 LocalFrame* frame = mainFrameImpl()->frame(); 3055 LocalFrame* frame = mainFrameImpl()->frame();
3056 if (!WebLocalFrameImpl::pluginContainerFromFrame(frame)) { 3056 if (!WebLocalFrameImpl::pluginContainerFromFrame(frame)) {
3057 float zoomFactor = m_zoomFactorOverride ? m_zoomFactorOverride : static_ cast<float>(zoomLevelToZoomFactor(m_zoomLevel)); 3057 float zoomFactor = m_zoomFactorOverride ? m_zoomFactorOverride : static_ cast<float>(zoomLevelToZoomFactor(m_zoomLevel));
3058 zoomFactor *= m_zoomFactorForDeviceScaleFactor; 3058 if (m_zoomFactorForDeviceScaleFactor) {
3059 if (m_compositorDeviceScaleFactorOverride) {
3060 // Adjust the page's DSF so that DevicePixelRatio becomes m_zoom FactorForDeviceScaleFactor.
3061 page()->setDeviceScaleFactor(m_zoomFactorForDeviceScaleFactor / m_compositorDeviceScaleFactorOverride);
3062 zoomFactor *= m_compositorDeviceScaleFactorOverride;
3063 } else {
3064 page()->setDeviceScaleFactor(1.f);
3065 zoomFactor *= m_zoomFactorForDeviceScaleFactor;
3066 }
3067 }
3059 frame->setPageZoomFactor(zoomFactor); 3068 frame->setPageZoomFactor(zoomFactor);
3060 } 3069 }
3061 3070
3062 return m_zoomLevel; 3071 return m_zoomLevel;
3063 } 3072 }
3064 3073
3065 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel, 3074 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel,
3066 double maximumZoomLevel) 3075 double maximumZoomLevel)
3067 { 3076 {
3068 m_minimumZoomLevel = minimumZoomLevel; 3077 m_minimumZoomLevel = minimumZoomLevel;
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 unsigned long WebViewImpl::createUniqueIdentifierForRequest() 3774 unsigned long WebViewImpl::createUniqueIdentifierForRequest()
3766 { 3775 {
3767 return createUniqueIdentifier(); 3776 return createUniqueIdentifier();
3768 } 3777 }
3769 3778
3770 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor ) 3779 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor )
3771 { 3780 {
3772 if (m_compositorDeviceScaleFactorOverride == deviceScaleFactor) 3781 if (m_compositorDeviceScaleFactorOverride == deviceScaleFactor)
3773 return; 3782 return;
3774 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; 3783 m_compositorDeviceScaleFactorOverride = deviceScaleFactor;
3784 if (m_zoomFactorForDeviceScaleFactor) {
3785 setZoomLevel(zoomLevel());
3786 return;
3787 }
3775 if (page() && m_layerTreeView) 3788 if (page() && m_layerTreeView)
3776 updateLayerTreeDeviceScaleFactor(); 3789 updateLayerTreeDeviceScaleFactor();
3777 } 3790 }
3778 3791
3779 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro otLayerScale) 3792 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro otLayerScale)
3780 { 3793 {
3781 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et) 3794 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et)
3782 return; 3795 return;
3783 m_rootLayerScale = rootLayerScale; 3796 m_rootLayerScale = rootLayerScale;
3784 m_rootLayerOffset = rootLayerOffset; 3797 m_rootLayerOffset = rootLayerOffset;
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
4574 { 4587 {
4575 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4588 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4576 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4589 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4577 if (!page()) 4590 if (!page())
4578 return 1; 4591 return 1;
4579 4592
4580 return page()->deviceScaleFactor(); 4593 return page()->deviceScaleFactor();
4581 } 4594 }
4582 4595
4583 } // namespace blink 4596 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/externs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698