Bug 1402860 - Remove ENABLE_INTL_API conditional from nsChromeRegistry. r=smaug

This commit is contained in:
Jonathan Kew 2017-09-25 17:32:34 +01:00
Родитель 853c408d06
Коммит ce97b2d154
1 изменённых файлов: 0 добавлений и 35 удалений

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

@ -32,9 +32,7 @@
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/Location.h"
#ifdef ENABLE_INTL_API
#include "unicode/uloc.h"
#endif
nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
@ -638,7 +636,6 @@ nsChromeRegistry::MustLoadURLRemotely(nsIURI *aURI, bool *aResult)
bool
nsChromeRegistry::GetDirectionForLocale(const nsACString& aLocale)
{
#ifdef ENABLE_INTL_API
int pref = mozilla::Preferences::GetInt("intl.uidirection", -1);
if (pref >= 0) {
return (pref > 0);
@ -646,28 +643,6 @@ nsChromeRegistry::GetDirectionForLocale(const nsACString& aLocale)
nsAutoCString locale(aLocale);
SanitizeForBCP47(locale);
return uloc_isRightToLeft(locale.get());
#else
// first check the intl.uidirection.<locale> preference, and if that is not
// set, check the same preference but with just the first two characters of
// the locale. If that isn't set, default to left-to-right.
nsAutoCString prefString = NS_LITERAL_CSTRING("intl.uidirection.") + aLocale;
nsCOMPtr<nsIPrefBranch> prefBranch (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (!prefBranch) {
return false;
}
nsCString dir;
prefBranch->GetCharPref(prefString.get(), getter_Copies(dir));
if (dir.IsEmpty()) {
int32_t hyphen = prefString.FindChar('-');
if (hyphen >= 1) {
nsAutoCString shortPref(Substring(prefString, 0, hyphen));
prefBranch->GetCharPref(shortPref.get(), getter_Copies(dir));
}
}
return dir.EqualsLiteral("rtl");
#endif
}
NS_IMETHODIMP_(bool)
@ -715,7 +690,6 @@ nsChromeRegistry::GetSingleton()
void
nsChromeRegistry::SanitizeForBCP47(nsACString& aLocale)
{
#ifdef ENABLE_INTL_API
// Currently, the only locale code we use that's not BCP47-conformant is
// "ja-JP-mac" on OS X, but let's try to be more general than just
// hard-coding that here.
@ -730,13 +704,4 @@ nsChromeRegistry::SanitizeForBCP47(nsACString& aLocale)
if (U_SUCCESS(err) && len > 0) {
aLocale.Assign(langTag, len);
}
#else
// This is only really needed for Intl API purposes, AFAIK,
// so probably won't be used in a non-ENABLE_INTL_API build.
// But let's fix up the single anomalous code we actually ship,
// just in case:
if (aLocale.EqualsLiteral("ja-JP-mac")) {
aLocale.AssignLiteral("ja-JP");
}
#endif
}