-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UIA RangeFromPoint API #17695
Fix UIA RangeFromPoint API #17695
Conversation
{ | ||
ScreenToClient(_getWindowHandle(), screenPoint->as_win32_point()); | ||
ScreenToClient(_getWindowHandle(), screenPoint.as_win32_point()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhecker this weirds me out - I think we are writing through the return value of as_win32_point? Is that safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitely less than 3.6 roentgen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(reversion)
This reverts commit 7e26412.
## Summary of the Pull Request Fixes the `RangeFromPoint` API such that we're now properly locking when we attempt to retrieve the viewport data. This also corrects the conversion from `UiaPoint` (screen position) to buffer coordinates (buffer cell). Closes #17579 ## Detailed Description of the Pull Request / Additional comments - `UiaTextRangeBase::Initialize(UiaPoint)`: - reordered logic to clamp to client area first, then begin conversion to buffer coordinates - properly lock when retrieving the viewport data - updated `_TranslatePointToScreen` and `_TranslatePointFromScreen` to use `&` instead of `*` - we weren't properly updating the parameter before - `TermControlUiaTextRange::_TranslatePointFromScreen()` - `includeOffsets` was basically copied over from `_TranslatePointToScreen`. The math itself was straight up wrong since we had to do it backwards. ## Validation Steps Performed ✅ Moved WT to top-left of monitor, then used inspect.exe to call `RangeFromPoint` API when mouse cursor is on top-left buffer cell (also meticulously stepped through the two functions ensuring everything was correct). (cherry picked from commit 7b39d24) Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgSC930 PVTI_lADOAF3p4s4AmhmszgSCpCs Service-Version: 1.21
Summary of the Pull Request
Fixes the
RangeFromPoint
API such that we're now properly locking when we attempt to retrieve the viewport data. This also corrects the conversion fromUiaPoint
(screen position) to buffer coordinates (buffer cell).Closes #17579
Detailed Description of the Pull Request / Additional comments
UiaTextRangeBase::Initialize(UiaPoint)
:_TranslatePointToScreen
and_TranslatePointFromScreen
to use&
instead of*
TermControlUiaTextRange::_TranslatePointFromScreen()
includeOffsets
was basically copied over from_TranslatePointToScreen
. The math itself was straight up wrong since we had to do it backwards.Validation Steps Performed
✅ Moved WT to top-left of monitor, then used inspect.exe to call
RangeFromPoint
API when mouse cursor is on top-left buffer cell (also meticulously stepped through the two functions ensuring everything was correct).