diff --git a/intl/unicharutil/util/nsUnicharUtils.cpp b/intl/unicharutil/util/nsUnicharUtils.cpp index eef28b90bffe..ee7293f5526a 100644 --- a/intl/unicharutil/util/nsUnicharUtils.cpp +++ b/intl/unicharutil/util/nsUnicharUtils.cpp @@ -515,9 +515,16 @@ uint32_t HashUTF8AsUTF16(const char* aUTF8, size_t aLength, bool* aErr) { return hash; } +// The Korean Won currency sign has East Asian Width = HALFWIDTH, and +// Script = COMMON (rather than HANGUL), but we don't want to treat it like +// Chinese/Japanese half-width characters for segment break transformation, +// so we exclude it individually in the two functions here. +static constexpr uint32_t kWonCurrencySign = 0x20A9; + bool IsSegmentBreakSkipChar(uint32_t u) { return intl::UnicodeProperties::IsEastAsianWidthFHWexcludingEmoji(u) && - intl::UnicodeProperties::GetScriptCode(u) != intl::Script::HANGUL; + intl::UnicodeProperties::GetScriptCode(u) != intl::Script::HANGUL && + u != kWonCurrencySign; } bool IsEastAsianPunctuation(uint32_t u) { @@ -527,7 +534,9 @@ bool IsEastAsianPunctuation(uint32_t u) { // two characters consistent behavior. constexpr uint32_t kFullwidthTilde = 0xFF5E; return intl::UnicodeProperties::IsEastAsianWidthFHW(u) && - (intl::UnicodeProperties::IsPunctuation(u) || u == kFullwidthTilde); + ((intl::UnicodeProperties::IsPunctuation(u) && + u != kWonCurrencySign) || + u == kFullwidthTilde); } bool IsPunctuationForWordSelect(char16_t aCh) { diff --git a/testing/web-platform/tests/css/css-text/line-breaking/segment-break-transformation-currency-001-ref.html b/testing/web-platform/tests/css/css-text/line-breaking/segment-break-transformation-currency-001-ref.html new file mode 100644 index 000000000000..567677cec716 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/line-breaking/segment-break-transformation-currency-001-ref.html @@ -0,0 +1,8 @@ + + +Segment break transformation reference + +

Each currency amount should have space before and after; there should be no other spaces.

+

+ 価格は $1.00 です。価格は ¥150 です。価格は €1.00 です。価格は ₩1500 です。 +

diff --git a/testing/web-platform/tests/css/css-text/line-breaking/segment-break-transformation-currency-001.html b/testing/web-platform/tests/css/css-text/line-breaking/segment-break-transformation-currency-001.html new file mode 100644 index 000000000000..3a24b05b4da3 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/line-breaking/segment-break-transformation-currency-001.html @@ -0,0 +1,23 @@ + + +Segment break transformation: currency symbols + + + + + +

Each currency amount should have space before and after; there should be no other spaces.

+

+ 価格は + $1.00 + です。 + 価格は + ¥150 + です。 + 価格は + €1.00 + です。 + 価格は + ₩1500 + です。 +

diff --git a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html index e7a12b133780..19edef5435ea 100644 --- a/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html +++ b/testing/web-platform/tests/css/css-text/white-space/seg-break-transformation-004.tentative.html @@ -2,7 +2,7 @@ -Won and halfwidth characters around line break +Halfwidth characters around line break @@ -16,77 +16,77 @@
-
₩ +
ノコリ 24
-
₩ +
ノコリ 24
-
₩ +
ノコリ 24
-
₩ +
ノコリ 24
-
₩ +
ノコリ 24
-
₩ +
ノコリ 24
-
₩24
+
ノコリ24
24 -₩
+コ
24 -₩
+コ
24 - ₩
+ コ
24 - ₩
+ コ
24 -₩
+コ
24 - ₩
-
24₩
+ コ
+
24コ