зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
aaedb8e230
Коммит
66b4b70e4d
|
@ -7,7 +7,6 @@
|
||||||
#ifndef DOM_SVG_SVGDATAPARSER_H_
|
#ifndef DOM_SVG_SVGDATAPARSER_H_
|
||||||
#define DOM_SVG_SVGDATAPARSER_H_
|
#define DOM_SVG_SVGDATAPARSER_H_
|
||||||
|
|
||||||
#include <cctype>
|
|
||||||
#include "mozilla/RangedPtr.h"
|
#include "mozilla/RangedPtr.h"
|
||||||
#include "nsStringFwd.h"
|
#include "nsStringFwd.h"
|
||||||
|
|
||||||
|
@ -22,11 +21,6 @@ class SVGDataParser {
|
||||||
explicit SVGDataParser(const nsAString& aValue);
|
explicit SVGDataParser(const nsAString& aValue);
|
||||||
|
|
||||||
protected:
|
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.
|
// Returns true if there are more characters to read, false otherwise.
|
||||||
bool SkipCommaWsp();
|
bool SkipCommaWsp();
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ bool SVGPathDataParser::ParseMoveto() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ bool SVGPathDataParser::ParseLineto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ bool SVGPathDataParser::ParseHorizontalLineto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ bool SVGPathDataParser::ParseVerticalLineto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ bool SVGPathDataParser::ParseCurveto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ bool SVGPathDataParser::ParseSmoothCurveto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ bool SVGPathDataParser::ParseQuadBezierCurveto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// Start of a new command
|
// Start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ bool SVGPathDataParser::ParseSmoothQuadBezierCurveto(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ bool SVGPathDataParser::ParseEllipticalArc(bool aAbsCoords) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SkipWsp() || IsAlpha(*mIter)) {
|
if (!SkipWsp() || IsAsciiAlpha(*mIter)) {
|
||||||
// End of data, or start of a new command
|
// End of data, or start of a new command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool SVGTransformListParser::ParseTransforms() {
|
||||||
|
|
||||||
bool SVGTransformListParser::ParseTransform() {
|
bool SVGTransformListParser::ParseTransform() {
|
||||||
RangedPtr<const char16_t> start(mIter);
|
RangedPtr<const char16_t> start(mIter);
|
||||||
while (IsAlpha(*mIter)) {
|
while (IsAsciiAlpha(*mIter)) {
|
||||||
++mIter;
|
++mIter;
|
||||||
if (mIter == mEnd) {
|
if (mIter == mEnd) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче