summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_formfield.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-03-28 20:00:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-28 20:00:35 +0000
commit53a8093c6ef694ec520fe0b087fbac86af97f5e8 (patch)
tree519a805d66eed415e310eb67a05212c6d217025d /core/fpdfdoc/cpdf_formfield.cpp
parent971a674ef17526ad37ce55ba90110830b94889d0 (diff)
downloadpdfium-53a8093c6ef694ec520fe0b087fbac86af97f5e8.tar.xz
Use CPDF_DefaultAppearance instead of custom parsing
This CL moves code over to using CPDF_DefaultAppearance instead of calling the CPDF_SimpleParser directly. This means the code for finding a specific tag start can move into CPDF_DefaultAppearance directly. Change-Id: I1dc64e54aedd03d059b963121d466f3eb75c17db Reviewed-on: https://pdfium-review.googlesource.com/28410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_formfield.cpp')
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 679acd1dc8..f3dcac2228 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -15,9 +15,9 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_number.h"
-#include "core/fpdfapi/parser/cpdf_simple_parser.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
+#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fpdfdoc/cpdf_interform.h"
#include "core/fpdfdoc/cpvt_generateap.h"
@@ -914,15 +914,16 @@ void CPDF_FormField::LoadDA() {
if (!pFont)
return;
- CPDF_SimpleParser syntax(DA.AsStringView());
- syntax.FindTagParamFromStart("Tf", 2);
- ByteString font_name(syntax.GetWord());
+ CPDF_DefaultAppearance appearance(DA);
+ if (!appearance.HasFont())
+ return;
+
+ ByteString font_name = appearance.GetFont(&m_FontSize);
CPDF_Dictionary* pFontDict = pFont->GetDictFor(font_name);
if (!pFontDict)
return;
m_pFont = m_pForm->GetDocument()->LoadFont(pFontDict);
- m_FontSize = FX_atof(syntax.GetWord());
}
bool CPDF_FormField::NotifyBeforeSelectionChange(const WideString& value) {