diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-24 16:16:49 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-25 13:11:17 +0000 |
commit | ab1faaa7f81b7dafe03d546341c6a643a58b3678 (patch) | |
tree | 76278cedc2e5787b4a5b814cf1150efe3038c435 /xfa/fde/css/cfde_cssselector.cpp | |
parent | ef002c85521278e3082517297cf60372d7751cb1 (diff) | |
download | pdfium-ab1faaa7f81b7dafe03d546341c6a643a58b3678.tar.xz |
Use fx_extension.h utilities in more places in xfa/
Change-Id: Id58c313aa446ecfa223e5c8edc095586b62a61fa
Reviewed-on: https://pdfium-review.googlesource.com/4455
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssselector.cpp')
-rw-r--r-- | xfa/fde/css/cfde_cssselector.cpp | 14 |
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); |