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

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

Issue 2774423003: Removing invalidateActionMode (Closed)
Patch Set: only unhide for invalidate Created 3 years, 9 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: content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
index f992a243f5afdc511bb038a0f0ce1dd264618ae7..850fc3db64ff81b904b888127e7a4823b34196ab 100644
--- a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
@@ -195,22 +195,24 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
// Just refreshes the view if it is already showing.
if (isActionModeValid()) {
- invalidateActionMode();
+ // Try/catch necessary for framework bug, crbug.com/446717.
+ try {
+ mActionMode.invalidate();
+ } catch (NullPointerException e) {
+ Log.w(TAG, "Ignoring NPE from ActionMode.invalidate() as workaround for L", e);
+ }
+ hideActionMode(false);
return true;
}
-
- if (mView.getParent() != null) {
- // On ICS, startActionMode throws an NPE when getParent() is null.
- assert mWebContents != null;
- ActionMode actionMode = supportsFloatingActionMode()
- ? startFloatingActionMode()
- : mView.startActionMode(mCallback);
- if (actionMode != null) {
- // This is to work around an LGE email issue. See crbug.com/651706 for more details.
- LGEmailActionModeWorkaround.runIfNecessary(mContext, actionMode);
- }
- mActionMode = actionMode;
+ assert mWebContents != null;
+ ActionMode actionMode = supportsFloatingActionMode()
+ ? startFloatingActionMode()
+ : mView.startActionMode(mCallback);
+ if (actionMode != null) {
+ // This is to work around an LGE email issue. See crbug.com/651706 for more details.
+ LGEmailActionModeWorkaround.runIfNecessary(mContext, actionMode);
}
+ mActionMode = actionMode;
mUnselectAllOnDismiss = true;
return isActionModeValid();
}
@@ -296,27 +298,6 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
}
/**
- * @see ActionMode#invalidate()
- * Note that invalidation will also reset visibility state. The caller
- * should account for this when making subsequent visibility updates.
- */
- private void invalidateActionMode() {
- if (!isActionModeValid()) return;
- if (mHidden) {
- assert canHideActionMode();
- mHidden = false;
- mView.removeCallbacks(mRepeatingHideRunnable);
- }
-
- // Try/catch necessary for framework bug, crbug.com/446717.
- try {
- mActionMode.invalidate();
- } catch (NullPointerException e) {
- Log.w(TAG, "Ignoring NPE from ActionMode.invalidate() as workaround for L", e);
- }
- }
-
- /**
* @see ActionMode#invalidateContentRect()
*/
public void invalidateContentRect() {
« 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