summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfformfill.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-16 16:06:45 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-16 16:06:45 +0000
commit2056fac754e679baea695390854fe7b0ce7acb28 (patch)
treeb0f2b982ac2ea9d4206ecd9703eb439ad524cb32 /fpdfsdk/fpdfformfill.cpp
parentd3427164e7869ee9c22fcb843ab619b247cbed72 (diff)
downloadpdfium-2056fac754e679baea695390854fe7b0ce7acb28.tar.xz
Add support for XFA specific FormField types
This adds to form field types specific types for XFA form fields to be used instead of the generic XFA value when possible. BUG=pdfium:952,chromium:763129,chromium:592758 Change-Id: I8d1cff6a280d71db348b7c31a251cbe2e398ec79 Reviewed-on: https://pdfium-review.googlesource.com/22677 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfformfill.cpp')
-rw-r--r--fpdfsdk/fpdfformfill.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index cc2861f7f2..10aecb3fde 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -71,6 +71,27 @@ static_assert(static_cast<int>(FormFieldType::kSignature) ==
#ifdef PDF_ENABLE_XFA
static_assert(static_cast<int>(FormFieldType::kXFA) == FPDF_FORMFIELD_XFA,
"XFA form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_CheckBox) ==
+ FPDF_FORMFIELD_XFA_CHECKBOX,
+ "XFA CheckBox form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_ComboBox) ==
+ FPDF_FORMFIELD_XFA_COMBOBOX,
+ "XFA ComboBox form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_ImageField) ==
+ FPDF_FORMFIELD_XFA_IMAGEFIELD,
+ "XFA ImageField form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_ListBox) ==
+ FPDF_FORMFIELD_XFA_LISTBOX,
+ "XFA ListBox form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_PushButton) ==
+ FPDF_FORMFIELD_XFA_PUSHBUTTON,
+ "XFA PushButton form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_Signature) ==
+ FPDF_FORMFIELD_XFA_SIGNATURE,
+ "XFA Signature form field types must match");
+static_assert(static_cast<int>(FormFieldType::kXFA_TextField) ==
+ FPDF_FORMFIELD_XFA_TEXTFIELD,
+ "XFA TextField form field types must match");
#endif // PDF_ENABLE_XFA
static_assert(kFormFieldTypeCount == FPDF_FORMFIELD_COUNT,
"Number of form field types must match");
@@ -238,7 +259,7 @@ FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
rcWidget.Inflate(1.0f, 1.0f);
if (rcWidget.Contains(CFX_PointF(static_cast<float>(page_x),
static_cast<float>(page_y)))) {
- return static_cast<int>(FormFieldType::kXFA);
+ return static_cast<int>(pXFAAnnot->GetFormFieldType());
}
}
#endif // PDF_ENABLE_XFA
@@ -698,7 +719,7 @@ FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle,
return;
Optional<FormFieldType> cast_input = IntToFormFieldType(fieldType);
- if (!cast_input.has_value())
+ if (!cast_input)
return;
if (cast_input.value() == FormFieldType::kUnknown) {