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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 , m_chromeClientImpl(ChromeClientImpl::create(this)) | 405 , m_chromeClientImpl(ChromeClientImpl::create(this)) |
406 , m_contextMenuClientImpl(this) | 406 , m_contextMenuClientImpl(this) |
407 , m_dragClientImpl(this) | 407 , m_dragClientImpl(this) |
408 , m_editorClientImpl(this) | 408 , m_editorClientImpl(this) |
409 , m_spellCheckerClientImpl(this) | 409 , m_spellCheckerClientImpl(this) |
410 , m_storageClientImpl(this) | 410 , m_storageClientImpl(this) |
411 , m_shouldAutoResize(false) | 411 , m_shouldAutoResize(false) |
412 , m_zoomLevel(0) | 412 , m_zoomLevel(0) |
413 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 413 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |
414 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 414 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
| 415 , m_zoomFactorForDeviceScaleFactor(1.f) |
| 416 , m_useZoomForDeviceScaleFactor(false) |
415 , m_maximumLegibleScale(1) | 417 , m_maximumLegibleScale(1) |
416 , m_doubleTapZoomPageScaleFactor(0) | 418 , m_doubleTapZoomPageScaleFactor(0) |
417 , m_doubleTapZoomPending(false) | 419 , m_doubleTapZoomPending(false) |
418 , m_enableFakePageScaleAnimationForTesting(false) | 420 , m_enableFakePageScaleAnimationForTesting(false) |
419 , m_fakePageScaleAnimationPageScaleFactor(0) | 421 , m_fakePageScaleAnimationPageScaleFactor(0) |
420 , m_fakePageScaleAnimationUseAnchor(false) | 422 , m_fakePageScaleAnimationUseAnchor(false) |
421 , m_doingDragAndDrop(false) | 423 , m_doingDragAndDrop(false) |
422 , m_ignoreInputEvents(false) | 424 , m_ignoreInputEvents(false) |
423 , m_compositorDeviceScaleFactorOverride(0) | 425 , m_compositorDeviceScaleFactorOverride(0) |
424 , m_rootLayerScale(1) | 426 , m_rootLayerScale(1) |
(...skipping 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 if (zoomLevel < m_minimumZoomLevel) | 2953 if (zoomLevel < m_minimumZoomLevel) |
2952 m_zoomLevel = m_minimumZoomLevel; | 2954 m_zoomLevel = m_minimumZoomLevel; |
2953 else if (zoomLevel > m_maximumZoomLevel) | 2955 else if (zoomLevel > m_maximumZoomLevel) |
2954 m_zoomLevel = m_maximumZoomLevel; | 2956 m_zoomLevel = m_maximumZoomLevel; |
2955 else | 2957 else |
2956 m_zoomLevel = zoomLevel; | 2958 m_zoomLevel = zoomLevel; |
2957 | 2959 |
2958 LocalFrame* frame = mainFrameImpl()->frame(); | 2960 LocalFrame* frame = mainFrameImpl()->frame(); |
2959 if (!WebLocalFrameImpl::pluginContainerFromFrame(frame)) { | 2961 if (!WebLocalFrameImpl::pluginContainerFromFrame(frame)) { |
2960 float zoomFactor = m_zoomFactorOverride ? m_zoomFactorOverride : static_
cast<float>(zoomLevelToZoomFactor(m_zoomLevel)); | 2962 float zoomFactor = m_zoomFactorOverride ? m_zoomFactorOverride : static_
cast<float>(zoomLevelToZoomFactor(m_zoomLevel)); |
| 2963 zoomFactor *= m_zoomFactorForDeviceScaleFactor; |
2961 frame->setPageZoomFactor(zoomFactor); | 2964 frame->setPageZoomFactor(zoomFactor); |
2962 } | 2965 } |
2963 | 2966 |
2964 return m_zoomLevel; | 2967 return m_zoomLevel; |
2965 } | 2968 } |
2966 | 2969 |
2967 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel, | 2970 void WebViewImpl::zoomLimitsChanged(double minimumZoomLevel, |
2968 double maximumZoomLevel) | 2971 double maximumZoomLevel) |
2969 { | 2972 { |
2970 m_minimumZoomLevel = minimumZoomLevel; | 2973 m_minimumZoomLevel = minimumZoomLevel; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3087 float WebViewImpl::deviceScaleFactor() const | 3090 float WebViewImpl::deviceScaleFactor() const |
3088 { | 3091 { |
3089 if (!page()) | 3092 if (!page()) |
3090 return 1; | 3093 return 1; |
3091 | 3094 |
3092 return page()->deviceScaleFactor(); | 3095 return page()->deviceScaleFactor(); |
3093 } | 3096 } |
3094 | 3097 |
3095 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) | 3098 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) |
3096 { | 3099 { |
3097 if (!page()) | 3100 if (m_useZoomForDeviceScaleFactor) { |
3098 return; | 3101 if (!m_layerTreeView || m_zoomFactorForDeviceScaleFactor == scaleFactor) |
| 3102 return; |
| 3103 m_zoomFactorForDeviceScaleFactor = scaleFactor; |
| 3104 setZoomLevel(m_zoomLevel); |
| 3105 } else { |
| 3106 if (!page()) |
| 3107 return; |
3099 | 3108 |
3100 page()->setDeviceScaleFactor(scaleFactor); | 3109 page()->setDeviceScaleFactor(scaleFactor); |
3101 | 3110 |
3102 if (m_layerTreeView) | 3111 if (!m_layerTreeView) |
3103 updateLayerTreeDeviceScaleFactor(); | 3112 return; |
| 3113 } |
| 3114 updateLayerTreeDeviceScaleFactor(); |
| 3115 } |
| 3116 |
| 3117 void WebViewImpl::enableUseZoomForDeviceScaleFactor() |
| 3118 { |
| 3119 m_useZoomForDeviceScaleFactor = true; |
3104 } | 3120 } |
3105 | 3121 |
3106 void WebViewImpl::setDeviceColorProfile(const WebVector<char>& colorProfile) | 3122 void WebViewImpl::setDeviceColorProfile(const WebVector<char>& colorProfile) |
3107 { | 3123 { |
3108 if (!page()) | 3124 if (!page()) |
3109 return; | 3125 return; |
3110 | 3126 |
3111 Vector<char> deviceProfile; | 3127 Vector<char> deviceProfile; |
3112 deviceProfile.append(colorProfile.data(), colorProfile.size()); | 3128 deviceProfile.append(colorProfile.data(), colorProfile.size()); |
3113 | 3129 |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4431 if (m_pageColorOverlay) | 4447 if (m_pageColorOverlay) |
4432 m_pageColorOverlay->update(); | 4448 m_pageColorOverlay->update(); |
4433 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4449 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4434 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4450 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4435 if (inspectorPageOverlay) | 4451 if (inspectorPageOverlay) |
4436 inspectorPageOverlay->update(); | 4452 inspectorPageOverlay->update(); |
4437 } | 4453 } |
4438 } | 4454 } |
4439 | 4455 |
4440 } // namespace blink | 4456 } // namespace blink |
OLD | NEW |