[PR #2423] [MERGED] Accessibility: Add BoundingRects to UiaTextRanges #24925

Open
opened 2026-01-31 09:06:08 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2423
Author: @carlos-zamora
Created: 8/13/2019
Status: Merged
Merged: 8/21/2019
Merged by: @DHowett-MSFT

Base: masterHead: dev/cazamor/acc-prov/utr-rects


📝 Commits (5)

📊 Changes

9 files changed (+70 additions, -9 deletions)

View changed files

📝 src/cascadia/TerminalControl/TermControl.cpp (+10 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -0)
📝 src/cascadia/TerminalControl/TermControlAutomationPeer.cpp (+1 -1)
📝 src/cascadia/TerminalControl/TermControlUiaProvider.cpp (+15 -3)
📝 src/cascadia/TerminalControl/TermControlUiaProvider.hpp (+10 -1)
📝 src/cascadia/TerminalControl/UiaTextRange.cpp (+29 -2)
📝 src/cascadia/TerminalControl/UiaTextRange.hpp (+1 -0)
📝 src/types/UiaTextRangeBase.cpp (+1 -1)
📝 src/types/UiaTextRangeBase.hpp (+1 -1)

📄 Description

Summary of the Pull Request

Add the visible rectangle indicators to text ranges. They are now sized appropriately and are located in their correct position. This supports panes, and makes them fairly accessible to use.

References

🚨 Target branch is "Refactor Accessibility Providers" #2414

PR Checklist

Detailed Description of the Pull Request / Additional comments

Thanks to that refactoring, this code is fairly easy to read. There are a few additional refactoring changes throughout this commit.

The core of these changes are in UiaTextRange::_TranslatePointToScreen(). This is where we translate the RECTs to the correct size and position.

  • Size: we needed the current font size. Acquired through ScreenInfoUiaProvider --> TermControl
    • 🚨 NOTE: using IRenderData's is incorrect because Terminal has a fake one there.
  • Position:
    • using ScreenInfoUiaProvider's get_BoundingRectangle to leverage XAML's knowledge of where we are on the screen
      • XAML already uses this function to create a box around the TerminalControl. Let's just borrow that.
    • using TermControl's padding value to adjust even further.

Validation Steps Performed

  1. Create various panes
  2. Make one of the panes have default font size, another with larger, and another with smaller
  3. For each pane, use inspect.exe to test as follows:
    1. get document range
    2. do bounding rects align properly with the text ✔
    3. create a selection
    4. get selection range
    5. do bounding rects align properly with the selection ✔
  4. verify that each pane creates bounding rects of different sizes for the text.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2423 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 8/13/2019 **Status:** ✅ Merged **Merged:** 8/21/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/cazamor/acc-prov/utr-rects` --- ### 📝 Commits (5) - [`1d8db6f`](https://github.com/microsoft/terminal/commit/1d8db6f37872447e6b2616819b278ee3b1f27255) Correct bounding rect size for UTRs - [`2e73134`](https://github.com/microsoft/terminal/commit/2e73134b6dce1ebc8394b6f4f0c669c8647c44f1) Correct bounding rect location for UTRs - [`5ab6ee4`](https://github.com/microsoft/terminal/commit/5ab6ee4cd2268f2563263bc8cebfe83726b4ee8b) PR Changes. - [`ca2deec`](https://github.com/microsoft/terminal/commit/ca2deecf3868ecc0516d9355a4ec2e207e91cfe8) Fix merge issue - [`d1d7ae8`](https://github.com/microsoft/terminal/commit/d1d7ae8cdc67a7efc410e0d448047002c48fb788) Make life easier for Carlos ### 📊 Changes **9 files changed** (+70 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+10 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControlAutomationPeer.cpp` (+1 -1) 📝 `src/cascadia/TerminalControl/TermControlUiaProvider.cpp` (+15 -3) 📝 `src/cascadia/TerminalControl/TermControlUiaProvider.hpp` (+10 -1) 📝 `src/cascadia/TerminalControl/UiaTextRange.cpp` (+29 -2) 📝 `src/cascadia/TerminalControl/UiaTextRange.hpp` (+1 -0) 📝 `src/types/UiaTextRangeBase.cpp` (+1 -1) 📝 `src/types/UiaTextRangeBase.hpp` (+1 -1) </details> ### 📄 Description ## Summary of the Pull Request Add the visible rectangle indicators to text ranges. They are now sized appropriately and are located in their correct position. This supports panes, and makes them fairly accessible to use. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References 🚨 Target branch is "Refactor Accessibility Providers" #2414 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #2103 * [x] CLA signed. * [x] ~Tests added/passed~ * [x] ~Requires documentation to be updated~ * [x] I am a core contributor. ## Detailed Description of the Pull Request / Additional comments Thanks to that refactoring, this code is fairly easy to read. There are a few additional refactoring changes throughout this commit. The core of these changes are in `UiaTextRange::_TranslatePointToScreen()`. This is where we translate the RECTs to the correct size and position. - Size: we needed the current font size. Acquired through `ScreenInfoUiaProvider` --> `TermControl` - 🚨 NOTE: using `IRenderData`'s is incorrect because Terminal has a fake one there. - Position: - using `ScreenInfoUiaProvider`'s `get_BoundingRectangle` to leverage XAML's knowledge of where we are on the screen - XAML already uses this function to create a box around the TerminalControl. Let's just borrow that. - using `TermControl`'s `padding` value to adjust even further. ## Validation Steps Performed 1. Create various panes 2. Make one of the panes have default font size, another with larger, and another with smaller 3. For each pane, use inspect.exe to test as follows: 1. get document range 2. do bounding rects align properly with the text ✔ 3. create a selection 4. get selection range 5. do bounding rects align properly with the selection ✔ 4. verify that each pane creates bounding rects of different sizes for the text. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:06:08 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24925