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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 1716653002: Implement OverlayPanels as SceneOverlays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prevent native call in test Created 4 years, 7 months 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
« no previous file with comments | « chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698