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

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
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) {
dgozman 2016/03/02 01:19:56 style: 4 spaces in blink
oshima 2016/03/02 03:15:07 Done.
3060 page()->setDeviceScaleFactor(m_zoomFactorForDeviceScaleFactor / m_co mpositorDeviceScaleFactorOverride);
dgozman 2016/03/02 01:19:56 This is surprising. I thought in new mode device_s
oshima 2016/03/02 03:15:07 DPR (Device Pixel Ratio), which emulator sets, is
3061 zoomFactor *= m_compositorDeviceScaleFactorOverride;
3062 } else {
3063 page()->setDeviceScaleFactor(1.f);
3064 zoomFactor *= m_zoomFactorForDeviceScaleFactor;
3065 }
3066 }
3059 frame->setPageZoomFactor(zoomFactor); 3067 frame->setPageZoomFactor(zoomFactor);
3060 } 3068 }
3061 3069
3062 return m_zoomLevel; 3070 return m_zoomLevel;
3063 } 3071 }
3064 3072
3065 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel, 3073 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel,
3066 double maximumZoomLevel) 3074 double maximumZoomLevel)
3067 { 3075 {
3068 m_minimumZoomLevel = minimumZoomLevel; 3076 m_minimumZoomLevel = minimumZoomLevel;
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 unsigned long WebViewImpl::createUniqueIdentifierForRequest() 3773 unsigned long WebViewImpl::createUniqueIdentifierForRequest()
3766 { 3774 {
3767 return createUniqueIdentifier(); 3775 return createUniqueIdentifier();
3768 } 3776 }
3769 3777
3770 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor ) 3778 void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor )
3771 { 3779 {
3772 if (m_compositorDeviceScaleFactorOverride == deviceScaleFactor) 3780 if (m_compositorDeviceScaleFactorOverride == deviceScaleFactor)
3773 return; 3781 return;
3774 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; 3782 m_compositorDeviceScaleFactorOverride = deviceScaleFactor;
3783 if (m_zoomFactorForDeviceScaleFactor) {
3784 setZoomLevel(zoomLevel());
3785 return;
3786 }
3775 if (page() && m_layerTreeView) 3787 if (page() && m_layerTreeView)
3776 updateLayerTreeDeviceScaleFactor(); 3788 updateLayerTreeDeviceScaleFactor();
3777 } 3789 }
3778 3790
3779 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro otLayerScale) 3791 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro otLayerScale)
3780 { 3792 {
3781 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et) 3793 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et)
3782 return; 3794 return;
3783 m_rootLayerScale = rootLayerScale; 3795 m_rootLayerScale = rootLayerScale;
3784 m_rootLayerOffset = rootLayerOffset; 3796 m_rootLayerOffset = rootLayerOffset;
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4580 { 4592 {
4581 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4593 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4582 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4594 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4583 if (!page()) 4595 if (!page())
4584 return 1; 4596 return 1;
4585 4597
4586 return page()->deviceScaleFactor(); 4598 return page()->deviceScaleFactor();
4587 } 4599 }
4588 4600
4589 } // namespace blink 4601 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698