Fix text replacement check position to resolve regression issue
Minor
Commit Hash:
20f7c0ec898720267e9d3aaae252edf1551469d5
Commit Time: 2025-05-02 22:17:20+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission primarily fixes a regression in the text replacement functionality caused by http://crrev/c/6299632. The change moves the check of the
_substitutionWasApplied flag and the invocation of dismissCorrectionIndicatorForView: from the end to the beginning of the setTextSelectionText:offset:range: method, and returns early when text replacement is detected as applied. This ensures immediate exit after text replacement is accepted, preventing further processing of potentially conflicting text updates. The change also includes resetting the replacement application state and timely clearing of the error correction indicator.
🎯 Impact Analysis
This change has a Minor level potential impact on WebView2Mac. The modification primarily involves text input and autocorrection functionalities on macOS, which are used in WebView2Mac to handle user text input and editing operations. Specific impacts include: 1) Improved responsiveness and accuracy of text replacement (such as autocorrection, quote replacement, etc.), which may enhance the text editing experience for users in WebView2Mac; 2) Fixed timing issues that could cause abnormal behavior in text replacement functions, ensuring correct execution of replacement operations; 3) More timely management of error correction indicators, which may reduce interface display anomalies. As this is a bug fix rather than a feature change, and specifically optimizes text replacement logic, it will not negatively affect the core rendering and interaction functionalities of WebView2Mac, and may instead improve the user experience related to text input.
Impacted Classes:
RenderWidgetHostViewCocoa