From ce83630690cd77539ae7c9927156c621e47c2dd8 Mon Sep 17 00:00:00 2001
From: Jimi Huotari <chiitoo@gentoo.org>
Date: Mon, 11 Dec 2017 00:57:26 +0200
Subject: [PATCH 1/2] Fix compilation with system ICU >=59

Changes made according to the following commit, with slight
modifications due to changed code:

http://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit/?h=56-based&id=363741cffb565dd6cfc2f95054c25a434b101dba
---
 chromium/base/i18n/bidi_line_iterator.cc                   |  2 +-
 chromium/base/i18n/break_iterator.cc                       |  8 ++++----
 chromium/base/i18n/case_conversion.cc                      |  4 ++--
 chromium/base/i18n/icu_string_conversions.cc               |  8 ++++----
 chromium/base/i18n/rtl.cc                                  |  8 ++++----
 chromium/base/i18n/string_search.cc                        |  6 +++---
 chromium/base/i18n/unicodestring.h                         |  2 +-
 chromium/components/url_formatter/idn_spoof_checker.cc     |  4 ++--
 chromium/components/url_formatter/url_formatter.cc         |  2 +-
 chromium/content/child/browser_font_resource_trusted.cc    |  2 +-
 chromium/ppapi/proxy/pdf_resource.cc                       |  8 ++++----
 chromium/third_party/WebKit/Source/platform/LinkHash.cpp   |  2 +-
 .../WebKit/Source/platform/exported/FilePathConversion.cpp |  2 +-
 .../WebKit/Source/platform/exported/URLConversion.cpp      |  2 +-
 .../WebKit/Source/platform/exported/WebString.cpp          |  4 ++--
 .../third_party/WebKit/Source/platform/weborigin/KURL.cpp  | 14 +++++++-------
 .../WebKit/Source/platform/weborigin/SecurityOrigin.cpp    |  2 +-
 .../WebKit/Source/platform/wtf/text/AtomicString.h         |  3 ++-
 .../WebKit/Source/platform/wtf/text/StringView.h           |  2 ++
 .../WebKit/Source/platform/wtf/text/WTFString.h            |  6 ++++++
 chromium/ui/base/l10n/l10n_util.cc                         |  2 +-
 chromium/ui/base/l10n/time_format.cc                       |  2 +-
 chromium/url/url_canon_icu.cc                              |  4 ++--
 23 files changed, 54 insertions(+), 45 deletions(-)

diff --git a/chromium/base/i18n/bidi_line_iterator.cc b/chromium/base/i18n/bidi_line_iterator.cc
index 216129e8b8..e7121935f8 100644
--- a/chromium/base/i18n/bidi_line_iterator.cc
+++ b/chromium/base/i18n/bidi_line_iterator.cc
@@ -44,7 +44,7 @@ bool BiDiLineIterator::Open(const string16& text, TextDirection direction) {
   bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error);
   if (U_FAILURE(error))
     return false;
-  ubidi_setPara(bidi_, text.data(), static_cast<int>(text.length()),
+  ubidi_setPara(bidi_, reinterpret_cast<const UChar*>(text.data()), static_cast<int>(text.length()),
                 GetParagraphLevelForDirection(direction), NULL, &error);
   return (U_SUCCESS(error) == TRUE);
 }
