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

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: Use page scale animation Created 5 years, 5 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 /* 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 2840 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 float scale; 2851 float scale;
2852 IntPoint scroll; 2852 IntPoint scroll;
2853 bool needAnimation; 2853 bool needAnimation;
2854 computeScaleAndScrollForFocusedNode(element, zoomInToLegibleScale, scale, sc roll, needAnimation); 2854 computeScaleAndScrollForFocusedNode(element, zoomInToLegibleScale, scale, sc roll, needAnimation);
2855 if (needAnimation) 2855 if (needAnimation)
2856 return startPageScaleAnimation(scroll, false, scale, scrollAndScaleAnima tionDurationInSeconds); 2856 return startPageScaleAnimation(scroll, false, scale, scrollAndScaleAnima tionDurationInSeconds);
2857 2857
2858 return false; 2858 return false;
2859 } 2859 }
2860 2860
2861 void WebViewImpl::smoothScroll(int targetX, int targetY, long durationMs)
2862 {
2863 LocalFrame* frame = page()->mainFrame() && page()->mainFrame()->isLocalFrame ()
2864 ? page()->deprecatedLocalMainFrame() : 0;
2865 if (!frame || !frame->view())
2866 return;
2867
2868 IntPoint targetPosition(targetX, targetY);
2869 startPageScaleAnimation(targetPosition, false, pageScaleFactor(), (double)du rationMs / 1000);
2870 }
2871
2861 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zo omInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation) 2872 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zo omInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation)
2862 { 2873 {
2863 focusedNode->document().updateLayoutIgnorePendingStylesheets(); 2874 focusedNode->document().updateLayoutIgnorePendingStylesheets();
2864 2875
2865 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 2876 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
2866 2877
2867 WebRect caretInViewport, unusedEnd; 2878 WebRect caretInViewport, unusedEnd;
2868 selectionBounds(caretInViewport, unusedEnd); 2879 selectionBounds(caretInViewport, unusedEnd);
2869 2880
2870 // 'caretInDocument' is rect encompassing the blinking cursor relative to th e root document. 2881 // 'caretInDocument' is rect encompassing the blinking cursor relative to th e root document.
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 { 4396 {
4386 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4397 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4387 } 4398 }
4388 4399
4389 void WebViewImpl::forceNextDrawingBufferCreationToFail() 4400 void WebViewImpl::forceNextDrawingBufferCreationToFail()
4390 { 4401 {
4391 DrawingBuffer::forceNextDrawingBufferCreationToFail(); 4402 DrawingBuffer::forceNextDrawingBufferCreationToFail();
4392 } 4403 }
4393 4404
4394 } // namespace blink 4405 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebView.h » ('j') | public/web/WebView.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698