Bug 1748061 - Make line-breaking behavior of fullwidth compatibility characters more compatible with UAX#14 and other browsers. r=platform-i18n-reviewers,gregtatum

Differential Revision: https://phabricator.services.mozilla.com/D136216
This commit is contained in:
Jonathan Kew 2022-01-23 17:44:33 +00:00
parent 9d8a5eda59
commit 67c4eb5567
96 changed files with 27 additions and 214 deletions

View file

@ -400,10 +400,10 @@ static int8_t GetClass(uint32_t u, LineBreakRule aLevel,
/* BREAK_BEFORE = 5, [BB] */ CLASS_OPEN_LIKE_CHARACTER,
/* MANDATORY_BREAK = 6, [BK] */ CLASS_CHARACTER,
/* CONTINGENT_BREAK = 7, [CB] */ CLASS_CHARACTER,
/* CLOSE_PUNCTUATION = 8, [CL] */ CLASS_CHARACTER,
/* CLOSE_PUNCTUATION = 8, [CL] */ CLASS_CLOSE_LIKE_CHARACTER,
/* COMBINING_MARK = 9, [CM] */ CLASS_CHARACTER,
/* CARRIAGE_RETURN = 10, [CR] */ CLASS_BREAKABLE,
/* EXCLAMATION = 11, [EX] */ CLASS_CHARACTER,
/* EXCLAMATION = 11, [EX] */ CLASS_CLOSE_LIKE_CHARACTER,
/* GLUE = 12, [GL] */ CLASS_NON_BREAKABLE,
/* HYPHEN = 13, [HY] */ CLASS_CHARACTER,
/* IDEOGRAPHIC = 14, [ID] */ CLASS_BREAKABLE,
@ -412,8 +412,8 @@ static int8_t GetClass(uint32_t u, LineBreakRule aLevel,
/* LINE_FEED = 17, [LF] */ CLASS_BREAKABLE,
/* NONSTARTER = 18, [NS] */ CLASS_CLOSE_LIKE_CHARACTER,
/* NUMERIC = 19, [NU] */ CLASS_NUMERIC,
/* OPEN_PUNCTUATION = 20, [OP] */ CLASS_CHARACTER,
/* POSTFIX_NUMERIC = 21, [PO] */ CLASS_CHARACTER,
/* OPEN_PUNCTUATION = 20, [OP] */ CLASS_OPEN_LIKE_CHARACTER,
/* POSTFIX_NUMERIC = 21, [PO] */ CLASS_CLOSE_LIKE_CHARACTER,
/* PREFIX_NUMERIC = 22, [PR] */ CLASS_CHARACTER,
/* QUOTATION = 23, [QU] */ CLASS_CHARACTER,
/* COMPLEX_CONTEXT = 24, [SA] */ CLASS_CHARACTER,
@ -564,20 +564,10 @@ static int8_t GetClass(uint32_t u, LineBreakRule aLevel,
}
if (0xff00 == h) {
if (l <= 0x0060) { // Fullwidth ASCII variant
// Fullwidth comma and period are exceptions to our map-to-ASCII
// behavior: https://bugzilla.mozilla.org/show_bug.cgi?id=1595428
if (l + 0x20 == ',' || l + 0x20 == '.') {
return CLASS_CLOSE;
}
// Also special-case fullwidth left/right white parenthesis,
// which do not fit the pattern of mapping to the ASCII block
if (l == 0x005f) {
return CLASS_OPEN;
}
if (l == 0x0060) {
return CLASS_CLOSE;
}
return GETCLASSFROMTABLE(gLBClass00, (l + 0x20));
// Previously, we treated Fullwidth chars the same as their ASCII
// counterparts, but UAX#14 (LineBreak.txt) disagrees with this and
// treats many of them as ideograph-like.
return sUnicodeLineBreakToClass[cls];
}
if (l < 0x00a0) { // Halfwidth Katakana variants
switch (l) {

View file

@ -68,6 +68,9 @@ static inline bool NS_NeedsPlatformNativeHandling(char16_t aChar) {
// Tibetan; better to just use our class-based breaker.
(0x0e01 <= aChar && aChar <= 0x0eff) || // Thai, Lao
#else
// Routing Tibetan to the platform-native breaker currently results in
// WPT failures in a few css3-text-line-break-opclns-* testcases that mix
// a Tibetan character with other-script context.
(0x0e01 <= aChar && aChar <= 0x0fff) || // Thai, Lao, Tibetan
#endif
(0x1780 <= aChar && aChar <= 0x17ff); // Khmer

View file

@ -1,2 +1,5 @@
[css3-text-line-break-opclns-004.html]
expected: FAIL
expected:
if os == "win": PASS
if os == "android": PASS
FAIL

View file

@ -1,2 +1,5 @@
[css3-text-line-break-opclns-005.html]
expected: FAIL
expected:
if os == "win": PASS
if os == "android": PASS
FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-006.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-012.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-014.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-015.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-016.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-017.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-018.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-019.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-020.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-021.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-022.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-023.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-024.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-025.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-026.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-027.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-028.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-029.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-030.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-031.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-032.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-033.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-034.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-035.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-036.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-037.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-049.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-050.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-051.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-052.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-053.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-054.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-055.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-056.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-057.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-058.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-059.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-060.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-102.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-103.html]
expected: FAIL

View file

@ -1,2 +1,5 @@
[css3-text-line-break-opclns-111.html]
expected: FAIL
expected:
if os == "win": PASS
if os == "android": PASS
FAIL

View file

@ -1,2 +1,5 @@
[css3-text-line-break-opclns-112.html]
expected: FAIL
expected:
if os == "win": PASS
if os == "android": PASS
FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-113.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-117.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-119.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-120.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-121.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-122.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-123.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-124.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-125.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-126.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-127.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-128.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-129.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-130.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-131.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-132.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-133.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-134.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-135.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-136.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-137.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-138.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-139.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-140.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-141.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-142.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-155.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-156.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-157.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-158.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-159.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-160.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-161.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-162.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-163.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-164.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-165.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[css3-text-line-break-opclns-166.html]
expected: FAIL

View file

@ -1,7 +1,4 @@
[css-text-line-break-de-po-loose.html]
[FE6A SMALL PERCENT SIGN may NOT appear at line start if de and loose]
expected: FAIL
[2035 REVERSED PRIME may NOT appear at line start if de and loose]
expected: FAIL

View file

@ -17,6 +17,3 @@
[2035 REVERSED PRIME may NOT appear at line start if de and normal]
expected: FAIL
[FE6A SMALL PERCENT SIGN may NOT appear at line start if de and normal]
expected: FAIL

View file

@ -5,9 +5,6 @@
[2033 DOUBLE PRIME may NOT appear at line start if de and strict]
expected: FAIL
[FE6A SMALL PERCENT SIGN may NOT appear at line start if de and strict]
expected: FAIL
[2109 DEGREE FAHRENHEIT may NOT appear at line start if de and strict]
expected: FAIL

View file

@ -1,6 +1,3 @@
[css-text-line-break-de-pr-loose.html]
[00B1 PLUS-MINUS SIGN may appear at line start if de and loose]
expected: FAIL
[FF04 FULLWIDTH DOLLAR SIGN may appear at line start if de and loose]
expected: FAIL

View file

@ -1,6 +1,3 @@
[css-text-line-break-de-pr-normal.html]
[00B1 PLUS-MINUS SIGN may appear at line start if de and normal]
expected: FAIL
[FF04 FULLWIDTH DOLLAR SIGN may appear at line start if de and normal]
expected: FAIL

View file

@ -1,6 +1,3 @@
[css-text-line-break-de-pr-strict.html]
[00B1 PLUS-MINUS SIGN may appear at line start if de and strict]
expected: FAIL
[FF04 FULLWIDTH DOLLAR SIGN may appear at line start if de and strict]
expected: FAIL

View file

@ -11,9 +11,6 @@
[2032 PRIME may NOT appear at line start if loose]
expected: FAIL
[FE6A SMALL PERCENT SIGN may NOT appear at line start if loose]
expected: FAIL
[2035 REVERSED PRIME may NOT appear at line start if loose]
expected: FAIL

View file

@ -2,9 +2,6 @@
[2033 DOUBLE PRIME may NOT appear at line start if normal]
expected: FAIL
[FE6A SMALL PERCENT SIGN may NOT appear at line start if normal]
expected: FAIL
[2103 DEGREE CELSIUS may NOT appear at line start if normal]
expected: FAIL

View file

@ -5,9 +5,6 @@
[2032 PRIME may NOT appear at line start if strict]
expected: FAIL
[FE6A SMALL PERCENT SIGN may NOT appear at line start if strict]
expected: FAIL
[2035 REVERSED PRIME may NOT appear at line start if strict]
expected: FAIL

View file

@ -1,6 +1,3 @@
[css-text-line-break-pr-loose.html]
[00B1 PLUS-MINUS SIGN may appear at line start if loose]
expected: FAIL
[FF04 FULLWIDTH DOLLAR SIGN may appear at line start if loose]
expected: FAIL

View file

@ -1,6 +1,3 @@
[css-text-line-break-pr-normal.html]
[00B1 PLUS-MINUS SIGN may appear at line start if normal]
expected: FAIL
[FF04 FULLWIDTH DOLLAR SIGN may appear at line start if normal]
expected: FAIL

View file

@ -1,6 +1,3 @@
[css-text-line-break-pr-strict.html]
[00B1 PLUS-MINUS SIGN may appear at line start if strict]
expected: FAIL
[FF04 FULLWIDTH DOLLAR SIGN may appear at line start if strict]
expected: FAIL