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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/lists/w3-list-styles-expected.txt ('k') | no next file » | 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 int groupValue = number % 10000; 352 int groupValue = number % 10000;
353 number /= 10000; 353 number /= 10000;
354 354
355 // Process least-significant group first, but put it in the buffer last. 355 // Process least-significant group first, but put it in the buffer last.
356 AbstractCJKChar* group = &buffer[(3 - i) * groupLength]; 356 AbstractCJKChar* group = &buffer[(3 - i) * groupLength];
357 357
358 if (groupValue && i) 358 if (groupValue && i)
359 group[7] = static_cast<AbstractCJKChar>(SecondGroupMarker - 1 + i); 359 group[7] = static_cast<AbstractCJKChar>(SecondGroupMarker - 1 + i);
360 360
361 // Put in the four digits and digit markers for any non-zero digits. 361 // Put in the four digits and digit markers for any non-zero digits.
362 group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 10)); 362 int digitValue = (groupValue % 10);
363 bool trailingZero = table[Lang] == Chinese && !digitValue;
364 if (digitValue)
365 group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 10));
363 if (number != 0 || groupValue > 9) { 366 if (number != 0 || groupValue > 9) {
364 int digitValue = ((groupValue / 10) % 10); 367 digitValue = ((groupValue / 10) % 10);
365 group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue); 368 if (digitValue || !trailingZero)
369 group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
370 trailingZero &= !digitValue;
366 if (digitValue) 371 if (digitValue)
367 group[5] = SecondDigitMarker; 372 group[5] = SecondDigitMarker;
368 } 373 }
369 if (number != 0 || groupValue > 99) { 374 if (number != 0 || groupValue > 99) {
370 int digitValue = ((groupValue / 100) % 10); 375 digitValue = ((groupValue / 100) % 10);
371 group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue); 376 if (digitValue || !trailingZero)
377 group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
378 trailingZero &= !digitValue;
372 if (digitValue) 379 if (digitValue)
373 group[3] = ThirdDigitMarker; 380 group[3] = ThirdDigitMarker;
374 } 381 }
375 if (number != 0 || groupValue > 999) { 382 if (number != 0 || groupValue > 999) {
376 int digitValue = groupValue / 1000; 383 digitValue = groupValue / 1000;
377 group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue); 384 if (digitValue || !trailingZero)
385 group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
378 if (digitValue) 386 if (digitValue)
379 group[1] = FourthDigitMarker; 387 group[1] = FourthDigitMarker;
380 } 388 }
381 389
390 if (trailingZero && i > 0) {
391 group[6] = group[7];
392 group[7] = Digit0;
393 }
394
382 // Remove the tens digit, but leave the marker, for any group that has 395 // Remove the tens digit, but leave the marker, for any group that has
383 // a value of less than 20. 396 // a value of less than 20.
384 if (table[Lang] == Chinese && groupValue < 20) { 397 if (table[Lang] == Chinese && groupValue < 20) {
385 ASSERT(group[4] == NoChar || group[4] == Digit0 || group[4] == Digit 1); 398 ASSERT(group[4] == NoChar || group[4] == Digit0 || group[4] == Digit 1);
386 group[4] = NoChar; 399 group[4] = NoChar;
387 } 400 }
388 401
389 if (number == 0) 402 if (number == 0)
390 break; 403 break;
391 } 404 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 case Myanmar: 453 case Myanmar:
441 case NoneListStyle: 454 case NoneListStyle:
442 case Oriya: 455 case Oriya:
443 case Persian: 456 case Persian:
444 case Square: 457 case Square:
445 case Telugu: 458 case Telugu:
446 case Thai: 459 case Thai:
447 case Tibetan: 460 case Tibetan:
448 case Urdu: 461 case Urdu:
449 case KoreanHangulFormal: 462 case KoreanHangulFormal:
463 case CJKIdeographic:
450 return type; // Can represent all ordinals. 464 return type; // Can represent all ordinals.
451 case Armenian: 465 case Armenian:
452 return (value < 1 || value > 99999999) ? DecimalListStyle : type; 466 return (value < 1 || value > 99999999) ? DecimalListStyle : type;
453 case CJKIdeographic:
454 return (value < 0) ? DecimalListStyle : type;
455 case Georgian: 467 case Georgian:
456 return (value < 1 || value > 19999) ? DecimalListStyle : type; 468 return (value < 1 || value > 19999) ? DecimalListStyle : type;
457 case Hebrew: 469 case Hebrew:
458 return (value < 0 || value > 999999) ? DecimalListStyle : type; 470 return (value < 0 || value > 999999) ? DecimalListStyle : type;
459 case LowerRoman: 471 case LowerRoman:
460 case UpperRoman: 472 case UpperRoman:
461 return (value < 1 || value > 3999) ? DecimalListStyle : type; 473 return (value < 1 || value > 3999) ? DecimalListStyle : type;
462 case CjkEarthlyBranch: 474 case CjkEarthlyBranch:
463 case CjkHeavenlyStem: 475 case CjkHeavenlyStem:
464 case EthiopicHalehameAm: 476 case EthiopicHalehameAm:
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 if (style()) { 1376 if (style()) {
1365 // Reuse the current margins. Otherwise resetting the margins to initial values 1377 // Reuse the current margins. Otherwise resetting the margins to initial values
1366 // would trigger unnecessary layout. 1378 // would trigger unnecessary layout.
1367 newStyle->setMarginStart(style()->marginStart()); 1379 newStyle->setMarginStart(style()->marginStart());
1368 newStyle->setMarginEnd(style()->marginRight()); 1380 newStyle->setMarginEnd(style()->marginRight());
1369 } 1381 }
1370 setStyle(newStyle.release()); 1382 setStyle(newStyle.release());
1371 } 1383 }
1372 1384
1373 } // namespace blink 1385 } // namespace blink
OLDNEW
« 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