summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_cssselector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/css/cfde_cssselector.cpp')
-rw-r--r--xfa/fde/css/cfde_cssselector.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp
index 6842d58738..c1e9f7f22a 100644
--- a/xfa/fde/css/cfde_cssselector.cpp
+++ b/xfa/fde/css/cfde_cssselector.cpp
@@ -8,24 +8,18 @@
#include <utility>
+#include "core/fxcrt/fx_extension.h"
#include "third_party/base/ptr_util.h"
namespace {
-bool IsCSSChar(wchar_t wch) {
- return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z');
-}
-
int32_t GetCSSNameLen(const wchar_t* psz, const wchar_t* pEnd) {
const wchar_t* pStart = psz;
while (psz < pEnd) {
wchar_t wch = *psz;
- if (IsCSSChar(wch) || (wch >= '0' && wch <= '9') || wch == '_' ||
- wch == '-') {
- ++psz;
- } else {
+ if (!FXSYS_iswalnum(wch) && wch != '_' && wch != '-')
break;
- }
+ ++psz;
}
return psz - pStart;
}
@@ -73,7 +67,7 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString(
std::unique_ptr<CFDE_CSSSelector> pFirst = nullptr;
for (psz = pStart; psz < pEnd;) {
wchar_t wch = *psz;
- if (IsCSSChar(wch) || wch == '*') {
+ if (FXSYS_iswalpha(wch) || wch == '*') {
int32_t iNameLen = wch == '*' ? 1 : GetCSSNameLen(psz, pEnd);
auto p = pdfium::MakeUnique<CFDE_CSSSelector>(
FDE_CSSSelectorType::Element, psz, iNameLen, true);