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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java

Issue 2146743002: Remove focus from base page when OverlayPanel open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
index b34157c0244179616c4050baa283a3a5794f0335..5dd539b41b8c70c30f94cba53db9474aa5c77fa7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
@@ -297,8 +297,9 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
}
/**
- * Set the visibility of the base page text selection controls.
- * TODO(mdjones): This should be replaced be focusing the panel's ContentViewCore.
+ * Set the visibility of the base page text selection controls. This will also attempt to
+ * remove focus from the base page to clear any open controls.
+ * TODO(mdjones): This should be replaced with focusing the panel's ContentViewCore.
* @param visible If the text controls are visible.
*/
protected void setBasePageTextControlsVisibility(boolean visible) {
@@ -308,10 +309,16 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
if (baseContentView == null) return;
// If the panel does not have focus or isn't open, return.
- if (isPanelOpened() && mDidClearTextControls && visible) return;
- if (!isPanelOpened() && !mDidClearTextControls && !visible) return;
+ if (isPanelOpened() && mDidClearTextControls && !visible) return;
+ if (!isPanelOpened() && !mDidClearTextControls && visible) return;
mDidClearTextControls = !visible;
+
+ if (!visible) {
+ baseContentView.preserveSelectionOnNextLossOfFocus();
+ baseContentView.getContainerView().clearFocus();
+ }
+
baseContentView.updateTextSelectionUI(visible);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698