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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 0ea604cb6c51abeec3a85071eff36d4bd5fe839b..2130358c79eff70f0bafd0534ff92cf632146b1a 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -2858,6 +2858,17 @@ bool WebViewImpl::scrollFocusedNodeIntoRect(const WebRect& rectInViewport)
return false;
}
+void WebViewImpl::smoothScroll(int targetX, int targetY, long durationMs)
+{
+ LocalFrame* frame = page()->mainFrame() && page()->mainFrame()->isLocalFrame()
+ ? page()->deprecatedLocalMainFrame() : 0;
+ if (!frame || !frame->view())
+ return;
+
+ IntPoint targetPosition(targetX, targetY);
+ startPageScaleAnimation(targetPosition, false, pageScaleFactor(), (double)durationMs / 1000);
+}
+
void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, bool zoomInToLegibleScale, float& newScale, IntPoint& newScroll, bool& needAnimation)
{
focusedNode->document().updateLayoutIgnorePendingStylesheets();
« 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