OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1320 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1320 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1321 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1321 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1322 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1322 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1323 OnScrollFocusedEditableNodeIntoRect) | 1323 OnScrollFocusedEditableNodeIntoRect) |
1324 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1324 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
1325 OnSetEditCommandsForNextKeyEvent) | 1325 OnSetEditCommandsForNextKeyEvent) |
1326 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1326 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
1327 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1327 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
1328 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1328 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
1329 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1329 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1330 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | |
1331 OnSetZoomLevelForLoadingURL) | |
1332 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1330 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1333 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1331 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1334 OnResetPageEncodingToDefault) | 1332 OnResetPageEncodingToDefault) |
1335 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1333 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1336 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1334 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1337 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1335 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
1338 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1336 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
1339 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1337 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
1340 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1338 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
1341 OnDragSourceSystemDragEnded) | 1339 OnDragSourceSystemDragEnded) |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2404 zoom_level = static_cast<int>(old_zoom_level + zoom); | 2402 zoom_level = static_cast<int>(old_zoom_level + zoom); |
2405 } else { | 2403 } else { |
2406 // We're going towards 100%, so first go to the next whole number. | 2404 // We're going towards 100%, so first go to the next whole number. |
2407 zoom_level = static_cast<int>(old_zoom_level); | 2405 zoom_level = static_cast<int>(old_zoom_level); |
2408 } | 2406 } |
2409 } | 2407 } |
2410 SetZoomLevel(zoom_level); | 2408 SetZoomLevel(zoom_level); |
2411 zoomLevelChanged(); | 2409 zoomLevelChanged(); |
2412 } | 2410 } |
2413 | 2411 |
2414 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | |
wjmaclean
2016/05/16 18:53:07
Happy to see this go, actually :-)
| |
2415 double zoom_level) { | |
2416 // TODO(wjmaclean): We should see if this restriction is really necessary, | |
2417 // since it isn't enforced in other parts of the page zoom system (e.g. | |
2418 // when a users changes the zoom of a currently displayed page). Android | |
2419 // has no UI for this, so in theory the following code would normally just use | |
2420 // the default zoom anyways. | |
2421 #if !defined(OS_ANDROID) | |
2422 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | |
2423 // for legacy WebView text scaling emulation. Thus, the code that resets | |
2424 // the zoom level from this map will be effectively resetting text zoom level. | |
2425 host_zoom_levels_[url] = zoom_level; | |
2426 #endif | |
2427 } | |
2428 | |
2429 void RenderViewImpl::OnSetZoomLevel( | 2412 void RenderViewImpl::OnSetZoomLevel( |
2430 PageMsg_SetZoomLevel_Command command, | 2413 PageMsg_SetZoomLevel_Command command, |
2431 double zoom_level) { | 2414 double zoom_level) { |
2432 switch (command) { | 2415 switch (command) { |
2433 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: | 2416 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: |
2434 uses_temporary_zoom_level_ = false; | 2417 uses_temporary_zoom_level_ = false; |
2435 break; | 2418 break; |
2436 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: | 2419 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: |
2437 uses_temporary_zoom_level_ = true; | 2420 uses_temporary_zoom_level_ = true; |
2438 break; | 2421 break; |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3450 if (IsUseZoomForDSFEnabled()) { | 3433 if (IsUseZoomForDSFEnabled()) { |
3451 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3434 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3452 } else { | 3435 } else { |
3453 webview()->setDeviceScaleFactor(device_scale_factor_); | 3436 webview()->setDeviceScaleFactor(device_scale_factor_); |
3454 } | 3437 } |
3455 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3438 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3456 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3439 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3457 } | 3440 } |
3458 | 3441 |
3459 } // namespace content | 3442 } // namespace content |
OLD | NEW |