Bug 1878356: Remove nbsp trimming from acc names, r=Jamie

This revision reverts the changes that trimmed non-breaking spaces from the
start and end of accessible names. The web platform group has decided that
those tests weren't valid as-is; the correct behavior is not to trim those
characters. This revision also removes expected-fail designations from
affected tests.

Differential Revision: https://phabricator.services.mozilla.com/D208687
This commit is contained in:
Nathan LaPre 2024-04-30 00:35:45 +00:00
Родитель d9830b1739
Коммит 9d751c3283
4 изменённых файлов: 0 добавлений и 47 удалений

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

@ -547,32 +547,6 @@ bool nsCoreUtils::IsWhitespaceString(const nsAString& aString) {
return iterBegin == iterEnd; return iterBegin == iterEnd;
} }
void nsCoreUtils::TrimNonBreakingSpaces(nsAString& aString) {
if (aString.IsEmpty()) {
return;
}
// Find the index past the last nbsp prefix character.
constexpr char16_t nbsp{0xA0};
size_t startIndex = 0;
while (aString.CharAt(startIndex) == nbsp) {
startIndex++;
}
// Find the index before the first nbsp suffix character.
size_t endIndex = aString.Length() - 1;
while (endIndex > startIndex && aString.CharAt(endIndex) == nbsp) {
endIndex--;
}
if (startIndex > endIndex) {
aString.Truncate();
return;
}
// Trim the string down, removing the non-breaking space characters.
aString = Substring(aString, startIndex, endIndex - startIndex + 1);
}
bool nsCoreUtils::AccEventObserversExist() { bool nsCoreUtils::AccEventObserversExist() {
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService(); nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
NS_ENSURE_TRUE(obsService, false); NS_ENSURE_TRUE(obsService, false);

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

@ -307,11 +307,6 @@ class nsCoreUtils {
aChar == 0xa0; aChar == 0xa0;
} }
/**
* Remove non-breaking spaces from the beginning and end of the string.
*/
static void TrimNonBreakingSpaces(nsAString& aString);
/* /*
* Return true if there are any observers of accessible events. * Return true if there are any observers of accessible events.
*/ */

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

@ -127,7 +127,6 @@ ENameValueFlag LocalAccessible::Name(nsString& aName) const {
if (!aName.IsEmpty()) return eNameOK; if (!aName.IsEmpty()) return eNameOK;
ENameValueFlag nameFlag = NativeName(aName); ENameValueFlag nameFlag = NativeName(aName);
nsCoreUtils::TrimNonBreakingSpaces(aName);
if (!aName.IsEmpty()) return nameFlag; if (!aName.IsEmpty()) return nameFlag;
// In the end get the name from tooltip. // In the end get the name from tooltip.

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

@ -1,15 +0,0 @@
[comp_text_node.html]
[span[role=button\] with text node, with leading/trailing non-breaking space]
expected: FAIL
[div[role=heading\] with text node, with leading/trailing non-breaking space]
expected: FAIL
[button with text node, with leading/trailing non-breaking space]
expected: FAIL
[heading with text node, with leading/trailing non-breaking space]
expected: FAIL
[link with text node, with leading/trailing non-breaking space]
expected: FAIL