Skip to content

Commit

Permalink
[a11y] Delegate UTF8ToUTF16 to FML (#31376)
Browse files Browse the repository at this point in the history
Delegates string encoding conversions between UTF-8 and UTF-16 strings
in //third_party/accessibility/base to our existing implementations in
FML.

Issue: flutter/flutter#98061
  • Loading branch information
cbracken authored Feb 10, 2022
1 parent 7b6a7b6 commit f55b161
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 104 deletions.
2 changes: 0 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -2109,8 +2109,6 @@ FILE: ../../../flutter/third_party/accessibility/base/simple_token.h
FILE: ../../../flutter/third_party/accessibility/base/string_utils.cc
FILE: ../../../flutter/third_party/accessibility/base/string_utils.h
FILE: ../../../flutter/third_party/accessibility/base/string_utils_unittest.cc
FILE: ../../../flutter/third_party/accessibility/base/win/string_conversion.cc
FILE: ../../../flutter/third_party/accessibility/base/win/string_conversion.h
FILE: ../../../flutter/third_party/accessibility/gfx/transform.cc
FILE: ../../../flutter/third_party/accessibility/gfx/transform.h
FILE: ../../../flutter/third_party/tonic/common/build_config.h
Expand Down
3 changes: 1 addition & 2 deletions third_party/accessibility/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ source_set("base") {
"win/scoped_safearray.h",
"win/scoped_variant.cc",
"win/scoped_variant.h",
"win/string_conversion.cc",
"win/string_conversion.h",
"win/variant_util.h",
"win/variant_vector.cc",
"win/variant_vector.h",
Expand All @@ -52,6 +50,7 @@ source_set("base") {

public_deps = [
"numerics",
"//flutter/fml:string_conversion",
"//flutter/third_party/accessibility/ax_build",
"//third_party/dart/runtime/third_party/double-conversion/src:libdouble_conversion",
]
Expand Down
19 changes: 3 additions & 16 deletions third_party/accessibility/base/string_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
#include <regex>
#include <sstream>

#include "flutter/fml/string_conversion.h"
#include "third_party/dart/runtime/third_party/double-conversion/src/double-conversion.h"

#if defined(_WIN32)
#include "base/win/string_conversion.h"
#endif

#include "no_destructor.h"

namespace base {
Expand Down Expand Up @@ -68,21 +65,11 @@ std::u16string ASCIIToUTF16(std::string src) {
}

std::u16string UTF8ToUTF16(std::string src) {
#if defined(_WIN32)
return WideToUTF16(win::Utf16FromUtf8(src));
#else
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.from_bytes(src);
#endif
return fml::Utf8ToUtf16(src);
}

std::string UTF16ToUTF8(std::u16string src) {
#if defined(_WIN32)
return win::Utf8FromUtf16(UTF16ToWide(src));
#else
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(src);
#endif
return fml::Utf16ToUtf8(src);
}

std::u16string WideToUTF16(const std::wstring& src) {
Expand Down
60 changes: 0 additions & 60 deletions third_party/accessibility/base/win/string_conversion.cc

This file was deleted.

24 changes: 0 additions & 24 deletions third_party/accessibility/base/win/string_conversion.h

This file was deleted.

0 comments on commit f55b161

Please sign in to comment.