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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 300323005: Route selection bounds updates through the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Defer selection updates until after compositor scheduling Created 6 years, 6 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 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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.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/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { 594 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) {
595 JNIEnv* env = AttachCurrentThread(); 595 JNIEnv* env = AttachCurrentThread();
596 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 596 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
597 if (obj.is_null()) 597 if (obj.is_null())
598 return; 598 return;
599 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text); 599 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text);
600 Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj()); 600 Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj());
601 } 601 }
602 602
603 void ContentViewCoreImpl::OnSelectionBoundsChanged( 603 void ContentViewCoreImpl::OnSelectionBoundsChanged(const gfx::PointF& anchor,
604 const ViewHostMsg_SelectionBounds_Params& params) { 604 const gfx::PointF& focus,
605 int anchor_dir,
606 int focus_dir,
607 bool is_anchor_visible,
608 bool is_focus_visible) {
605 JNIEnv* env = AttachCurrentThread(); 609 JNIEnv* env = AttachCurrentThread();
606 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 610 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
607 if (obj.is_null()) 611 if (obj.is_null())
608 return; 612 return;
609 ScopedJavaLocalRef<jobject> anchor_rect_dip( 613 Java_ContentViewCore_onSelectionBoundsChanged(env,
610 CreateJavaRect(env, params.anchor_rect)); 614 obj.obj(),
611 ScopedJavaLocalRef<jobject> focus_rect_dip( 615 anchor.x(),
612 CreateJavaRect(env, params.focus_rect)); 616 anchor.y(),
613 Java_ContentViewCore_onSelectionBoundsChanged(env, obj.obj(), 617 focus.x(),
614 anchor_rect_dip.obj(), 618 focus.y(),
615 params.anchor_dir, 619 anchor_dir,
616 focus_rect_dip.obj(), 620 focus_dir,
617 params.focus_dir, 621 is_anchor_visible,
618 params.is_anchor_first); 622 is_focus_visible);
619 } 623 }
620 624
621 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { 625 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) {
622 JNIEnv* env = AttachCurrentThread(); 626 JNIEnv* env = AttachCurrentThread();
623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 627 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
624 if (obj.is_null()) 628 if (obj.is_null())
625 return; 629 return;
626 Java_ContentViewCore_showPastePopup(env, obj.obj(), 630 Java_ContentViewCore_showPastePopup(env, obj.obj(),
627 static_cast<jint>(x_dip), 631 static_cast<jint>(x_dip),
628 static_cast<jint>(y_dip)); 632 static_cast<jint>(y_dip));
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 reinterpret_cast<ui::WindowAndroid*>(window_android), 1636 reinterpret_cast<ui::WindowAndroid*>(window_android),
1633 retained_objects_set); 1637 retained_objects_set);
1634 return reinterpret_cast<intptr_t>(view); 1638 return reinterpret_cast<intptr_t>(view);
1635 } 1639 }
1636 1640
1637 bool RegisterContentViewCore(JNIEnv* env) { 1641 bool RegisterContentViewCore(JNIEnv* env) {
1638 return RegisterNativesImpl(env); 1642 return RegisterNativesImpl(env);
1639 } 1643 }
1640 1644
1641 } // namespace content 1645 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698