Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog (230416 => 230417)
--- releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog 2018-04-09 12:59:39 UTC (rev 230416)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog 2018-04-09 12:59:46 UTC (rev 230417)
@@ -1,3 +1,12 @@
+2018-03-27 Fujii Hironori <hironori.fu...@sony.com>
+
+ [GTK] Layout test editing/deleting/delete-surrogatepair.html crashing with CRITICAL **: enchant_dict_check: assertion 'g_utf8_validate(word, len, NULL)' failed
+ https://bugs.webkit.org/show_bug.cgi?id=176799
+
+ Reviewed by Carlos Garcia Campos.
+
+ * platform/gtk/TestExpectations: Unmarked editing/deleting/delete-surrogatepair.html.
+
2018-03-22 Zalan Bujtas <za...@apple.com>
[Simple line layout] Text with letter spacing is not positioned properly.
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (230416 => 230417)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-04-09 12:59:39 UTC (rev 230416)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-04-09 12:59:46 UTC (rev 230417)
@@ -1,3 +1,28 @@
+2018-03-27 Fujii Hironori <hironori.fu...@sony.com>
+
+ [GTK] Layout test editing/deleting/delete-surrogatepair.html crashing with CRITICAL **: enchant_dict_check: assertion 'g_utf8_validate(word, len, NULL)' failed
+ https://bugs.webkit.org/show_bug.cgi?id=176799
+
+ Reviewed by Carlos Garcia Campos.
+
+ The length of a surrogate-pair UTF-16 character is 2 even though
+ the number of characters is 1. An incorrect string length was
+ passed to enchant_dict_check if the string contains a
+ surrogate-pair character because the length was calculated by
+ applying UTF-16 character position to UTF-8 string.
+
+ No new tests (Covered by existing tests).
+
+ * platform/text/enchant/TextCheckerEnchant.cpp:
+ (WebCore::TextCheckerEnchant::checkSpellingOfWord): Changed the
+ type of an argument `word` from CString to String. Convert a
+ substring of the argument into UTF-8.
+ (WebCore::TextCheckerEnchant::checkSpellingOfString): Pass the
+ original UTF-16 string to checkSpellingOfWord instead of a
+ converted UTF-8 string.
+ * platform/text/enchant/TextCheckerEnchant.h: Changed the type of
+ an argument `word` from CString to String.
+
2018-03-22 Zalan Bujtas <za...@apple.com>
[Simple line layout] Text with letter spacing is not positioned properly.
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp (230416 => 230417)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp 2018-04-09 12:59:39 UTC (rev 230416)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp 2018-04-09 12:59:46 UTC (rev 230417)
@@ -64,14 +64,12 @@
enchant_dict_add(dictionary, word.utf8().data(), -1);
}
-void TextCheckerEnchant::checkSpellingOfWord(const CString& word, int start, int end, int& misspellingLocation, int& misspellingLength)
+void TextCheckerEnchant::checkSpellingOfWord(const String& word, int start, int end, int& misspellingLocation, int& misspellingLength)
{
- const char* string = word.data();
- char* startPtr = g_utf8_offset_to_pointer(string, start);
- int numberOfBytes = static_cast<int>(g_utf8_offset_to_pointer(string, end) - startPtr);
+ CString string = word.substring(start, end - start).utf8();
for (auto& dictionary : m_enchantDictionaries) {
- if (!enchant_dict_check(dictionary, startPtr, numberOfBytes)) {
+ if (!enchant_dict_check(dictionary, string.data(), string.length())) {
// Stop checking, this word is ok in at least one dict.
misspellingLocation = -1;
misspellingLength = 0;
@@ -96,11 +94,10 @@
if (!iter)
return;
- CString utf8String = string.utf8();
int start = ubrk_first(iter);
for (int end = ubrk_next(iter); end != UBRK_DONE; end = ubrk_next(iter)) {
if (isWordTextBreak(iter)) {
- checkSpellingOfWord(utf8String, start, end, misspellingLocation, misspellingLength);
+ checkSpellingOfWord(string, start, end, misspellingLocation, misspellingLength);
// Stop checking the next words If the current word is misspelled, to do not overwrite its misspelled location and length.
if (misspellingLength)
return;
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/text/enchant/TextCheckerEnchant.h (230416 => 230417)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/text/enchant/TextCheckerEnchant.h 2018-04-09 12:59:39 UTC (rev 230416)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/text/enchant/TextCheckerEnchant.h 2018-04-09 12:59:46 UTC (rev 230417)
@@ -48,7 +48,7 @@
private:
void freeEnchantBrokerDictionaries();
- void checkSpellingOfWord(const CString&, int start, int end, int& misspellingLocation, int& misspellingLength);
+ void checkSpellingOfWord(const String&, int start, int end, int& misspellingLocation, int& misspellingLength);
EnchantBroker* m_broker;
Vector<EnchantDict*> m_enchantDictionaries;