--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -194,17 +194,16 @@
#include "nsSandboxFlags.h"
#include "nsScriptSecurityManager.h"
#include "nsSerializationHelper.h"
#include "nsStreamUtils.h"
#include "nsTextEditorState.h"
#include "nsTextFragment.h"
#include "nsTextNode.h"
#include "nsThreadUtils.h"
-#include "nsUnicharUtilCIID.h"
#include "nsUnicodeProperties.h"
#include "nsViewManager.h"
#include "nsViewportInfo.h"
#include "nsWidgetsCID.h"
#include "nsIWindowProvider.h"
#include "nsWrapperCacheInlines.h"
#include "nsXULPopupManager.h"
#include "xpcprivate.h" // nsXPConnect
@@ -1754,19 +1753,19 @@ nsContentUtils::IsFirstLetterPunctuation
}
}
return false;
}
// static
bool nsContentUtils::IsAlphanumeric(uint32_t aChar)
{
- nsIUGenCategory::nsUGenCategory cat = mozilla::unicode::GetGenCategory(aChar);
-
- return (cat == nsIUGenCategory::kLetter || cat == nsIUGenCategory::kNumber);
+ nsUGenCategory cat = mozilla::unicode::GetGenCategory(aChar);
+
+ return (cat == nsUGenCategory::kLetter || cat == nsUGenCategory::kNumber);
}
// static
bool nsContentUtils::IsAlphanumericAt(const nsTextFragment* aFrag, uint32_t aOffset)
{
char16_t h = aFrag->CharAt(aOffset);
if (!IS_SURROGATE(h)) {
return IsAlphanumeric(h);
--- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
@@ -62,17 +62,16 @@
#include "nsXPIDLString.h"
#include "nsIObserverService.h"
#include "nsISimpleEnumerator.h"
#include "nsIDirectoryEnumerator.h"
#include "nsIFile.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "mozISpellI18NManager.h"
-#include "nsUnicharUtilCIID.h"
#include "nsUnicharUtils.h"
#include "nsCRT.h"
#include "mozInlineSpellChecker.h"
#include "mozilla/Services.h"
#include <stdlib.h>
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "mozilla/dom/EncodingUtils.h"
--- a/extensions/spellcheck/src/mozEnglishWordUtils.cpp
+++ b/extensions/spellcheck/src/mozEnglishWordUtils.cpp
@@ -2,17 +2,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozEnglishWordUtils.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "nsUnicharUtils.h"
-#include "nsUnicharUtilCIID.h"
#include "nsUnicodeProperties.h"
#include "nsCRT.h"
#include "mozilla/Likely.h"
NS_IMPL_CYCLE_COLLECTING_ADDREF(mozEnglishWordUtils)
NS_IMPL_CYCLE_COLLECTING_RELEASE(mozEnglishWordUtils)
NS_INTERFACE_MAP_BEGIN(mozEnglishWordUtils)
@@ -129,17 +128,17 @@ NS_IMETHODIMP mozEnglishWordUtils::GetRo
}
return NS_OK;
}
// This needs vast improvement
bool mozEnglishWordUtils::ucIsAlpha(char16_t aChar)
{
// XXX we have to fix callers to handle the full Unicode range
- return nsIUGenCategory::kLetter == mozilla::unicode::GetGenCategory(aChar);
+ return nsUGenCategory::kLetter == mozilla::unicode::GetGenCategory(aChar);
}
NS_IMETHODIMP mozEnglishWordUtils::FindNextWord(const char16_t *word, uint32_t length, uint32_t offset, int32_t *begin, int32_t *end)
{
const char16_t *p = word + offset;
const char16_t *endbuf = word + length;
const char16_t *startWord=p;
if(p<endbuf){
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -7,17 +7,16 @@
#include "nsDebug.h"
#include "nsIAtom.h"
#include "nsComponentManagerUtils.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMElement.h"
#include "nsIDOMRange.h"
#include "nsIEditor.h"
#include "nsIDOMNode.h"
-#include "nsUnicharUtilCIID.h"
#include "nsUnicodeProperties.h"
#include "nsServiceManagerUtils.h"
#include "nsIContent.h"
#include "nsTextFragment.h"
#include "mozilla/dom/Element.h"
#include "nsRange.h"
#include "nsContentUtils.h"
#include "nsIFrame.h"
@@ -846,19 +845,19 @@ WordSplitState::ClassifyCharacter(int32_
{
NS_ASSERTION(aIndex >= 0 && aIndex <= int32_t(mDOMWordText.Length()),
"Index out of range");
if (aIndex == int32_t(mDOMWordText.Length()))
return CHAR_CLASS_SEPARATOR;
// this will classify the character, we want to treat "ignorable" characters
// such as soft hyphens, and also ZWJ and ZWNJ as word characters.
- nsIUGenCategory::nsUGenCategory
- charCategory = mozilla::unicode::GetGenCategory(mDOMWordText[aIndex]);
- if (charCategory == nsIUGenCategory::kLetter ||
+ nsUGenCategory charCategory =
+ mozilla::unicode::GetGenCategory(mDOMWordText[aIndex]);
+ if (charCategory == nsUGenCategory::kLetter ||
IsIgnorableCharacter(mDOMWordText[aIndex]) ||
mDOMWordText[aIndex] == 0x200C /* ZWNJ */ ||
mDOMWordText[aIndex] == 0x200D /* ZWJ */)
return CHAR_CLASS_WORD;
// If conditional punctuation is surrounded immediately on both sides by word
// characters it also counts as a word character.
if (IsConditionalPunctuation(mDOMWordText[aIndex])) {
@@ -897,20 +896,20 @@ WordSplitState::ClassifyCharacter(int32_
if (aIndex > 0 &&
mDOMWordText[aIndex] == '.' &&
mDOMWordText[aIndex - 1] != '.' &&
ClassifyCharacter(aIndex - 1, false) != CHAR_CLASS_WORD) {
return CHAR_CLASS_WORD;
}
// all other punctuation
- if (charCategory == nsIUGenCategory::kSeparator ||
- charCategory == nsIUGenCategory::kOther ||
- charCategory == nsIUGenCategory::kPunctuation ||
- charCategory == nsIUGenCategory::kSymbol) {
+ if (charCategory == nsUGenCategory::kSeparator ||
+ charCategory == nsUGenCategory::kOther ||
+ charCategory == nsUGenCategory::kPunctuation ||
+ charCategory == nsUGenCategory::kSymbol) {
// Don't break on hyphens, as hunspell handles them on its own.
if (aIndex > 0 &&
mDOMWordText[aIndex] == '-' &&
mDOMWordText[aIndex - 1] != '-' &&
ClassifyCharacter(aIndex - 1, false) == CHAR_CLASS_WORD) {
// A hyphen is only meaningful as a separator inside a word
// if the previous and next characters are a word character.
if (aIndex == int32_t(mDOMWordText.Length()) - 1)
@@ -1028,17 +1027,17 @@ WordSplitState::IsSpecialWord()
bool
WordSplitState::ShouldSkipWord(int32_t aStart, int32_t aLength)
{
int32_t last = aStart + aLength;
// check to see if the word contains a digit
for (int32_t i = aStart; i < last; i ++) {
- if (unicode::GetGenCategory(mDOMWordText[i]) == nsIUGenCategory::kNumber) {
+ if (unicode::GetGenCategory(mDOMWordText[i]) == nsUGenCategory::kNumber) {
return true;
}
}
// not special
return false;
}
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -21,19 +21,19 @@
#include "nsGkAtoms.h"
#include "gfxTypes.h"
#include "gfxContext.h"
#include "gfxFontMissingGlyphs.h"
#include "gfxGraphiteShaper.h"
#include "gfxHarfBuzzShaper.h"
#include "gfxUserFontSet.h"
-#include "nsIUGenCategory.h"
#include "nsSpecialCasingData.h"
#include "nsTextRunTransformations.h"
+#include "nsUGenCategory.h"
#include "nsUnicodeProperties.h"
#include "nsStyleConsts.h"
#include "mozilla/AppUnits.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
@@ -694,17 +694,17 @@ bool
gfxShapedText::FilterIfIgnorable(uint32_t aIndex, uint32_t aCh)
{
if (IsIgnorable(aCh)) {
// There are a few default-ignorables of Letter category (currently,
// just the Hangul filler characters) that we'd better not discard
// if they're followed by additional characters in the same cluster.
// Some fonts use them to carry the width of a whole cluster of
// combining jamos; see bug 1238243.
- if (GetGenCategory(aCh) == nsIUGenCategory::kLetter &&
+ if (GetGenCategory(aCh) == nsUGenCategory::kLetter &&
aIndex + 1 < GetLength() &&
!GetCharacterGlyphs()[aIndex + 1].IsClusterStart()) {
return false;
}
DetailedGlyph *details = AllocateDetailedGlyphs(aIndex, 1);
details->mGlyphID = aCh;
details->mAdvance = 0;
details->mXOffset = 0;
--- a/intl/build/nsI18nModule.cpp
+++ b/intl/build/nsI18nModule.cpp
@@ -6,18 +6,16 @@
#include "mozilla/ModuleUtils.h"
// lwbrk
#include "nsLWBrkCIID.h"
#include "nsJISx4051LineBreaker.h"
#include "nsSampleWordBreaker.h"
// unicharutil
-#include "nsCategoryImp.h"
-#include "nsUnicharUtilCIID.h"
#include "nsEntityConverter.h"
#include "nsSaveAsCharset.h"
#include "nsUnicodeNormalizer.h"
// string bundles (intl)
#include "nsStringBundleService.h"
#include "nsStringBundleTextOverride.h"
@@ -27,44 +25,40 @@
// uconv
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJISx4051LineBreaker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSampleWordBreaker)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleTextOverride, Init)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsCategoryImp,
- nsCategoryImp::GetInstance)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEntityConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSaveAsCharset)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeNormalizer)
NS_DEFINE_NAMED_CID(MOZ_LOCALESERVICE_CID);
NS_DEFINE_NAMED_CID(MOZ_OSPREFERENCES_CID);
NS_DEFINE_NAMED_CID(NS_LBRK_CID);
NS_DEFINE_NAMED_CID(NS_WBRK_CID);
-NS_DEFINE_NAMED_CID(NS_UNICHARCATEGORY_CID);
NS_DEFINE_NAMED_CID(NS_ENTITYCONVERTER_CID);
NS_DEFINE_NAMED_CID(NS_SAVEASCHARSET_CID);
NS_DEFINE_NAMED_CID(NS_UNICODE_NORMALIZER_CID);
NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID);
NS_DEFINE_NAMED_CID(NS_LOCALESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID);
NS_DEFINE_NAMED_CID(NS_SCRIPTABLEDATEFORMAT_CID);
NS_DEFINE_NAMED_CID(NS_PLATFORMCHARSET_CID);
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
static const mozilla::Module::CIDEntry kIntlCIDs[] = {
{ &kMOZ_LOCALESERVICE_CID, false, nullptr, mozilla::intl::LocaleServiceConstructor },
{ &kMOZ_OSPREFERENCES_CID, false, nullptr, mozilla::intl::OSPreferencesConstructor },
{ &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor },
{ &kNS_WBRK_CID, false, nullptr, nsSampleWordBreakerConstructor },
- { &kNS_UNICHARCATEGORY_CID, false, nullptr, nsCategoryImpConstructor },
{ &kNS_ENTITYCONVERTER_CID, false, nullptr, nsEntityConverterConstructor },
{ &kNS_SAVEASCHARSET_CID, false, nullptr, nsSaveAsCharsetConstructor },
{ &kNS_UNICODE_NORMALIZER_CID, false, nullptr, nsUnicodeNormalizerConstructor },
{ &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor },
{ &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor },
{ &kNS_LOCALESERVICE_CID, false, nullptr, CreateLocaleService },
{ &kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor },
{ &kNS_SCRIPTABLEDATEFORMAT_CID, false, nullptr, NS_NewScriptableDateFormat },
@@ -73,17 +67,16 @@ static const mozilla::Module::CIDEntry k
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
{ MOZ_LOCALESERVICE_CONTRACTID, &kMOZ_LOCALESERVICE_CID },
{ MOZ_OSPREFERENCES_CONTRACTID, &kMOZ_OSPREFERENCES_CID },
{ NS_LBRK_CONTRACTID, &kNS_LBRK_CID },
{ NS_WBRK_CONTRACTID, &kNS_WBRK_CID },
- { NS_UNICHARCATEGORY_CONTRACTID, &kNS_UNICHARCATEGORY_CID },
{ NS_ENTITYCONVERTER_CONTRACTID, &kNS_ENTITYCONVERTER_CID },
{ NS_SAVEASCHARSET_CONTRACTID, &kNS_SAVEASCHARSET_CID },
{ NS_UNICODE_NORMALIZER_CONTRACTID, &kNS_UNICODE_NORMALIZER_CID },
{ NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID },
{ NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID },
{ NS_LOCALESERVICE_CONTRACTID, &kNS_LOCALESERVICE_CID },
{ NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID },
{ NS_SCRIPTABLEDATEFORMAT_CONTRACTID, &kNS_SCRIPTABLEDATEFORMAT_CID },
--- a/intl/hyphenation/glue/nsHyphenator.cpp
+++ b/intl/hyphenation/glue/nsHyphenator.cpp
@@ -2,17 +2,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHyphenator.h"
#include "nsIFile.h"
#include "nsUTF8Utils.h"
#include "nsUnicodeProperties.h"
-#include "nsUnicharUtilCIID.h"
#include "nsIURI.h"
#include "hyphen.h"
nsHyphenator::nsHyphenator(nsIURI *aURI)
: mDict(nullptr)
{
nsCString uriSpec;
@@ -61,18 +60,18 @@ nsHyphenator::Hyphenate(const nsAString&
if (i + 1 < aString.Length() && NS_IS_LOW_SURROGATE(aString[i+1])) {
ch = SURROGATE_TO_UCS4(ch, aString[i+1]);
chLen = 2;
} else {
NS_WARNING("unpaired surrogate found during hyphenation");
}
}
- nsIUGenCategory::nsUGenCategory cat = mozilla::unicode::GetGenCategory(ch);
- if (cat == nsIUGenCategory::kLetter || cat == nsIUGenCategory::kMark) {
+ nsUGenCategory cat = mozilla::unicode::GetGenCategory(ch);
+ if (cat == nsUGenCategory::kLetter || cat == nsUGenCategory::kMark) {
if (!inWord) {
inWord = true;
wordStart = i;
}
wordLimit = i + chLen;
if (i + chLen < aString.Length()) {
continue;
}
--- a/intl/lwbrk/nsJISx4051LineBreaker.cpp
+++ b/intl/lwbrk/nsJISx4051LineBreaker.cpp
@@ -660,17 +660,17 @@ public:
if (mHasCJKChar)
return false;
uint32_t index = mIndex + aOffset;
// If the character at index is a letter (rather than various punctuation
// characters, etc) then we want a shorter "conservative" range
uint32_t conservativeRangeStart, conservativeRangeEnd;
if (index < mLength &&
- nsIUGenCategory::kLetter ==
+ nsUGenCategory::kLetter ==
(mText ? GetGenCategory(mText[index])
: GetGenCategory(GetUnicodeCharAt(index)))) {
// Primarily for hyphenated word prefixes/suffixes; we add 1 to Start
// to get more balanced behavior (if we break off a 2-letter prefix,
// that means the break will actually be three letters from start of
// word, to include the hyphen; whereas a 2-letter suffix will be
// broken only two letters from end of word).
conservativeRangeEnd = CONSERVATIVE_RANGE_LETTER;
--- a/intl/unicharutil/moz.build
+++ b/intl/unicharutil/moz.build
@@ -11,23 +11,21 @@ XPIDL_SOURCES += [
'nsIEntityConverter.idl',
'nsISaveAsCharset.idl',
'nsIUnicodeNormalizer.idl',
]
XPIDL_MODULE = 'unicharutil'
EXPORTS += [
- 'nsIUGenCategory.h',
- 'nsUnicharUtilCIID.h',
+ 'nsUGenCategory.h',
'nsUnicodeNormalizer.h',
]
UNIFIED_SOURCES += [
- 'nsCategoryImp.cpp',
'nsEntityConverter.cpp',
'nsSaveAsCharset.cpp',
]
if CONFIG['ENABLE_INTL_API']:
UNIFIED_SOURCES += [
'nsUnicodeNormalizer_ICU.cpp',
]
deleted file mode 100644
--- a/intl/unicharutil/nsCategoryImp.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nscore.h"
-#include "nsISupports.h"
-#include "nsCategoryImp.h"
-#include "nsUnicodeProperties.h"
-
-NS_IMPL_QUERY_INTERFACE(nsCategoryImp, nsIUGenCategory)
-
-NS_IMETHODIMP_(MozExternalRefCountType) nsCategoryImp::AddRef(void)
-{
- return MozExternalRefCountType(1);
-}
-
-NS_IMETHODIMP_(MozExternalRefCountType) nsCategoryImp::Release(void)
-{
- return MozExternalRefCountType(1);
-}
-
-nsCategoryImp* nsCategoryImp::GetInstance()
-{
- static nsCategoryImp categoryImp;
- return &categoryImp;
-}
-
-nsIUGenCategory::nsUGenCategory nsCategoryImp::Get(uint32_t aChar)
-{
- return mozilla::unicode::GetGenCategory(aChar);
-}
deleted file mode 100644
--- a/intl/unicharutil/nsCategoryImp.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef nsCategoryImp_h__
-#define nsCategoryImp_h__
-
-#include "nsIUGenCategory.h"
-
-class nsCategoryImp : public nsIUGenCategory {
- NS_DECL_THREADSAFE_ISUPPORTS
-
-public:
- static nsCategoryImp* GetInstance();
-
- /**
- * Give a Unichar, return a nsUGenCategory
- */
- virtual nsUGenCategory Get(uint32_t aChar) override;
-};
-
-#endif /* nsCategoryImp_h__ */
deleted file mode 100644
--- a/intl/unicharutil/nsIUGenCategory.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef nsIUGenCategory_h__
-#define nsIUGenCategory_h__
-
-
-#include "nsISupports.h"
-#include "nscore.h"
-
-// {671fea05-fcee-4b1c-82a3-6eb03eda8ddc}
-#define NS_IUGENCATEGORY_IID \
-{ 0x671fea05, 0xfcee, 0x4b1c, \
- { 0x82, 0xa3, 0x6e, 0xb0, 0x3e, 0xda, 0x8d, 0xdc } }
-
-
-class nsIUGenCategory : public nsISupports {
-
-public:
-
- NS_DECLARE_STATIC_IID_ACCESSOR(NS_IUGENCATEGORY_IID)
-
- /**
- * Read http://unicode.org/reports/tr44/#General_Category_Values
- * for the detailed definition of the following categories
- */
- typedef enum {
- kUndefined = 0,
- kMark = 1, // Mn, Mc, and Me
- kNumber = 2, // Nd, Nl, and No
- kSeparator = 3, // Zs, Zl, and Zp
- kOther = 4, // Cc, Cf, Cs, Co, and Cn
- kLetter = 5, // Lu, Ll, Lt, Lm, and Lo
- kPunctuation = 6, // Pc, Pd, Ps, Pe, Pi, Pf, and Po
- kSymbol = 7 // Sm, Sc, Sk, and So
- } nsUGenCategory;
-
- /**
- * Give a Unichar, return a nsUGenCategory
- */
- virtual nsUGenCategory Get(uint32_t aChar) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIUGenCategory, NS_IUGENCATEGORY_IID)
-
-#endif /* nsIUGenCategory_h__ */
new file mode 100644
--- /dev/null
+++ b/intl/unicharutil/nsUGenCategory.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsUGenCategory_h__
+#define nsUGenCategory_h__
+
+/**
+ * Read http://unicode.org/reports/tr44/#General_Category_Values
+ * for the detailed definition of the following categories
+ */
+enum class nsUGenCategory {
+ kUndefined = 0,
+ kMark = 1, // Mn, Mc, and Me
+ kNumber = 2, // Nd, Nl, and No
+ kSeparator = 3, // Zs, Zl, and Zp
+ kOther = 4, // Cc, Cf, Cs, Co, and Cn
+ kLetter = 5, // Lu, Ll, Lt, Lm, and Lo
+ kPunctuation = 6, // Pc, Pd, Ps, Pe, Pi, Pf, and Po
+ kSymbol = 7 // Sm, Sc, Sk, and So
+};
+
+#endif // nsUGenCategory_h__
deleted file mode 100644
--- a/intl/unicharutil/nsUnicharUtilCIID.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef nsUnicharUtilCIID_h__
-#define nsUnicharUtilCIID_h__
-
-
-#include "nsISupports.h"
-#include "nscore.h"
-
-#define NS_UNICHARCATEGORY_CID \
-{ 0x748a1132, 0x671a, 0x409a, \
- { 0x8d, 0x1d, 0xf1, 0xcd, 0xf6, 0xb3, 0xa6, 0xb4 } }
-
-#define NS_UNICHARCATEGORY_CONTRACTID "@mozilla.org/intl/unicharcategory;1"
-
-#endif
--- a/intl/unicharutil/util/IrishCasing.cpp
+++ b/intl/unicharutil/util/IrishCasing.cpp
@@ -211,17 +211,17 @@ const uint8_t IrishCasing::sUcClasses[26
uint8_t
IrishCasing::GetClass(uint32_t aCh)
{
using mozilla::unicode::GetGenCategory;
if (aCh >= 'a' && aCh <= 'z') {
return sLcClasses[aCh - 'a'];
} else if (aCh >= 'A' && aCh <= 'Z') {
return sUcClasses[aCh - 'A'];
- } else if (GetGenCategory(aCh) == nsIUGenCategory::kLetter) {
+ } else if (GetGenCategory(aCh) == nsUGenCategory::kLetter) {
if (aCh == a_ACUTE || aCh == e_ACUTE || aCh == i_ACUTE ||
aCh == o_ACUTE || aCh == u_ACUTE) {
return kClass_vowel;
} else if (aCh == A_ACUTE || aCh == E_ACUTE || aCh == I_ACUTE ||
aCh == O_ACUTE || aCh == U_ACUTE) {
return kClass_Vowel;
} else {
return kClass_letter;
--- a/intl/unicharutil/util/nsUnicodeProperties.cpp
+++ b/intl/unicharutil/util/nsUnicodeProperties.cpp
@@ -93,51 +93,51 @@ that the Plane 0 pages are always the fi
array.
The division of the remaining 16 bits into Page and Char fields is
adjusted for each property (by experiment using the generation tool)
to provide the most compact storage, depending on the distribution
of values.
*/
-const nsIUGenCategory::nsUGenCategory sDetailedToGeneralCategory[] = {
+const nsUGenCategory sDetailedToGeneralCategory[] = {
/*
* The order here corresponds to the HB_UNICODE_GENERAL_CATEGORY_* constants
* of the hb_unicode_general_category_t enum in gfx/harfbuzz/src/hb-unicode.h.
*/
- /* CONTROL */ nsIUGenCategory::kOther,
- /* FORMAT */ nsIUGenCategory::kOther,
- /* UNASSIGNED */ nsIUGenCategory::kOther,
- /* PRIVATE_USE */ nsIUGenCategory::kOther,
- /* SURROGATE */ nsIUGenCategory::kOther,
- /* LOWERCASE_LETTER */ nsIUGenCategory::kLetter,
- /* MODIFIER_LETTER */ nsIUGenCategory::kLetter,
- /* OTHER_LETTER */ nsIUGenCategory::kLetter,
- /* TITLECASE_LETTER */ nsIUGenCategory::kLetter,
- /* UPPERCASE_LETTER */ nsIUGenCategory::kLetter,
- /* COMBINING_MARK */ nsIUGenCategory::kMark,
- /* ENCLOSING_MARK */ nsIUGenCategory::kMark,
- /* NON_SPACING_MARK */ nsIUGenCategory::kMark,
- /* DECIMAL_NUMBER */ nsIUGenCategory::kNumber,
- /* LETTER_NUMBER */ nsIUGenCategory::kNumber,
- /* OTHER_NUMBER */ nsIUGenCategory::kNumber,
- /* CONNECT_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* DASH_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* CLOSE_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* FINAL_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* INITIAL_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* OTHER_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* OPEN_PUNCTUATION */ nsIUGenCategory::kPunctuation,
- /* CURRENCY_SYMBOL */ nsIUGenCategory::kSymbol,
- /* MODIFIER_SYMBOL */ nsIUGenCategory::kSymbol,
- /* MATH_SYMBOL */ nsIUGenCategory::kSymbol,
- /* OTHER_SYMBOL */ nsIUGenCategory::kSymbol,
- /* LINE_SEPARATOR */ nsIUGenCategory::kSeparator,
- /* PARAGRAPH_SEPARATOR */ nsIUGenCategory::kSeparator,
- /* SPACE_SEPARATOR */ nsIUGenCategory::kSeparator
+ /* CONTROL */ nsUGenCategory::kOther,
+ /* FORMAT */ nsUGenCategory::kOther,
+ /* UNASSIGNED */ nsUGenCategory::kOther,
+ /* PRIVATE_USE */ nsUGenCategory::kOther,
+ /* SURROGATE */ nsUGenCategory::kOther,
+ /* LOWERCASE_LETTER */ nsUGenCategory::kLetter,
+ /* MODIFIER_LETTER */ nsUGenCategory::kLetter,
+ /* OTHER_LETTER */ nsUGenCategory::kLetter,
+ /* TITLECASE_LETTER */ nsUGenCategory::kLetter,
+ /* UPPERCASE_LETTER */ nsUGenCategory::kLetter,
+ /* COMBINING_MARK */ nsUGenCategory::kMark,
+ /* ENCLOSING_MARK */ nsUGenCategory::kMark,
+ /* NON_SPACING_MARK */ nsUGenCategory::kMark,
+ /* DECIMAL_NUMBER */ nsUGenCategory::kNumber,
+ /* LETTER_NUMBER */ nsUGenCategory::kNumber,
+ /* OTHER_NUMBER */ nsUGenCategory::kNumber,
+ /* CONNECT_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* DASH_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* CLOSE_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* FINAL_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* INITIAL_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* OTHER_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* OPEN_PUNCTUATION */ nsUGenCategory::kPunctuation,
+ /* CURRENCY_SYMBOL */ nsUGenCategory::kSymbol,
+ /* MODIFIER_SYMBOL */ nsUGenCategory::kSymbol,
+ /* MATH_SYMBOL */ nsUGenCategory::kSymbol,
+ /* OTHER_SYMBOL */ nsUGenCategory::kSymbol,
+ /* LINE_SEPARATOR */ nsUGenCategory::kSeparator,
+ /* PARAGRAPH_SEPARATOR */ nsUGenCategory::kSeparator,
+ /* SPACE_SEPARATOR */ nsUGenCategory::kSeparator
};
#ifdef ENABLE_INTL_API
const hb_unicode_general_category_t sICUtoHBcategory[U_CHAR_CATEGORY_COUNT] = {
HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED, // U_GENERAL_OTHER_TYPES = 0,
HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER, // U_UPPERCASE_LETTER = 1,
HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER, // U_LOWERCASE_LETTER = 2,
HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER, // U_TITLECASE_LETTER = 3,
--- a/intl/unicharutil/util/nsUnicodeProperties.h
+++ b/intl/unicharutil/util/nsUnicodeProperties.h
@@ -3,32 +3,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NS_UNICODEPROPERTIES_H
#define NS_UNICODEPROPERTIES_H
#include "nsBidiUtils.h"
-#include "nsIUGenCategory.h"
+#include "nsUGenCategory.h"
#include "nsUnicodeScriptCodes.h"
#include "harfbuzz/hb.h"
#if ENABLE_INTL_API
#include "unicode/uchar.h"
#include "unicode/uscript.h"
#endif
const nsCharProps2& GetCharProps2(uint32_t aCh);
namespace mozilla {
namespace unicode {
-extern const nsIUGenCategory::nsUGenCategory sDetailedToGeneralCategory[];
+extern const nsUGenCategory sDetailedToGeneralCategory[];
/* This MUST match the values assigned by genUnicodePropertyData.pl! */
enum VerticalOrientation {
VERTICAL_ORIENTATION_U = 0,
VERTICAL_ORIENTATION_R = 1,
VERTICAL_ORIENTATION_Tu = 2,
VERTICAL_ORIENTATION_Tr = 3
};
@@ -229,18 +229,18 @@ bool IsEastAsianWidthFWH(uint32_t aCh);
// Return whether the char is default-ignorable.
inline bool IsDefaultIgnorable(uint32_t aCh)
{
return GetCharProps2(aCh).mDefaultIgnorable;
}
#endif // !ENABLE_INTL_API
-// returns the simplified Gen Category as defined in nsIUGenCategory
-inline nsIUGenCategory::nsUGenCategory GetGenCategory(uint32_t aCh) {
+// returns the simplified Gen Category as defined in nsUGenCategory
+inline nsUGenCategory GetGenCategory(uint32_t aCh) {
return sDetailedToGeneralCategory[GetGeneralCategory(aCh)];
}
inline VerticalOrientation GetVerticalOrientation(uint32_t aCh) {
return VerticalOrientation(GetCharProps2(aCh).mVertOrient);
}
inline IdentifierType GetIdentifierType(uint32_t aCh) {
--- a/layout/generic/nsTextRunTransformations.cpp
+++ b/layout/generic/nsTextRunTransformations.cpp
@@ -302,17 +302,17 @@ nsCaseTransformTextRunFactory::Transform
bool mergeNeeded = false;
bool capitalizeDutchIJ = false;
bool prevIsLetter = false;
bool ntPrefix = false; // true immediately after a word-initial 'n' or 't'
// when doing Irish lowercasing
uint32_t sigmaIndex = uint32_t(-1);
- nsIUGenCategory::nsUGenCategory cat;
+ nsUGenCategory cat;
uint8_t style = aAllUppercase ? NS_STYLE_TEXT_TRANSFORM_UPPERCASE : 0;
bool forceNonFullWidth = false;
const nsIAtom* lang = aLanguage;
LanguageSpecificCasingBehavior languageSpecificCasing = GetCasingFor(lang);
mozilla::GreekCasing::State greekState;
mozilla::IrishCasing::State irishState;
@@ -372,17 +372,17 @@ nsCaseTransformTextRunFactory::Transform
sigmaIndex = uint32_t(-1);
break;
}
}
cat = mozilla::unicode::GetGenCategory(ch);
if (languageSpecificCasing == eLSCB_Irish &&
- cat == nsIUGenCategory::kLetter) {
+ cat == nsUGenCategory::kLetter) {
// See bug 1018805 for Irish lowercasing requirements
if (!prevIsLetter && (ch == 'n' || ch == 't')) {
ntPrefix = true;
} else {
if (ntPrefix && mozilla::IrishCasing::IsUpperVowel(ch)) {
aConvertedString.Append('-');
++extraChars;
}
@@ -409,17 +409,17 @@ nsCaseTransformTextRunFactory::Transform
// was a letter, CAPITAL SIGMA maps to FINAL SIGMA and we record the
// position in the converted string; if we then encounter another letter,
// that FINAL SIGMA is replaced with a standard SMALL SIGMA.
// If sigmaIndex is not -1, it marks where we have provisionally mapped
// a CAPITAL SIGMA to FINAL SIGMA; if we now find another letter, we
// need to change it to SMALL SIGMA.
if (sigmaIndex != uint32_t(-1)) {
- if (cat == nsIUGenCategory::kLetter) {
+ if (cat == nsUGenCategory::kLetter) {
aConvertedString.SetCharAt(GREEK_SMALL_LETTER_SIGMA, sigmaIndex);
}
}
if (ch == GREEK_CAPITAL_LETTER_SIGMA) {
// If preceding char was a letter, map to FINAL instead of SMALL,
// and note where it occurred by setting sigmaIndex; we'll change it
// to standard SMALL SIGMA later if another letter follows
@@ -434,18 +434,18 @@ nsCaseTransformTextRunFactory::Transform
}
prevIsLetter = true;
break;
}
// ignore diacritics for the purpose of contextual sigma mapping;
// otherwise, reset prevIsLetter appropriately and clear the
// sigmaIndex marker
- if (cat != nsIUGenCategory::kMark) {
- prevIsLetter = (cat == nsIUGenCategory::kLetter);
+ if (cat != nsUGenCategory::kMark) {
+ prevIsLetter = (cat == nsUGenCategory::kLetter);
sigmaIndex = uint32_t(-1);
}
mcm = mozilla::unicode::SpecialLower(ch);
if (mcm) {
int j = 0;
while (j < 2 && mcm->mMappedChars[j + 1]) {
aConvertedString.Append(mcm->mMappedChars[j]);