Chromium Code Reviews| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2368 zoom_level = static_cast<int>(old_zoom_level + zoom); | 2366 zoom_level = static_cast<int>(old_zoom_level + zoom); |
| 2369 } else { | 2367 } else { |
| 2370 // We're going towards 100%, so first go to the next whole number. | 2368 // We're going towards 100%, so first go to the next whole number. |
| 2371 zoom_level = static_cast<int>(old_zoom_level); | 2369 zoom_level = static_cast<int>(old_zoom_level); |
| 2372 } | 2370 } |
| 2373 } | 2371 } |
| 2374 SetZoomLevel(zoom_level); | 2372 SetZoomLevel(zoom_level); |
| 2375 zoomLevelChanged(); | 2373 zoomLevelChanged(); |
| 2376 } | 2374 } |
| 2377 | 2375 |
| 2378 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | |
| 2379 double zoom_level) { | |
| 2380 // TODO(wjmaclean): We should see if this restriction is really necessary, | |
| 2381 // since it isn't enforced in other parts of the page zoom system (e.g. | |
| 2382 // when a users changes the zoom of a currently displayed page). Android | |
| 2383 // has no UI for this, so in theory the following code would normally just use | |
| 2384 // the default zoom anyways. | |
| 2385 #if !defined(OS_ANDROID) | |
|
jam
2016/05/17 17:20:30
hmm maybe best to keep android behavior same in th
scottmg
2016/05/17 17:36:16
Yeah, I only enabled it because it made the test w
| |
| 2386 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | |
| 2387 // for legacy WebView text scaling emulation. Thus, the code that resets | |
| 2388 // the zoom level from this map will be effectively resetting text zoom level. | |
| 2389 host_zoom_levels_[url] = zoom_level; | |
| 2390 #endif | |
| 2391 } | |
| 2392 | |
| 2393 void RenderViewImpl::OnSetZoomLevel( | 2376 void RenderViewImpl::OnSetZoomLevel( |
| 2394 PageMsg_SetZoomLevel_Command command, | 2377 PageMsg_SetZoomLevel_Command command, |
| 2395 double zoom_level) { | 2378 double zoom_level) { |
| 2396 switch (command) { | 2379 switch (command) { |
| 2397 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: | 2380 case PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY: |
| 2398 uses_temporary_zoom_level_ = false; | 2381 uses_temporary_zoom_level_ = false; |
| 2399 break; | 2382 break; |
| 2400 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: | 2383 case PageMsg_SetZoomLevel_Command::SET_TEMPORARY: |
| 2401 uses_temporary_zoom_level_ = true; | 2384 uses_temporary_zoom_level_ = true; |
| 2402 break; | 2385 break; |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3404 return render_frame->focused_pepper_plugin(); | 3387 return render_frame->focused_pepper_plugin(); |
| 3405 } | 3388 } |
| 3406 frame = frame->traverseNext(false); | 3389 frame = frame->traverseNext(false); |
| 3407 } | 3390 } |
| 3408 | 3391 |
| 3409 return nullptr; | 3392 return nullptr; |
| 3410 } | 3393 } |
| 3411 #endif | 3394 #endif |
| 3412 | 3395 |
| 3413 } // namespace content | 3396 } // namespace content |
| OLD | NEW |