Ticket #24189: qtwebengine-6.11.3-icu4c_79-1.patch
| File qtwebengine-6.11.3-icu4c_79-1.patch, 7.4 KB (added by , 3 weeks ago) |
|---|
-
src/3rdparty/chromium/v8/src/regexp/gen-regexp-special-case.cc
diff -Naur qtwebengine-6.11.3.orig/src/3rdparty/chromium/v8/src/regexp/gen-regexp-special-case.cc qtwebengine-6.11.3/src/3rdparty/chromium/v8/src/regexp/gen-regexp-special-case.cc
old new 9 9 10 10 #include "src/base/strings.h" 11 11 #include "src/regexp/special-case.h" 12 #include "unicode/uchar.h" 12 13 13 14 namespace v8 { 14 15 namespace internal { … … 17 18 static const base::uc32 kSurrogateEnd = 0xdfff; 18 19 static const base::uc32 kNonBmpStart = 0x10000; 19 20 21 // Removes supplementary code points from |set| and returns whether any were 22 // present. Since Unicode 18, the case closure of a BMP character can contain 23 // supplementary code points (U+1DF95 LATIN SMALL LIGATURE LONG S WITH 24 // DESCENDER S case-folds to U+00DF LATIN SMALL LETTER SHARP S). Non-unicode 25 // ignoreCase matching compares UTF-16 code units, so a supplementary code 26 // point never matches a BMP character and does not take part in Canonicalize. 27 bool RemoveSupplementary(icu::UnicodeSet& set) { 28 constexpr UChar32 kFirstSupplementary = static_cast<UChar32>(kNonBmpStart); 29 if (!set.containsSome(kFirstSupplementary, UCHAR_MAX_VALUE)) return false; 30 set.remove(kFirstSupplementary, UCHAR_MAX_VALUE); 31 return true; 32 } 33 20 34 // The following code generates "src/regexp/special-case.cc". 21 35 void PrintSet(std::ofstream& out, const char* name, 22 36 const icu::UnicodeSet& set) { … … 51 65 icu::UnicodeSet current; 52 66 icu::UnicodeSet special_add; 53 67 icu::UnicodeSet ignore; 68 icu::UnicodeSet supplementary_equivalents; 54 69 UErrorCode status = U_ZERO_ERROR; 55 70 icu::UnicodeSet upper("[\\p{Lu}]", status); 56 71 CHECK(U_SUCCESS(status)); … … 63 78 } 64 79 current.set(i, i); 65 80 current.closeOver(USET_CASE_INSENSITIVE); 81 if (RemoveSupplementary(current)) supplementary_equivalents.add(i); 66 82 67 83 // Check to see if all characters in the case-folding equivalence 68 84 // class as defined by UnicodeSet::closeOver all map to the same … … 112 128 UChar32 canonical = RegExpCaseFolding::Canonicalize(c); 113 129 current.set(c, c); 114 130 current.closeOver(USET_CASE_INSENSITIVE); 131 RemoveSupplementary(current); 115 132 current.removeAll(ignore); 116 133 for (int32_t j = 0; j < current.getRangeCount(); j++) { 117 134 for (UChar32 c2 = current.getRangeStart(j); … … 124 141 125 142 PrintSet(out, "IgnoreSet", ignore); 126 143 PrintSet(out, "SpecialAddSet", special_add); 144 PrintSet(out, "SupplementaryEquivalentsSet", supplementary_equivalents); 127 145 } 128 146 129 147 void WriteHeader(const char* header_filename) { -
src/3rdparty/chromium/v8/src/regexp/regexp-parser.cc
diff -Naur qtwebengine-6.11.3.orig/src/3rdparty/chromium/v8/src/regexp/regexp-parser.cc qtwebengine-6.11.3/src/3rdparty/chromium/v8/src/regexp/regexp-parser.cc
old new 9 9 #include "src/regexp/regexp-ast.h" 10 10 #include "src/regexp/regexp-macro-assembler.h" 11 11 #include "src/regexp/regexp.h" 12 #include "src/regexp/special-case.h" 12 13 #include "src/strings/char-predicates-inl.h" 13 14 #include "src/utils/ostreams.h" 14 15 #include "src/utils/utils.h" … … 155 156 156 157 void RegExpTextBuilder::AddCharacter(base::uc16 c) { 157 158 FlushPendingSurrogate(); 159 if (NeedsDesugaringForIgnoreCase(c)) { 160 AddClassRangesForDesugaring(c); 161 return; 162 } 158 163 if (characters_ == nullptr) { 159 164 characters_ = zone()->New<ZoneList<base::uc16>>(4, zone()); 160 165 } … … 237 242 return false; 238 243 } 239 244 240 // We only use this for characters made of surrogate pairs. All other241 // characters outside of character classes are made case independent in the242 // codegeneration.245 // Desugar supplementary characters with case equivalents and BMP characters 246 // with supplementary equivalents. Other atoms are folded during code 247 // generation. 243 248 bool RegExpTextBuilder::NeedsDesugaringForIgnoreCase(base::uc32 c) { 244 249 #ifdef V8_INTL_SUPPORT 245 250 if (IsUnicodeMode() && ignore_case()) { 251 if (c <= unibrow::Utf16::kMaxNonSurrogateCharCode) { 252 return RegExpCaseFolding::HasSupplementaryEquivalents( 253 static_cast<base::uc16>(c)); 254 } 246 255 icu::UnicodeSet set(c, c); 247 set.closeOver(USET_CASE_INSENSITIVE); 248 set.removeAllStrings(); 256 RegExpCaseFolding::CloseOver(set, RegExpCaseFolding::Mode::kUnicode); 249 257 return set.size() > 1; 250 258 } 251 259 // In the case where ICU is not included, we act as if the unicode flag is -
src/3rdparty/chromium/v8/src/regexp/special-case.h
diff -Naur qtwebengine-6.11.3.orig/src/3rdparty/chromium/v8/src/regexp/special-case.h qtwebengine-6.11.3/src/3rdparty/chromium/v8/src/regexp/special-case.h
old new 7 7 8 8 #ifdef V8_INTL_SUPPORT 9 9 #include "src/base/logging.h" 10 #include "src/base/strings.h" 10 11 #include "src/common/globals.h" 11 12 12 #include "unicode/uchar.h" 13 13 #include "unicode/uniset.h" 14 14 #include "unicode/unistr.h" … … 71 71 // another character. Characters that match no other characters in 72 72 // their equivalence class are added to IgnoreSet. Characters that 73 73 // match at least one other character are added to SpecialAddSet. 74 // Supplementary code points are ignored throughout: non-unicode matching 75 // compares UTF-16 code units, so they can never match a BMP character. 76 // 77 // The generator additionally emits SupplementaryEquivalentsSet, the BMP 78 // characters whose Unicode case closure contains supplementary code points. 79 // This set is used for unicode-mode matching, see HasSupplementaryEquivalents. 74 80 75 81 class RegExpCaseFolding final : public AllStatic { 76 82 public: 83 enum class Mode { kNonUnicode, kUnicode }; 84 77 85 static const icu::UnicodeSet& IgnoreSet(); 78 86 static const icu::UnicodeSet& SpecialAddSet(); 79 87 … … 108 116 // h. Return cu. 109 117 return cu; 110 118 } 119 120 // Close a set of characters under case equivalence, preserving its 121 // original members. Non-unicode inputs must be UTF-16 code units. 122 static void CloseOver(icu::UnicodeSet& set, Mode mode) { 123 if (mode == Mode::kUnicode) { 124 set.closeOver(USET_SIMPLE_CASE_INSENSITIVE); 125 return; 126 } 127 DCHECK(!set.containsSome(0x10000, 0x10ffff)); 128 if (IgnoreSet().containsNone(set)) { 129 CloseOverNonUnicode(set); 130 return; 131 } 132 if (IgnoreSet().containsAll(set)) return; 133 // Ignored characters neither contribute nor acquire equivalents, but 134 // must remain in the result if they were explicitly present. 135 icu::UnicodeSet ignored(set); 136 ignored.retainAll(IgnoreSet()); 137 set.removeAll(IgnoreSet()); 138 CloseOverNonUnicode(set); 139 set.addAll(ignored); 140 } 141 142 // Whether c has supplementary Unicode case equivalents. 143 static bool HasSupplementaryEquivalents(base::uc16 c) { 144 return SupplementaryEquivalentsSet().contains(c); 145 } 146 147 private: 148 static const icu::UnicodeSet& SupplementaryEquivalentsSet(); 149 150 // Requires a set containing no IgnoreSet characters. 151 static void CloseOverNonUnicode(icu::UnicodeSet& set) { 152 set.closeOver(USET_SIMPLE_CASE_INSENSITIVE); 153 set.removeAll(IgnoreSet()); 154 set.remove(0x10000, 0x10ffff); 155 } 111 156 }; 112 157 113 158 } // namespace internal
