Commit 62774a22 authored by Ramya Nagarajan's avatar Ramya Nagarajan Committed by Commit Bot

[Mac] Restrict Emoji menu item to editable areas.

The menu item is not shown when the context menu is in a non-editable
area. It's also omitted if a misspelling is selected, giving
more prominence to spelling suggestions.

Bug: 830213
Change-Id: I6a75bed3b091313c6dc32580d1c8900d8ab6ef83
Reviewed-on: https://chromium-review.googlesource.com/1008422Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: Ramya Nagarajan <ramyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549978}
parent 49d4be35
...@@ -222,7 +222,7 @@ bool RenderViewContextMenuMac::IsCommandIdChecked(int command_id) const { ...@@ -222,7 +222,7 @@ bool RenderViewContextMenuMac::IsCommandIdChecked(int command_id) const {
bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const { bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const {
switch (command_id) { switch (command_id) {
case IDC_CONTENT_CONTEXT_EMOJI: case IDC_CONTENT_CONTEXT_EMOJI:
return true; return params_.is_editable;
case IDC_CONTENT_CONTEXT_LOOK_UP: case IDC_CONTENT_CONTEXT_LOOK_UP:
return true; return true;
...@@ -346,7 +346,10 @@ void RenderViewContextMenuMac::InitToolkitMenu() { ...@@ -346,7 +346,10 @@ void RenderViewContextMenuMac::InitToolkitMenu() {
menu_model_.InsertSeparatorAt(index++, ui::NORMAL_SEPARATOR); menu_model_.InsertSeparatorAt(index++, ui::NORMAL_SEPARATOR);
} }
if (base::FeatureList::IsEnabled(features::kEnableEmojiContextMenu)) { // The Emoji menu item is available for editable text fields, unless the
// selected text is a misspelling.
if (params_.is_editable && params_.misspelled_word.empty() &&
base::FeatureList::IsEnabled(features::kEnableEmojiContextMenu)) {
// The "Emoji" item is available near the top of the context menu, after // The "Emoji" item is available near the top of the context menu, after
// any "Look Up" of selected text. // any "Look Up" of selected text.
menu_model_.InsertItemWithStringIdAt(index++, IDC_CONTENT_CONTEXT_EMOJI, menu_model_.InsertItemWithStringIdAt(index++, IDC_CONTENT_CONTEXT_EMOJI,
......
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