Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: Source/core/layout/LayoutListMarker.cpp

Issue 1210903004: Implement hanja counter styles (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix remaining tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/CSSValueKeywords.in ('k') | Source/core/paint/ListMarkerPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) 6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 AbstractCJKChar* group = &buffer[(3 - i) * groupLength]; 363 AbstractCJKChar* group = &buffer[(3 - i) * groupLength];
364 364
365 if (groupValue && i) { 365 if (groupValue && i) {
366 group[8] = static_cast<AbstractCJKChar>(SecondGroupMarker + i); 366 group[8] = static_cast<AbstractCJKChar>(SecondGroupMarker + i);
367 group[7] = static_cast<AbstractCJKChar>(SecondGroupMarker - 1 + i); 367 group[7] = static_cast<AbstractCJKChar>(SecondGroupMarker - 1 + i);
368 } 368 }
369 369
370 // Put in the four digits and digit markers for any non-zero digits. 370 // Put in the four digits and digit markers for any non-zero digits.
371 int digitValue = (groupValue % 10); 371 int digitValue = (groupValue % 10);
372 bool trailingZero = table[Lang] == Chinese && !digitValue; 372 bool trailingZero = table[Lang] == Chinese && !digitValue;
373 if (digitValue) 373 if (digitValue) {
374 group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 10)); 374 bool dropOne = table[Lang] == Korean && cjkStyle == Informal && digi tValue == 1 && i > 0;
375 if (!dropOne)
376 group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 1 0));
377 }
375 if (number != 0 || groupValue > 9) { 378 if (number != 0 || groupValue > 9) {
376 digitValue = ((groupValue / 10) % 10); 379 digitValue = ((groupValue / 10) % 10);
377 if (digitValue || !trailingZero) 380 bool dropOne = table[Lang] == Korean && cjkStyle == Informal && digi tValue == 1;
381 if ((digitValue && !dropOne) || (!digitValue && !trailingZero))
378 group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue); 382 group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
379 trailingZero &= !digitValue; 383 trailingZero &= !digitValue;
380 if (digitValue) 384 if (digitValue)
381 group[5] = SecondDigitMarker; 385 group[5] = SecondDigitMarker;
382 } 386 }
383 if (number != 0 || groupValue > 99) { 387 if (number != 0 || groupValue > 99) {
384 digitValue = ((groupValue / 100) % 10); 388 digitValue = ((groupValue / 100) % 10);
385 if (digitValue || !trailingZero) 389 bool dropOne = table[Lang] == Korean && cjkStyle == Informal && digi tValue == 1;
390 if ((digitValue && !dropOne) || (!digitValue && !trailingZero))
386 group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue); 391 group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
387 trailingZero &= !digitValue; 392 trailingZero &= !digitValue;
388 if (digitValue) 393 if (digitValue)
389 group[3] = ThirdDigitMarker; 394 group[3] = ThirdDigitMarker;
390 } 395 }
391 if (number != 0 || groupValue > 999) { 396 if (number != 0 || groupValue > 999) {
392 digitValue = groupValue / 1000; 397 digitValue = groupValue / 1000;
393 if (digitValue || !trailingZero) 398 bool dropOne = table[Lang] == Korean && cjkStyle == Informal && digi tValue == 1;
399 if ((digitValue && !dropOne) || (!digitValue && !trailingZero))
394 group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue); 400 group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
395 if (digitValue) 401 if (digitValue)
396 group[1] = FourthDigitMarker; 402 group[1] = FourthDigitMarker;
397 } 403 }
398 404
399 if (trailingZero && i > 0) { 405 if (trailingZero && i > 0) {
400 group[6] = group[7]; 406 group[6] = group[7];
401 group[7] = group[8]; 407 group[7] = group[8];
402 group[8] = Digit0; 408 group[8] = Digit0;
403 } 409 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 case Myanmar: 472 case Myanmar:
467 case NoneListStyle: 473 case NoneListStyle:
468 case Oriya: 474 case Oriya:
469 case Persian: 475 case Persian:
470 case Square: 476 case Square:
471 case Telugu: 477 case Telugu:
472 case Thai: 478 case Thai:
473 case Tibetan: 479 case Tibetan:
474 case Urdu: 480 case Urdu:
475 case KoreanHangulFormal: 481 case KoreanHangulFormal:
482 case KoreanHanjaFormal:
483 case KoreanHanjaInformal:
476 case CJKIdeographic: 484 case CJKIdeographic:
477 case SimpChineseFormal: 485 case SimpChineseFormal:
478 case SimpChineseInformal: 486 case SimpChineseInformal:
479 case TradChineseFormal: 487 case TradChineseFormal:
480 case TradChineseInformal: 488 case TradChineseInformal:
481 return type; // Can represent all ordinals. 489 return type; // Can represent all ordinals.
482 case Armenian: 490 case Armenian:
483 case LowerArmenian: 491 case LowerArmenian:
484 case UpperArmenian: 492 case UpperArmenian:
485 return (value < 1 || value > 99999999) ? DecimalListStyle : type; 493 return (value < 1 || value > 99999999) ? DecimalListStyle : type;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 case UpperArmenian: 581 case UpperArmenian:
574 case UpperLatin: 582 case UpperLatin:
575 case UpperRoman: 583 case UpperRoman:
576 case Urdu: 584 case Urdu:
577 return '.'; 585 return '.';
578 case SimpChineseFormal: 586 case SimpChineseFormal:
579 case SimpChineseInformal: 587 case SimpChineseInformal:
580 case TradChineseFormal: 588 case TradChineseFormal:
581 case TradChineseInformal: 589 case TradChineseInformal:
582 case KoreanHangulFormal: 590 case KoreanHangulFormal:
591 case KoreanHanjaFormal:
592 case KoreanHanjaInformal:
583 return 0x3001; 593 return 0x3001;
584 } 594 }
585 595
586 ASSERT_NOT_REACHED(); 596 ASSERT_NOT_REACHED();
587 return '.'; 597 return '.';
588 } 598 }
589 599
590 String listMarkerText(EListStyleType type, int value) 600 String listMarkerText(EListStyleType type, int value)
591 { 601 {
592 // If the list-style-type, say hebrew, cannot represent |value| because it's outside 602 // If the list-style-type, say hebrew, cannot represent |value| because it's outside
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 static const UChar koreanHangulFormalTable[26] = { 869 static const UChar koreanHangulFormalTable[26] = {
860 Korean, 870 Korean,
861 0xB9CC, 0x0000, 0xC5B5, 0x0000, 0xC870, 0x0000, 871 0xB9CC, 0x0000, 0xC5B5, 0x0000, 0xC870, 0x0000,
862 0xC2ED, 0xBC31, 0xCC9C, 872 0xC2ED, 0xBC31, 0xCC9C,
863 0xC601, 0xC77C, 0xC774, 0xC0BC, 0xC0AC, 873 0xC601, 0xC77C, 0xC774, 0xC0BC, 0xC0AC,
864 0xC624, 0xC721, 0xCE60, 0xD314, 0xAD6C, 874 0xC624, 0xC721, 0xCE60, 0xD314, 0xAD6C,
865 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000 875 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000
866 }; 876 };
867 return toCJKIdeographic(value, koreanHangulFormalTable, Formal); 877 return toCJKIdeographic(value, koreanHangulFormalTable, Formal);
868 } 878 }
879 case KoreanHanjaFormal: {
880 static const UChar koreanHanjaFormalTable[26] = {
881 Korean,
882 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000,
883 0x62FE, 0x767E, 0x4EDF,
884 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x56DB,
885 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D,
886 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000
887 };
888 return toCJKIdeographic(value, koreanHanjaFormalTable, Formal);
889 }
890 case KoreanHanjaInformal: {
891 static const UChar koreanHanjaInformalTable[26] = {
892 Korean,
893 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000,
894 0x5341, 0x767E, 0x5343,
895 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB,
896 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D,
897 0xB9C8, 0xC774, 0xB108, 0xC2A4, 0x0020, 0x0000
898 };
899 return toCJKIdeographic(value, koreanHanjaInformalTable, Informal);
900 }
869 case CJKIdeographic: 901 case CJKIdeographic:
870 case TradChineseInformal: { 902 case TradChineseInformal: {
871 static const UChar traditionalChineseInformalTable[22] = { 903 static const UChar traditionalChineseInformalTable[22] = {
872 Chinese, 904 Chinese,
873 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000, 905 0x842C, 0x0000, 0x5104, 0x0000, 0x5146, 0x0000,
874 0x5341, 0x767E, 0x5343, 906 0x5341, 0x767E, 0x5343,
875 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 907 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB,
876 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D, 908 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D,
877 0x8CA0, 0x0000 909 0x8CA0, 0x0000
878 }; 910 };
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 case EthiopicHalehame: 1131 case EthiopicHalehame:
1100 case EthiopicHalehameAm: 1132 case EthiopicHalehameAm:
1101 case EthiopicHalehameTiEr: 1133 case EthiopicHalehameTiEr:
1102 case EthiopicHalehameTiEt: 1134 case EthiopicHalehameTiEt:
1103 case Georgian: 1135 case Georgian:
1104 case Gujarati: 1136 case Gujarati:
1105 case Gurmukhi: 1137 case Gurmukhi:
1106 case Hangul: 1138 case Hangul:
1107 case HangulConsonant: 1139 case HangulConsonant:
1108 case KoreanHangulFormal: 1140 case KoreanHangulFormal:
1141 case KoreanHanjaFormal:
1142 case KoreanHanjaInformal:
1109 case Hebrew: 1143 case Hebrew:
1110 case Hiragana: 1144 case Hiragana:
1111 case HiraganaIroha: 1145 case HiraganaIroha:
1112 case Kannada: 1146 case Kannada:
1113 case Katakana: 1147 case Katakana:
1114 case KatakanaIroha: 1148 case KatakanaIroha:
1115 case Khmer: 1149 case Khmer:
1116 case Lao: 1150 case Lao:
1117 case LowerAlpha: 1151 case LowerAlpha:
1118 case LowerArmenian: 1152 case LowerArmenian:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 case EthiopicHalehame: 1213 case EthiopicHalehame:
1180 case EthiopicHalehameAm: 1214 case EthiopicHalehameAm:
1181 case EthiopicHalehameTiEr: 1215 case EthiopicHalehameTiEr:
1182 case EthiopicHalehameTiEt: 1216 case EthiopicHalehameTiEt:
1183 case Georgian: 1217 case Georgian:
1184 case Gujarati: 1218 case Gujarati:
1185 case Gurmukhi: 1219 case Gurmukhi:
1186 case Hangul: 1220 case Hangul:
1187 case HangulConsonant: 1221 case HangulConsonant:
1188 case KoreanHangulFormal: 1222 case KoreanHangulFormal:
1223 case KoreanHanjaFormal:
1224 case KoreanHanjaInformal:
1189 case Hebrew: 1225 case Hebrew:
1190 case Hiragana: 1226 case Hiragana:
1191 case HiraganaIroha: 1227 case HiraganaIroha:
1192 case Kannada: 1228 case Kannada:
1193 case Katakana: 1229 case Katakana:
1194 case KatakanaIroha: 1230 case KatakanaIroha:
1195 case Khmer: 1231 case Khmer:
1196 case Lao: 1232 case Lao:
1197 case LowerAlpha: 1233 case LowerAlpha:
1198 case LowerArmenian: 1234 case LowerArmenian:
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 case Devanagari: 1390 case Devanagari:
1355 case EthiopicHalehame: 1391 case EthiopicHalehame:
1356 case EthiopicHalehameAm: 1392 case EthiopicHalehameAm:
1357 case EthiopicHalehameTiEr: 1393 case EthiopicHalehameTiEr:
1358 case EthiopicHalehameTiEt: 1394 case EthiopicHalehameTiEt:
1359 case Georgian: 1395 case Georgian:
1360 case Gujarati: 1396 case Gujarati:
1361 case Gurmukhi: 1397 case Gurmukhi:
1362 case Hangul: 1398 case Hangul:
1363 case KoreanHangulFormal: 1399 case KoreanHangulFormal:
1400 case KoreanHanjaFormal:
1401 case KoreanHanjaInformal:
1364 case HangulConsonant: 1402 case HangulConsonant:
1365 case Hebrew: 1403 case Hebrew:
1366 case Hiragana: 1404 case Hiragana:
1367 case HiraganaIroha: 1405 case HiraganaIroha:
1368 case Kannada: 1406 case Kannada:
1369 case Katakana: 1407 case Katakana:
1370 case KatakanaIroha: 1408 case KatakanaIroha:
1371 case Khmer: 1409 case Khmer:
1372 case Lao: 1410 case Lao:
1373 case LowerAlpha: 1411 case LowerAlpha:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 if (style()) { 1481 if (style()) {
1444 // Reuse the current margins. Otherwise resetting the margins to initial values 1482 // Reuse the current margins. Otherwise resetting the margins to initial values
1445 // would trigger unnecessary layout. 1483 // would trigger unnecessary layout.
1446 newStyle->setMarginStart(style()->marginStart()); 1484 newStyle->setMarginStart(style()->marginStart());
1447 newStyle->setMarginEnd(style()->marginRight()); 1485 newStyle->setMarginEnd(style()->marginRight());
1448 } 1486 }
1449 setStyle(newStyle.release()); 1487 setStyle(newStyle.release());
1450 } 1488 }
1451 1489
1452 } // namespace blink 1490 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSValueKeywords.in ('k') | Source/core/paint/ListMarkerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698