|
|
|
Lines 215-231
DecimalToText(CounterValue aOrdinal, nsS
|
Link Here
|
|---|
|
| 215 |
return true; |
215 |
return true; |
| 216 |
} |
216 |
} |
| 217 |
|
217 |
|
| 218 |
// We know cjk-ideographic need 31 characters to display 99,999,999,999,999,999 |
218 |
// We know cjk-ideographic need 31 characters to display 99,999,999,999,999,999 |
| 219 |
// georgian needs 6 at most |
219 |
// georgian needs 6 at most |
| 220 |
// armenian needs 12 at most |
220 |
// armenian needs 12 at most |
| 221 |
// hebrew may need more... |
221 |
// hebrew may need more... |
| 222 |
|
222 |
|
| 223 |
#define NUM_BUF_SIZE 34 |
223 |
#define NUM_BUF_SIZE 34 |
| 224 |
|
224 |
|
| 225 |
enum CJKIdeographicLang { |
225 |
enum CJKIdeographicLang { |
| 226 |
CHINESE, KOREAN, JAPANESE |
226 |
CHINESE, KOREAN, JAPANESE |
| 227 |
}; |
227 |
}; |
| 228 |
struct CJKIdeographicData { |
228 |
struct CJKIdeographicData { |
| 229 |
char16_t digit[10]; |
229 |
char16_t digit[10]; |
| 230 |
char16_t unit[3]; |
230 |
char16_t unit[3]; |
| 231 |
char16_t unit10K[2]; |
231 |
char16_t unit10K[2]; |
|
Lines 391-407
CJKIdeographicToText(CounterValue aOrdin
|
Link Here
|
|---|
|
| 391 |
aOrdinal /= 10; |
391 |
aOrdinal /= 10; |
| 392 |
pos++; |
392 |
pos++; |
| 393 |
} while (aOrdinal > 0); |
393 |
} while (aOrdinal > 0); |
| 394 |
aResult.Assign(buf + idx, NUM_BUF_SIZE - idx); |
394 |
aResult.Assign(buf + idx, NUM_BUF_SIZE - idx); |
| 395 |
return true; |
395 |
return true; |
| 396 |
} |
396 |
} |
| 397 |
|
397 |
|
| 398 |
#define HEBREW_GERESH 0x05F3 |
398 |
#define HEBREW_GERESH 0x05F3 |
| 399 |
static const char16_t gHebrewDigit[22] = |
399 |
static const char16_t gHebrewDigit[22] = |
| 400 |
{ |
400 |
{ |
| 401 |
// 1 2 3 4 5 6 7 8 9 |
401 |
// 1 2 3 4 5 6 7 8 9 |
| 402 |
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, |
402 |
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, |
| 403 |
// 10 20 30 40 50 60 70 80 90 |
403 |
// 10 20 30 40 50 60 70 80 90 |
| 404 |
0x05D9, 0x05DB, 0x05DC, 0x05DE, 0x05E0, 0x05E1, 0x05E2, 0x05E4, 0x05E6, |
404 |
0x05D9, 0x05DB, 0x05DC, 0x05DE, 0x05E0, 0x05E1, 0x05E2, 0x05E4, 0x05E6, |
| 405 |
// 100 200 300 400 |
405 |
// 100 200 300 400 |
| 406 |
0x05E7, 0x05E8, 0x05E9, 0x05EA |
406 |
0x05E7, 0x05E8, 0x05E9, 0x05EA |
| 407 |
}; |
407 |
}; |
|
Lines 442-462
HebrewToText(CounterValue aOrdinal, nsSu
|
Link Here
|
|---|
|
| 442 |
n2 = 9; |
442 |
n2 = 9; |
| 443 |
thousandsGroup.Append(gHebrewDigit[ n2 - 1]); |
443 |
thousandsGroup.Append(gHebrewDigit[ n2 - 1]); |
| 444 |
} else { |
444 |
} else { |
| 445 |
n2 = n3 - (n3 % 10); |
445 |
n2 = n3 - (n3 % 10); |
| 446 |
thousandsGroup.Append(gHebrewDigit[(n2/10)-1+9]); |
446 |
thousandsGroup.Append(gHebrewDigit[(n2/10)-1+9]); |
| 447 |
} // if |
447 |
} // if |
| 448 |
n3 -= n2; |
448 |
n3 -= n2; |
| 449 |
} // if |
449 |
} // if |
| 450 |
|
450 |
|
| 451 |
// Process digit for 1 - 9 |
451 |
// Process digit for 1 - 9 |
| 452 |
if ( n3 > 0) |
452 |
if ( n3 > 0) |
| 453 |
thousandsGroup.Append(gHebrewDigit[n3-1]); |
453 |
thousandsGroup.Append(gHebrewDigit[n3-1]); |
| 454 |
if (outputSep) |
454 |
if (outputSep) |
| 455 |
thousandsGroup.Append((char16_t)HEBREW_GERESH); |
455 |
thousandsGroup.Append((char16_t)HEBREW_GERESH); |
| 456 |
if (allText.IsEmpty()) |
456 |
if (allText.IsEmpty()) |
| 457 |
allText = thousandsGroup; |
457 |
allText = thousandsGroup; |
| 458 |
else |
458 |
else |
| 459 |
allText = thousandsGroup + allText; |
459 |
allText = thousandsGroup + allText; |
| 460 |
aOrdinal /= 1000; |
460 |
aOrdinal /= 1000; |
| 461 |
outputSep = true; |
461 |
outputSep = true; |
| 462 |
} while (aOrdinal >= 1); |
462 |
} while (aOrdinal >= 1); |
|
Lines 635-651
BuiltinCounterStyle::GetPrefix(nsSubstri
|
Link Here
|
|---|
|
| 635 |
|
635 |
|
| 636 |
/* virtual */ void |
636 |
/* virtual */ void |
| 637 |
BuiltinCounterStyle::GetSuffix(nsSubstring& aResult) |
637 |
BuiltinCounterStyle::GetSuffix(nsSubstring& aResult) |
| 638 |
{ |
638 |
{ |
| 639 |
switch (mStyle) { |
639 |
switch (mStyle) { |
| 640 |
case NS_STYLE_LIST_STYLE_NONE: |
640 |
case NS_STYLE_LIST_STYLE_NONE: |
| 641 |
aResult.Truncate(); |
641 |
aResult.Truncate(); |
| 642 |
break; |
642 |
break; |
| 643 |
|
643 |
|
| 644 |
case NS_STYLE_LIST_STYLE_DISC: |
644 |
case NS_STYLE_LIST_STYLE_DISC: |
| 645 |
case NS_STYLE_LIST_STYLE_CIRCLE: |
645 |
case NS_STYLE_LIST_STYLE_CIRCLE: |
| 646 |
case NS_STYLE_LIST_STYLE_SQUARE: |
646 |
case NS_STYLE_LIST_STYLE_SQUARE: |
| 647 |
case NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED: |
647 |
case NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED: |
| 648 |
case NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN: |
648 |
case NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN: |
| 649 |
case NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC: |
649 |
case NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC: |
| 650 |
aResult = ' '; |
650 |
aResult = ' '; |
| 651 |
break; |
651 |
break; |
|
Lines 942-977
BuiltinCounterStyle::GetInitialCounterTe
|
Link Here
|
|---|
|
| 942 |
return CJKIdeographicToText(aOrdinal, aResult, gDataJapaneseFormal); |
942 |
return CJKIdeographicToText(aOrdinal, aResult, gDataJapaneseFormal); |
| 943 |
case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: |
943 |
case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: |
| 944 |
return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHangulFormal); |
944 |
return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHangulFormal); |
| 945 |
case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: |
945 |
case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: |
| 946 |
return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHanjaInformal); |
946 |
return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHanjaInformal); |
| 947 |
case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: |
947 |
case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: |
| 948 |
return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHanjaFormal); |
948 |
return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHanjaFormal); |
| 949 |
|
949 |
|
| 950 |
case NS_STYLE_LIST_STYLE_HEBREW: |
950 |
case NS_STYLE_LIST_STYLE_HEBREW: |
| 951 |
aIsRTL = true; |
951 |
aIsRTL = true; |
| 952 |
return HebrewToText(aOrdinal, aResult); |
952 |
return HebrewToText(aOrdinal, aResult); |
| 953 |
|
953 |
|
| 954 |
case NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC: |
954 |
case NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC: |
| 955 |
return EthiopicToText(aOrdinal, aResult); |
955 |
return EthiopicToText(aOrdinal, aResult); |
| 956 |
|
956 |
|
| 957 |
default: |
957 |
default: |
| 958 |
NS_NOTREACHED("Unknown builtin counter style"); |
958 |
NS_NOTREACHED("Unknown builtin counter style"); |
| 959 |
return false; |
959 |
return false; |
| 960 |
} |
960 |
} |
| 961 |
} |
961 |
} |
| 962 |
|
962 |
|
| 963 |
class DependentBuiltinCounterStyle final : public BuiltinCounterStyle |
963 |
class DependentBuiltinCounterStyle final : public BuiltinCounterStyle |
| 964 |
{ |
964 |
{ |
| 965 |
private: |
965 |
private: |
| 966 |
~DependentBuiltinCounterStyle() {} |
966 |
~DependentBuiltinCounterStyle() {} |
| 967 |
public: |
967 |
public: |
| 968 |
DependentBuiltinCounterStyle(int32_t aStyle, CounterStyleManager* aManager) |
968 |
DependentBuiltinCounterStyle(int32_t aStyle, CounterStyleManager* aManager) |
| 969 |
: BuiltinCounterStyle(aStyle), |
969 |
: BuiltinCounterStyle(aStyle), |
| 970 |
mManager(aManager) |
970 |
mManager(aManager) |
| 971 |
{ |
971 |
{ |
| 972 |
NS_ASSERTION(IsDependentStyle(), "Not a dependent builtin style"); |
972 |
NS_ASSERTION(IsDependentStyle(), "Not a dependent builtin style"); |
| 973 |
MOZ_ASSERT(!IsCustomStyle(), "Not a builtin style"); |
973 |
MOZ_ASSERT(!IsCustomStyle(), "Not a builtin style"); |
| 974 |
} |
974 |
} |
| 975 |
|
975 |
|
| 976 |
virtual CounterStyle* GetFallback() override; |
976 |
virtual CounterStyle* GetFallback() override; |
| 977 |
|
977 |
|
|
|
| 1140 |
// is owned by nsPresContext, and will be released after all nodes and |
1140 |
// is owned by nsPresContext, and will be released after all nodes and |
| 1141 |
// frames are released. |
1141 |
// frames are released. |
| 1142 |
CounterStyleManager* mManager; |
1142 |
CounterStyleManager* mManager; |
| 1143 |
|
1143 |
|
| 1144 |
RefPtr<nsCSSCounterStyleRule> mRule; |
1144 |
RefPtr<nsCSSCounterStyleRule> mRule; |
| 1145 |
uint32_t mRuleGeneration; |
1145 |
uint32_t mRuleGeneration; |
| 1146 |
|
1146 |
|
| 1147 |
uint8_t mSystem; |
1147 |
uint8_t mSystem; |
| 1148 |
uint8_t mSpeakAs; |
1148 |
// GetSpeakAs will ensure that private member mSpeakAs is initialized before used |
|
|
1149 |
MOZ_INIT_OUTSIDE_CTOR uint8_t mSpeakAs; |
| 1149 |
|
1150 |
|
| 1150 |
enum { |
1151 |
enum { |
| 1151 |
// loop detection |
1152 |
// loop detection |
| 1152 |
FLAG_EXTENDS_VISITED = 1 << 0, |
1153 |
FLAG_EXTENDS_VISITED = 1 << 0, |
| 1153 |
FLAG_EXTENDS_LOOP = 1 << 1, |
1154 |
FLAG_EXTENDS_LOOP = 1 << 1, |
| 1154 |
FLAG_SPEAKAS_VISITED = 1 << 2, |
1155 |
FLAG_SPEAKAS_VISITED = 1 << 2, |
| 1155 |
FLAG_SPEAKAS_LOOP = 1 << 3, |
1156 |
FLAG_SPEAKAS_LOOP = 1 << 3, |
| 1156 |
// field status |
1157 |
// field status |