Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 1251323002: Plumb smooth scrolling in Chromium compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 while ((observer = it.GetNext()) != NULL) 1334 while ((observer = it.GetNext()) != NULL)
1335 if (observer->OnMessageReceived(message)) 1335 if (observer->OnMessageReceived(message))
1336 return true; 1336 return true;
1337 1337
1338 bool handled = true; 1338 bool handled = true;
1339 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) 1339 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message)
1340 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) 1340 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand)
1341 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) 1341 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret)
1342 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, 1342 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect,
1343 OnScrollFocusedEditableNodeIntoRect) 1343 OnScrollFocusedEditableNodeIntoRect)
1344 IPC_MESSAGE_HANDLER(InputMsg_SmoothScroll, OnSmoothScroll)
1344 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, 1345 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent,
1345 OnSetEditCommandsForNextKeyEvent) 1346 OnSetEditCommandsForNextKeyEvent)
1346 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 1347 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1347 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) 1348 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
1348 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 1349 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
1349 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 1350 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
1350 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale) 1351 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale)
1351 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1352 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1352 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1353 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1353 OnSetZoomLevelForLoadingURL) 1354 OnSetZoomLevelForLoadingURL)
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 if (!element.isNull() && IsEditableNode(element)) { 1485 if (!element.isNull() && IsEditableNode(element)) {
1485 rect_for_scrolled_focused_editable_node_ = rect; 1486 rect_for_scrolled_focused_editable_node_ = rect;
1486 has_scrolled_focused_editable_node_into_rect_ = true; 1487 has_scrolled_focused_editable_node_into_rect_ = true;
1487 will_animate = webview()->scrollFocusedNodeIntoRect(rect); 1488 will_animate = webview()->scrollFocusedNodeIntoRect(rect);
1488 } 1489 }
1489 1490
1490 if (!will_animate) 1491 if (!will_animate)
1491 FocusChangeComplete(); 1492 FocusChangeComplete();
1492 } 1493 }
1493 1494
1495 void RenderViewImpl::OnSmoothScroll(int target_x,
1496 int target_y,
1497 long duration_ms) {
1498 if (!webview())
1499 return;
1500 webview()->smoothScroll(target_x, target_y, duration_ms);
1501 }
1502
1494 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( 1503 void RenderViewImpl::OnSetEditCommandsForNextKeyEvent(
1495 const EditCommands& edit_commands) { 1504 const EditCommands& edit_commands) {
1496 edit_commands_ = edit_commands; 1505 edit_commands_ = edit_commands;
1497 } 1506 }
1498 1507
1499 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset, 1508 void RenderViewImpl::OnSetHistoryOffsetAndLength(int history_offset,
1500 int history_length) { 1509 int history_length) {
1501 DCHECK_GE(history_offset, -1); 1510 DCHECK_GE(history_offset, -1);
1502 DCHECK_GE(history_length, 0); 1511 DCHECK_GE(history_length, 0);
1503 1512
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3824 std::vector<gfx::Size> sizes; 3833 std::vector<gfx::Size> sizes;
3825 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3834 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3826 if (!url.isEmpty()) 3835 if (!url.isEmpty())
3827 urls.push_back( 3836 urls.push_back(
3828 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3837 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3829 } 3838 }
3830 SendUpdateFaviconURL(urls); 3839 SendUpdateFaviconURL(urls);
3831 } 3840 }
3832 3841
3833 } // namespace content 3842 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698