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

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: address comments 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 IntPoint targetPosition(targetX, targetY);
2880 startPageScaleAnimation(targetPosition, false, pageScaleFactor(), (double)du rationMs / 1000);
2881 }
2882
2877 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zo omInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation) 2883 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zo omInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation)
2878 { 2884 {
2879 focusedNode->document().updateLayoutIgnorePendingStylesheets(); 2885 focusedNode->document().updateLayoutIgnorePendingStylesheets();
2880 2886
2881 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 2887 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
2882 2888
2883 WebRect caretInViewport, unusedEnd; 2889 WebRect caretInViewport, unusedEnd;
2884 selectionBounds(caretInViewport, unusedEnd); 2890 selectionBounds(caretInViewport, unusedEnd);
2885 2891
2886 // 'caretInDocument' is rect encompassing the blinking cursor relative to th e root document. 2892 // 'caretInDocument' is rect encompassing the blinking cursor relative to th e root document.
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
4415 { 4421 {
4416 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4422 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4417 } 4423 }
4418 4424
4419 void WebViewImpl::forceNextDrawingBufferCreationToFail() 4425 void WebViewImpl::forceNextDrawingBufferCreationToFail()
4420 { 4426 {
4421 DrawingBuffer::forceNextDrawingBufferCreationToFail(); 4427 DrawingBuffer::forceNextDrawingBufferCreationToFail();
4422 } 4428 }
4423 4429
4424 } // namespace blink 4430 } // 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