| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| 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 db1ce867ec9be9bd68f576b2c0d9d2c2f8d1080b..e9af227ec12f4dd52f640f0b56a47cf1692a2d16 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
|
| @@ -1508,8 +1508,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| @SuppressWarnings("javadoc")
|
| public void onAttachedToWindow() {
|
| setAccessibilityState(mAccessibilityManager.isEnabled());
|
| - setTextHandlesTemporarilyHidden(false);
|
| - restoreSelectionPopupsIfNecessary();
|
| + updateTextSelectionUI(true);
|
| ScreenOrientationListener.getInstance().addObserver(this, mContext);
|
| GamepadList.onAttachedToWindow(mContext);
|
| mAccessibilityManager.addAccessibilityStateChangeListener(this);
|
| @@ -1517,6 +1516,23 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| }
|
|
|
| /**
|
| + * Update the text selection UI depending on the focus of the page. This will hide the selection
|
| + * handles and selection popups if focus is lost.
|
| + * TODO(mdjones): This was added as a temporary measure to hide text UI while Reader Mode or
|
| + * Contextual Search are showing. This should be removed in favor of proper focusing of the
|
| + * panel's ContentViewCore (which is currently not being added to the view hierarchy).
|
| + * @param focused If the ContentViewCore currently has focus.
|
| + */
|
| + public void updateTextSelectionUI(boolean focused) {
|
| + setTextHandlesTemporarilyHidden(!focused);
|
| + if (focused) {
|
| + restoreSelectionPopupsIfNecessary();
|
| + } else {
|
| + hidePopupsAndPreserveSelection();
|
| + }
|
| + }
|
| +
|
| + /**
|
| * @see View#onDetachedFromWindow()
|
| */
|
| @SuppressWarnings("javadoc")
|
| @@ -1533,8 +1549,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // Override the handle visibility explicitly to address this, but
|
| // preserve the underlying selection for detachment cases like screen
|
| // locking and app switching.
|
| - setTextHandlesTemporarilyHidden(true);
|
| - hidePopupsAndPreserveSelection();
|
| + updateTextSelectionUI(false);
|
| mSystemCaptioningBridge.removeListener(this);
|
| }
|
|
|
|
|