Skip to content

Commit

Permalink
Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING ma…
Browse files Browse the repository at this point in the history
…cros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj

Differential Revision: https://phabricator.services.mozilla.com/D80860
  • Loading branch information
sigiesec committed Jul 1, 2020
1 parent 2775b60 commit fbd56b0
Show file tree
Hide file tree
Showing 1,219 changed files with 10,180 additions and 12,180 deletions.
21 changes: 8 additions & 13 deletions accessible/android/AccessibleWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ void AccessibleWrap::GetRoleDescription(role aRole,
if (aRole == roles::HEADING && aAttributes) {
// The heading level is an attribute, so we need that.
AutoTArray<nsString, 1> formatString;
nsresult rv = aAttributes->GetStringProperty(NS_LITERAL_CSTRING("level"),
nsresult rv = aAttributes->GetStringProperty("level"_ns,
*formatString.AppendElement());
if (NS_SUCCEEDED(rv) &&
LocalizeString("headingLevel", aRoleDescription, formatString)) {
Expand All @@ -548,8 +548,8 @@ void AccessibleWrap::GetRoleDescription(role aRole,

if ((aRole == roles::LANDMARK || aRole == roles::REGION) && aAttributes) {
nsAutoString xmlRoles;
if (NS_SUCCEEDED(aAttributes->GetStringProperty(
NS_LITERAL_CSTRING("xml-roles"), xmlRoles))) {
if (NS_SUCCEEDED(
aAttributes->GetStringProperty("xml-roles"_ns, xmlRoles))) {
nsWhitespaceTokenizer tokenizer(xmlRoles);
while (tokenizer.hasMoreTokens()) {
if (LocalizeString(NS_ConvertUTF16toUTF8(tokenizer.nextToken()).get(),
Expand Down Expand Up @@ -798,8 +798,7 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
}

nsString posinset;
nsresult rv = aAttributes->GetStringProperty(NS_LITERAL_CSTRING("posinset"),
posinset);
nsresult rv = aAttributes->GetStringProperty("posinset"_ns, posinset);
if (NS_SUCCEEDED(rv)) {
int32_t rowIndex;
if (sscanf(NS_ConvertUTF16toUTF8(posinset).get(), "%d", &rowIndex) > 0) {
Expand All @@ -819,8 +818,7 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
}

nsString colSize;
rv = aAttributes->GetStringProperty(NS_LITERAL_CSTRING("child-item-count"),
colSize);
rv = aAttributes->GetStringProperty("child-item-count"_ns, colSize);
if (NS_SUCCEEDED(rv)) {
int32_t rowCount;
if (sscanf(NS_ConvertUTF16toUTF8(colSize).get(), "%d", &rowCount) > 0) {
Expand All @@ -831,8 +829,7 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
java::sdk::Integer::ValueOf(1));

nsString unused;
rv = aAttributes->GetStringProperty(NS_LITERAL_CSTRING("hierarchical"),
unused);
rv = aAttributes->GetStringProperty("hierarchical"_ns, unused);
if (NS_SUCCEEDED(rv)) {
GECKOBUNDLE_PUT(collectionInfo, "isHierarchical",
java::sdk::Boolean::TRUE());
Expand Down Expand Up @@ -897,8 +894,7 @@ bool AccessibleWrap::HandleLiveRegionEvent(AccEvent* aEvent) {

nsCOMPtr<nsIPersistentProperties> attributes = Attributes();
nsString live;
nsresult rv =
attributes->GetStringProperty(NS_LITERAL_CSTRING("container-live"), live);
nsresult rv = attributes->GetStringProperty("container-live"_ns, live);
if (!NS_SUCCEEDED(rv)) {
return false;
}
Expand All @@ -908,8 +904,7 @@ bool AccessibleWrap::HandleLiveRegionEvent(AccEvent* aEvent) {
: nsIAccessibleAnnouncementEvent::POLITE;

nsString atomic;
rv = attributes->GetStringProperty(NS_LITERAL_CSTRING("container-atomic"),
atomic);
rv = attributes->GetStringProperty("container-atomic"_ns, atomic);

Accessible* announcementTarget = this;
nsAutoString announcement;
Expand Down
2 changes: 1 addition & 1 deletion accessible/aom/AccessibleNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void AccessibleNode::GetComputedRole(nsAString& aRole) {
void AccessibleNode::GetStates(nsTArray<nsString>& aStates) {
nsAccessibilityService* accService = GetOrCreateAccService();
if (!mIntl || !accService) {
aStates.AppendElement(NS_LITERAL_STRING("defunct"));
aStates.AppendElement(u"defunct"_ns);
return;
}

Expand Down
7 changes: 3 additions & 4 deletions accessible/atk/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,10 @@ bool a11y::ShouldA11yBeEnabled() {
nsCOMPtr<nsIGSettingsCollection> a11y_settings;

if (gsettings) {
gsettings->GetCollectionForSchema(
NS_LITERAL_CSTRING(GSETINGS_A11Y_INTERFACE),
getter_AddRefs(a11y_settings));
gsettings->GetCollectionForSchema(nsLiteralCString(GSETINGS_A11Y_INTERFACE),
getter_AddRefs(a11y_settings));
if (a11y_settings) {
a11y_settings->GetBoolean(NS_LITERAL_CSTRING(GSETINGS_A11Y_KEY),
a11y_settings->GetBoolean(nsLiteralCString(GSETINGS_A11Y_KEY),
&sShouldEnable);
}
}
Expand Down
3 changes: 1 addition & 2 deletions accessible/base/ARIAMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1469,8 +1469,7 @@ bool AttrIterator::Next(nsAString& aAttrName, nsAString& aAttrValue) {
if (attr->NamespaceEquals(kNameSpaceID_None)) {
nsAtom* attrAtom = attr->Atom();
nsDependentAtomString attrStr(attrAtom);
if (!StringBeginsWith(attrStr, NS_LITERAL_STRING("aria-")))
continue; // Not ARIA
if (!StringBeginsWith(attrStr, u"aria-"_ns)) continue; // Not ARIA

uint8_t attrFlags = aria::AttrCharacteristicsFor(attrAtom);
if (attrFlags & ATTR_BYPASSOBJ)
Expand Down
9 changes: 4 additions & 5 deletions accessible/base/DocManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,15 @@ void DocManager::AddListeners(Document* aDocument,
nsPIDOMWindowOuter* window = aDocument->GetWindow();
EventTarget* target = window->GetChromeEventHandler();
EventListenerManager* elm = target->GetOrCreateListenerManager();
elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, u"pagehide"_ns, TrustedEventsAtCapture());

#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDocCreate))
logging::Text("added 'pagehide' listener");
#endif

if (aAddDOMContentLoadedListener) {
elm->AddEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
elm->AddEventListenerByType(this, u"DOMContentLoaded"_ns,
TrustedEventsAtCapture());
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDocCreate))
Expand All @@ -413,10 +412,10 @@ void DocManager::RemoveListeners(Document* aDocument) {
if (!target) return;

EventListenerManager* elm = target->GetOrCreateListenerManager();
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
elm->RemoveEventListenerByType(this, u"pagehide"_ns,
TrustedEventsAtCapture());

elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
elm->RemoveEventListenerByType(this, u"DOMContentLoaded"_ns,
TrustedEventsAtCapture());
}

Expand Down
3 changes: 1 addition & 2 deletions accessible/base/MarkupMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ MARKUPMAP(
nsAutoString displayValue;
StyleInfo styleInfo(aElement);
styleInfo.Display(displayValue);
if (displayValue != NS_LITERAL_STRING("block") &&
displayValue != NS_LITERAL_STRING("inline-block")) {
if (displayValue != u"block"_ns && displayValue != u"inline-block"_ns) {
return nullptr;
}
// Check for various conditions to determine if this is a block
Expand Down
25 changes: 9 additions & 16 deletions accessible/base/TextAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,19 @@ void TextAttrsMgr::InvalidTextAttr::ExposeValue(
nsIPersistentProperties* aAttributes, const uint32_t& aValue) {
switch (aValue) {
case eFalse:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid,
NS_LITERAL_STRING("false"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid, u"false"_ns);
break;

case eGrammar:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid,
NS_LITERAL_STRING("grammar"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid, u"grammar"_ns);
break;

case eSpelling:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid,
NS_LITERAL_STRING("spelling"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid, u"spelling"_ns);
break;

case eTrue:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid,
NS_LITERAL_STRING("true"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::invalid, u"true"_ns);
break;
}
}
Expand Down Expand Up @@ -592,9 +588,8 @@ bool TextAttrsMgr::AutoGeneratedTextAttr::GetValueFor(Accessible* aAccessible,

void TextAttrsMgr::AutoGeneratedTextAttr::ExposeValue(
nsIPersistentProperties* aAttributes, const bool& aValue) {
nsAccUtils::SetAccAttr(
aAttributes, nsGkAtoms::auto_generated,
aValue ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::auto_generated,
aValue ? u"true"_ns : u"false"_ns);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -697,17 +692,15 @@ void TextAttrsMgr::TextPosTextAttr::ExposeValue(
switch (aValue) {
case eTextPosBaseline:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textPosition,
NS_LITERAL_STRING("baseline"));
u"baseline"_ns);
break;

case eTextPosSub:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textPosition,
NS_LITERAL_STRING("sub"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textPosition, u"sub"_ns);
break;

case eTextPosSuper:
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textPosition,
NS_LITERAL_STRING("super"));
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textPosition, u"super"_ns);
break;

case eTextPosNone:
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/XULMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ XULMAP_TYPE(toolbarbutton, XULToolbarButtonAccessible)
XULMAP_TYPE(tooltip, XULTooltipAccessible)

XULMAP(label, [](Element* aElement, Accessible* aContext) -> Accessible* {
if (aElement->ClassList()->Contains(NS_LITERAL_STRING("text-link"))) {
if (aElement->ClassList()->Contains(u"text-link"_ns)) {
return new XULLinkAccessible(aElement, aContext->Document());
}
return new XULLabelAccessible(aElement, aContext->Document());
Expand Down
7 changes: 3 additions & 4 deletions accessible/base/nsAccUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ void nsAccUtils::SetLiveContainerAttributes(
if (ancestor->IsElement() && ancestor->AsElement()->AttrValueIs(
kNameSpaceID_None, nsGkAtoms::aria_atomic,
nsGkAtoms::_true, eCaseMatters)) {
SetAccAttr(aAttributes, nsGkAtoms::containerAtomic,
NS_LITERAL_STRING("true"));
SetAccAttr(aAttributes, nsGkAtoms::containerAtomic, u"true"_ns);
}

// container-busy attribute
Expand Down Expand Up @@ -357,10 +356,10 @@ nsIntPoint nsAccUtils::GetScreenCoordsForParent(Accessible* aAccessible) {
bool nsAccUtils::GetLiveAttrValue(uint32_t aRule, nsAString& aValue) {
switch (aRule) {
case eOffLiveAttr:
aValue = NS_LITERAL_STRING("off");
aValue = u"off"_ns;
return true;
case ePoliteLiveAttr:
aValue = NS_LITERAL_STRING("polite");
aValue = u"polite"_ns;
return true;
}

Expand Down
Loading

0 comments on commit fbd56b0

Please sign in to comment.