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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 1251323002: Plumb smooth scrolling in Chromium compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 5 years, 3 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 | « android_webview/native/aw_contents.h ('k') | android_webview/renderer/aw_render_view_ext.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 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 void AwContents::SetDipScaleInternal(float dip_scale) { 1060 void AwContents::SetDipScaleInternal(float dip_scale) {
1061 browser_view_renderer_.SetDipScale(dip_scale); 1061 browser_view_renderer_.SetDipScale(dip_scale);
1062 } 1062 }
1063 1063
1064 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint x, jint y) { 1064 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint x, jint y) {
1065 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1065 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1066 browser_view_renderer_.ScrollTo(gfx::Vector2d(x, y)); 1066 browser_view_renderer_.ScrollTo(gfx::Vector2d(x, y));
1067 } 1067 }
1068 1068
1069 void AwContents::SmoothScroll(JNIEnv* env,
1070 jobject obj,
1071 jint target_x,
1072 jint target_y,
1073 jlong duration_ms) {
1074 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1075
1076 float scale = browser_view_renderer_.dip_scale() *
1077 browser_view_renderer_.page_scale_factor();
1078 render_view_host_ext_->SmoothScroll(target_x / scale, target_y / scale,
1079 duration_ms);
1080 }
1081
1069 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) { 1082 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) {
1070 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1083 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1071 JNIEnv* env = AttachCurrentThread(); 1084 JNIEnv* env = AttachCurrentThread();
1072 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1085 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1073 if (obj.is_null()) 1086 if (obj.is_null())
1074 return; 1087 return;
1075 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(), 1088 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(),
1076 page_scale_factor); 1089 page_scale_factor);
1077 } 1090 }
1078 1091
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 void AwContents::GrantFileSchemeAccesstoChildProcess(JNIEnv* env, jobject obj) { 1226 void AwContents::GrantFileSchemeAccesstoChildProcess(JNIEnv* env, jobject obj) {
1214 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( 1227 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
1215 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); 1228 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme);
1216 } 1229 }
1217 1230
1218 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1231 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1219 g_should_download_favicons = true; 1232 g_should_download_favicons = true;
1220 } 1233 }
1221 1234
1222 } // namespace android_webview 1235 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/renderer/aw_render_view_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698