Ignore text replacement operations across input type changes
Minor
Commit Hash:
bf5802127a56e47588aa504ec77bea84cd4b5455
Commit Time: 2025-05-14 23:45:46+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
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.
🎯 Impact Analysis
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.
Impacted Classes:
RenderWidgetHostViewCocoa