Chromium Code Reviews| 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 8d9c66e4913e7dbcb70f356c1bf969a0af14d8e1..c410296aec18b34d8d5862a768232070642119db 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 |
| @@ -196,12 +196,13 @@ public class SelectionPopupController extends ActionModeCallbackHelper { |
| // Just refreshes the view if it is already showing. |
| if (isActionModeValid()) { |
| - invalidateActionMode(); |
| - return true; |
| - } |
| - |
| - if (mView.getParent() != null) { |
| - // On ICS, startActionMode throws an NPE when getParent() is null. |
| + // 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); |
| + } |
| + } else { |
| assert mWebContents != null; |
| ActionMode actionMode = supportsFloatingActionMode() |
| ? startFloatingActionMode() |
| @@ -212,6 +213,7 @@ public class SelectionPopupController extends ActionModeCallbackHelper { |
| } |
| mActionMode = actionMode; |
| } |
| + hideActionMode(false); |
|
Tima Vaisburd
2017/03/28 02:54:42
Can the action mode be hidden (i.e. mHidden == tru
boliu
2017/03/28 17:09:19
So only SELECTION_HANDLES_SHOWN can fall into inva
Tima Vaisburd
2017/03/28 17:39:52
Action mode can be hidden, but it should exist.
I
boliu
2017/03/28 17:44:12
Oh, ok. Yeah I got confused, old code in invalidat
amaralp
2017/03/28 18:15:08
The only times mHidden is set to true is when a sc
|
| mUnselectAllOnDismiss = true; |
|
Jinsuk Kim
2017/03/28 02:19:59
|mUnselectAllOnDismiss| gets turned on but didn't
boliu
2017/03/28 17:09:19
Looks ok, it would have already been false in the
amaralp
2017/03/28 18:15:08
It would have been already false. Also I've change
|
| return isActionModeValid(); |
| } |
| @@ -297,28 +299,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); |
| - mPendingInvalidateContentRect = false; |
| - } |
| - |
| - // 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() { |