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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 return true; | 1310 return true; |
1311 | 1311 |
1312 bool handled = true; | 1312 bool handled = true; |
1313 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1313 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1314 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1314 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1315 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1315 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1316 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1316 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1317 OnScrollFocusedEditableNodeIntoRect) | 1317 OnScrollFocusedEditableNodeIntoRect) |
1318 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1318 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
1319 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1319 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1320 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | |
1321 OnSetZoomLevelForLoadingURL) | |
1322 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1320 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1323 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1321 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1324 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1322 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
1325 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1323 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
1326 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1324 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
1327 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1325 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
1328 OnDragSourceSystemDragEnded) | 1326 OnDragSourceSystemDragEnded) |
1329 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 1327 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
1330 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 1328 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
1331 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 1329 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2220 zoom_level = static_cast<int>(old_zoom_level + zoom); | 2218 zoom_level = static_cast<int>(old_zoom_level + zoom); |
2221 } else { | 2219 } else { |
2222 // We're going towards 100%, so first go to the next whole number. | 2220 // We're going towards 100%, so first go to the next whole number. |
2223 zoom_level = static_cast<int>(old_zoom_level); | 2221 zoom_level = static_cast<int>(old_zoom_level); |
2224 } | 2222 } |
2225 } | 2223 } |
2226 SetZoomLevel(zoom_level); | 2224 SetZoomLevel(zoom_level); |
2227 zoomLevelChanged(); | 2225 zoomLevelChanged(); |
2228 } | 2226 } |
2229 | 2227 |
2230 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | |
2231 double zoom_level) { | |
2232 // TODO(wjmaclean): We should see if this restriction is really necessary, | |
2233 // since it isn't enforced in other parts of the page zoom system (e.g. | |
2234 // when a users changes the zoom of a currently displayed page). Android | |
2235 // has no UI for this, so in theory the following code would normally just use | |
2236 // the default zoom anyways. | |
2237 #if !defined(OS_ANDROID) | |
2238 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | |
2239 // for legacy WebView text scaling emulation. Thus, the code that resets | |
2240 // the zoom level from this map will be effectively resetting text zoom level. | |
2241 host_zoom_levels_[url] = zoom_level; | |
2242 #endif | |
2243 } | |
2244 | |
2245 void RenderViewImpl::OnSetZoomLevel( | 2228 void RenderViewImpl::OnSetZoomLevel( |
2246 PageMsg_SetZoomLevel_Command command, | 2229 PageMsg_SetZoomLevel_Command command, |
2247 double zoom_level) { | 2230 double zoom_level) { |
2248 switch (command) { | 2231 switch (command) { |
2249 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: | 2232 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: |
2250 uses_temporary_zoom_level_ = false; | 2233 uses_temporary_zoom_level_ = false; |
2251 break; | 2234 break; |
2252 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: | 2235 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: |
2253 uses_temporary_zoom_level_ = true; | 2236 uses_temporary_zoom_level_ = true; |
2254 break; | 2237 break; |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 if (IsUseZoomForDSFEnabled()) { | 2997 if (IsUseZoomForDSFEnabled()) { |
3015 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 2998 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3016 } else { | 2999 } else { |
3017 webview()->setDeviceScaleFactor(device_scale_factor_); | 3000 webview()->setDeviceScaleFactor(device_scale_factor_); |
3018 } | 3001 } |
3019 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3002 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3020 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3003 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3021 } | 3004 } |
3022 | 3005 |
3023 } // namespace content | 3006 } // namespace content |
OLD | NEW |