summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_ap.cpp
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-02-16 14:26:22 -0800
committerWei Li <weili@chromium.org>2016-02-16 14:26:22 -0800
commit970c11e2225d73234009ccdc6f656abd01ae4026 (patch)
treec184a4d3b62785ee5431cc2c6d7199103b78986f /core/src/fpdfdoc/doc_ap.cpp
parent4f7f4eea92b607ca3864df63e4b277abd5e5af97 (diff)
downloadpdfium-970c11e2225d73234009ccdc6f656abd01ae4026.tar.xz
Refactor CPDF_SimpleParser and add unit tests.
Remove unused member functions and simplify calls to find tag parameters. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1681403007 .
Diffstat (limited to 'core/src/fpdfdoc/doc_ap.cpp')
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index c84a36d499..b6134927cf 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -228,19 +228,16 @@ static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
}
static CPVT_Color ParseColor(const CFX_ByteString& str) {
CPDF_SimpleParser syntax(str);
- syntax.SetPos(0);
- if (syntax.FindTagParam("g", 1)) {
+ if (syntax.FindTagParamFromStart("g", 1)) {
return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord()));
}
- syntax.SetPos(0);
- if (syntax.FindTagParam("rg", 3)) {
+ if (syntax.FindTagParamFromStart("rg", 3)) {
FX_FLOAT f1 = FX_atof(syntax.GetWord());
FX_FLOAT f2 = FX_atof(syntax.GetWord());
FX_FLOAT f3 = FX_atof(syntax.GetWord());
return CPVT_Color(CPVT_Color::kRGB, f1, f2, f3);
}
- syntax.SetPos(0);
- if (syntax.FindTagParam("k", 4)) {
+ if (syntax.FindTagParamFromStart("k", 4)) {
FX_FLOAT f1 = FX_atof(syntax.GetWord());
FX_FLOAT f2 = FX_atof(syntax.GetWord());
FX_FLOAT f3 = FX_atof(syntax.GetWord());
@@ -288,7 +285,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
return FALSE;
}
CPDF_SimpleParser syntax(DA);
- syntax.FindTagParam("Tf", 2);
+ syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString sFontName = syntax.GetWord();
sFontName = PDF_NameDecode(sFontName);
if (sFontName.IsEmpty()) {