From ced57b7200475da7fb6600a99c4380777ce039bc Mon Sep 17 00:00:00 2001 From: Ben Murdoch <benm@google.com> Date: Wed, 12 Nov 2014 18:48:37 +0000 Subject: [PATCH] Cherry pick [Android] Support unfocusable container views. This solves the S-Pen selection problem for GMail in M37. Bug: 18066784,18726212 Original change description: If the ContentViewCore container view is not focusable (which can happen when it's emebedded in an app via android webview), we were clearing the RWHVA notion of focus when the RenderView was swapped out. As the view is never focusable again, chromium never considers this view focused and as such, text selection did not function. We support this type of container view by always treating it focused from Chromium's point of view. BUG=430859 (internal b/18066784) Change-Id: If08372c93ff0c87b483f0b408f04247764db2c56 Committed: https://crrev.com/9074d9fc9119ef4d2223f6c993d1a1b67a0bea7c Cr-Commit-Position: refs/heads/master@{#303071} (cherry picked from commit f66cc3b6f091903a97b577e413da0c2acd80d3b7) --- .../src/org/chromium/content/browser/ContentViewCore.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index 12c3d07420..58d2f94601 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java @@ -2613,7 +2613,10 @@ public class ContentViewCore * @see View#hasFocus() */ @CalledByNative - public boolean hasFocus() { + private boolean hasFocus() { + // If the container view is not focusable, we consider it always focused from + // Chromium's point of view. + if (!mContainerView.isFocusable()) return true; return mContainerView.hasFocus(); } -- GitLab