Bug 1852867 - Replace call to isalpha in SVGDataParser::IsAlpha with a call to mozilla::IsAsciiAlpha r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D188071
This commit is contained in:
Robert Longson 2023-09-13 14:27:36 +00:00
Родитель aaedb8e230
Коммит 66b4b70e4d
3 изменённых файлов: 10 добавлений и 16 удалений

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

@ -7,7 +7,6 @@
#ifndef DOM_SVG_SVGDATAPARSER_H_
#define DOM_SVG_SVGDATAPARSER_H_
#include <cctype>
#include "mozilla/RangedPtr.h"
#include "nsStringFwd.h"
@ -22,11 +21,6 @@ class SVGDataParser {
explicit SVGDataParser(const nsAString& aValue);
protected:
static bool IsAlpha(char16_t aCh) {
// Exclude non-ascii characters before calling isalpha
return (aCh & 0x7f) == aCh && isalpha(aCh);
}
// Returns true if there are more characters to read, false otherwise.
bool SkipCommaWsp();

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

@ -130,7 +130,7 @@ bool SVGPathDataParser::ParseMoveto() {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -163,7 +163,7 @@ bool SVGPathDataParser::ParseLineto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -187,7 +187,7 @@ bool SVGPathDataParser::ParseHorizontalLineto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -211,7 +211,7 @@ bool SVGPathDataParser::ParseVerticalLineto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -236,7 +236,7 @@ bool SVGPathDataParser::ParseCurveto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -260,7 +260,7 @@ bool SVGPathDataParser::ParseSmoothCurveto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -284,7 +284,7 @@ bool SVGPathDataParser::ParseQuadBezierCurveto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// Start of a new command
return true;
}
@ -308,7 +308,7 @@ bool SVGPathDataParser::ParseSmoothQuadBezierCurveto(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}
@ -339,7 +339,7 @@ bool SVGPathDataParser::ParseEllipticalArc(bool aAbsCoords) {
return false;
}
if (!SkipWsp() || IsAlpha(*mIter)) {
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
// End of data, or start of a new command
return true;
}

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

@ -49,7 +49,7 @@ bool SVGTransformListParser::ParseTransforms() {
bool SVGTransformListParser::ParseTransform() {
RangedPtr<const char16_t> start(mIter);
while (IsAlpha(*mIter)) {
while (IsAsciiAlpha(*mIter)) {
++mIter;
if (mIter == mEnd) {
return false;