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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 701233002: [Android] Support unfocusable container views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 9aa69cdf7daa3a7578068240ec0373366ffd46e7..ba9ca49d42242219337c53e626c4c9424a23792e 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -581,6 +581,14 @@ bool ContentViewCoreImpl::HasFocus() {
return Java_ContentViewCore_hasFocus(env, obj.obj());
}
+bool ContentViewCoreImpl::IsFocusable() {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
+ if (obj.is_null())
+ return false;
+ return Java_ContentViewCore_isFocusable(env, obj.obj());
+}
+
void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
@@ -839,6 +847,11 @@ void ContentViewCoreImpl::SetFocusInternal(bool focused) {
if (!GetRenderWidgetHostViewAndroid())
return;
+ if (!IsFocusable()) {
+ LOG(WARN) << "Unfocusable container view, treating as always focused.";
jdduke (slow) 2014/11/05 21:20:31 Hmm, we know that this condition exists, will the
+ focused = true;
+ }
+
if (focused)
GetRenderWidgetHostViewAndroid()->Focus();
else

Powered by Google App Engine
This is Rietveld 408576698