Move TEXTPOS_* from cpdf_formcontrol.h to cpdf_apsettings.h
Add comments explaining where CPDF_ApSettings returns one of these
values. Stop short of making this an enum class since the current
code tolerates out of range values.
Change-Id: Ibc8605e65249874acf97937995e64511e051fc6f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/59214
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfdoc/cpdf_apsettings.h b/core/fpdfdoc/cpdf_apsettings.h
index d7a6eda..2a16336 100644
--- a/core/fpdfdoc/cpdf_apsettings.h
+++ b/core/fpdfdoc/cpdf_apsettings.h
@@ -17,6 +17,15 @@
class CPDF_FormControl;
class CPDF_Stream;
+// Corresponds to PDF spec section 12.5.6.19 (Widget annotation TP dictionary).
+#define TEXTPOS_CAPTION 0
+#define TEXTPOS_ICON 1
+#define TEXTPOS_BELOW 2
+#define TEXTPOS_ABOVE 3
+#define TEXTPOS_RIGHT 4
+#define TEXTPOS_LEFT 5
+#define TEXTPOS_OVERLAID 6
+
class CPDF_ApSettings {
public:
explicit CPDF_ApSettings(CPDF_Dictionary* pDict);
@@ -57,6 +66,8 @@
CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); }
CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); }
CPDF_IconFit GetIconFit() const;
+
+ // Returns one of the TEXTPOS_* values above.
int GetTextPosition() const;
FX_ARGB GetColor(int& iColorType, const ByteString& csEntry) const;
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index 8c02d46..d8e5e8c 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -22,14 +22,6 @@
#include "core/fxge/fx_dib.h"
#include "third_party/base/optional.h"
-#define TEXTPOS_CAPTION 0
-#define TEXTPOS_ICON 1
-#define TEXTPOS_BELOW 2
-#define TEXTPOS_ABOVE 3
-#define TEXTPOS_RIGHT 4
-#define TEXTPOS_LEFT 5
-#define TEXTPOS_OVERLAID 6
-
class CFX_RenderDevice;
class CPDF_Dictionary;
class CPDF_Font;