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 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1284 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1285 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1285 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
1286 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1286 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
1287 OnScrollFocusedEditableNodeIntoRect) | 1287 OnScrollFocusedEditableNodeIntoRect) |
1288 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1288 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
1289 OnSetEditCommandsForNextKeyEvent) | 1289 OnSetEditCommandsForNextKeyEvent) |
1290 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1290 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
1291 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1291 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
1292 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1292 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
1293 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1293 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
1294 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | |
1295 OnSetZoomLevelForLoadingURL) | |
1296 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1294 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
1297 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1295 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
1298 OnResetPageEncodingToDefault) | 1296 OnResetPageEncodingToDefault) |
1299 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1297 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
1300 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1298 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
1301 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1299 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
1302 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1300 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
1303 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1301 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
1304 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1302 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
1305 OnDragSourceSystemDragEnded) | 1303 OnDragSourceSystemDragEnded) |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 zoom_level = static_cast<int>(old_zoom_level + zoom); | 2365 zoom_level = static_cast<int>(old_zoom_level + zoom); |
2368 } else { | 2366 } else { |
2369 // We're going towards 100%, so first go to the next whole number. | 2367 // We're going towards 100%, so first go to the next whole number. |
2370 zoom_level = static_cast<int>(old_zoom_level); | 2368 zoom_level = static_cast<int>(old_zoom_level); |
2371 } | 2369 } |
2372 } | 2370 } |
2373 SetZoomLevel(zoom_level); | 2371 SetZoomLevel(zoom_level); |
2374 zoomLevelChanged(); | 2372 zoomLevelChanged(); |
2375 } | 2373 } |
2376 | 2374 |
2377 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | |
2378 double zoom_level) { | |
2379 // TODO(wjmaclean): We should see if this restriction is really necessary, | |
2380 // since it isn't enforced in other parts of the page zoom system (e.g. | |
2381 // when a users changes the zoom of a currently displayed page). Android | |
2382 // has no UI for this, so in theory the following code would normally just use | |
2383 // the default zoom anyways. | |
2384 #if !defined(OS_ANDROID) | |
2385 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | |
2386 // for legacy WebView text scaling emulation. Thus, the code that resets | |
2387 // the zoom level from this map will be effectively resetting text zoom level. | |
2388 host_zoom_levels_[url] = zoom_level; | |
2389 #endif | |
2390 } | |
2391 | |
2392 void RenderViewImpl::OnSetZoomLevel( | 2375 void RenderViewImpl::OnSetZoomLevel( |
2393 PageMsg_SetZoomLevel_Command command, | 2376 PageMsg_SetZoomLevel_Command command, |
2394 double zoom_level) { | 2377 double zoom_level) { |
2395 switch (command) { | 2378 switch (command) { |
2396 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: | 2379 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: |
2397 uses_temporary_zoom_level_ = false; | 2380 uses_temporary_zoom_level_ = false; |
2398 break; | 2381 break; |
2399 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: | 2382 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: |
2400 uses_temporary_zoom_level_ = true; | 2383 uses_temporary_zoom_level_ = true; |
2401 break; | 2384 break; |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 return render_frame->focused_pepper_plugin(); | 3386 return render_frame->focused_pepper_plugin(); |
3404 } | 3387 } |
3405 frame = frame->traverseNext(false); | 3388 frame = frame->traverseNext(false); |
3406 } | 3389 } |
3407 | 3390 |
3408 return nullptr; | 3391 return nullptr; |
3409 } | 3392 } |
3410 #endif | 3393 #endif |
3411 | 3394 |
3412 } // namespace content | 3395 } // namespace content |
OLD | NEW |