summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_formfill.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-21 21:09:54 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-21 21:09:54 +0000
commitc3cc2ab66d3d8f52dea8083abb6775115e17af7d (patch)
tree227eb764e7ee1f674f9ac992ec6620e4e57e2b01 /fpdfsdk/fpdf_formfill.cpp
parentaaaf9877478d7add8a74b4db74d97ca19ce1c47e (diff)
downloadpdfium-c3cc2ab66d3d8f52dea8083abb6775115e17af7d.tar.xz
Clean up constant values for JS alert and beep
Define constant values in the public API for the valid values of alert button type, alert icon type, and beep type. Replace various magic numbers through out the code base using these values. Also replace the XFA specific versions with an enum class that is guaranteed to have the same values, instead of #defines that just happen to. This CL does not attempt to add error checking on these values, since it currently doesn't exist so adding it may cause regressions. Change-Id: Ief3aee2a4ad419691c18fc1dba8b984ad222141b Reviewed-on: https://pdfium-review.googlesource.com/35730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_formfill.cpp')
-rw-r--r--fpdfsdk/fpdf_formfill.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 01bea1cf0a..792ced773f 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -33,6 +33,51 @@
#include "xfa/fxfa/cxfa_ffpageview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
+static_assert(static_cast<int>(AlertButton::kDefault) ==
+ JSPLATFORM_ALERT_BUTTON_DEFAULT,
+ "Default alert button types must match");
+static_assert(static_cast<int>(AlertButton::kOK) == JSPLATFORM_ALERT_BUTTON_OK,
+ "OK alert button types must match");
+static_assert(static_cast<int>(AlertButton::kOKCancel) ==
+ JSPLATFORM_ALERT_BUTTON_OKCANCEL,
+ "OKCancel alert button types must match");
+static_assert(static_cast<int>(AlertButton::kYesNo) ==
+ JSPLATFORM_ALERT_BUTTON_YESNO,
+ "YesNo alert button types must match");
+static_assert(static_cast<int>(AlertButton::kYesNoCancel) ==
+ JSPLATFORM_ALERT_BUTTON_YESNOCANCEL,
+ "YesNoCancel alert button types must match");
+
+static_assert(static_cast<int>(AlertIcon::kDefault) ==
+ JSPLATFORM_ALERT_ICON_DEFAULT,
+ "Default alert icon types must match");
+static_assert(static_cast<int>(AlertIcon::kError) ==
+ JSPLATFORM_ALERT_ICON_ERROR,
+ "Error alert icon types must match");
+static_assert(static_cast<int>(AlertIcon::kWarning) ==
+ JSPLATFORM_ALERT_ICON_WARNING,
+ "Warning alert icon types must match");
+static_assert(static_cast<int>(AlertIcon::kQuestion) ==
+ JSPLATFORM_ALERT_ICON_QUESTION,
+ "Question alert icon types must match");
+static_assert(static_cast<int>(AlertIcon::kStatus) ==
+ JSPLATFORM_ALERT_ICON_STATUS,
+ "Status alert icon types must match");
+static_assert(static_cast<int>(AlertIcon::kAsterisk) ==
+ JSPLATFORM_ALERT_ICON_ASTERISK,
+ "Asterisk alert icon types must match");
+
+static_assert(static_cast<int>(AlertReturn::kOK) == JSPLATFORM_ALERT_RETURN_OK,
+ "OK alert return types must match");
+static_assert(static_cast<int>(AlertReturn::kCancel) ==
+ JSPLATFORM_ALERT_RETURN_CANCEL,
+ "Cancel alert return types must match");
+static_assert(static_cast<int>(AlertReturn::kNo) == JSPLATFORM_ALERT_RETURN_NO,
+ "No alert return types must match");
+static_assert(static_cast<int>(AlertReturn::kYes) ==
+ JSPLATFORM_ALERT_RETURN_YES,
+ "Yes alert return types must match");
+
static_assert(static_cast<int>(FormType::kNone) == FORMTYPE_NONE,
"None form types must match");
static_assert(static_cast<int>(FormType::kAcroForm) == FORMTYPE_ACRO_FORM,