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

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

Issue 931423003: Rename rendering/RenderList* to layout/LayoutList* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove spurious LayoutLayerModelObject reference Created 5 years, 10 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/layout/LayoutListMarker.h ('k') | Source/core/layout/LayoutObject.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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/rendering/RenderListMarker.h" 26 #include "core/layout/LayoutListMarker.h"
27 27
28 #include "core/fetch/ImageResource.h" 28 #include "core/fetch/ImageResource.h"
29 #include "core/layout/Layer.h" 29 #include "core/layout/Layer.h"
30 #include "core/layout/LayoutListItem.h"
30 #include "core/layout/TextRunConstructor.h" 31 #include "core/layout/TextRunConstructor.h"
31 #include "core/paint/ListMarkerPainter.h" 32 #include "core/paint/ListMarkerPainter.h"
32 #include "core/rendering/RenderListItem.h"
33 #include "platform/fonts/Font.h" 33 #include "platform/fonts/Font.h"
34 #include "wtf/text/StringBuilder.h" 34 #include "wtf/text/StringBuilder.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 const int cMarkerPadding = 7; 38 const int cMarkerPadding = 7;
39 39
40 enum SequenceType { NumericSequence, AlphabeticSequence }; 40 enum SequenceType { NumericSequence, AlphabeticSequence };
41 41
42 static String toRoman(int number, bool upper) 42 static String toRoman(int number, bool upper)
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 if (number == 0) { 199 if (number == 0) {
200 static const UChar hebrewZero[3] = { 0x05D0, 0x05E4, 0x05E1 }; 200 static const UChar hebrewZero[3] = { 0x05D0, 0x05E4, 0x05E1 };
201 return String(hebrewZero, 3); 201 return String(hebrewZero, 3);
202 } 202 }
203 203
204 const int lettersSize = 11; // big enough for two 5-digit sequences plus a q uote mark between 204 const int lettersSize = 11; // big enough for two 5-digit sequences plus a q uote mark between
205 UChar letters[lettersSize]; 205 UChar letters[lettersSize];
206 206
207 int length; 207 int length;
208 if (number < 1000) 208 if (number < 1000) {
209 length = 0; 209 length = 0;
210 else { 210 } else {
211 length = toHebrewUnder1000(number / 1000, letters); 211 length = toHebrewUnder1000(number / 1000, letters);
212 letters[length++] = '\''; 212 letters[length++] = '\'';
213 number = number % 1000; 213 number = number % 1000;
214 } 214 }
215 length += toHebrewUnder1000(number, letters + length); 215 length += toHebrewUnder1000(number, letters + length);
216 216
217 ASSERT(length <= lettersSize); 217 ASSERT(length <= lettersSize);
218 return String(letters, length); 218 return String(letters, length);
219 } 219 }
220 220
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return String(letters, length); 316 return String(letters, length);
317 } 317 }
318 318
319 // The table uses the order from the CSS3 specification: 319 // The table uses the order from the CSS3 specification:
320 // first 3 group markers, then 3 digit markers, then ten digits. 320 // first 3 group markers, then 3 digit markers, then ten digits.
321 static String toCJKIdeographic(int number, const UChar table[16]) 321 static String toCJKIdeographic(int number, const UChar table[16])
322 { 322 {
323 ASSERT(number >= 0); 323 ASSERT(number >= 0);
324 324
325 enum AbstractCJKChar { 325 enum AbstractCJKChar {
326 noChar, 326 NoChar,
327 secondGroupMarker, thirdGroupMarker, fourthGroupMarker, 327 SecondGroupMarker, ThirdGroupMarker, FourthGroupMarker,
328 secondDigitMarker, thirdDigitMarker, fourthDigitMarker, 328 SecondDigitMarker, ThirdDigitMarker, FourthDigitMarker,
329 digit0, digit1, digit2, digit3, digit4, 329 Digit0, Digit1, Digit2, Digit3, Digit4,
330 digit5, digit6, digit7, digit8, digit9 330 Digit5, Digit6, Digit7, Digit8, Digit9
331 }; 331 };
332 332
333 if (number == 0) 333 if (number == 0)
334 return String(&table[digit0 - 1], 1); 334 return String(&table[Digit0 - 1], 1);
335 335
336 const int groupLength = 8; // 4 digits, 3 digit markers, and a group marker 336 const int groupLength = 8; // 4 digits, 3 digit markers, and a group marker
337 const int bufferLength = 4 * groupLength; 337 const int bufferLength = 4 * groupLength;
338 AbstractCJKChar buffer[bufferLength] = { noChar }; 338 AbstractCJKChar buffer[bufferLength] = { NoChar };
339 339
340 for (int i = 0; i < 4; ++i) { 340 for (int i = 0; i < 4; ++i) {
341 int groupValue = number % 10000; 341 int groupValue = number % 10000;
342 number /= 10000; 342 number /= 10000;
343 343
344 // Process least-significant group first, but put it in the buffer last. 344 // Process least-significant group first, but put it in the buffer last.
345 AbstractCJKChar* group = &buffer[(3 - i) * groupLength]; 345 AbstractCJKChar* group = &buffer[(3 - i) * groupLength];
346 346
347 if (groupValue && i) 347 if (groupValue && i)
348 group[7] = static_cast<AbstractCJKChar>(secondGroupMarker - 1 + i); 348 group[7] = static_cast<AbstractCJKChar>(SecondGroupMarker - 1 + i);
349 349
350 // Put in the four digits and digit markers for any non-zero digits. 350 // Put in the four digits and digit markers for any non-zero digits.
351 group[6] = static_cast<AbstractCJKChar>(digit0 + (groupValue % 10)); 351 group[6] = static_cast<AbstractCJKChar>(Digit0 + (groupValue % 10));
352 if (number != 0 || groupValue > 9) { 352 if (number != 0 || groupValue > 9) {
353 int digitValue = ((groupValue / 10) % 10); 353 int digitValue = ((groupValue / 10) % 10);
354 group[4] = static_cast<AbstractCJKChar>(digit0 + digitValue); 354 group[4] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
355 if (digitValue) 355 if (digitValue)
356 group[5] = secondDigitMarker; 356 group[5] = SecondDigitMarker;
357 } 357 }
358 if (number != 0 || groupValue > 99) { 358 if (number != 0 || groupValue > 99) {
359 int digitValue = ((groupValue / 100) % 10); 359 int digitValue = ((groupValue / 100) % 10);
360 group[2] = static_cast<AbstractCJKChar>(digit0 + digitValue); 360 group[2] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
361 if (digitValue) 361 if (digitValue)
362 group[3] = thirdDigitMarker; 362 group[3] = ThirdDigitMarker;
363 } 363 }
364 if (number != 0 || groupValue > 999) { 364 if (number != 0 || groupValue > 999) {
365 int digitValue = groupValue / 1000; 365 int digitValue = groupValue / 1000;
366 group[0] = static_cast<AbstractCJKChar>(digit0 + digitValue); 366 group[0] = static_cast<AbstractCJKChar>(Digit0 + digitValue);
367 if (digitValue) 367 if (digitValue)
368 group[1] = fourthDigitMarker; 368 group[1] = FourthDigitMarker;
369 } 369 }
370 370
371 // Remove the tens digit, but leave the marker, for any group that has 371 // Remove the tens digit, but leave the marker, for any group that has
372 // a value of less than 20. 372 // a value of less than 20.
373 if (groupValue < 20) { 373 if (groupValue < 20) {
374 ASSERT(group[4] == noChar || group[4] == digit0 || group[4] == digit 1); 374 ASSERT(group[4] == NoChar || group[4] == Digit0 || group[4] == Digit 1);
375 group[4] = noChar; 375 group[4] = NoChar;
376 } 376 }
377 377
378 if (number == 0) 378 if (number == 0)
379 break; 379 break;
380 } 380 }
381 381
382 // Convert into characters, omitting consecutive runs of digit0 and 382 // Convert into characters, omitting consecutive runs of Digit0 and
383 // any trailing digit0. 383 // any trailing Digit0.
384 int length = 0; 384 int length = 0;
385 UChar characters[bufferLength]; 385 UChar characters[bufferLength];
386 AbstractCJKChar last = noChar; 386 AbstractCJKChar last = NoChar;
387 for (int i = 0; i < bufferLength; ++i) { 387 for (int i = 0; i < bufferLength; ++i) {
388 AbstractCJKChar a = buffer[i]; 388 AbstractCJKChar a = buffer[i];
389 if (a != noChar) { 389 if (a != NoChar) {
390 if (a != digit0 || last != digit0) 390 if (a != Digit0 || last != Digit0)
391 characters[length++] = table[a - 1]; 391 characters[length++] = table[a - 1];
392 last = a; 392 last = a;
393 } 393 }
394 } 394 }
395 if (last == digit0) 395 if (last == Digit0)
396 --length; 396 --length;
397 397
398 return String(characters, length); 398 return String(characters, length);
399 } 399 }
400 400
401 static EListStyleType effectiveListMarkerType(EListStyleType type, int value) 401 static EListStyleType effectiveListMarkerType(EListStyleType type, int value)
402 { 402 {
403 // Note, the following switch statement has been explicitly grouped 403 // Note, the following switch statement has been explicitly grouped
404 // by list-style-type ordinal range. 404 // by list-style-type ordinal range.
405 switch (type) { 405 switch (type) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 case UpperGreek: 490 case UpperGreek:
491 case UpperLatin: 491 case UpperLatin:
492 case UpperNorwegian: 492 case UpperNorwegian:
493 return (value < 1) ? DecimalListStyle : type; 493 return (value < 1) ? DecimalListStyle : type;
494 } 494 }
495 495
496 ASSERT_NOT_REACHED(); 496 ASSERT_NOT_REACHED();
497 return type; 497 return type;
498 } 498 }
499 499
500 UChar RenderListMarker::listMarkerSuffix(EListStyleType type, int value) 500 UChar LayoutListMarker::listMarkerSuffix(EListStyleType type, int value)
501 { 501 {
502 // If the list-style-type cannot represent |value| because it's outside its 502 // If the list-style-type cannot represent |value| because it's outside its
503 // ordinal range then we fall back to some list style that can represent |va lue|. 503 // ordinal range then we fall back to some list style that can represent |va lue|.
504 EListStyleType effectiveType = effectiveListMarkerType(type, value); 504 EListStyleType effectiveType = effectiveListMarkerType(type, value);
505 505
506 // Note, the following switch statement has been explicitly 506 // Note, the following switch statement has been explicitly
507 // grouped by list-style-type suffix. 507 // grouped by list-style-type suffix.
508 switch (effectiveType) { 508 switch (effectiveType) {
509 case Asterisks: 509 case Asterisks:
510 case Circle: 510 case Circle:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 ASSERT_NOT_REACHED(); 595 ASSERT_NOT_REACHED();
596 return '.'; 596 return '.';
597 } 597 }
598 598
599 String listMarkerText(EListStyleType type, int value) 599 String listMarkerText(EListStyleType type, int value)
600 { 600 {
601 // If the list-style-type, say hebrew, cannot represent |value| because it's outside 601 // If the list-style-type, say hebrew, cannot represent |value| because it's outside
602 // its ordinal range then we fallback to some list style that can represent |value|. 602 // its ordinal range then we fallback to some list style that can represent |value|.
603 switch (effectiveListMarkerType(type, value)) { 603 switch (effectiveListMarkerType(type, value)) {
604 case NoneListStyle: 604 case NoneListStyle:
605 return ""; 605 return "";
606 606
607 case Asterisks: { 607 case Asterisks: {
608 static const LChar asterisksSymbols[1] = { 608 static const LChar asterisksSymbols[1] = {
609 0x2A 609 0x2A
610 }; 610 };
611 return toSymbolic(value, asterisksSymbols); 611 return toSymbolic(value, asterisksSymbols);
612 } 612 }
613 // We use the same characters for text security. 613 // We use the same characters for text security.
614 // See RenderText::setInternalString. 614 // See RenderText::setInternalString.
615 case Circle: 615 case Circle:
616 return String(&whiteBullet, 1); 616 return String(&whiteBullet, 1);
617 case Disc: 617 case Disc:
618 return String(&bullet, 1); 618 return String(&bullet, 1);
619 case Footnotes: { 619 case Footnotes: {
620 static const UChar footnotesSymbols[4] = { 620 static const UChar footnotesSymbols[4] = {
621 0x002A, 0x2051, 0x2020, 0x2021 621 0x002A, 0x2051, 0x2020, 0x2021
622 }; 622 };
623 return toSymbolic(value, footnotesSymbols); 623 return toSymbolic(value, footnotesSymbols);
624 } 624 }
625 case Square: 625 case Square:
626 // The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE 626 // The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE
627 // instead, but I think this looks better. 627 // instead, but I think this looks better.
628 return String(&blackSquare, 1); 628 return String(&blackSquare, 1);
629 629
630 case DecimalListStyle: 630 case DecimalListStyle:
631 return String::number(value);
632 case DecimalLeadingZero:
633 if (value < -9 || value > 9)
631 return String::number(value); 634 return String::number(value);
632 case DecimalLeadingZero: 635 if (value < 0)
633 if (value < -9 || value > 9) 636 return "-0" + String::number(-value); // -01 to -09
634 return String::number(value); 637 return "0" + String::number(value); // 00 to 09
635 if (value < 0) 638
636 return "-0" + String::number(-value); // -01 to -09 639 case ArabicIndic: {
637 return "0" + String::number(value); // 00 to 09 640 static const UChar arabicIndicNumerals[10] = {
638 641 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x06 68, 0x0669
639 case ArabicIndic: { 642 };
640 static const UChar arabicIndicNumerals[10] = { 643 return toNumeric(value, arabicIndicNumerals);
641 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669 644 }
642 }; 645 case BinaryListStyle: {
643 return toNumeric(value, arabicIndicNumerals); 646 static const LChar binaryNumerals[2] = {
644 } 647 '0', '1'
645 case BinaryListStyle: { 648 };
646 static const LChar binaryNumerals[2] = { 649 return toNumeric(value, binaryNumerals);
647 '0', '1' 650 }
648 }; 651 case Bengali: {
649 return toNumeric(value, binaryNumerals); 652 static const UChar bengaliNumerals[10] = {
650 } 653 0x09E6, 0x09E7, 0x09E8, 0x09E9, 0x09EA, 0x09EB, 0x09EC, 0x09ED, 0x09 EE, 0x09EF
651 case Bengali: { 654 };
652 static const UChar bengaliNumerals[10] = { 655 return toNumeric(value, bengaliNumerals);
653 0x09E6, 0x09E7, 0x09E8, 0x09E9, 0x09EA, 0x09EB, 0x09EC, 0x09ED, 0x09EE, 0x09EF 656 }
654 }; 657 case Cambodian:
655 return toNumeric(value, bengaliNumerals); 658 case Khmer: {
656 } 659 static const UChar khmerNumerals[10] = {
657 case Cambodian: 660 0x17E0, 0x17E1, 0x17E2, 0x17E3, 0x17E4, 0x17E5, 0x17E6, 0x17E7, 0x17 E8, 0x17E9
658 case Khmer: { 661 };
659 static const UChar khmerNumerals[10] = { 662 return toNumeric(value, khmerNumerals);
660 0x17E0, 0x17E1, 0x17E2, 0x17E3, 0x17E4, 0x17E5, 0x17E6, 0x17E7, 0x17E8, 0x17E9 663 }
661 }; 664 case Devanagari: {
662 return toNumeric(value, khmerNumerals); 665 static const UChar devanagariNumerals[10] = {
663 } 666 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x09 6E, 0x096F
664 case Devanagari: { 667 };
665 static const UChar devanagariNumerals[10] = { 668 return toNumeric(value, devanagariNumerals);
666 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F 669 }
667 }; 670 case Gujarati: {
668 return toNumeric(value, devanagariNumerals); 671 static const UChar gujaratiNumerals[10] = {
669 } 672 0x0AE6, 0x0AE7, 0x0AE8, 0x0AE9, 0x0AEA, 0x0AEB, 0x0AEC, 0x0AED, 0x0A EE, 0x0AEF
670 case Gujarati: { 673 };
671 static const UChar gujaratiNumerals[10] = { 674 return toNumeric(value, gujaratiNumerals);
672 0x0AE6, 0x0AE7, 0x0AE8, 0x0AE9, 0x0AEA, 0x0AEB, 0x0AEC, 0x0AED, 0x0AEE, 0x0AEF 675 }
673 }; 676 case Gurmukhi: {
674 return toNumeric(value, gujaratiNumerals); 677 static const UChar gurmukhiNumerals[10] = {
675 } 678 0x0A66, 0x0A67, 0x0A68, 0x0A69, 0x0A6A, 0x0A6B, 0x0A6C, 0x0A6D, 0x0A 6E, 0x0A6F
676 case Gurmukhi: { 679 };
677 static const UChar gurmukhiNumerals[10] = { 680 return toNumeric(value, gurmukhiNumerals);
678 0x0A66, 0x0A67, 0x0A68, 0x0A69, 0x0A6A, 0x0A6B, 0x0A6C, 0x0A6D, 0x0A6E, 0x0A6F 681 }
679 }; 682 case Kannada: {
680 return toNumeric(value, gurmukhiNumerals); 683 static const UChar kannadaNumerals[10] = {
681 } 684 0x0CE6, 0x0CE7, 0x0CE8, 0x0CE9, 0x0CEA, 0x0CEB, 0x0CEC, 0x0CED, 0x0C EE, 0x0CEF
682 case Kannada: { 685 };
683 static const UChar kannadaNumerals[10] = { 686 return toNumeric(value, kannadaNumerals);
684 0x0CE6, 0x0CE7, 0x0CE8, 0x0CE9, 0x0CEA, 0x0CEB, 0x0CEC, 0x0CED, 0x0CEE, 0x0CEF 687 }
685 }; 688 case LowerHexadecimal: {
686 return toNumeric(value, kannadaNumerals); 689 static const LChar lowerHexadecimalNumerals[16] = {
687 } 690 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd' , 'e', 'f'
688 case LowerHexadecimal: { 691 };
689 static const LChar lowerHexadecimalNumerals[16] = { 692 return toNumeric(value, lowerHexadecimalNumerals);
690 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' 693 }
691 }; 694 case Lao: {
692 return toNumeric(value, lowerHexadecimalNumerals); 695 static const UChar laoNumerals[10] = {
693 } 696 0x0ED0, 0x0ED1, 0x0ED2, 0x0ED3, 0x0ED4, 0x0ED5, 0x0ED6, 0x0ED7, 0x0E D8, 0x0ED9
694 case Lao: { 697 };
695 static const UChar laoNumerals[10] = { 698 return toNumeric(value, laoNumerals);
696 0x0ED0, 0x0ED1, 0x0ED2, 0x0ED3, 0x0ED4, 0x0ED5, 0x0ED6, 0x0ED7, 0x0ED8, 0x0ED9 699 }
697 }; 700 case Malayalam: {
698 return toNumeric(value, laoNumerals); 701 static const UChar malayalamNumerals[10] = {
699 } 702 0x0D66, 0x0D67, 0x0D68, 0x0D69, 0x0D6A, 0x0D6B, 0x0D6C, 0x0D6D, 0x0D 6E, 0x0D6F
700 case Malayalam: { 703 };
701 static const UChar malayalamNumerals[10] = { 704 return toNumeric(value, malayalamNumerals);
702 0x0D66, 0x0D67, 0x0D68, 0x0D69, 0x0D6A, 0x0D6B, 0x0D6C, 0x0D6D, 0x0D6E, 0x0D6F 705 }
703 }; 706 case Mongolian: {
704 return toNumeric(value, malayalamNumerals); 707 static const UChar mongolianNumerals[10] = {
705 } 708 0x1810, 0x1811, 0x1812, 0x1813, 0x1814, 0x1815, 0x1816, 0x1817, 0x18 18, 0x1819
706 case Mongolian: { 709 };
707 static const UChar mongolianNumerals[10] = { 710 return toNumeric(value, mongolianNumerals);
708 0x1810, 0x1811, 0x1812, 0x1813, 0x1814, 0x1815, 0x1816, 0x1817, 0x1818, 0x1819 711 }
709 }; 712 case Myanmar: {
710 return toNumeric(value, mongolianNumerals); 713 static const UChar myanmarNumerals[10] = {
711 } 714 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x10 48, 0x1049
712 case Myanmar: { 715 };
713 static const UChar myanmarNumerals[10] = { 716 return toNumeric(value, myanmarNumerals);
714 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049 717 }
715 }; 718 case Octal: {
716 return toNumeric(value, myanmarNumerals); 719 static const LChar octalNumerals[8] = {
717 } 720 '0', '1', '2', '3', '4', '5', '6', '7'
718 case Octal: { 721 };
719 static const LChar octalNumerals[8] = { 722 return toNumeric(value, octalNumerals);
720 '0', '1', '2', '3', '4', '5', '6', '7' 723 }
721 }; 724 case Oriya: {
722 return toNumeric(value, octalNumerals); 725 static const UChar oriyaNumerals[10] = {
723 } 726 0x0B66, 0x0B67, 0x0B68, 0x0B69, 0x0B6A, 0x0B6B, 0x0B6C, 0x0B6D, 0x0B 6E, 0x0B6F
724 case Oriya: { 727 };
725 static const UChar oriyaNumerals[10] = { 728 return toNumeric(value, oriyaNumerals);
726 0x0B66, 0x0B67, 0x0B68, 0x0B69, 0x0B6A, 0x0B6B, 0x0B6C, 0x0B6D, 0x0B6E, 0x0B6F 729 }
727 }; 730 case Persian:
728 return toNumeric(value, oriyaNumerals); 731 case Urdu: {
729 } 732 static const UChar urduNumerals[10] = {
730 case Persian: 733 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06 F8, 0x06F9
731 case Urdu: { 734 };
732 static const UChar urduNumerals[10] = { 735 return toNumeric(value, urduNumerals);
733 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9 736 }
734 }; 737 case Telugu: {
735 return toNumeric(value, urduNumerals); 738 static const UChar teluguNumerals[10] = {
736 } 739 0x0C66, 0x0C67, 0x0C68, 0x0C69, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C 6E, 0x0C6F
737 case Telugu: { 740 };
738 static const UChar teluguNumerals[10] = { 741 return toNumeric(value, teluguNumerals);
739 0x0C66, 0x0C67, 0x0C68, 0x0C69, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C6F 742 }
740 }; 743 case Tibetan: {
741 return toNumeric(value, teluguNumerals); 744 static const UChar tibetanNumerals[10] = {
742 } 745 0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F 28, 0x0F29
743 case Tibetan: { 746 };
744 static const UChar tibetanNumerals[10] = { 747 return toNumeric(value, tibetanNumerals);
745 0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F28, 0x0F29 748 }
746 }; 749 case Thai: {
747 return toNumeric(value, tibetanNumerals); 750 static const UChar thaiNumerals[10] = {
748 } 751 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E 58, 0x0E59
749 case Thai: { 752 };
750 static const UChar thaiNumerals[10] = { 753 return toNumeric(value, thaiNumerals);
751 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59 754 }
752 }; 755 case UpperHexadecimal: {
753 return toNumeric(value, thaiNumerals); 756 static const LChar upperHexadecimalNumerals[16] = {
754 } 757 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D' , 'E', 'F'
755 case UpperHexadecimal: { 758 };
756 static const LChar upperHexadecimalNumerals[16] = { 759 return toNumeric(value, upperHexadecimalNumerals);
757 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 760 }
758 }; 761
759 return toNumeric(value, upperHexadecimalNumerals); 762 case LowerAlpha:
760 } 763 case LowerLatin: {
761 764 static const LChar lowerLatinAlphabet[26] = {
762 case LowerAlpha: 765 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
763 case LowerLatin: { 766 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
764 static const LChar lowerLatinAlphabet[26] = { 767 };
765 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 768 return toAlphabetic(value, lowerLatinAlphabet);
766 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' 769 }
767 }; 770 case UpperAlpha:
768 return toAlphabetic(value, lowerLatinAlphabet); 771 case UpperLatin: {
769 } 772 static const LChar upperLatinAlphabet[26] = {
770 case UpperAlpha: 773 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
771 case UpperLatin: { 774 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
772 static const LChar upperLatinAlphabet[26] = { 775 };
773 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 776 return toAlphabetic(value, upperLatinAlphabet);
774 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' 777 }
775 }; 778 case LowerGreek: {
776 return toAlphabetic(value, upperLatinAlphabet); 779 static const UChar lowerGreekAlphabet[24] = {
777 } 780 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
778 case LowerGreek: { 781 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0,
779 static const UChar lowerGreekAlphabet[24] = { 782 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9
780 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 783 };
781 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 784 return toAlphabetic(value, lowerGreekAlphabet);
782 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9 785 }
783 }; 786
784 return toAlphabetic(value, lowerGreekAlphabet); 787 case Hiragana: {
785 } 788 // FIXME: This table comes from the CSS3 draft, and is probably
786 789 // incorrect, given the comments in that draft.
787 case Hiragana: { 790 static const UChar hiraganaAlphabet[48] = {
788 // FIXME: This table comes from the CSS3 draft, and is probably 791 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F,
789 // incorrect, given the comments in that draft. 792 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D, 0x305F,
790 static const UChar hiraganaAlphabet[48] = { 793 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D,
791 0x3042, 0x3044, 0x3046, 0x3048, 0x304A, 0x304B, 0x304D, 0x304F, 794 0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E, 0x307F,
792 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305B, 0x305D, 0x305F, 795 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A,
793 0x3061, 0x3064, 0x3066, 0x3068, 0x306A, 0x306B, 0x306C, 0x306D, 796 0x308B, 0x308C, 0x308D, 0x308F, 0x3090, 0x3091, 0x3092, 0x3093
794 0x306E, 0x306F, 0x3072, 0x3075, 0x3078, 0x307B, 0x307E, 0x307F, 797 };
795 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088, 0x3089, 0x308A, 798 return toAlphabetic(value, hiraganaAlphabet);
796 0x308B, 0x308C, 0x308D, 0x308F, 0x3090, 0x3091, 0x3092, 0x3093 799 }
797 }; 800 case HiraganaIroha: {
798 return toAlphabetic(value, hiraganaAlphabet); 801 // FIXME: This table comes from the CSS3 draft, and is probably
799 } 802 // incorrect, given the comments in that draft.
800 case HiraganaIroha: { 803 static const UChar hiraganaIrohaAlphabet[47] = {
801 // FIXME: This table comes from the CSS3 draft, and is probably 804 0x3044, 0x308D, 0x306F, 0x306B, 0x307B, 0x3078, 0x3068, 0x3061,
802 // incorrect, given the comments in that draft. 805 0x308A, 0x306C, 0x308B, 0x3092, 0x308F, 0x304B, 0x3088, 0x305F,
803 static const UChar hiraganaIrohaAlphabet[47] = { 806 0x308C, 0x305D, 0x3064, 0x306D, 0x306A, 0x3089, 0x3080, 0x3046,
804 0x3044, 0x308D, 0x306F, 0x306B, 0x307B, 0x3078, 0x3068, 0x3061, 807 0x3090, 0x306E, 0x304A, 0x304F, 0x3084, 0x307E, 0x3051, 0x3075,
805 0x308A, 0x306C, 0x308B, 0x3092, 0x308F, 0x304B, 0x3088, 0x305F, 808 0x3053, 0x3048, 0x3066, 0x3042, 0x3055, 0x304D, 0x3086, 0x3081,
806 0x308C, 0x305D, 0x3064, 0x306D, 0x306A, 0x3089, 0x3080, 0x3046, 809 0x307F, 0x3057, 0x3091, 0x3072, 0x3082, 0x305B, 0x3059
807 0x3090, 0x306E, 0x304A, 0x304F, 0x3084, 0x307E, 0x3051, 0x3075, 810 };
808 0x3053, 0x3048, 0x3066, 0x3042, 0x3055, 0x304D, 0x3086, 0x3081, 811 return toAlphabetic(value, hiraganaIrohaAlphabet);
809 0x307F, 0x3057, 0x3091, 0x3072, 0x3082, 0x305B, 0x3059 812 }
810 }; 813 case Katakana: {
811 return toAlphabetic(value, hiraganaIrohaAlphabet); 814 // FIXME: This table comes from the CSS3 draft, and is probably
812 } 815 // incorrect, given the comments in that draft.
813 case Katakana: { 816 static const UChar katakanaAlphabet[48] = {
814 // FIXME: This table comes from the CSS3 draft, and is probably 817 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, 0x30AF,
815 // incorrect, given the comments in that draft. 818 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, 0x30BF,
816 static const UChar katakanaAlphabet[48] = { 819 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, 0x30CD,
817 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, 0x30AF, 820 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, 0x30DF,
818 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, 0x30BF, 821 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, 0x30EA,
819 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, 0x30CD, 822 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3
820 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, 0x30DF, 823 };
821 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, 0x30EA, 824 return toAlphabetic(value, katakanaAlphabet);
822 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F0, 0x30F1, 0x30F2, 0x30F3 825 }
823 }; 826 case KatakanaIroha: {
824 return toAlphabetic(value, katakanaAlphabet); 827 // FIXME: This table comes from the CSS3 draft, and is probably
825 } 828 // incorrect, given the comments in that draft.
826 case KatakanaIroha: { 829 static const UChar katakanaIrohaAlphabet[47] = {
827 // FIXME: This table comes from the CSS3 draft, and is probably 830 0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, 0x30D8, 0x30C8, 0x30C1,
828 // incorrect, given the comments in that draft. 831 0x30EA, 0x30CC, 0x30EB, 0x30F2, 0x30EF, 0x30AB, 0x30E8, 0x30BF,
829 static const UChar katakanaIrohaAlphabet[47] = { 832 0x30EC, 0x30BD, 0x30C4, 0x30CD, 0x30CA, 0x30E9, 0x30E0, 0x30A6,
830 0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, 0x30D8, 0x30C8, 0x30C1, 833 0x30F0, 0x30CE, 0x30AA, 0x30AF, 0x30E4, 0x30DE, 0x30B1, 0x30D5,
831 0x30EA, 0x30CC, 0x30EB, 0x30F2, 0x30EF, 0x30AB, 0x30E8, 0x30BF, 834 0x30B3, 0x30A8, 0x30C6, 0x30A2, 0x30B5, 0x30AD, 0x30E6, 0x30E1,
832 0x30EC, 0x30BD, 0x30C4, 0x30CD, 0x30CA, 0x30E9, 0x30E0, 0x30A6, 835 0x30DF, 0x30B7, 0x30F1, 0x30D2, 0x30E2, 0x30BB, 0x30B9
833 0x30F0, 0x30CE, 0x30AA, 0x30AF, 0x30E4, 0x30DE, 0x30B1, 0x30D5, 836 };
834 0x30B3, 0x30A8, 0x30C6, 0x30A2, 0x30B5, 0x30AD, 0x30E6, 0x30E1, 837 return toAlphabetic(value, katakanaIrohaAlphabet);
835 0x30DF, 0x30B7, 0x30F1, 0x30D2, 0x30E2, 0x30BB, 0x30B9 838 }
836 }; 839
837 return toAlphabetic(value, katakanaIrohaAlphabet); 840 case Afar:
838 } 841 case EthiopicHalehameAaEt:
839 842 case EthiopicHalehameAaEr: {
840 case Afar: 843 static const UChar ethiopicHalehameAaErAlphabet[18] = {
841 case EthiopicHalehameAaEt: 844 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1260, 0x1270, 0x12 90,
842 case EthiopicHalehameAaEr: { 845 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12E8, 0x12F0, 0x1308, 0x1338, 0x13 48
843 static const UChar ethiopicHalehameAaErAlphabet[18] = { 846 };
844 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1260, 0x1270, 0x1290, 847 return toAlphabetic(value, ethiopicHalehameAaErAlphabet);
845 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12E8, 0x12F0, 0x1308, 0x1338, 0x1348 848 }
846 }; 849 case Amharic:
847 return toAlphabetic(value, ethiopicHalehameAaErAlphabet); 850 case EthiopicHalehameAmEt: {
848 } 851 static const UChar ethiopicHalehameAmEtAlphabet[33] = {
849 case Amharic: 852 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x12 40,
850 case EthiopicHalehameAmEt: { 853 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12 B8,
851 static const UChar ethiopicHalehameAmEtAlphabet[33] = { 854 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x13 20,
852 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240, 855 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350
853 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 856 };
854 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 857 return toAlphabetic(value, ethiopicHalehameAmEtAlphabet);
855 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350 858 }
856 }; 859 case AmharicAbegede:
857 return toAlphabetic(value, ethiopicHalehameAmEtAlphabet); 860 case EthiopicAbegedeAmEt: {
858 } 861 static const UChar ethiopicAbegedeAmEtAlphabet[33] = {
859 case AmharicAbegede: 862 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12 E0,
860 case EthiopicAbegedeAmEt: { 863 0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x12 90,
861 static const UChar ethiopicAbegedeAmEtAlphabet[33] = { 864 0x1298, 0x1220, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1228, 0x1230, 0x12 38,
862 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12E0, 865 0x1270, 0x1278, 0x1280, 0x1340, 0x1330, 0x1350
863 0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x1290, 866 };
864 0x1298, 0x1220, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1228, 0x1230, 0x1238, 867 return toAlphabetic(value, ethiopicAbegedeAmEtAlphabet);
865 0x1270, 0x1278, 0x1280, 0x1340, 0x1330, 0x1350 868 }
866 }; 869 case CjkEarthlyBranch: {
867 return toAlphabetic(value, ethiopicAbegedeAmEtAlphabet); 870 static const UChar cjkEarthlyBranchAlphabet[12] = {
868 } 871 0x5B50, 0x4E11, 0x5BC5, 0x536F, 0x8FB0, 0x5DF3, 0x5348, 0x672A, 0x75 33,
869 case CjkEarthlyBranch: { 872 0x9149, 0x620C, 0x4EA5
870 static const UChar cjkEarthlyBranchAlphabet[12] = { 873 };
871 0x5B50, 0x4E11, 0x5BC5, 0x536F, 0x8FB0, 0x5DF3, 0x5348, 0x672A, 0x7533, 874 return toAlphabetic(value, cjkEarthlyBranchAlphabet);
872 0x9149, 0x620C, 0x4EA5 875 }
873 }; 876 case CjkHeavenlyStem: {
874 return toAlphabetic(value, cjkEarthlyBranchAlphabet); 877 static const UChar cjkHeavenlyStemAlphabet[10] = {
875 } 878 0x7532, 0x4E59, 0x4E19, 0x4E01, 0x620A, 0x5DF1, 0x5E9A, 0x8F9B, 0x58 EC,
876 case CjkHeavenlyStem: { 879 0x7678
877 static const UChar cjkHeavenlyStemAlphabet[10] = { 880 };
878 0x7532, 0x4E59, 0x4E19, 0x4E01, 0x620A, 0x5DF1, 0x5E9A, 0x8F9B, 0x58EC, 881 return toAlphabetic(value, cjkHeavenlyStemAlphabet);
879 0x7678 882 }
880 }; 883 case Ethiopic:
881 return toAlphabetic(value, cjkHeavenlyStemAlphabet); 884 case EthiopicHalehameGez: {
882 } 885 static const UChar ethiopicHalehameGezAlphabet[26] = {
883 case Ethiopic: 886 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1240, 0x12 60,
884 case EthiopicHalehameGez: { 887 0x1270, 0x1280, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12 E8,
885 static const UChar ethiopicHalehameGezAlphabet[26] = { 888 0x12F0, 0x1308, 0x1320, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350
886 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1240, 0x1260, 889 };
887 0x1270, 0x1280, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12E8, 890 return toAlphabetic(value, ethiopicHalehameGezAlphabet);
888 0x12F0, 0x1308, 0x1320, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350 891 }
889 }; 892 case EthiopicAbegede:
890 return toAlphabetic(value, ethiopicHalehameGezAlphabet); 893 case EthiopicAbegedeGez: {
891 } 894 static const UChar ethiopicAbegedeGezAlphabet[26] = {
892 case EthiopicAbegede: 895 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1200, 0x12C8, 0x12D8, 0x1210, 0x13 20,
893 case EthiopicAbegedeGez: { 896 0x12E8, 0x12A8, 0x1208, 0x1218, 0x1290, 0x1220, 0x12D0, 0x1348, 0x13 38,
894 static const UChar ethiopicAbegedeGezAlphabet[26] = { 897 0x1240, 0x1228, 0x1230, 0x1270, 0x1280, 0x1340, 0x1330, 0x1350
895 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1200, 0x12C8, 0x12D8, 0x1210, 0x1320, 898 };
896 0x12E8, 0x12A8, 0x1208, 0x1218, 0x1290, 0x1220, 0x12D0, 0x1348, 0x1338, 899 return toAlphabetic(value, ethiopicAbegedeGezAlphabet);
897 0x1240, 0x1228, 0x1230, 0x1270, 0x1280, 0x1340, 0x1330, 0x1350 900 }
898 }; 901 case HangulConsonant: {
899 return toAlphabetic(value, ethiopicAbegedeGezAlphabet); 902 static const UChar hangulConsonantAlphabet[14] = {
900 } 903 0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, 0x3145, 0x3147, 0x31 48,
901 case HangulConsonant: { 904 0x314A, 0x314B, 0x314C, 0x314D, 0x314E
902 static const UChar hangulConsonantAlphabet[14] = { 905 };
903 0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, 0x3145, 0x3147, 0x3148, 906 return toAlphabetic(value, hangulConsonantAlphabet);
904 0x314A, 0x314B, 0x314C, 0x314D, 0x314E 907 }
905 }; 908 case Hangul: {
906 return toAlphabetic(value, hangulConsonantAlphabet); 909 static const UChar hangulAlphabet[14] = {
907 } 910 0xAC00, 0xB098, 0xB2E4, 0xB77C, 0xB9C8, 0xBC14, 0xC0AC, 0xC544, 0xC7 90,
908 case Hangul: { 911 0xCC28, 0xCE74, 0xD0C0, 0xD30C, 0xD558
909 static const UChar hangulAlphabet[14] = { 912 };
910 0xAC00, 0xB098, 0xB2E4, 0xB77C, 0xB9C8, 0xBC14, 0xC0AC, 0xC544, 0xC790, 913 return toAlphabetic(value, hangulAlphabet);
911 0xCC28, 0xCE74, 0xD0C0, 0xD30C, 0xD558 914 }
912 }; 915 case Oromo:
913 return toAlphabetic(value, hangulAlphabet); 916 case EthiopicHalehameOmEt: {
914 } 917 static const UChar ethiopicHalehameOmEtAlphabet[25] = {
915 case Oromo: 918 0x1200, 0x1208, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 0x12 70,
916 case EthiopicHalehameOmEt: { 919 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12C8, 0x12E8, 0x12F0, 0x12 F8,
917 static const UChar ethiopicHalehameOmEtAlphabet[25] = { 920 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348
918 0x1200, 0x1208, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 0x1270, 921 };
919 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12C8, 0x12E8, 0x12F0, 0x12F8, 922 return toAlphabetic(value, ethiopicHalehameOmEtAlphabet);
920 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348 923 }
921 }; 924 case Sidama:
922 return toAlphabetic(value, ethiopicHalehameOmEtAlphabet); 925 case EthiopicHalehameSidEt: {
923 } 926 static const UChar ethiopicHalehameSidEtAlphabet[26] = {
924 case Sidama: 927 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x12 60,
925 case EthiopicHalehameSidEt: { 928 0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12C8, 0x12E8, 0x12 F0,
926 static const UChar ethiopicHalehameSidEtAlphabet[26] = { 929 0x12F8, 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348
927 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 930 };
928 0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12C8, 0x12E8, 0x12F0, 931 return toAlphabetic(value, ethiopicHalehameSidEtAlphabet);
929 0x12F8, 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348 932 }
930 }; 933 case Somali:
931 return toAlphabetic(value, ethiopicHalehameSidEtAlphabet); 934 case EthiopicHalehameSoEt: {
932 } 935 static const UChar ethiopicHalehameSoEtAlphabet[22] = {
933 case Somali: 936 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x12 60,
934 case EthiopicHalehameSoEt: { 937 0x1270, 0x1290, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 0x12D0, 0x12E8, 0x12 F0,
935 static const UChar ethiopicHalehameSoEtAlphabet[22] = { 938 0x1300, 0x1308, 0x1338, 0x1348
936 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 939 };
937 0x1270, 0x1290, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 0x12D0, 0x12E8, 0x12F0, 940 return toAlphabetic(value, ethiopicHalehameSoEtAlphabet);
938 0x1300, 0x1308, 0x1338, 0x1348 941 }
939 }; 942 case Tigre:
940 return toAlphabetic(value, ethiopicHalehameSoEtAlphabet); 943 case EthiopicHalehameTig: {
941 } 944 static const UChar ethiopicHalehameTigAlphabet[27] = {
942 case Tigre: 945 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x12 60,
943 case EthiopicHalehameTig: { 946 0x1270, 0x1278, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12 E8,
944 static const UChar ethiopicHalehameTigAlphabet[27] = { 947 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348, 0x13 50
945 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1260, 948 };
946 0x1270, 0x1278, 0x1290, 0x12A0, 0x12A8, 0x12C8, 0x12D0, 0x12D8, 0x12E8, 949 return toAlphabetic(value, ethiopicHalehameTigAlphabet);
947 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1338, 0x1330, 0x1348, 0x1350 950 }
948 }; 951 case TigrinyaEr:
949 return toAlphabetic(value, ethiopicHalehameTigAlphabet); 952 case EthiopicHalehameTiEr: {
950 } 953 static const UChar ethiopicHalehameTiErAlphabet[31] = {
951 case TigrinyaEr: 954 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x12 50,
952 case EthiopicHalehameTiEr: { 955 0x1260, 0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 0x12 C8,
953 static const UChar ethiopicHalehameTiErAlphabet[31] = { 956 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 0x13 28,
954 0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, 0x1238, 0x1240, 0x1250, 957 0x1330, 0x1338, 0x1348, 0x1350
955 0x1260, 0x1270, 0x1278, 0x1290, 0x1298, 0x12A0, 0x12A8, 0x12B8, 0x12C8, 958 };
956 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 0x1320, 0x1328, 959 return toAlphabetic(value, ethiopicHalehameTiErAlphabet);
957 0x1330, 0x1338, 0x1348, 0x1350 960 }
958 }; 961 case TigrinyaErAbegede:
959 return toAlphabetic(value, ethiopicHalehameTiErAlphabet); 962 case EthiopicAbegedeTiEr: {
960 } 963 static const UChar ethiopicAbegedeTiErAlphabet[31] = {
961 case TigrinyaErAbegede: 964 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12 E0,
962 case EthiopicAbegedeTiEr: { 965 0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x12 90,
963 static const UChar ethiopicAbegedeTiErAlphabet[31] = { 966 0x1298, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1250, 0x1228, 0x1230, 0x12 38,
964 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12E0, 967 0x1270, 0x1278, 0x1330, 0x1350
965 0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x1290, 968 };
966 0x1298, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1250, 0x1228, 0x1230, 0x1238, 969 return toAlphabetic(value, ethiopicAbegedeTiErAlphabet);
967 0x1270, 0x1278, 0x1330, 0x1350 970 }
968 }; 971 case TigrinyaEt:
969 return toAlphabetic(value, ethiopicAbegedeTiErAlphabet); 972 case EthiopicHalehameTiEt: {
970 } 973 static const UChar ethiopicHalehameTiEtAlphabet[34] = {
971 case TigrinyaEt: 974 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x12 40,
972 case EthiopicHalehameTiEt: { 975 0x1250, 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12 A8,
973 static const UChar ethiopicHalehameTiEtAlphabet[34] = { 976 0x12B8, 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x13 08,
974 0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, 0x1230, 0x1238, 0x1240, 977 0x1320, 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350
975 0x1250, 0x1260, 0x1270, 0x1278, 0x1280, 0x1290, 0x1298, 0x12A0, 0x12A8, 978 };
976 0x12B8, 0x12C8, 0x12D0, 0x12D8, 0x12E0, 0x12E8, 0x12F0, 0x1300, 0x1308, 979 return toAlphabetic(value, ethiopicHalehameTiEtAlphabet);
977 0x1320, 0x1328, 0x1330, 0x1338, 0x1340, 0x1348, 0x1350 980 }
978 }; 981 case TigrinyaEtAbegede:
979 return toAlphabetic(value, ethiopicHalehameTiEtAlphabet); 982 case EthiopicAbegedeTiEt: {
980 } 983 static const UChar ethiopicAbegedeTiEtAlphabet[34] = {
981 case TigrinyaEtAbegede: 984 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12 E0,
982 case EthiopicAbegedeTiEt: { 985 0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x12 90,
983 static const UChar ethiopicAbegedeTiEtAlphabet[34] = { 986 0x1298, 0x1220, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1250, 0x1228, 0x12 30,
984 0x12A0, 0x1260, 0x1308, 0x12F0, 0x1300, 0x1200, 0x12C8, 0x12D8, 0x12E0, 987 0x1238, 0x1270, 0x1278, 0x1280, 0x1340, 0x1330, 0x1350
985 0x1210, 0x1320, 0x1328, 0x12E8, 0x12A8, 0x12B8, 0x1208, 0x1218, 0x1290, 988 };
986 0x1298, 0x1220, 0x12D0, 0x1348, 0x1338, 0x1240, 0x1250, 0x1228, 0x1230, 989 return toAlphabetic(value, ethiopicAbegedeTiEtAlphabet);
987 0x1238, 0x1270, 0x1278, 0x1280, 0x1340, 0x1330, 0x1350 990 }
988 }; 991 case UpperGreek: {
989 return toAlphabetic(value, ethiopicAbegedeTiEtAlphabet); 992 static const UChar upperGreekAlphabet[24] = {
990 } 993 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x03 99,
991 case UpperGreek: { 994 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x03 A3,
992 static const UChar upperGreekAlphabet[24] = { 995 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9
993 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 996 };
994 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x03A3, 997 return toAlphabetic(value, upperGreekAlphabet);
995 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9 998 }
996 }; 999 case LowerNorwegian: {
997 return toAlphabetic(value, upperGreekAlphabet); 1000 static const LChar lowerNorwegianAlphabet[29] = {
998 } 1001 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
999 case LowerNorwegian: { 1002 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
1000 static const LChar lowerNorwegianAlphabet[29] = { 1003 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xE6,
1001 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 1004 0xF8, 0xE5
1002 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 1005 };
1003 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xE6, 1006 return toAlphabetic(value, lowerNorwegianAlphabet);
1004 0xF8, 0xE5 1007 }
1005 }; 1008 case UpperNorwegian: {
1006 return toAlphabetic(value, lowerNorwegianAlphabet); 1009 static const LChar upperNorwegianAlphabet[29] = {
1007 } 1010 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
1008 case UpperNorwegian: { 1011 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52,
1009 static const LChar upperNorwegianAlphabet[29] = { 1012 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xC6,
1010 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 1013 0xD8, 0xC5
1011 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 1014 };
1012 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xC6, 1015 return toAlphabetic(value, upperNorwegianAlphabet);
1013 0xD8, 0xC5 1016 }
1014 }; 1017 case CJKIdeographic: {
1015 return toAlphabetic(value, upperNorwegianAlphabet); 1018 static const UChar traditionalChineseInformalTable[16] = {
1016 } 1019 0x842C, 0x5104, 0x5146,
1017 case CJKIdeographic: { 1020 0x5341, 0x767E, 0x5343,
1018 static const UChar traditionalChineseInformalTable[16] = { 1021 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB,
1019 0x842C, 0x5104, 0x5146, 1022 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D
1020 0x5341, 0x767E, 0x5343, 1023 };
1021 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 1024 return toCJKIdeographic(value, traditionalChineseInformalTable);
1022 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D 1025 }
1023 }; 1026
1024 return toCJKIdeographic(value, traditionalChineseInformalTable); 1027 case LowerRoman:
1025 } 1028 return toRoman(value, false);
1026 1029 case UpperRoman:
1027 case LowerRoman: 1030 return toRoman(value, true);
1028 return toRoman(value, false); 1031
1029 case UpperRoman: 1032 case Armenian:
1030 return toRoman(value, true); 1033 case UpperArmenian:
1031 1034 // CSS3 says "armenian" means "lower-armenian".
1032 case Armenian: 1035 // But the CSS2.1 test suite contains uppercase test results for "armeni an",
1033 case UpperArmenian: 1036 // so we'll match the test suite.
1034 // CSS3 says "armenian" means "lower-armenian". 1037 return toArmenian(value, true);
1035 // But the CSS2.1 test suite contains uppercase test results for "ar menian", 1038 case LowerArmenian:
1036 // so we'll match the test suite. 1039 return toArmenian(value, false);
1037 return toArmenian(value, true); 1040 case Georgian:
1038 case LowerArmenian: 1041 return toGeorgian(value);
1039 return toArmenian(value, false); 1042 case Hebrew:
1040 case Georgian: 1043 return toHebrew(value);
1041 return toGeorgian(value);
1042 case Hebrew:
1043 return toHebrew(value);
1044 } 1044 }
1045 1045
1046 ASSERT_NOT_REACHED(); 1046 ASSERT_NOT_REACHED();
1047 return ""; 1047 return "";
1048 } 1048 }
1049 1049
1050 RenderListMarker::RenderListMarker(RenderListItem* item) 1050 LayoutListMarker::LayoutListMarker(LayoutListItem* item)
1051 : RenderBox(0) 1051 : RenderBox(0)
1052 , m_listItem(item) 1052 , m_listItem(item)
1053 { 1053 {
1054 // init LayoutObject attributes 1054 // init LayoutObject attributes
1055 setInline(true); // our object is Inline 1055 setInline(true); // our object is Inline
1056 setReplaced(true); // pretend to be replaced 1056 setReplaced(true); // pretend to be replaced
1057 } 1057 }
1058 1058
1059 RenderListMarker::~RenderListMarker() 1059 LayoutListMarker::~LayoutListMarker()
1060 { 1060 {
1061 } 1061 }
1062 1062
1063 void RenderListMarker::destroy() 1063 void LayoutListMarker::destroy()
1064 { 1064 {
1065 if (m_image) 1065 if (m_image)
1066 m_image->removeClient(this); 1066 m_image->removeClient(this);
1067 RenderBox::destroy(); 1067 RenderBox::destroy();
1068 } 1068 }
1069 1069
1070 RenderListMarker* RenderListMarker::createAnonymous(RenderListItem* item) 1070 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item)
1071 { 1071 {
1072 Document& document = item->document(); 1072 Document& document = item->document();
1073 RenderListMarker* renderer = new RenderListMarker(item); 1073 LayoutListMarker* renderer = new LayoutListMarker(item);
1074 renderer->setDocumentForAnonymous(&document); 1074 renderer->setDocumentForAnonymous(&document);
1075 return renderer; 1075 return renderer;
1076 } 1076 }
1077 1077
1078 void RenderListMarker::styleWillChange(StyleDifference diff, const LayoutStyle& newStyle) 1078 void LayoutListMarker::styleWillChange(StyleDifference diff, const LayoutStyle& newStyle)
1079 { 1079 {
1080 if (style() && (newStyle.listStylePosition() != style()->listStylePosition() || newStyle.listStyleType() != style()->listStyleType())) 1080 if (style() && (newStyle.listStylePosition() != style()->listStylePosition() || newStyle.listStyleType() != style()->listStyleType()))
1081 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 1081 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
1082 1082
1083 RenderBox::styleWillChange(diff, newStyle); 1083 RenderBox::styleWillChange(diff, newStyle);
1084 } 1084 }
1085 1085
1086 void RenderListMarker::styleDidChange(StyleDifference diff, const LayoutStyle* o ldStyle) 1086 void LayoutListMarker::styleDidChange(StyleDifference diff, const LayoutStyle* o ldStyle)
1087 { 1087 {
1088 RenderBox::styleDidChange(diff, oldStyle); 1088 RenderBox::styleDidChange(diff, oldStyle);
1089 1089
1090 if (m_image != style()->listStyleImage()) { 1090 if (m_image != style()->listStyleImage()) {
1091 if (m_image) 1091 if (m_image)
1092 m_image->removeClient(this); 1092 m_image->removeClient(this);
1093 m_image = style()->listStyleImage(); 1093 m_image = style()->listStyleImage();
1094 if (m_image) 1094 if (m_image)
1095 m_image->addClient(this); 1095 m_image->addClient(this);
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 InlineBox* RenderListMarker::createInlineBox() 1099 InlineBox* LayoutListMarker::createInlineBox()
1100 { 1100 {
1101 InlineBox* result = RenderBox::createInlineBox(); 1101 InlineBox* result = RenderBox::createInlineBox();
1102 result->setIsText(isText()); 1102 result->setIsText(isText());
1103 return result; 1103 return result;
1104 } 1104 }
1105 1105
1106 bool RenderListMarker::isImage() const 1106 bool LayoutListMarker::isImage() const
1107 { 1107 {
1108 return m_image && !m_image->errorOccurred(); 1108 return m_image && !m_image->errorOccurred();
1109 } 1109 }
1110 1110
1111 LayoutRect RenderListMarker::localSelectionRect() 1111 LayoutRect LayoutListMarker::localSelectionRect()
1112 { 1112 {
1113 InlineBox* box = inlineBoxWrapper(); 1113 InlineBox* box = inlineBoxWrapper();
1114 if (!box) 1114 if (!box)
1115 return LayoutRect(LayoutPoint(), size()); 1115 return LayoutRect(LayoutPoint(), size());
1116 RootInlineBox& root = inlineBoxWrapper()->root(); 1116 RootInlineBox& root = inlineBoxWrapper()->root();
1117 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode( ) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio nTop() - inlineBoxWrapper()->logicalTop(); 1117 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode( ) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio nTop() - inlineBoxWrapper()->logicalTop();
1118 if (root.block().style()->isHorizontalWritingMode()) 1118 if (root.block().style()->isHorizontalWritingMode())
1119 return LayoutRect(0, newLogicalTop, size().width(), root.selectionHeight ()); 1119 return LayoutRect(0, newLogicalTop, size().width(), root.selectionHeight ());
1120 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), size().height()) ; 1120 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), size().height()) ;
1121 } 1121 }
1122 1122
1123 void RenderListMarker::paint(const PaintInfo& paintInfo, const LayoutPoint& pain tOffset) 1123 void LayoutListMarker::paint(const PaintInfo& paintInfo, const LayoutPoint& pain tOffset)
1124 { 1124 {
1125 ListMarkerPainter(*this).paint(paintInfo, paintOffset); 1125 ListMarkerPainter(*this).paint(paintInfo, paintOffset);
1126 } 1126 }
1127 1127
1128 void RenderListMarker::layout() 1128 void LayoutListMarker::layout()
1129 { 1129 {
1130 ASSERT(needsLayout()); 1130 ASSERT(needsLayout());
1131 1131
1132 if (isImage()) { 1132 if (isImage()) {
1133 updateMarginsAndContent(); 1133 updateMarginsAndContent();
1134 setWidth(m_image->imageSize(this, style()->effectiveZoom()).width()); 1134 setWidth(m_image->imageSize(this, style()->effectiveZoom()).width());
1135 setHeight(m_image->imageSize(this, style()->effectiveZoom()).height()); 1135 setHeight(m_image->imageSize(this, style()->effectiveZoom()).height());
1136 } else { 1136 } else {
1137 setLogicalWidth(minPreferredLogicalWidth()); 1137 setLogicalWidth(minPreferredLogicalWidth());
1138 setLogicalHeight(style()->fontMetrics().height()); 1138 setLogicalHeight(style()->fontMetrics().height());
1139 } 1139 }
1140 1140
1141 setMarginStart(0); 1141 setMarginStart(0);
1142 setMarginEnd(0); 1142 setMarginEnd(0);
1143 1143
1144 Length startMargin = style()->marginStart(); 1144 Length startMargin = style()->marginStart();
1145 Length endMargin = style()->marginEnd(); 1145 Length endMargin = style()->marginEnd();
1146 if (startMargin.isFixed()) 1146 if (startMargin.isFixed())
1147 setMarginStart(startMargin.value()); 1147 setMarginStart(startMargin.value());
1148 if (endMargin.isFixed()) 1148 if (endMargin.isFixed())
1149 setMarginEnd(endMargin.value()); 1149 setMarginEnd(endMargin.value());
1150 1150
1151 clearNeedsLayout(); 1151 clearNeedsLayout();
1152 } 1152 }
1153 1153
1154 void RenderListMarker::imageChanged(WrappedImagePtr o, const IntRect*) 1154 void LayoutListMarker::imageChanged(WrappedImagePtr o, const IntRect*)
1155 { 1155 {
1156 // A list marker can't have a background or border image, so no need to call the base class method. 1156 // A list marker can't have a background or border image, so no need to call the base class method.
1157 if (o != m_image->data()) 1157 if (o != m_image->data())
1158 return; 1158 return;
1159 1159
1160 if (size() != m_image->imageSize(this, style()->effectiveZoom()) || m_image- >errorOccurred()) 1160 if (size() != m_image->imageSize(this, style()->effectiveZoom()) || m_image- >errorOccurred())
1161 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 1161 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
1162 else 1162 else
1163 setShouldDoFullPaintInvalidation(); 1163 setShouldDoFullPaintInvalidation();
1164 } 1164 }
1165 1165
1166 void RenderListMarker::updateMarginsAndContent() 1166 void LayoutListMarker::updateMarginsAndContent()
1167 { 1167 {
1168 updateContent(); 1168 updateContent();
1169 updateMargins(); 1169 updateMargins();
1170 } 1170 }
1171 1171
1172 void RenderListMarker::updateContent() 1172 void LayoutListMarker::updateContent()
1173 { 1173 {
1174 // FIXME: This if-statement is just a performance optimization, but it's mes sy to use the preferredLogicalWidths dirty bit for this. 1174 // FIXME: This if-statement is just a performance optimization, but it's mes sy to use the preferredLogicalWidths dirty bit for this.
1175 // It's unclear if this is a premature optimization. 1175 // It's unclear if this is a premature optimization.
1176 if (!preferredLogicalWidthsDirty()) 1176 if (!preferredLogicalWidthsDirty())
1177 return; 1177 return;
1178 1178
1179 m_text = ""; 1179 m_text = "";
1180 1180
1181 if (isImage()) { 1181 if (isImage()) {
1182 // FIXME: This is a somewhat arbitrary width. Generated images for mark ers really won't become particularly useful 1182 // FIXME: This is a somewhat arbitrary width. Generated images for mark ers really won't become particularly useful
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 case UpperHexadecimal: 1272 case UpperHexadecimal:
1273 case UpperLatin: 1273 case UpperLatin:
1274 case UpperNorwegian: 1274 case UpperNorwegian:
1275 case UpperRoman: 1275 case UpperRoman:
1276 case Urdu: 1276 case Urdu:
1277 m_text = listMarkerText(type, m_listItem->value()); 1277 m_text = listMarkerText(type, m_listItem->value());
1278 break; 1278 break;
1279 } 1279 }
1280 } 1280 }
1281 1281
1282 void RenderListMarker::computePreferredLogicalWidths() 1282 void LayoutListMarker::computePreferredLogicalWidths()
1283 { 1283 {
1284 ASSERT(preferredLogicalWidthsDirty()); 1284 ASSERT(preferredLogicalWidthsDirty());
1285 updateContent(); 1285 updateContent();
1286 1286
1287 if (isImage()) { 1287 if (isImage()) {
1288 LayoutSize imageSize = m_image->imageSize(this, style()->effectiveZoom() ); 1288 LayoutSize imageSize = m_image->imageSize(this, style()->effectiveZoom() );
1289 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style()->isHor izontalWritingMode() ? imageSize.width() : imageSize.height(); 1289 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style()->isHor izontalWritingMode() ? imageSize.width() : imageSize.height();
1290 clearPreferredLogicalWidthsDirty(); 1290 clearPreferredLogicalWidthsDirty();
1291 updateMargins(); 1291 updateMargins();
1292 return; 1292 return;
1293 } 1293 }
1294 1294
1295 const Font& font = style()->font(); 1295 const Font& font = style()->font();
1296 1296
1297 LayoutUnit logicalWidth = 0; 1297 LayoutUnit logicalWidth = 0;
1298 EListStyleType type = style()->listStyleType(); 1298 EListStyleType type = style()->listStyleType();
1299 switch (type) { 1299 switch (type) {
1300 case NoneListStyle: 1300 case NoneListStyle:
1301 break; 1301 break;
1302 case Asterisks: 1302 case Asterisks:
1303 case Footnotes: 1303 case Footnotes:
1304 logicalWidth = font.width(m_text); // no suffix for these types 1304 logicalWidth = font.width(m_text); // no suffix for these types
1305 break; 1305 break;
1306 case Circle: 1306 case Circle:
1307 case Disc: 1307 case Disc:
1308 case Square: 1308 case Square:
1309 logicalWidth = (font.fontMetrics().ascent() * 2 / 3 + 1) / 2 + 2; 1309 logicalWidth = (font.fontMetrics().ascent() * 2 / 3 + 1) / 2 + 2;
1310 break; 1310 break;
1311 case Afar: 1311 case Afar:
1312 case Amharic: 1312 case Amharic:
1313 case AmharicAbegede: 1313 case AmharicAbegede:
1314 case ArabicIndic: 1314 case ArabicIndic:
1315 case Armenian: 1315 case Armenian:
1316 case BinaryListStyle: 1316 case BinaryListStyle:
1317 case Bengali: 1317 case Bengali:
1318 case Cambodian: 1318 case Cambodian:
1319 case CJKIdeographic: 1319 case CJKIdeographic:
1320 case CjkEarthlyBranch: 1320 case CjkEarthlyBranch:
1321 case CjkHeavenlyStem: 1321 case CjkHeavenlyStem:
1322 case DecimalLeadingZero: 1322 case DecimalLeadingZero:
1323 case DecimalListStyle: 1323 case DecimalListStyle:
1324 case Devanagari: 1324 case Devanagari:
1325 case Ethiopic: 1325 case Ethiopic:
1326 case EthiopicAbegede: 1326 case EthiopicAbegede:
1327 case EthiopicAbegedeAmEt: 1327 case EthiopicAbegedeAmEt:
1328 case EthiopicAbegedeGez: 1328 case EthiopicAbegedeGez:
1329 case EthiopicAbegedeTiEr: 1329 case EthiopicAbegedeTiEr:
1330 case EthiopicAbegedeTiEt: 1330 case EthiopicAbegedeTiEt:
1331 case EthiopicHalehameAaEr: 1331 case EthiopicHalehameAaEr:
1332 case EthiopicHalehameAaEt: 1332 case EthiopicHalehameAaEt:
1333 case EthiopicHalehameAmEt: 1333 case EthiopicHalehameAmEt:
1334 case EthiopicHalehameGez: 1334 case EthiopicHalehameGez:
1335 case EthiopicHalehameOmEt: 1335 case EthiopicHalehameOmEt:
1336 case EthiopicHalehameSidEt: 1336 case EthiopicHalehameSidEt:
1337 case EthiopicHalehameSoEt: 1337 case EthiopicHalehameSoEt:
1338 case EthiopicHalehameTiEr: 1338 case EthiopicHalehameTiEr:
1339 case EthiopicHalehameTiEt: 1339 case EthiopicHalehameTiEt:
1340 case EthiopicHalehameTig: 1340 case EthiopicHalehameTig:
1341 case Georgian: 1341 case Georgian:
1342 case Gujarati: 1342 case Gujarati:
1343 case Gurmukhi: 1343 case Gurmukhi:
1344 case Hangul: 1344 case Hangul:
1345 case HangulConsonant: 1345 case HangulConsonant:
1346 case Hebrew: 1346 case Hebrew:
1347 case Hiragana: 1347 case Hiragana:
1348 case HiraganaIroha: 1348 case HiraganaIroha:
1349 case Kannada: 1349 case Kannada:
1350 case Katakana: 1350 case Katakana:
1351 case KatakanaIroha: 1351 case KatakanaIroha:
1352 case Khmer: 1352 case Khmer:
1353 case Lao: 1353 case Lao:
1354 case LowerAlpha: 1354 case LowerAlpha:
1355 case LowerArmenian: 1355 case LowerArmenian:
1356 case LowerGreek: 1356 case LowerGreek:
1357 case LowerHexadecimal: 1357 case LowerHexadecimal:
1358 case LowerLatin: 1358 case LowerLatin:
1359 case LowerNorwegian: 1359 case LowerNorwegian:
1360 case LowerRoman: 1360 case LowerRoman:
1361 case Malayalam: 1361 case Malayalam:
1362 case Mongolian: 1362 case Mongolian:
1363 case Myanmar: 1363 case Myanmar:
1364 case Octal: 1364 case Octal:
1365 case Oriya: 1365 case Oriya:
1366 case Oromo: 1366 case Oromo:
1367 case Persian: 1367 case Persian:
1368 case Sidama: 1368 case Sidama:
1369 case Somali: 1369 case Somali:
1370 case Telugu: 1370 case Telugu:
1371 case Thai: 1371 case Thai:
1372 case Tibetan: 1372 case Tibetan:
1373 case Tigre: 1373 case Tigre:
1374 case TigrinyaEr: 1374 case TigrinyaEr:
1375 case TigrinyaErAbegede: 1375 case TigrinyaErAbegede:
1376 case TigrinyaEt: 1376 case TigrinyaEt:
1377 case TigrinyaEtAbegede: 1377 case TigrinyaEtAbegede:
1378 case UpperAlpha: 1378 case UpperAlpha:
1379 case UpperArmenian: 1379 case UpperArmenian:
1380 case UpperGreek: 1380 case UpperGreek:
1381 case UpperHexadecimal: 1381 case UpperHexadecimal:
1382 case UpperLatin: 1382 case UpperLatin:
1383 case UpperNorwegian: 1383 case UpperNorwegian:
1384 case UpperRoman: 1384 case UpperRoman:
1385 case Urdu: 1385 case Urdu:
1386 if (m_text.isEmpty()) 1386 if (m_text.isEmpty()) {
1387 logicalWidth = 0; 1387 logicalWidth = 0;
1388 else { 1388 } else {
1389 LayoutUnit itemWidth = font.width(m_text); 1389 LayoutUnit itemWidth = font.width(m_text);
1390 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->valu e()), ' ' }; 1390 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()) , ' ' };
1391 LayoutUnit suffixSpaceWidth = font.width(constructTextRun(this, font, suffixSpace, 2, styleRef(), style()->direction())); 1391 LayoutUnit suffixSpaceWidth = font.width(constructTextRun(this, font , suffixSpace, 2, styleRef(), style()->direction()));
1392 logicalWidth = itemWidth + suffixSpaceWidth; 1392 logicalWidth = itemWidth + suffixSpaceWidth;
1393 } 1393 }
1394 break; 1394 break;
1395 } 1395 }
1396 1396
1397 m_minPreferredLogicalWidth = logicalWidth; 1397 m_minPreferredLogicalWidth = logicalWidth;
1398 m_maxPreferredLogicalWidth = logicalWidth; 1398 m_maxPreferredLogicalWidth = logicalWidth;
1399 1399
1400 clearPreferredLogicalWidthsDirty(); 1400 clearPreferredLogicalWidthsDirty();
1401 1401
1402 updateMargins(); 1402 updateMargins();
1403 } 1403 }
1404 1404
1405 void RenderListMarker::updateMargins() 1405 void LayoutListMarker::updateMargins()
1406 { 1406 {
1407 const FontMetrics& fontMetrics = style()->fontMetrics(); 1407 const FontMetrics& fontMetrics = style()->fontMetrics();
1408 1408
1409 LayoutUnit marginStart = 0; 1409 LayoutUnit marginStart = 0;
1410 LayoutUnit marginEnd = 0; 1410 LayoutUnit marginEnd = 0;
1411 1411
1412 if (isInside()) { 1412 if (isInside()) {
1413 if (isImage()) 1413 if (isImage()) {
1414 marginEnd = cMarkerPadding; 1414 marginEnd = cMarkerPadding;
1415 else switch (style()->listStyleType()) { 1415 } else {
1416 switch (style()->listStyleType()) {
1416 case Disc: 1417 case Disc:
1417 case Circle: 1418 case Circle:
1418 case Square: 1419 case Square:
1419 marginStart = -1; 1420 marginStart = -1;
1420 marginEnd = fontMetrics.ascent() - minPreferredLogicalWidth() + 1; 1421 marginEnd = fontMetrics.ascent() - minPreferredLogicalWidth() + 1;
1421 break; 1422 break;
1422 default: 1423 default:
1423 break; 1424 break;
1425 }
1424 } 1426 }
1425 } else { 1427 } else {
1426 if (style()->isLeftToRightDirection()) { 1428 if (style()->isLeftToRightDirection()) {
1427 if (isImage()) 1429 if (isImage()) {
1428 marginStart = -minPreferredLogicalWidth() - cMarkerPadding; 1430 marginStart = -minPreferredLogicalWidth() - cMarkerPadding;
1429 else { 1431 } else {
1430 int offset = fontMetrics.ascent() * 2 / 3; 1432 int offset = fontMetrics.ascent() * 2 / 3;
1431 switch (style()->listStyleType()) { 1433 switch (style()->listStyleType()) {
1432 case Disc: 1434 case Disc:
1433 case Circle: 1435 case Circle:
1434 case Square: 1436 case Square:
1435 marginStart = -offset - cMarkerPadding - 1; 1437 marginStart = -offset - cMarkerPadding - 1;
1436 break; 1438 break;
1437 case NoneListStyle: 1439 case NoneListStyle:
1438 break; 1440 break;
1439 default: 1441 default:
1440 marginStart = m_text.isEmpty() ? LayoutUnit() : -minPref erredLogicalWidth() - offset / 2; 1442 marginStart = m_text.isEmpty() ? LayoutUnit() : -minPreferre dLogicalWidth() - offset / 2;
1441 } 1443 }
1442 } 1444 }
1443 marginEnd = -marginStart - minPreferredLogicalWidth(); 1445 marginEnd = -marginStart - minPreferredLogicalWidth();
1444 } else { 1446 } else {
1445 if (isImage()) 1447 if (isImage()) {
1446 marginEnd = cMarkerPadding; 1448 marginEnd = cMarkerPadding;
1447 else { 1449 } else {
1448 int offset = fontMetrics.ascent() * 2 / 3; 1450 int offset = fontMetrics.ascent() * 2 / 3;
1449 switch (style()->listStyleType()) { 1451 switch (style()->listStyleType()) {
1450 case Disc: 1452 case Disc:
1451 case Circle: 1453 case Circle:
1452 case Square: 1454 case Square:
1453 marginEnd = offset + cMarkerPadding + 1 - minPreferredLo gicalWidth(); 1455 marginEnd = offset + cMarkerPadding + 1 - minPreferredLogica lWidth();
1454 break; 1456 break;
1455 case NoneListStyle: 1457 case NoneListStyle:
1456 break; 1458 break;
1457 default: 1459 default:
1458 marginEnd = m_text.isEmpty() ? 0 : offset / 2; 1460 marginEnd = m_text.isEmpty() ? 0 : offset / 2;
1459 } 1461 }
1460 } 1462 }
1461 marginStart = -marginEnd - minPreferredLogicalWidth(); 1463 marginStart = -marginEnd - minPreferredLogicalWidth();
1462 } 1464 }
1463 1465
1464 } 1466 }
1465 1467
1466 style()->setMarginStart(Length(marginStart, Fixed)); 1468 style()->setMarginStart(Length(marginStart, Fixed));
1467 style()->setMarginEnd(Length(marginEnd, Fixed)); 1469 style()->setMarginEnd(Length(marginEnd, Fixed));
1468 } 1470 }
1469 1471
1470 LayoutUnit RenderListMarker::lineHeight(bool firstLine, LineDirectionMode direct ion, LinePositionMode linePositionMode) const 1472 LayoutUnit LayoutListMarker::lineHeight(bool firstLine, LineDirectionMode direct ion, LinePositionMode linePositionMode) const
1471 { 1473 {
1472 if (!isImage()) 1474 if (!isImage())
1473 return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLi neBoxes); 1475 return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLi neBoxes);
1474 return RenderBox::lineHeight(firstLine, direction, linePositionMode); 1476 return RenderBox::lineHeight(firstLine, direction, linePositionMode);
1475 } 1477 }
1476 1478
1477 int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine , LineDirectionMode direction, LinePositionMode linePositionMode) const 1479 int LayoutListMarker::baselinePosition(FontBaseline baselineType, bool firstLine , LineDirectionMode direction, LinePositionMode linePositionMode) const
1478 { 1480 {
1479 ASSERT(linePositionMode == PositionOnContainingLine); 1481 ASSERT(linePositionMode == PositionOnContainingLine);
1480 if (!isImage()) 1482 if (!isImage())
1481 return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes); 1483 return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
1482 return RenderBox::baselinePosition(baselineType, firstLine, direction, lineP ositionMode); 1484 return RenderBox::baselinePosition(baselineType, firstLine, direction, lineP ositionMode);
1483 } 1485 }
1484 1486
1485 bool RenderListMarker::isInside() const 1487 bool LayoutListMarker::isInside() const
1486 { 1488 {
1487 return m_listItem->notInList() || style()->listStylePosition() == INSIDE; 1489 return m_listItem->notInList() || style()->listStylePosition() == INSIDE;
1488 } 1490 }
1489 1491
1490 IntRect RenderListMarker::getRelativeMarkerRect() 1492 IntRect LayoutListMarker::getRelativeMarkerRect()
1491 { 1493 {
1492 if (isImage()) 1494 if (isImage())
1493 return IntRect(0, 0, m_image->imageSize(this, style()->effectiveZoom()). width(), m_image->imageSize(this, style()->effectiveZoom()).height()); 1495 return IntRect(0, 0, m_image->imageSize(this, style()->effectiveZoom()). width(), m_image->imageSize(this, style()->effectiveZoom()).height());
1494 1496
1495 IntRect relativeRect; 1497 IntRect relativeRect;
1496 EListStyleType type = style()->listStyleType(); 1498 EListStyleType type = style()->listStyleType();
1497 switch (type) { 1499 switch (type) {
1498 case Asterisks: 1500 case Asterisks:
1499 case Footnotes: { 1501 case Footnotes: {
1500 const Font& font = style()->font(); 1502 const Font& font = style()->font();
1501 relativeRect = IntRect(0, 0, font.width(m_text), font.fontMetrics(). height()); 1503 relativeRect = IntRect(0, 0, font.width(m_text), font.fontMetrics().heig ht());
1502 break; 1504 break;
1503 } 1505 }
1504 case Disc: 1506 case Disc:
1505 case Circle: 1507 case Circle:
1506 case Square: { 1508 case Square: {
1507 // FIXME: Are these particular rounding rules necessary? 1509 // FIXME: Are these particular rounding rules necessary?
1508 const FontMetrics& fontMetrics = style()->fontMetrics(); 1510 const FontMetrics& fontMetrics = style()->fontMetrics();
1509 int ascent = fontMetrics.ascent(); 1511 int ascent = fontMetrics.ascent();
1510 int bulletWidth = (ascent * 2 / 3 + 1) / 2; 1512 int bulletWidth = (ascent * 2 / 3 + 1) / 2;
1511 relativeRect = IntRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletW idth, bulletWidth); 1513 relativeRect = IntRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth , bulletWidth);
1512 break; 1514 break;
1513 } 1515 }
1514 case NoneListStyle: 1516 case NoneListStyle:
1517 return IntRect();
1518 case Afar:
1519 case Amharic:
1520 case AmharicAbegede:
1521 case ArabicIndic:
1522 case Armenian:
1523 case BinaryListStyle:
1524 case Bengali:
1525 case Cambodian:
1526 case CJKIdeographic:
1527 case CjkEarthlyBranch:
1528 case CjkHeavenlyStem:
1529 case DecimalLeadingZero:
1530 case DecimalListStyle:
1531 case Devanagari:
1532 case Ethiopic:
1533 case EthiopicAbegede:
1534 case EthiopicAbegedeAmEt:
1535 case EthiopicAbegedeGez:
1536 case EthiopicAbegedeTiEr:
1537 case EthiopicAbegedeTiEt:
1538 case EthiopicHalehameAaEr:
1539 case EthiopicHalehameAaEt:
1540 case EthiopicHalehameAmEt:
1541 case EthiopicHalehameGez:
1542 case EthiopicHalehameOmEt:
1543 case EthiopicHalehameSidEt:
1544 case EthiopicHalehameSoEt:
1545 case EthiopicHalehameTiEr:
1546 case EthiopicHalehameTiEt:
1547 case EthiopicHalehameTig:
1548 case Georgian:
1549 case Gujarati:
1550 case Gurmukhi:
1551 case Hangul:
1552 case HangulConsonant:
1553 case Hebrew:
1554 case Hiragana:
1555 case HiraganaIroha:
1556 case Kannada:
1557 case Katakana:
1558 case KatakanaIroha:
1559 case Khmer:
1560 case Lao:
1561 case LowerAlpha:
1562 case LowerArmenian:
1563 case LowerGreek:
1564 case LowerHexadecimal:
1565 case LowerLatin:
1566 case LowerNorwegian:
1567 case LowerRoman:
1568 case Malayalam:
1569 case Mongolian:
1570 case Myanmar:
1571 case Octal:
1572 case Oriya:
1573 case Oromo:
1574 case Persian:
1575 case Sidama:
1576 case Somali:
1577 case Telugu:
1578 case Thai:
1579 case Tibetan:
1580 case Tigre:
1581 case TigrinyaEr:
1582 case TigrinyaErAbegede:
1583 case TigrinyaEt:
1584 case TigrinyaEtAbegede:
1585 case UpperAlpha:
1586 case UpperArmenian:
1587 case UpperGreek:
1588 case UpperHexadecimal:
1589 case UpperLatin:
1590 case UpperNorwegian:
1591 case UpperRoman:
1592 case Urdu:
1593 if (m_text.isEmpty())
1515 return IntRect(); 1594 return IntRect();
1516 case Afar: 1595 const Font& font = style()->font();
1517 case Amharic: 1596 int itemWidth = font.width(m_text);
1518 case AmharicAbegede: 1597 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' };
1519 case ArabicIndic: 1598 int suffixSpaceWidth = font.width(constructTextRun(this, font, suffixSpa ce, 2, styleRef(), style()->direction()));
1520 case Armenian: 1599 relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetr ics().height());
1521 case BinaryListStyle:
1522 case Bengali:
1523 case Cambodian:
1524 case CJKIdeographic:
1525 case CjkEarthlyBranch:
1526 case CjkHeavenlyStem:
1527 case DecimalLeadingZero:
1528 case DecimalListStyle:
1529 case Devanagari:
1530 case Ethiopic:
1531 case EthiopicAbegede:
1532 case EthiopicAbegedeAmEt:
1533 case EthiopicAbegedeGez:
1534 case EthiopicAbegedeTiEr:
1535 case EthiopicAbegedeTiEt:
1536 case EthiopicHalehameAaEr:
1537 case EthiopicHalehameAaEt:
1538 case EthiopicHalehameAmEt:
1539 case EthiopicHalehameGez:
1540 case EthiopicHalehameOmEt:
1541 case EthiopicHalehameSidEt:
1542 case EthiopicHalehameSoEt:
1543 case EthiopicHalehameTiEr:
1544 case EthiopicHalehameTiEt:
1545 case EthiopicHalehameTig:
1546 case Georgian:
1547 case Gujarati:
1548 case Gurmukhi:
1549 case Hangul:
1550 case HangulConsonant:
1551 case Hebrew:
1552 case Hiragana:
1553 case HiraganaIroha:
1554 case Kannada:
1555 case Katakana:
1556 case KatakanaIroha:
1557 case Khmer:
1558 case Lao:
1559 case LowerAlpha:
1560 case LowerArmenian:
1561 case LowerGreek:
1562 case LowerHexadecimal:
1563 case LowerLatin:
1564 case LowerNorwegian:
1565 case LowerRoman:
1566 case Malayalam:
1567 case Mongolian:
1568 case Myanmar:
1569 case Octal:
1570 case Oriya:
1571 case Oromo:
1572 case Persian:
1573 case Sidama:
1574 case Somali:
1575 case Telugu:
1576 case Thai:
1577 case Tibetan:
1578 case Tigre:
1579 case TigrinyaEr:
1580 case TigrinyaErAbegede:
1581 case TigrinyaEt:
1582 case TigrinyaEtAbegede:
1583 case UpperAlpha:
1584 case UpperArmenian:
1585 case UpperGreek:
1586 case UpperHexadecimal:
1587 case UpperLatin:
1588 case UpperNorwegian:
1589 case UpperRoman:
1590 case Urdu:
1591 if (m_text.isEmpty())
1592 return IntRect();
1593 const Font& font = style()->font();
1594 int itemWidth = font.width(m_text);
1595 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()) , ' ' };
1596 int suffixSpaceWidth = font.width(constructTextRun(this, font, suffi xSpace, 2, styleRef(), style()->direction()));
1597 relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.font Metrics().height());
1598 } 1600 }
1599 1601
1600 if (!style()->isHorizontalWritingMode()) { 1602 if (!style()->isHorizontalWritingMode()) {
1601 relativeRect = relativeRect.transposedRect(); 1603 relativeRect = relativeRect.transposedRect();
1602 relativeRect.setX(size().width() - relativeRect.x() - relativeRect.width ()); 1604 relativeRect.setX(size().width() - relativeRect.x() - relativeRect.width ());
1603 } 1605 }
1604 1606
1605 return relativeRect; 1607 return relativeRect;
1606 } 1608 }
1607 1609
1608 void RenderListMarker::setSelectionState(SelectionState state) 1610 void LayoutListMarker::setSelectionState(SelectionState state)
1609 { 1611 {
1610 // The selection state for our containing block hierarchy is updated by the base class call. 1612 // The selection state for our containing block hierarchy is updated by the base class call.
1611 RenderBox::setSelectionState(state); 1613 RenderBox::setSelectionState(state);
1612 1614
1613 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) 1615 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes())
1614 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); 1616 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone );
1615 } 1617 }
1616 1618
1617 LayoutRect RenderListMarker::selectionRectForPaintInvalidation(const LayoutBoxMo delObject* paintInvalidationContainer) const 1619 LayoutRect LayoutListMarker::selectionRectForPaintInvalidation(const LayoutBoxMo delObject* paintInvalidationContainer) const
1618 { 1620 {
1619 ASSERT(!needsLayout()); 1621 ASSERT(!needsLayout());
1620 1622
1621 if (selectionState() == SelectionNone || !inlineBoxWrapper()) 1623 if (selectionState() == SelectionNone || !inlineBoxWrapper())
1622 return LayoutRect(); 1624 return LayoutRect();
1623 1625
1624 RootInlineBox& root = inlineBoxWrapper()->root(); 1626 RootInlineBox& root = inlineBoxWrapper()->root();
1625 LayoutRect rect(0, root.selectionTop() - location().y(), size().width(), roo t.selectionHeight()); 1627 LayoutRect rect(0, root.selectionTop() - location().y(), size().width(), roo t.selectionHeight());
1626 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); 1628 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0);
1627 // FIXME: groupedMapping() leaks the squashing abstraction. 1629 // FIXME: groupedMapping() leaks the squashing abstraction.
1628 if (paintInvalidationContainer->layer()->groupedMapping()) 1630 if (paintInvalidationContainer->layer()->groupedMapping())
1629 Layer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect ); 1631 Layer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect );
1630 return rect; 1632 return rect;
1631 } 1633 }
1632 1634
1633 void RenderListMarker::listItemStyleDidChange() 1635 void LayoutListMarker::listItemStyleDidChange()
1634 { 1636 {
1635 RefPtr<LayoutStyle> newStyle = LayoutStyle::create(); 1637 RefPtr<LayoutStyle> newStyle = LayoutStyle::create();
1636 // The marker always inherits from the list item, regardless of where it mig ht end 1638 // The marker always inherits from the list item, regardless of where it mig ht end
1637 // up (e.g., in some deeply nested line box). See CSS3 spec. 1639 // up (e.g., in some deeply nested line box). See CSS3 spec.
1638 newStyle->inheritFrom(m_listItem->styleRef()); 1640 newStyle->inheritFrom(m_listItem->styleRef());
1639 if (style()) { 1641 if (style()) {
1640 // Reuse the current margins. Otherwise resetting the margins to initial values 1642 // Reuse the current margins. Otherwise resetting the margins to initial values
1641 // would trigger unnecessary layout. 1643 // would trigger unnecessary layout.
1642 newStyle->setMarginStart(style()->marginStart()); 1644 newStyle->setMarginStart(style()->marginStart());
1643 newStyle->setMarginEnd(style()->marginRight()); 1645 newStyle->setMarginEnd(style()->marginRight());
1644 } 1646 }
1645 setStyle(newStyle.release()); 1647 setStyle(newStyle.release());
1646 } 1648 }
1647 1649
1648 } // namespace blink 1650 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutListMarker.h ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698