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

Side by Side 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, 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/web_contents/web_contents_android.h" 5 #include "content/browser/web_contents/web_contents_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 void WebContentsAndroid::ScrollFocusedEditableNodeIntoView( 386 void WebContentsAndroid::ScrollFocusedEditableNodeIntoView(
387 JNIEnv* env, 387 JNIEnv* env,
388 jobject obj) { 388 jobject obj) {
389 RenderViewHost* host = web_contents_->GetRenderViewHost(); 389 RenderViewHost* host = web_contents_->GetRenderViewHost();
390 if (!host) 390 if (!host)
391 return; 391 return;
392 host->Send(new InputMsg_ScrollFocusedEditableNodeIntoRect( 392 host->Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(
393 host->GetRoutingID(), gfx::Rect())); 393 host->GetRoutingID(), gfx::Rect()));
394 } 394 }
395 395
396 void WebContentsAndroid::SmoothScroll(JNIEnv* env,
397 jobject obj,
398 jint target_x,
399 jint target_y,
400 jlong duration_ms) {
401 RenderViewHost* host = web_contents_->GetRenderViewHost();
402 if (!host)
403 return;
404
405 ContentViewCoreImpl* contentViewCore =
406 ContentViewCoreImpl::FromWebContents(web_contents_);
407 float scale_factor = contentViewCore->GetScaleFactor();
408 host->Send(new InputMsg_SmoothScroll(host->GetRoutingID(),
409 target_x / scale_factor,
410 target_y / scale_factor, duration_ms));
411 }
412
396 void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) { 413 void WebContentsAndroid::SelectWordAroundCaret(JNIEnv* env, jobject obj) {
397 RenderViewHost* host = web_contents_->GetRenderViewHost(); 414 RenderViewHost* host = web_contents_->GetRenderViewHost();
398 if (!host) 415 if (!host)
399 return; 416 return;
400 host->SelectWordAroundCaret(); 417 host->SelectWordAroundCaret();
401 } 418 }
402 419
403 void WebContentsAndroid::AdjustSelectionByCharacterOffset(JNIEnv* env, 420 void WebContentsAndroid::AdjustSelectionByCharacterOffset(JNIEnv* env,
404 jobject obj, 421 jobject obj,
405 jint start_adjust, 422 jint start_adjust,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 534
518 void WebContentsAndroid::ResumeMediaSession(JNIEnv* env, jobject obj) { 535 void WebContentsAndroid::ResumeMediaSession(JNIEnv* env, jobject obj) {
519 web_contents_->ResumeMediaSession(); 536 web_contents_->ResumeMediaSession();
520 } 537 }
521 538
522 void WebContentsAndroid::SuspendMediaSession(JNIEnv* env, jobject obj) { 539 void WebContentsAndroid::SuspendMediaSession(JNIEnv* env, jobject obj) {
523 web_contents_->SuspendMediaSession(); 540 web_contents_->SuspendMediaSession();
524 } 541 }
525 542
526 } // namespace content 543 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698