Bug 1800181: Atomize font family and language a11y text attributes. r=morgan

This reduces memory used by the cache, since the same font family and language strings often occur many times in the same document (and likely even across documents).

Differential Revision: https://phabricator.services.mozilla.com/D162276
This commit is contained in:
James Teh 2022-11-18 22:03:56 +00:00
parent 2ab8453c6f
commit 35eb75ce3d

View File

@ -221,7 +221,8 @@ bool TextAttrsMgr::LangTextAttr::GetValueFor(LocalAccessible* aAccessible,
void TextAttrsMgr::LangTextAttr::ExposeValue(AccAttributes* aAttributes,
const nsString& aValue) {
aAttributes->SetAttributeStringCopy(nsGkAtoms::language, aValue);
RefPtr<nsAtom> lang = NS_Atomize(aValue);
aAttributes->SetAttribute(nsGkAtoms::language, lang);
}
////////////////////////////////////////////////////////////////////////////////
@ -401,7 +402,8 @@ bool TextAttrsMgr::FontFamilyTextAttr::GetValueFor(LocalAccessible* aAccessible,
void TextAttrsMgr::FontFamilyTextAttr::ExposeValue(AccAttributes* aAttributes,
const nsString& aValue) {
aAttributes->SetAttributeStringCopy(nsGkAtoms::font_family, aValue);
RefPtr<nsAtom> family = NS_Atomize(aValue);
aAttributes->SetAttribute(nsGkAtoms::font_family, family);
}
bool TextAttrsMgr::FontFamilyTextAttr::GetFontFamily(nsIFrame* aFrame,