Bug 1170072 - Part 1. Make GetCharProps1 as static function. r=jfkthame

This commit is contained in:
Makoto Kato 2015-09-07 11:54:46 +09:00
Родитель e681e88f6d
Коммит 544d70a000
3 изменённых файлов: 32 добавлений и 27 удалений

Просмотреть файл

@ -115,15 +115,6 @@ SameScript(int32_t runScript, int32_t currCharScript)
currCharScript == runScript;
}
// Return whether the char has a mirrored-pair counterpart.
// NOTE that this depends on the implementation of nsCharProps records in
// nsUnicodeProperties, and may need to be updated if those structures change
static inline bool
HasMirroredChar(uint32_t aCh)
{
return GetCharProps1(aCh).mMirrorOffsetIndex != 0;
}
gfxScriptItemizer::gfxScriptItemizer(const char16_t *src, uint32_t length)
: textPtr(src), textLength(length)
{

Просмотреть файл

@ -13,7 +13,7 @@
#define UNICODE_LIMIT 0x110000
const nsCharProps1&
static const nsCharProps1&
GetCharProps1(uint32_t aCh)
{
if (aCh < UNICODE_BMP_LIMIT) {
@ -130,6 +130,18 @@ GetMirroredChar(uint32_t aCh)
return aCh + sMirrorOffsets[GetCharProps1(aCh).mMirrorOffsetIndex];
}
bool
HasMirroredChar(uint32_t aCh)
{
return GetCharProps1(aCh).mMirrorOffsetIndex != 0;
}
uint8_t
GetCombiningClass(uint32_t aCh)
{
return GetCharProps1(aCh).mCombiningClass;
}
uint32_t
GetScriptTagForCode(int32_t aScriptCode)
{
@ -249,6 +261,21 @@ IsClusterExtender(uint32_t aCh, uint8_t aCategory)
(aCh >= 0xff9e && aCh <= 0xff9f)); // katakana sound marks
}
enum HSType {
HST_NONE = 0x00,
HST_L = 0x01,
HST_V = 0x02,
HST_T = 0x04,
HST_LV = 0x03,
HST_LVT = 0x07
};
static HSType
GetHangulSyllableType(uint32_t aCh)
{
return HSType(GetCharProps1(aCh).mHangulType);
}
void
ClusterIterator::Next()
{

Просмотреть файл

@ -10,7 +10,6 @@
#include "nsIUGenCategory.h"
#include "nsUnicodeScriptCodes.h"
const nsCharProps1& GetCharProps1(uint32_t aCh);
const nsCharProps2& GetCharProps2(uint32_t aCh);
namespace mozilla {
@ -19,11 +18,12 @@ namespace unicode {
extern nsIUGenCategory::nsUGenCategory sDetailedToGeneralCategory[];
// Return whether the char has a mirrored-pair counterpart.
uint32_t GetMirroredChar(uint32_t aCh);
inline uint8_t GetCombiningClass(uint32_t aCh) {
return GetCharProps1(aCh).mCombiningClass;
}
bool HasMirroredChar(uint32_t aChr);
uint8_t GetCombiningClass(uint32_t aCh);
// returns the detailed General Category in terms of HB_UNICODE_* values
inline uint8_t GetGeneralCategory(uint32_t aCh) {
@ -104,19 +104,6 @@ inline bool IsClusterExtender(uint32_t aCh) {
return IsClusterExtender(aCh, GetGeneralCategory(aCh));
}
enum HSType {
HST_NONE = 0x00,
HST_L = 0x01,
HST_V = 0x02,
HST_T = 0x04,
HST_LV = 0x03,
HST_LVT = 0x07
};
inline HSType GetHangulSyllableType(uint32_t aCh) {
return HSType(GetCharProps1(aCh).mHangulType);
}
// Case mappings for the full Unicode range;
// note that it may be worth testing for ASCII chars and taking
// a separate fast-path before calling these, in perf-critical places