tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 33dfc6cf93fbe38b9d0ef6f69b37520e4c1eaddc
parent a876179e45510f1f23b1b0ecedb4867e15831bb0
Author: Jonathan Kew <jkew@mozilla.com>
Date:   Fri,  5 Dec 2025 18:22:48 +0000

Bug 2003721 - Convert GetCasingFor() in nsTextRunTransformations to use nsStyleUtil::MatchesLanguagePrefix. r=layout-reviewers,emilio

This doesn't change behavior, just cleans up the code a bit by using the
nsStyleUtil helper.

Differential Revision: https://phabricator.services.mozilla.com/D275280

Diffstat:
Mlayout/generic/nsTextRunTransformations.cpp | 27++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp @@ -21,6 +21,7 @@ #include "nsLineBreaker.h" #include "nsSpecialCasingData.h" #include "nsStyleConsts.h" +#include "nsStyleUtil.h" #include "nsTextFrameUtils.h" #include "nsUnicharUtils.h" #include "nsUnicodeProperties.h" @@ -261,33 +262,25 @@ static LanguageSpecificCasingBehavior GetCasingFor(const nsAtom* aLang) { if (!aLang) { return eLSCB_None; } - if (aLang == nsGkAtoms::tr || aLang == nsGkAtoms::az || - aLang == nsGkAtoms::ba || aLang == nsGkAtoms::crh || - aLang == nsGkAtoms::tt) { + if (nsStyleUtil::MatchesLanguagePrefix(aLang, u"tr") || + nsStyleUtil::MatchesLanguagePrefix(aLang, u"az") || + nsStyleUtil::MatchesLanguagePrefix(aLang, u"ba") || + nsStyleUtil::MatchesLanguagePrefix(aLang, u"crh") || + nsStyleUtil::MatchesLanguagePrefix(aLang, u"tt")) { return eLSCB_Turkish; } - if (aLang == nsGkAtoms::nl) { + if (nsStyleUtil::MatchesLanguagePrefix(aLang, u"nl")) { return eLSCB_Dutch; } - if (aLang == nsGkAtoms::el) { + if (nsStyleUtil::MatchesLanguagePrefix(aLang, u"el")) { return eLSCB_Greek; } - if (aLang == nsGkAtoms::ga) { + if (nsStyleUtil::MatchesLanguagePrefix(aLang, u"ga")) { return eLSCB_Irish; } - if (aLang == nsGkAtoms::lt) { + if (nsStyleUtil::MatchesLanguagePrefix(aLang, u"lt")) { return eLSCB_Lithuanian; } - - // Is there a region subtag we should ignore? - nsAtomString langStr(const_cast<nsAtom*>(aLang)); - int index = langStr.FindChar('-'); - if (index > 0) { - langStr.Truncate(index); - RefPtr<nsAtom> truncatedLang = NS_Atomize(langStr); - return GetCasingFor(truncatedLang); - } - return eLSCB_None; }