Remove unnecessary menu items (Emoji, Look Up, AutoFill) from Omnibox context menu
Moderate
提交哈希:
e9141f474b694a00a3a97e31aaec72b7714511c2
提交时间: 2026-05-18 18:26:20
影响等级: Moderate
生成工具: chromium-watcher
上游审核链接:
查看上游审核 🔗
📋 摘要
This commit removes Emoji, writing direction, Look Up, and AutoFill menu items from the Omnibox context menu as part of the Chrome "Menu Simplification" (GlowUp) feature. It introduces new virtual methods — SupportsEmoji(), SupportsLookUp(), SupportsEditableContextMenuItems(), and SupportsAutoFill() — on the Textfield and TextInputClient base classes. OmniboxViewViews overrides these to return false when kMenuSimplification is enabled, so menu construction skips those items. Additionally, text_input_host.mm's HasInputContext() is modified to return no input context when the TextInputClient does not support AutoFill and an active Cocoa menu is present, preventing macOS from injecting AutoFill items.
🎯 影响分析
This commit has moderate impact on WebView2Mac. The critical change is in ui/views/cocoa/text_input_host.mm's HasInputContext() method — a core component of the Remote Cocoa text input path that WebView2Mac's TextInputHost shares.
Specific impacts on WebView2Mac:
1. The text_input_host.mm change directly affects WebView2Mac text input behavior, since WebView2's HostingNSWindowBridge shares this code path. The new condition calls SupportsAutoFill() on the pending TextInputClient and checks for active Cocoa menus, potentially changing when input context is disabled.
2. ui::TextInputClient gains a new virtual method SupportsAutoFill() (defaulting to true) — a base class change inherited by all implementors including WebView2's text input clients.
3. Textfield base class gains new virtual methods SupportsEmoji(), SupportsLookUp(), and SupportsEditableContextMenuItems(), which may affect Textfield subclasses used within WebView2.
4. Changes to views_text_services_context_menu_mac.mm and views_text_services_context_menu_base.cc affect all components using Views text services context menus, including text input controls in WebView2.
The downstream Edge code does not yet have these new methods. However, since all defaults preserve backward-compatible behavior (returning true), there should be no behavioral change unless kMenuSimplification is explicitly enabled. Merge conflicts in text_input_host.mm are possible given the modified conditional logic.
Specific impacts on WebView2Mac:
1. The text_input_host.mm change directly affects WebView2Mac text input behavior, since WebView2's HostingNSWindowBridge shares this code path. The new condition calls SupportsAutoFill() on the pending TextInputClient and checks for active Cocoa menus, potentially changing when input context is disabled.
2. ui::TextInputClient gains a new virtual method SupportsAutoFill() (defaulting to true) — a base class change inherited by all implementors including WebView2's text input clients.
3. Textfield base class gains new virtual methods SupportsEmoji(), SupportsLookUp(), and SupportsEditableContextMenuItems(), which may affect Textfield subclasses used within WebView2.
4. Changes to views_text_services_context_menu_mac.mm and views_text_services_context_menu_base.cc affect all components using Views text services context menus, including text input controls in WebView2.
The downstream Edge code does not yet have these new methods. However, since all defaults preserve backward-compatible behavior (returning true), there should be no behavioral change unless kMenuSimplification is explicitly enabled. Merge conflicts in text_input_host.mm are possible given the modified conditional logic.
受影响的类:
ui::TextInputClient
views::TextInputHost
views::Textfield
views::ViewsTextServicesContextMenuMac
views::ViewsTextServicesContextMenuBase
OmniboxViewViews