diff --git a/chromium/base/i18n/break_iterator.cc b/chromium/base/i18n/break_iterator.cc
index 869390fec3..3ee6e7cf19 100644
--- a/chromium/base/i18n/break_iterator.cc
+++ b/chromium/base/i18n/break_iterator.cc
@@ -59,9 +59,9 @@ bool BreakIterator::Init() {
       return false;
   }
   if (break_type_ == RULE_BASED) {
-    iter_ = ubrk_openRules(rules_.c_str(),
+    iter_ = ubrk_openRules(reinterpret_cast<const UChar*>(rules_.c_str()),
                            static_cast<int32_t>(rules_.length()),
-                           string_.data(),
+                           reinterpret_cast<const UChar*>(string_.data()),
                            static_cast<int32_t>(string_.size()),
                            &parse_error,
                            &status);
@@ -72,7 +72,7 @@ bool BreakIterator::Init() {
   } else {
     iter_ = ubrk_open(break_type,
                       NULL,
-                      string_.data(),
+                      reinterpret_cast<const UChar*>(string_.data()),
                       static_cast<int32_t>(string_.size()),
                       &status);
     if (U_FAILURE(status)) {
@@ -128,7 +128,7 @@ bool BreakIterator::Advance() {
 bool BreakIterator::SetText(const base::char16* text, const size_t length) {
   UErrorCode status = U_ZERO_ERROR;
   ubrk_setText(static_cast<UBreakIterator*>(iter_),
-               text, length, &status);
+               reinterpret_cast<const UChar*>(text), length, &status);
   pos_ = 0;  // implicit when ubrk_setText is done
   prev_ = npos;
   if (U_FAILURE(status)) {
diff --git a/chromium/base/i18n/case_conversion.cc b/chromium/base/i18n/case_conversion.cc
index 9b7ce80537..0ff369084f 100644
--- a/chromium/base/i18n/case_conversion.cc
+++ b/chromium/base/i18n/case_conversion.cc
@@ -64,8 +64,8 @@ string16 CaseMap(StringPiece16 string, CaseMapperFunction case_mapper) {
     // terminator, but will otherwise. So we don't need to save room for that.
     // Don't use WriteInto, which assumes null terminators.
     int32_t new_length = case_mapper(
-        &dest[0], saturated_cast<int32_t>(dest.size()),
-        string.data(), saturated_cast<int32_t>(string.size()),
+        reinterpret_cast<UChar*>(&dest[0]), saturated_cast<int32_t>(dest.size()),
+        reinterpret_cast<const UChar*>(string.data()), saturated_cast<int32_t>(string.size()),
         &error);
     dest.resize(new_length);
   } while (error == U_BUFFER_OVERFLOW_ERROR);
diff --git a/chromium/base/i18n/icu_string_conversions.cc b/chromium/base/i18n/icu_string_conversions.cc
index be82db2a95..1db3c508bb 100644
--- a/chromium/base/i18n/icu_string_conversions.cc
+++ b/chromium/base/i18n/icu_string_conversions.cc
@@ -151,7 +151,7 @@ bool UTF16ToCodepage(const string16& utf16,
   if (!U_SUCCESS(status))
     return false;
 
-  return ConvertFromUTF16(converter, utf16.c_str(),
+  return ConvertFromUTF16(converter, reinterpret_cast<const UChar*>(utf16.c_str()),
                           static_cast<int>(utf16.length()), on_error, encoded);
 }
 
@@ -178,7 +178,7 @@ bool CodepageToUTF16(const std::string& encoded,
 
   SetUpErrorHandlerForToUChars(on_error, converter, &status);
   std::unique_ptr<char16[]> buffer(new char16[uchar_max_length]);
-  int actual_size = ucnv_toUChars(converter, buffer.get(),
+  int actual_size = ucnv_toUChars(converter, reinterpret_cast<UChar*>(buffer.get()),
       static_cast<int>(uchar_max_length), encoded.data(),
       static_cast<int>(encoded.length()), &status);
   ucnv_close(converter);
@@ -205,8 +205,8 @@ bool ConvertToUtf8AndNormalize(const std::string& text,
   string16 normalized_utf16;
   std::unique_ptr<char16[]> buffer(new char16[max_length]);
   int actual_length = unorm_normalize(
-      utf16.c_str(), utf16.length(), UNORM_NFC, 0,
-      buffer.get(), static_cast<int>(max_length), &status);
+      reinterpret_cast<const UChar*>(utf16.c_str()), utf16.length(), UNORM_NFC, 0,
+      reinterpret_cast<UChar*>(buffer.get()), static_cast<int>(max_length), &status);
   if (!U_SUCCESS(status))
     return false;
   normalized_utf16.assign(buffer.get(), actual_length);
diff --git a/chromium/base/i18n/rtl.cc b/chromium/base/i18n/rtl.cc
index e7e0006377..8d5657a980 100644
--- a/chromium/base/i18n/rtl.cc
+++ b/chromium/base/i18n/rtl.cc
@@ -212,7 +212,7 @@ TextDirection GetTextDirectionForLocale(const char* locale_name) {
 }
 
 TextDirection GetFirstStrongCharacterDirection(const string16& text) {
-  const UChar* string = text.c_str();
+  const UChar* string = reinterpret_cast<const UChar*>(text.c_str());
   size_t length = text.length();
   size_t position = 0;
   while (position < length) {
@@ -228,7 +228,7 @@ TextDirection GetFirstStrongCharacterDirection(const string16& text) {
 }
 
 TextDirection GetLastStrongCharacterDirection(const string16& text) {
-  const UChar* string = text.c_str();
+  const UChar* string = reinterpret_cast<const UChar*>(text.c_str());
   size_t position = text.length();
   while (position > 0) {
     UChar32 character;
@@ -243,7 +243,7 @@ TextDirection GetLastStrongCharacterDirection(const string16& text) {
 }
 
 TextDirection GetStringDirection(const string16& text) {
-  const UChar* string = text.c_str();
+  const UChar* string = reinterpret_cast<const UChar*>(text.c_str());
   size_t length = text.length();
   size_t position = 0;
 
@@ -374,7 +374,7 @@ bool UnadjustStringForLocaleDirection(string16* text) {
 #endif  // !OS_WIN
 
 bool StringContainsStrongRTLChars(const string16& text) {
-  const UChar* string = text.c_str();
+  const UChar* string = reinterpret_cast<const UChar*>(text.c_str());
   size_t length = text.length();
   size_t position = 0;
   while (position < length) {
diff --git a/chromium/base/i18n/string_search.cc b/chromium/base/i18n/string_search.cc
index 779e4d9976..2441c81d01 100644
--- a/chromium/base/i18n/string_search.cc
+++ b/chromium/base/i18n/string_search.cc
@@ -20,8 +20,8 @@ FixedPatternStringSearchIgnoringCaseAndAccents(const string16& find_this)
   const string16& dummy = find_this_;
 
   UErrorCode status = U_ZERO_ERROR;
-  search_ = usearch_open(find_this_.data(), find_this_.size(),
-                         dummy.data(), dummy.size(),
+  search_ = usearch_open(reinterpret_cast<const UChar*>(find_this_.data()), find_this_.size(),
+                         reinterpret_cast<const UChar*>(dummy.data()), dummy.size(),
                          uloc_getDefault(),
                          NULL,  // breakiter
                          &status);
@@ -41,7 +41,7 @@ FixedPatternStringSearchIgnoringCaseAndAccents::
 bool FixedPatternStringSearchIgnoringCaseAndAccents::Search(
     const string16& in_this, size_t* match_index, size_t* match_length) {
   UErrorCode status = U_ZERO_ERROR;
-  usearch_setText(search_, in_this.data(), in_this.size(), &status);
+  usearch_setText(search_, reinterpret_cast<const UChar *>(in_this.data()), in_this.size(), &status);
 
   // Default to basic substring search if usearch fails. According to
   // http://icu-project.org/apiref/icu4c/usearch_8h.html, usearch_open will fail
diff --git a/chromium/base/i18n/unicodestring.h b/chromium/base/i18n/unicodestring.h
index b62c5264de..bb5233c486 100644
--- a/chromium/base/i18n/unicodestring.h
+++ b/chromium/base/i18n/unicodestring.h
@@ -18,7 +18,7 @@ namespace i18n {
 
 inline string16 UnicodeStringToString16(const icu::UnicodeString& unistr) {
 #if U_ICU_VERSION_MAJOR_NUM >= 59
-  return base::string16(icu::toUCharPtr(unistr.getBuffer()),
+  return base::string16(reinterpret_cast<const char16*>(unistr.getBuffer()),
                         static_cast<size_t>(unistr.length()));
 #else
   return base::string16(unistr.getBuffer(),
diff --git a/chromium/components/url_formatter/idn_spoof_checker.cc b/chromium/components/url_formatter/idn_spoof_checker.cc
index 376b2c65e0..a78e268cab 100644
--- a/chromium/components/url_formatter/idn_spoof_checker.cc
+++ b/chromium/components/url_formatter/idn_spoof_checker.cc
@@ -155,14 +155,14 @@ bool IDNSpoofChecker::SafeToDisplayAsUnicode(base::StringPiece16 label,
                                              bool is_tld_ascii) {
   UErrorCode status = U_ZERO_ERROR;
   int32_t result =
-      uspoof_check(checker_, label.data(),
+      uspoof_check(checker_, (const UChar*)label.data(),
                    base::checked_cast<int32_t>(label.size()), NULL, &status);
   // If uspoof_check fails (due to library failure), or if any of the checks
   // fail, treat the IDN as unsafe.
   if (U_FAILURE(status) || (result & USPOOF_ALL_CHECKS))
     return false;
 
-  icu::UnicodeString label_string(FALSE, label.data(),
+  icu::UnicodeString label_string(FALSE, (const UChar*)label.data(),
                                   base::checked_cast<int32_t>(label.size()));
 
   // A punycode label with 'xn--' prefix is not subject to the URL
diff --git a/chromium/components/url_formatter/url_formatter.cc b/chromium/components/url_formatter/url_formatter.cc
index 461bc7942c..01b796db83 100644
--- a/chromium/components/url_formatter/url_formatter.cc
+++ b/chromium/components/url_formatter/url_formatter.cc
@@ -374,7 +374,7 @@ bool IDNToUnicodeOneComponent(const base::char16* comp,
       // code units, |status| will be U_BUFFER_OVERFLOW_ERROR and we'll try
       // the conversion again, but with a sufficiently large buffer.
       output_length = uidna_labelToUnicode(
-          uidna, comp, static_cast<int32_t>(comp_len), &(*out)[original_length],
+          uidna, (const UChar*)comp, static_cast<int32_t>(comp_len), (UChar*)&(*out)[original_length],
           output_length, &info, &status);
     } while ((status == U_BUFFER_OVERFLOW_ERROR && info.errors == 0));
 
diff --git a/chromium/content/child/browser_font_resource_trusted.cc b/chromium/content/child/browser_font_resource_trusted.cc
index 7fd605bce3..d01ac7b021 100644
--- a/chromium/content/child/browser_font_resource_trusted.cc
+++ b/chromium/content/child/browser_font_resource_trusted.cc
@@ -77,7 +77,7 @@ class TextRunCollection {
     } else {
       bidi_ = ubidi_open();
       UErrorCode uerror = U_ZERO_ERROR;
-      ubidi_setPara(bidi_, text_.data(), text_.size(), run.rtl, NULL, &uerror);
+      ubidi_setPara(bidi_, reinterpret_cast<const UChar*>(text_.data()), text_.size(), run.rtl, NULL, &uerror);
       if (U_SUCCESS(uerror))
         num_runs_ = ubidi_countRuns(bidi_, &uerror);
     }
diff --git a/chromium/ppapi/proxy/pdf_resource.cc b/chromium/ppapi/proxy/pdf_resource.cc
index 565c23ddf8..ff3028ec48 100644
--- a/chromium/ppapi/proxy/pdf_resource.cc
+++ b/chromium/ppapi/proxy/pdf_resource.cc
@@ -58,10 +58,10 @@ void PDFResource::SearchString(const unsigned short* input_string,
                                PP_PrivateFindResult** results, int* count) {
   if (locale_.empty())
     locale_ = GetLocale();
-  const base::char16* string =
-      reinterpret_cast<const base::char16*>(input_string);
-  const base::char16* term =
-      reinterpret_cast<const base::char16*>(input_term);
+  const UChar* string =
+      reinterpret_cast<const UChar*>(input_string);
+  const UChar* term =
+      reinterpret_cast<const UChar*>(input_term);
 
   UErrorCode status = U_ZERO_ERROR;
   UStringSearch* searcher = usearch_open(term, -1, string, -1, locale_.c_str(),
diff --git a/chromium/third_party/WebKit/Source/platform/LinkHash.cpp b/chromium/third_party/WebKit/Source/platform/LinkHash.cpp
index 6ce1608cbe..bede9083cc 100644
--- a/chromium/third_party/WebKit/Source/platform/LinkHash.cpp
+++ b/chromium/third_party/WebKit/Source/platform/LinkHash.cpp
@@ -51,7 +51,7 @@ static bool ResolveRelative(const KURL& base,
                                 relative_utf8.length(), 0, buffer, &parsed);
   }
   return url::ResolveRelative(base_utf8.Data(), base_utf8.length(),
-                              base.GetParsed(), relative.Characters16(),
+                              base.GetParsed(), (const base::char16*)relative.Characters16(),
                               relative.length(), 0, buffer, &parsed);
 }
 
diff --git a/chromium/third_party/WebKit/Source/platform/exported/FilePathConversion.cpp b/chromium/third_party/WebKit/Source/platform/exported/FilePathConversion.cpp
index 7c4d7dd8c7..657e6d2cab 100644
--- a/chromium/third_party/WebKit/Source/platform/exported/FilePathConversion.cpp
+++ b/chromium/third_party/WebKit/Source/platform/exported/FilePathConversion.cpp
@@ -19,7 +19,7 @@ base::FilePath WebStringToFilePath(const WebString& web_string) {
   String str = web_string;
   if (!str.Is8Bit()) {
     return base::FilePath::FromUTF16Unsafe(
-        base::StringPiece16(str.Characters16(), str.length()));
+        base::StringPiece16((const base::char16*)str.Characters16(), str.length()));
   }
 
 #if defined(OS_POSIX)
diff --git a/chromium/third_party/WebKit/Source/platform/exported/URLConversion.cpp b/chromium/third_party/WebKit/Source/platform/exported/URLConversion.cpp
index fb54235e3a..1b28e171d8 100644
--- a/chromium/third_party/WebKit/Source/platform/exported/URLConversion.cpp
+++ b/chromium/third_party/WebKit/Source/platform/exported/URLConversion.cpp
@@ -23,7 +23,7 @@ GURL WebStringToGURL(const WebString& web_string) {
   }
 
   // GURL can consume UTF-16 directly.
-  return GURL(base::StringPiece16(str.Characters16(), str.length()));
+  return GURL(base::StringPiece16((const base::char16*)str.Characters16(), str.length()));
 }
 
 }  // namespace blink
diff --git a/chromium/third_party/WebKit/Source/platform/exported/WebString.cpp b/chromium/third_party/WebKit/Source/platform/exported/WebString.cpp
index 2147203fde..fb70d88dba 100644
--- a/chromium/third_party/WebKit/Source/platform/exported/WebString.cpp
+++ b/chromium/third_party/WebKit/Source/platform/exported/WebString.cpp
@@ -59,7 +59,7 @@ void WebString::Assign(const WebString& other) {
 }
 
 void WebString::Assign(const WebUChar* data, size_t length) {
-  Assign(StringImpl::Create8BitIfPossible(data, length).Get());
+  Assign(StringImpl::Create8BitIfPossible((const UChar*)data, length).Get());
 }
 
 size_t WebString::length() const {
@@ -75,7 +75,7 @@ const WebLChar* WebString::Data8() const {
 }
 
 const WebUChar* WebString::Data16() const {
-  return !private_.IsNull() && !Is8Bit() ? private_->Characters16() : 0;
+  return !private_.IsNull() && !Is8Bit() ? (const WebUChar*)private_->Characters16() : 0;
 }
 
 std::string WebString::Utf8(UTF8ConversionMode mode) const {
diff --git a/chromium/third_party/WebKit/Source/platform/weborigin/KURL.cpp b/chromium/third_party/WebKit/Source/platform/weborigin/KURL.cpp
index 40c78874e2..89a7425e39 100644
--- a/chromium/third_party/WebKit/Source/platform/weborigin/KURL.cpp
+++ b/chromium/third_party/WebKit/Source/platform/weborigin/KURL.cpp
@@ -104,7 +104,7 @@ class KURLCharsetConverter final : public url::CharsetConverter {
                         int input_length,
                         url::CanonOutput* output) override {
     CString encoded = encoding_->Encode(
-        String(input, input_length), WTF::kURLEncodedEntitiesForUnencodables);
+        String((const UChar*)input, input_length), WTF::kURLEncodedEntitiesForUnencodables);
     output->Append(encoded.data(), static_cast<int>(encoded.length()));
   }
 
@@ -341,7 +341,7 @@ String KURL::LastPathComponent() const {
   if (string_.Is8Bit())
     url::ExtractFileName(AsURLChar8Subtle(string_), path, &file);
   else
-    url::ExtractFileName(string_.Characters16(), path, &file);
+    url::ExtractFileName((const base::char16*)string_.Characters16(), path, &file);
 
   // Bug: https://bugs.webkit.org/show_bug.cgi?id=21015 this function returns
   // a null string when the path is empty, which we duplicate here.
@@ -371,7 +371,7 @@ unsigned short KURL::Port() const {
   DCHECK(!string_.IsNull());
   int port = string_.Is8Bit()
                  ? url::ParsePort(AsURLChar8Subtle(string_), parsed_.port)
-                 : url::ParsePort(string_.Characters16(), parsed_.port);
+                 : url::ParsePort((const base::char16*)string_.Characters16(), parsed_.port);
   DCHECK_NE(port, url::PORT_UNSPECIFIED);  // Checked port.len <= 0 before.
 
   if (port == url::PORT_INVALID ||
@@ -666,7 +666,7 @@ bool KURL::IsHierarchical() const {
     return false;
   return string_.Is8Bit()
              ? url::IsStandard(AsURLChar8Subtle(string_), parsed_.scheme)
-             : url::IsStandard(string_.Characters16(), parsed_.scheme);
+             : url::IsStandard((const base::char16*)string_.Characters16(), parsed_.scheme);
 }
 
 bool EqualIgnoringFragmentIdentifier(const KURL& a, const KURL& b) {
@@ -719,7 +719,7 @@ unsigned KURL::PathAfterLastSlash() const {
   if (string_.Is8Bit())
     url::ExtractFileName(AsURLChar8Subtle(string_), parsed_.path, &filename);
   else
-    url::ExtractFileName(string_.Characters16(), parsed_.path, &filename);
+    url::ExtractFileName((const base::char16*)string_.Characters16(), parsed_.path, &filename);
   return filename.begin;
 }
 
@@ -732,7 +732,7 @@ bool ProtocolIs(const String& url, const char* protocol) {
   if (url.Is8Bit())
     return url::FindAndCompareScheme(AsURLChar8Subtle(url), url.length(),
                                      protocol, 0);
-  return url::FindAndCompareScheme(url.Characters16(), url.length(), protocol,
+  return url::FindAndCompareScheme((const base::char16*)url.Characters16(), url.length(), protocol,
                                    0);
 }
 
@@ -765,7 +765,7 @@ void KURL::Init(const KURL& base,
                                      charset_converter, &output, &parsed_);
   } else {
     is_valid_ = url::ResolveRelative(base_utf8.Data(), base_utf8.length(),
-                                     base.parsed_, relative.Characters16(),
+                                     base.parsed_, (const base::char16*)relative.Characters16(),
                                      clampTo<int>(relative.length()),
                                      charset_converter, &output, &parsed_);
   }
diff --git a/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
index 2b991e5b31..cddbe8deb6 100644
--- a/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
+++ b/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -638,7 +638,7 @@ String SecurityOrigin::CanonicalizeHost(const String& host, bool* success) {
         url::CanonicalizeHost(utf8.Data(), url::Component(0, utf8.length()),
                               &canon_output, &out_host);
   } else {
-    *success = url::CanonicalizeHost(host.Characters16(),
+    *success = url::CanonicalizeHost(reinterpret_cast<const base::char16 *>(host.Characters16()),
                                      url::Component(0, host.length()),
                                      &canon_output, &out_host);
   }
diff --git a/chromium/third_party/WebKit/Source/platform/wtf/text/AtomicString.h b/chromium/third_party/WebKit/Source/platform/wtf/text/AtomicString.h
index efcac876c0..2a71d177ea 100644
--- a/chromium/third_party/WebKit/Source/platform/wtf/text/AtomicString.h
+++ b/chromium/third_party/WebKit/Source/platform/wtf/text/AtomicString.h
@@ -66,9 +66,10 @@ class WTF_EXPORT AtomicString {
   AtomicString(const LChar* chars, unsigned length);
   AtomicString(const UChar* chars, unsigned length);
   AtomicString(const UChar* chars);
+#if U_ICU_VERSION_MAJOR_NUM < 59
   AtomicString(const char16_t* chars)
       : AtomicString(reinterpret_cast<const UChar*>(chars)) {}
-
+#endif
   template <size_t inlineCapacity>
   explicit AtomicString(const Vector<UChar, inlineCapacity>& vector)
       : AtomicString(vector.data(), vector.size()) {}
diff --git a/chromium/third_party/WebKit/Source/platform/wtf/text/StringView.h b/chromium/third_party/WebKit/Source/platform/wtf/text/StringView.h
index 4a752e40f2..9a3f132a1d 100644
--- a/chromium/third_party/WebKit/Source/platform/wtf/text/StringView.h
+++ b/chromium/third_party/WebKit/Source/platform/wtf/text/StringView.h
@@ -83,8 +83,10 @@ class WTF_EXPORT StringView {
         characters16_(chars),
         length_(length) {}
   StringView(const UChar* chars);
+#if U_ICU_VERSION_MAJOR_NUM < 59
   StringView(const char16_t* chars)
       : StringView(reinterpret_cast<const UChar*>(chars)) {}
+#endif
 
 #if DCHECK_IS_ON()
   ~StringView();
diff --git a/chromium/third_party/WebKit/Source/platform/wtf/text/WTFString.h b/chromium/third_party/WebKit/Source/platform/wtf/text/WTFString.h
index b13c39395c..7a6bd7b952 100644
--- a/chromium/third_party/WebKit/Source/platform/wtf/text/WTFString.h
+++ b/chromium/third_party/WebKit/Source/platform/wtf/text/WTFString.h
@@ -36,6 +36,7 @@
 #include <algorithm>
 #include <iosfwd>
 
+#include "third_party/icu/source/common/unicode/uvernum.h"
 #ifdef __OBJC__
 #include <objc/objc.h>
 #endif
@@ -82,8 +83,13 @@ class WTF_EXPORT String {
 
   // Construct a string with UTF-16 data, from a null-terminated source.
   String(const UChar*);
+#if U_ICU_VERSION_MAJOR_NUM < 59
   String(const char16_t* chars)
       : String(reinterpret_cast<const UChar*>(chars)) {}
+#else
+  String(const uint16_t* chars)
+      : String(reinterpret_cast<const UChar*>(chars)) {}
+#endif
 
   // Construct a string with latin1 data.
   String(const LChar* characters, unsigned length);
diff --git a/chromium/ui/base/l10n/l10n_util.cc b/chromium/ui/base/l10n/l10n_util.cc
index 1e09e2ce1a..838cd9734e 100644
--- a/chromium/ui/base/l10n/l10n_util.cc
+++ b/chromium/ui/base/l10n/l10n_util.cc
@@ -581,7 +581,7 @@ base::string16 GetDisplayNameForLocale(const std::string& locale,
 
     int actual_size = uloc_getDisplayName(
         locale_code.c_str(), display_locale.c_str(),
-        base::WriteInto(&display_name, kBufferSize), kBufferSize - 1, &error);
+        (UChar*)base::WriteInto(&display_name, kBufferSize), kBufferSize - 1, &error);
     DCHECK(U_SUCCESS(error));
     display_name.resize(actual_size);
   }
diff --git a/chromium/ui/base/l10n/time_format.cc b/chromium/ui/base/l10n/time_format.cc
index 2ac75b0686..52134dcea5 100644
--- a/chromium/ui/base/l10n/time_format.cc
+++ b/chromium/ui/base/l10n/time_format.cc
@@ -141,7 +141,7 @@ base::string16 TimeFormat::DetailedWithMonthAndYear(
   DCHECK_GT(capacity, 1);
   base::string16 result;
   UErrorCode error = U_ZERO_ERROR;
-  time_string.extract(static_cast<UChar*>(base::WriteInto(&result, capacity)),
+  time_string.extract(reinterpret_cast<UChar*>(base::WriteInto(&result, capacity)),
                       capacity, error);
   DCHECK(U_SUCCESS(error));
   return result;
diff --git a/chromium/url/url_canon_icu.cc b/chromium/url/url_canon_icu.cc
index d0468cccaf..ffa623f264 100644
--- a/chromium/url/url_canon_icu.cc
+++ b/chromium/url/url_canon_icu.cc
@@ -133,7 +133,7 @@ void ICUCharsetConverter::ConvertFromUTF16(const base::char16* input,
     UErrorCode err = U_ZERO_ERROR;
     char* dest = &output->data()[begin_offset];
     int required_capacity = ucnv_fromUChars(converter_, dest, dest_capacity,
-                                            input, input_len, &err);
+                                            (const UChar*)input, input_len, &err);
     if (err != U_BUFFER_OVERFLOW_ERROR) {
       output->set_length(begin_offset + required_capacity);
       return;
@@ -170,7 +170,7 @@ bool IDNToASCII(const base::char16* src, int src_len, CanonOutputW* output) {
   while (true) {
     UErrorCode err = U_ZERO_ERROR;
     UIDNAInfo info = UIDNA_INFO_INITIALIZER;
-    int output_length = uidna_nameToASCII(uidna, src, src_len, output->data(),
+    int output_length = uidna_nameToASCII(uidna, (const UChar*)src, src_len, (UChar*)output->data(),
                                           output->capacity(), &info, &err);
     if (U_SUCCESS(err) && info.errors == 0) {
       output->set_length(output_length);
-- 
2.15.1

