Skip to content
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

Extract WideToUTF16String/UTF16StringToWide to FML #39006

Merged
merged 2 commits into from Jan 19, 2023

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented Jan 19, 2023

In third_party/accessibility, for string conversion, we use a mix of:

  • FML
  • third_party/accessibility base string utility functions
  • static functions local to the translation unit itself

This moves all conversions between UTF16 and wide strings to FML. Note that this implementation is only safe on platforms where:

  • the size of wchar_t and char16_t are the same
  • the encoding of wchar_t and char16_t are both UTF-16 which is the case for Windows, hence why these functions are implemented in a Windows-specific translation unit (wstring_conversion).

Issue: flutter/flutter#118811

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@cbracken cbracken force-pushed the WideToUTF16 branch 4 times, most recently from 5ec7530 to d91e80a Compare January 19, 2023 19:28
In third_party/accessibility, for string conversion, we use a mix of:
* FML
* third_party/accessibility base string utility functions
* static functions local to the translation unit itself

This moves all conversions between UTF16 and wide strings to FML. Note
that this implementation is only safe on platforms where:
  * the size of wchar_t and char16_t are the same
  * the encoding of wchar_t and char16_t are both UTF-16
which is the case for Windows, hence why these functions are implemented
in a Windows-specific translation unit (wstring_conversion).

Issue: flutter/flutter#118811
Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM :)

Copy link
Contributor

@yaakovschectman yaakovschectman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I was thinking about this too

@chinmaygarde
Copy link
Member

The windows failures do look related.

@cbracken
Copy link
Member Author

cbracken commented Jan 19, 2023

Yep - two of the tests were wrong; serves me right for adding Windows-specific tests from a Mac.

@cbracken
Copy link
Member Author

Looking good now :)

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 19, 2023
@auto-submit auto-submit bot merged commit 7bbe79e into flutter:main Jan 19, 2023
@godofredoc
Copy link
Contributor

@godofredoc godofredoc added revert Label used to revert changes in a closed and merged pull request. and removed revert Label used to revert changes in a closed and merged pull request. labels Jan 20, 2023
godofredoc added a commit that referenced this pull request Jan 20, 2023
auto-submit bot pushed a commit that referenced this pull request Jan 20, 2023
@cbracken
Copy link
Member Author

cbracken commented Jan 20, 2023

Oh wow. I'm curious how that wasn't caught in presubmit! Thanks for reverting.

We should definitely not be using //third_party/accessibility:base outside of the accessibility tree. I'll fix that code and see if I can add a visibility restriction so people don't re-add code like that in future.

@cbracken
Copy link
Member Author

cbracken commented Jan 20, 2023

Ah I see why it wasn't caught - a new usage was introduced in a separate PR between the time presubmits ran and the patch landed.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 20, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 20, 2023
…118869)

* 7bbe79e10 Extract WideToUTF16String/UTF16StringToWide to FML (flutter/engine#39006)

* acca56ce0 Revert "Extract WideToUTF16String/UTF16StringToWide to FML (#39006)" (flutter/engine#39019)

* 730e88fb6 [Impeller] Check the correct stencil coverage when deciding whether to elide a restore (flutter/engine#39023)
ricardoamador pushed a commit to ricardoamador/engine that referenced this pull request Jan 25, 2023
* Extract WideToUTF16String/UTF16StringToWide to FML

In third_party/accessibility, for string conversion, we use a mix of:
* FML
* third_party/accessibility base string utility functions
* static functions local to the translation unit itself

This moves all conversions between UTF16 and wide strings to FML. Note
that this implementation is only safe on platforms where:
  * the size of wchar_t and char16_t are the same
  * the encoding of wchar_t and char16_t are both UTF-16
which is the case for Windows, hence why these functions are implemented
in a Windows-specific translation unit (wstring_conversion).

Issue: flutter/flutter#118811

* Migrate UTF16ToWide as well
ricardoamador pushed a commit to ricardoamador/engine that referenced this pull request Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
5 participants