Commit 31c0e1a6 authored by amaralp's avatar amaralp Committed by Commit bot

Start action mode even if clipboard is empty

Previously clank would not call View#startActionMode for a FloatingPastePopup menu
if the copy/paste clipboard was empty (because there would be nothing in the menu).
This is a problem because apps using WebView may want to add items to the
FloatingPastePopup menu (using startActionMode) even if the clipboard is empty.

This patch makes clank call View#startActionMode and make an empty menu when there
is nothing to paste.

BUG=652916

Review-Url: https://codereview.chromium.org/2443963003
Cr-Commit-Position: refs/heads/master@{#427210}
parent 666fbc65
......@@ -2525,7 +2525,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
return;
}
if (!mHasInsertion || !canPaste()) return;
if (!mHasInsertion || (!supportsFloatingActionMode() && !canPaste())) return;
PastePopupMenu pastePopupMenu = getPastePopup();
if (pastePopupMenu == null) return;
......
......@@ -174,6 +174,10 @@ public class WebActionModeCallback implements ActionMode.Callback {
new MenuInflater(getContext()).inflate(R.menu.select_action_menu, menu);
}
if (!mEditable || !canPaste()) {
menu.removeItem(R.id.select_action_menu_paste);
}
if (mIsInsertion) {
menu.removeItem(R.id.select_action_menu_select_all);
menu.removeItem(R.id.select_action_menu_cut);
......@@ -183,10 +187,6 @@ public class WebActionModeCallback implements ActionMode.Callback {
return;
}
if (!mEditable || !canPaste()) {
menu.removeItem(R.id.select_action_menu_paste);
}
if (!mEditable) {
menu.removeItem(R.id.select_action_menu_cut);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment