chromium-icu58.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. From 424584b4984bde7c831f42e9fb47f1ad583a1c46 Mon Sep 17 00:00:00 2001
  2. From: jshin <jshin@chromium.org>
  3. Date: Fri, 21 Oct 2016 01:15:50 -0700
  4. Subject: [PATCH] Update aspirational_scripts per Unicode 9
  5. This is a preparation to update ICU to 58.1.
  6. Without this change, ICU update CL cannot be tested on
  7. trybots because a compile will fail due to '#error' checking
  8. if ICU version is less than 58.
  9. BUG=637001
  10. TEST=None
  11. TBR=pkasting@chromium.org
  12. Review-Url: https://chromiumcodereview.appspot.com/2436113003
  13. Cr-Commit-Position: refs/heads/master@{#426749}
  14. ---
  15. components/url_formatter/url_formatter.cc | 10 +++++-----
  16. 1 file changed, 5 insertions(+), 5 deletions(-)
  17. diff --git a/components/url_formatter/url_formatter.cc b/components/url_formatter/url_formatter.cc
  18. index 4455db3..2b82c0c 100644
  19. --- a/components/url_formatter/url_formatter.cc
  20. +++ b/components/url_formatter/url_formatter.cc
  21. @@ -428,9 +428,9 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) {
  22. // section at
  23. // http://www.unicode.org/Public/security/latest/xidmodifications.txt) are
  24. // are added to the allowed set. The list has to be updated when a new
  25. - // version of Unicode is released. The current version is 8.0.0 and ICU 58
  26. - // will have Unicode 9.0 data.
  27. -#if U_ICU_VERSION_MAJOR_NUM < 58
  28. + // version of Unicode is released. The current version is 9.0.0 and ICU 60
  29. + // will have Unicode 10.0 data.
  30. +#if U_ICU_VERSION_MAJOR_NUM < 60
  31. const icu::UnicodeSet aspirational_scripts(
  32. icu::UnicodeString(
  33. // Unified Canadian Syllabics
  34. @@ -444,13 +444,13 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) {
  35. // Yi
  36. "\\uA000-\\uA48C"
  37. // Miao
  38. - "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7F"
  39. + "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7E"
  40. "\\U00016F8F-\\U00016F9F]",
  41. -1, US_INV),
  42. *status);
  43. allowed_set.addAll(aspirational_scripts);
  44. #else
  45. -#error "Update aspirational_scripts per Unicode 9.0"
  46. +#error "Update aspirational_scripts per Unicode 10.0"
  47. #endif
  48. // U+0338 is included in the recommended set, while U+05F4 and U+2027 are in
  49. --
  50. 2.10.2
  51. From e60b571faa3f14dd9119a6792dccf12f8bf80192 Mon Sep 17 00:00:00 2001
  52. From: jshin <jshin@chromium.org>
  53. Date: Fri, 21 Oct 2016 12:20:05 -0700
  54. Subject: [PATCH] Prepare to upgrade ICU to 58 part 2
  55. U_LB_COUNT is assumed to be 40 in Blink line breaking code, but it's
  56. 43 in ICU 58/Unicode 9.
  57. Three new classes (Emoji Base, Emoji Modifier, and ZWJ) should behave
  58. identically whether or not 'word-break: break-all' is in effect.
  59. BUG=637001
  60. TEST=TextBreakIterator.cpp is compiled without an error with ICU 58.
  61. R=kojii@chromium.org
  62. CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
  63. Review-Url: https://chromiumcodereview.appspot.com/2440923002
  64. Cr-Commit-Position: refs/heads/master@{#426860}
  65. ---
  66. .../WebKit/Source/platform/text/TextBreakIterator.cpp | 16 ++++++++++++----
  67. 1 file changed, 12 insertions(+), 4 deletions(-)
  68. diff --git a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
  69. index 568dc0a..36121eb 100644
  70. --- a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
  71. +++ b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
  72. @@ -28,6 +28,9 @@
  73. #include "wtf/StdLibExtras.h"
  74. #include "wtf/text/CharacterNames.h"
  75. +#include <unicode/uchar.h>
  76. +#include <unicode/uvernum.h>
  77. +
  78. namespace blink {
  79. unsigned numGraphemeClusters(const String& string) {
  80. @@ -129,6 +132,11 @@ static const unsigned char asciiLineBreakTable[][(asciiLineBreakTableLastChar -
  81. };
  82. // clang-format on
  83. +#if U_ICU_VERSION_MAJOR_NUM >= 58
  84. +#define BA_LB_COUNT (U_LB_COUNT - 3)
  85. +#else
  86. +#define BA_LB_COUNT U_LB_COUNT
  87. +#endif
  88. // Line breaking table for CSS word-break: break-all. This table differs from
  89. // asciiLineBreakTable in:
  90. // - Indices are Line Breaking Classes defined in UAX#14 Unicode Line Breaking
  91. @@ -136,7 +144,7 @@ static const unsigned char asciiLineBreakTable[][(asciiLineBreakTableLastChar -
  92. // - 1 indicates additional break opportunities. 0 indicates to fallback to
  93. // normal line break, not "prohibit break."
  94. // clang-format off
  95. -static const unsigned char breakAllLineBreakClassTable[][U_LB_COUNT / 8 + 1] = {
  96. +static const unsigned char breakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = {
  97. // XX AI AL B2 BA BB BK CB CL CM CR EX GL HY ID IN IS LF NS NU OP PO PR QU SA SG SP SY ZW NL WJ H2 H3 JL JT JV CP CJ HL RI
  98. { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX
  99. { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AI
  100. @@ -190,7 +198,7 @@ static_assert(WTF_ARRAY_LENGTH(asciiLineBreakTable) ==
  101. asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar +
  102. 1,
  103. "asciiLineBreakTable should be consistent");
  104. -static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == U_LB_COUNT,
  105. +static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == BA_LB_COUNT,
  106. "breakAllLineBreakClassTable should be consistent");
  107. static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh) {
  108. @@ -226,8 +234,8 @@ static inline ULineBreak lineBreakPropertyValue(UChar lastCh, UChar ch) {
  109. static inline bool shouldBreakAfterBreakAll(ULineBreak lastLineBreak,
  110. ULineBreak lineBreak) {
  111. - if (lineBreak >= 0 && lineBreak < U_LB_COUNT && lastLineBreak >= 0 &&
  112. - lastLineBreak < U_LB_COUNT) {
  113. + if (lineBreak >= 0 && lineBreak < BA_LB_COUNT && lastLineBreak >= 0 &&
  114. + lastLineBreak < BA_LB_COUNT) {
  115. const unsigned char* tableRow = breakAllLineBreakClassTable[lastLineBreak];
  116. return tableRow[lineBreak / 8] & (1 << (lineBreak % 8));
  117. }
  118. --
  119. 2.10.2