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

Unified Diff: Source/core/layout/LayoutListMarker.cpp

Issue 1170603003: Drop trailing zeroes only for rightmost group for cjk-ideographic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Really fix test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/lists/w3-list-styles-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutListMarker.cpp
diff --git a/Source/core/layout/LayoutListMarker.cpp b/Source/core/layout/LayoutListMarker.cpp
index 6342510585ad0454a109d65ace58b666b952c60b..81abb8c1ea8cbfc348a86e39c73d123292b4d7f8 100644
--- a/Source/core/layout/LayoutListMarker.cpp
+++ b/Source/core/layout/LayoutListMarker.cpp
@@ -359,26 +359,39 @@ static String toCJKIdeographic(int number, const UChar table[23])
group[7] = static_cast<AbstractCJKChar>(SecondGroupMarker - 1 + i);
// Put in the four digits and digit markers for any non-zero digits.
- group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 10));
+ int digitValue = (groupValue % 10);
+ bool trailingZero = table[Lang] == Chinese && !digitValue;
+ if (digitValue)
+ group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 10));
if (number != 0 || groupValue > 9) {
- int digitValue = ((groupValue / 10) % 10);
- group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
+ digitValue = ((groupValue / 10) % 10);
+ if (digitValue || !trailingZero)
+ group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
+ trailingZero &= !digitValue;
if (digitValue)
group[5] = SecondDigitMarker;
}
if (number != 0 || groupValue > 99) {
- int digitValue = ((groupValue / 100) % 10);
- group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
+ digitValue = ((groupValue / 100) % 10);
+ if (digitValue || !trailingZero)
+ group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
+ trailingZero &= !digitValue;
if (digitValue)
group[3] = ThirdDigitMarker;
}
if (number != 0 || groupValue > 999) {
- int digitValue = groupValue / 1000;
- group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
+ digitValue = groupValue / 1000;
+ if (digitValue || !trailingZero)
+ group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
if (digitValue)
group[1] = FourthDigitMarker;
}
+ if (trailingZero && i > 0) {
+ group[6] = group[7];
+ group[7] = Digit0;
+ }
+
// Remove the tens digit, but leave the marker, for any group that has
// a value of less than 20.
if (table[Lang] == Chinese && groupValue < 20) {
@@ -447,11 +460,10 @@ static EListStyleType effectiveListMarkerType(EListStyleType type, int value)
case Tibetan:
case Urdu:
case KoreanHangulFormal:
+ case CJKIdeographic:
return type; // Can represent all ordinals.
case Armenian:
return (value < 1 || value > 99999999) ? DecimalListStyle : type;
- case CJKIdeographic:
- return (value < 0) ? DecimalListStyle : type;
case Georgian:
return (value < 1 || value > 19999) ? DecimalListStyle : type;
case Hebrew:
« no previous file with comments | « LayoutTests/fast/lists/w3-list-styles-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698