Chromium Code Reviews| 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 |