Ignore text replacement operations across input type changes
Minor
提交哈希:
bf5802127a56e47588aa504ec77bea84cd4b5455
提交时间: 2025-05-14 23:45:46+00:00
影响等级: Minor
生成工具: webview2-upstream-sentry
上游审核链接:
查看上游审核 🔗
📋 摘要
This submission modifies the handling mechanism of text replacement callbacks on macOS. The main changes include: replacing the parameter of the text replacement callback method from change counter (changeNumber) to text input type (textInputType), and adding input type validation when executing the text replacement callback. If the text input type at the time of callback creation differs from the current text input type, the text replacement operation is ignored, indicating that the text replacement was prepared for a different text object. Related debugging code has also been removed.
🎯 影响分析
This change has a positive impact on WebView2Mac. Since WebView2Mac supports multiple text input scenarios (such as text boxes, password boxes, search boxes, etc.), users may quickly switch between different types of input fields. This change ensures that text replacement operations (such as autocorrect and autocomplete) are only applied to the correct input types, avoiding issues that could arise from incorrect text replacement. For example, it prevents autocorrect suggestions intended for regular text boxes from being mistakenly applied to password boxes or other types of input fields. This improves the accuracy and user experience of WebView2Mac when handling text input, especially on complex web pages containing multiple different types of input fields.
受影响的类:
RenderWidgetHostViewCocoa