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

Unified Diff: content/browser/web_contents/web_contents_android.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, 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: content/browser/web_contents/web_contents_android.cc
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc
index 8fd5c506a2dfb263920e9538108c22af5985d837..bcd2b56d28fbd008254afb96ba140b77b23959ad 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -393,6 +393,23 @@ void WebContentsAndroid::ScrollFocusedEditableNodeIntoView(
host->GetRoutingID(), gfx::Rect()));
}
+void WebContentsAndroid::SmoothScroll(JNIEnv* env,
+ jobject obj,
+ jint target_x,
+ jint target_y,
+ jlong duration_ms) {
+ RenderViewHost* host = web_contents_->GetRenderViewHost();
+ if (!host)
+ return;
+
+ ContentViewCoreImpl* contentViewCore =
+ ContentViewCoreImpl::FromWebContents(web_contents_);
+ float scale_factor = contentViewCore->GetScaleFactor();
+ host->Send(new InputMsg_SmoothScroll(host->GetRoutingID(),
+ target_x / scale_factor,
+ target_y / scale_factor, duration_ms));
+}
+
void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) {
RenderViewHost* host = web_contents_->GetRenderViewHost();
if (!host)

Powered by Google App Engine
This is Rietveld 408576698