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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 1251473003: Add WebView API for smoothScroll (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Provide default empty implementation on the api 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
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebView.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 float scale; 2867 float scale;
2868 IntPoint scroll; 2868 IntPoint scroll;
2869 bool needAnimation; 2869 bool needAnimation;
2870 computeScaleAndScrollForFocusedNode(element, zoomInToLegibleScale, scale, sc roll, needAnimation); 2870 computeScaleAndScrollForFocusedNode(element, zoomInToLegibleScale, scale, sc roll, needAnimation);
2871 if (needAnimation) 2871 if (needAnimation)
2872 return startPageScaleAnimation(scroll, false, scale, scrollAndScaleAnima tionDurationInSeconds); 2872 return startPageScaleAnimation(scroll, false, scale, scrollAndScaleAnima tionDurationInSeconds);
2873 2873
2874 return false; 2874 return false;
2875 } 2875 }
2876 2876
2877 void WebViewImpl::smoothScroll(int targetX, int targetY, long durationMs)
2878 {
2879 LocalFrame* frame = page()->mainFrame() && page()->mainFrame()->isLocalFrame ()
dcheng 2015/07/28 18:50:14 Who calls this? Will this be covered by a test on
aelias_OOO_until_Jul13 2015/07/28 19:00:21 Actually, why is this code here at all? The code
hush (inactive) 2015/07/28 19:18:11 I was copying the logic of WebViewImpl::scrollFocu
2880 ? page()->deprecatedLocalMainFrame() : 0;
2881 if (!frame || !frame->view())
2882 return;
2883
2884 IntPoint targetPosition(targetX, targetY);
2885 startPageScaleAnimation(targetPosition, false, pageScaleFactor(), (double)du rationMs / 1000);
2886 }
2887
2877 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zo omInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation) 2888 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zo omInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation)
2878 { 2889 {
2879 focusedNode->document().updateLayoutIgnorePendingStylesheets(); 2890 focusedNode->document().updateLayoutIgnorePendingStylesheets();
2880 2891
2881 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 2892 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
2882 2893
2883 WebRect caretInViewport, unusedEnd; 2894 WebRect caretInViewport, unusedEnd;
2884 selectionBounds(caretInViewport, unusedEnd); 2895 selectionBounds(caretInViewport, unusedEnd);
2885 2896
2886 // 'caretInDocument' is rect encompassing the blinking cursor relative to th e root document. 2897 // 'caretInDocument' is rect encompassing the blinking cursor relative to th e root document.
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
4420 { 4431 {
4421 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4432 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4422 } 4433 }
4423 4434
4424 void WebViewImpl::forceNextDrawingBufferCreationToFail() 4435 void WebViewImpl::forceNextDrawingBufferCreationToFail()
4425 { 4436 {
4426 DrawingBuffer::forceNextDrawingBufferCreationToFail(); 4437 DrawingBuffer::forceNextDrawingBufferCreationToFail();
4427 } 4438 }
4428 4439
4429 } // namespace blink 4440 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698