| 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 0f29638937d97ae92300dc06ee9ef87ebcd6d3f2..0928fb4054199b931d4c9a834cae9c8b18351864 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
|
| @@ -1507,8 +1507,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);
|
| @@ -1516,6 +1515,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")
|
| @@ -1532,8 +1548,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);
|
| }
|
|
|
|
|