Truly independent web browser
LibUnicode: Treat Southeast Asian vowel signs as combining marks
Tim Ledbetter935136194e4b
diff --git a/Libraries/LibUnicode/CharacterTypes.cpp b/Libraries/LibUnicode/CharacterTypes.cppindex cc7cb7027be..9816028e739 100644--- a/Libraries/LibUnicode/CharacterTypes.cpp+++ b/Libraries/LibUnicode/CharacterTypes.cpp@@ -533,6 +533,14 @@ static LineBreakClass resolved_line_break_class(u32 code_point, bool allow_condicase U_LB_AMBIGUOUS:return LineBreakClass::Ambiguous;case U_LB_COMPLEX_CONTEXT:+ // https://www.unicode.org/reports/tr14/#LB1+ // In the absence of such criteria all characters with a specific combination of original class and+ // General_Category property value are resolved as follows:+ // Resolved | Original | General_Category+ // [...]+ // CM | SA | Only Mn or Mc+ if ((U_GET_GC_MASK(icu_code_point) & (U_GC_MN_MASK | U_GC_MC_MASK)) != 0)+ return LineBreakClass::CombiningMark;return LineBreakClass::ComplexContext;case U_LB_COMBINING_MARK:return LineBreakClass::CombiningMark;diff --git a/Tests/LibWeb/Text/expected/css/word-break-soft-wrap-opportunities.txt b/Tests/LibWeb/Text/expected/css/word-break-soft-wrap-opportunities.txtnew file mode 100644index 00000000000..ff74dbb6951--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/word-break-soft-wrap-opportunities.txt@@ -0,0 +1 @@+break-all "မာစာ": "မာ|စာ"diff --git a/Tests/LibWeb/Text/input/css/word-break-soft-wrap-opportunities.html b/Tests/LibWeb/Text/input/css/word-break-soft-wrap-opportunities.htmlnew file mode 100644index 00000000000..b2d4d05e61b--- /dev/null+++ b/Tests/LibWeb/Text/input/css/word-break-soft-wrap-opportunities.html@@ -0,0 +1,41 @@+<!doctype html>+<script src="../include.js"></script>+<style>+ @font-face {+ font-family: Ahem;+ src: url("../../../Ref/data/fonts/Ahem.ttf");+ }+ #text {+ font: 20px/20px Ahem;+ width: 0;+ }+</style>+<div id="text"></div>+<script>+ promiseTest(async () => {+ await document.fonts.load("20px Ahem");+ const text = document.getElementById("text");+ for (const [wordBreak, content] of [+ ["break-all", "\u1019\u102c\u1005\u102c"],+ ]) {+ text.style.wordBreak = wordBreak;+ text.textContent = content;+ let result = "";+ let previousCenter = null;+ for (let i = 0; i < content.length; ++i) {+ const range = document.createRange();+ range.setStart(text.firstChild, i);+ range.setEnd(text.firstChild, i + 1);+ // A range that starts at a line break can also cover the end of the line before it.+ const rects = range.getClientRects();+ const rect = rects[rects.length - 1];+ const center = rect.top + rect.height / 2;+ if (previousCenter !== null && Math.abs(center - previousCenter) > 10)+ result += "|";+ previousCenter = center;+ result += content[i];+ }+ println(`${wordBreak} ${JSON.stringify(content)}: ${JSON.stringify(result)}`);+ }+ });+</script>