Skip to content

Remove FakeEmbeddingTextInfo which is no longer necessary.#16768

Merged
SaschaCowley merged 4 commits into
nvaccess:masterfrom
jcsteh:rmFakeEmbed
Sep 5, 2024
Merged

Remove FakeEmbeddingTextInfo which is no longer necessary.#16768
SaschaCowley merged 4 commits into
nvaccess:masterfrom
jcsteh:rmFakeEmbed

Conversation

@jcsteh

@jcsteh jcsteh commented Jun 29, 2024

Copy link
Copy Markdown
Contributor

Link to issue number:

None.

Summary of the issue:

ia2TextMozilla.FakeEmbeddingTextInfo was necessary when Firefox didn't support IAccessibleText on tables and table rows. However, that was fixed 6 years ago in Mozilla bug 1052866. Now, this NVDA code is never used.

Description of user facing changes

None. I have not included a change log entry because this is purely code cleanup and has no impact for users or add-on developers.

Description of development approach

Removed the code.

Note that this code mentions a hack for Mozilla bug 1169238. That hack couldn't have worked once Mozilla bug 1052866 was fixed because we never would have used FakeEmbeddingTextInfo after that. Regardless, Mozilla bug 1169238 was fixed over a year ago and that fix is available in all supported versions of Firefox.

Testing strategy:

Test case:
data:text/html,<button>Before</button><div contentEditable="true">foo<table><tr><th>1</th><td>2</td></tr></table>bar</div>

In both Firefox and Chrome (results the same before and after this PR):

  1. Opened the test case.
  2. Focused the editor.
  3. Pressed control+a. Verified that NVDA reported "foo 12 bar selected".
  4. Selected just the last "o" and "1". Used NVDA's report selection command and verified that NVDA reported "o 1 selected".
  5. Selected just "1" and "2". Used NVDA's report selection command and verified that NVDA reported "12 selected".
  6. Selected just "2" and "b". Used NVDA's report selection command and verified that NVDA reported "2 b" selected.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • Refactor
    • Improved internal text handling by removing the FakeEmbeddingTextInfo class and updating related methods for more efficient processing.

@jcsteh jcsteh requested a review from a team as a code owner June 29, 2024 03:05
@jcsteh jcsteh requested a review from michaelDCurran June 29, 2024 03:05
@coderabbitai

coderabbitai Bot commented Jun 29, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The ia2TextMozilla.py file has undergone significant refactorings, primarily involving the removal of the FakeEmbeddingTextInfo class and its associated methods. Key functions such as _getRawTextInfo, _getEmbedding, and _findUnitEndpoints have been adjusted to handle text information in the absence of FakeEmbeddingTextInfo, ensuring robust and efficient text handling.

Changes

Files Change Summary
.../NVDAObjects/IAccessible/ia2TextMozilla.py Removed FakeEmbeddingTextInfo class and related methods, and updated _getRawTextInfo, _getEmbedding, _findUnitEndpoints functions to accommodate these changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant NVDA
    participant ia2TextMozilla

    User->>NVDA: Request text information
    NVDA->>ia2TextMozilla: _getRawTextInfo()
    ia2TextMozilla-->>NVDA: Returns TextInfo object

    User->>NVDA: Request embedding info
    NVDA->>ia2TextMozilla: _getEmbedding()
    ia2TextMozilla-->>NVDA: Provides embedding information

    User->>NVDA: Request unit endpoints
    NVDA->>ia2TextMozilla: _findUnitEndpoints()
    ia2TextMozilla-->>NVDA: Returns endpoints

    Note over NVDA, ia2TextMozilla: Interaction after removal of FakeEmbeddingTextInfo
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@seanbudd

seanbudd commented Jul 1, 2024

Copy link
Copy Markdown
Member

Note: this is an API breaking change, and as such has been delayed until 2025.1 This needs a changelog entry when the 2025.1 release entries are created

@jcsteh

jcsteh commented Jul 1, 2024

Copy link
Copy Markdown
Contributor Author

Yeah. It's unfortunate because I very much doubt FakeEmbeddingTextInfo is used by anything - it's just far too specific to an internal implementation detail - but it isn't underscore prefixed, so it has to be considered public. That said, it really doesn't matter when this gets merged given that it's just cleanup.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Jul 2, 2024
@seanbudd

Copy link
Copy Markdown
Member

Can you fix merge conflicts and add a an API removal notice to the changes for developers for 2025.1?

@seanbudd seanbudd removed the blocked label Aug 28, 2024
@SaschaCowley SaschaCowley added the merge-early Merge Early in a developer cycle label Sep 4, 2024
@jcsteh

jcsteh commented Sep 5, 2024

Copy link
Copy Markdown
Contributor Author

Thanks @SaschaCowley. I had intended to get to this, but just... hadn't yet. :)

@SaschaCowley SaschaCowley merged commit 9d15b16 into nvaccess:master Sep 5, 2024
@jcsteh jcsteh deleted the rmFakeEmbed branch May 25, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-breaking-change conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. merge-early Merge Early in a developer cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants