[WebView2] Apply text scale factor to CoreWebView2 content #8540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WebView2 was not accounting for system text scale (OS Settings | Accessibility | Text Size) while the rest of Xaml UI did, resulting in ignored accessibility preference and discrepancy of text size between WV2 and other Xaml content. An additional side effect was that, when text scale is set, WV2 context menus (right-click over web content) were sometimes rendered at wild offsets, showing up completely detached from click point (this usually happened when right-clicking near right/bottom edges of WV2).
Fix this by incorporating UISettings.TextScaleFactor when setting CoreWebView2 scale via ICoreWebView2Controller3::RasterizationScale. Also register for changes to the TextScaleFactor so we can update CoreWebView2 accordingly.