Move HasXFAField out from XFA feature flag

Moves the PDFium API method FPDF_HasXFAField out from behind the XFA feature
flag so that XFA metrics can be generated without enabling the entire
feature. Changes some of the constant names to be more accurate.

BUG=pdfium:917

Change-Id: I6d8fe9fd88d392d028de2504d39d978de4a1d5b7
Reviewed-on: https://pdfium-review.googlesource.com/15990
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index af1d0db..47a92f1 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -39,6 +39,7 @@
 #include "fpdfsdk/javascript/ijs_runtime.h"
 #include "public/fpdf_edit.h"
 #include "public/fpdf_ext.h"
+#include "public/fpdf_formfill.h"
 #include "public/fpdf_progressive.h"
 #include "third_party/base/allocator/partition_allocator/partition_alloc.h"
 #include "third_party/base/numerics/safe_conversions_impl.h"
@@ -49,7 +50,6 @@
 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
 #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
 #include "fxbarcode/BC_Library.h"
-#include "public/fpdf_formfill.h"
 #endif  // PDF_ENABLE_XFA
 
 #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
@@ -565,14 +565,12 @@
       password);
 }
 
-#ifdef PDF_ENABLE_XFA
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_HasXFAField(FPDF_DOCUMENT document,
                                                      int* docType) {
   if (!document)
     return false;
 
-  const CPDF_Document* pDoc =
-      static_cast<CPDFXFA_Context*>(document)->GetPDFDoc();
+  const CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
   if (!pDoc)
     return false;
 
@@ -593,6 +591,7 @@
   return true;
 }
 
+#ifdef PDF_ENABLE_XFA
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document) {
   return document && static_cast<CPDFXFA_Context*>(document)->LoadXFADoc();
 }
diff --git a/fpdfsdk/fpdfview_c_api_test.c b/fpdfsdk/fpdfview_c_api_test.c
index 996f48a..211d7e0 100644
--- a/fpdfsdk/fpdfview_c_api_test.c
+++ b/fpdfsdk/fpdfview_c_api_test.c
@@ -206,8 +206,8 @@
     CHK(FPDF_SetFormFieldHighlightAlpha);
     CHK(FPDF_RemoveFormFieldHighlight);
     CHK(FPDF_FFLDraw);
-#ifdef PDF_ENABLE_XFA
     CHK(FPDF_HasXFAField);
+#ifdef PDF_ENABLE_XFA
     CHK(FPDF_LoadXFA);
     CHK(FPDF_Widget_Undo);
     CHK(FPDF_Widget_Redo);
diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h
index bf385b3..e4194fed 100644
--- a/public/fpdf_formfill.h
+++ b/public/fpdf_formfill.h
@@ -12,11 +12,9 @@
 
 typedef void* FPDF_FORMHANDLE;
 
-#ifdef PDF_ENABLE_XFA
 #define DOCTYPE_PDF 0          // Normal pdf Document
-#define DOCTYPE_DYNAMIC_XFA 1  // Dynamic xfa Document Type
-#define DOCTYPE_STATIC_XFA 2   // Static xfa Document Type
-#endif  // PDF_ENABLE_XFA
+#define DOCTYPE_DYNAMIC_XFA 1  // Dynamic XFA Document Type
+#define DOCTYPE_STATIC_XFA 2   // Static XFA Document Type
 
 // Exported Functions
 #ifdef __cplusplus
@@ -1607,7 +1605,6 @@
                                               int flags);
 #endif
 
-#ifdef PDF_ENABLE_XFA
 /**
  * Function: FPDF_HasXFAField
  *                      This method is designed to check whether a pdf document
@@ -1624,6 +1621,7 @@
 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_HasXFAField(FPDF_DOCUMENT document,
                                                      int* docType);
 
+#ifdef PDF_ENABLE_XFA
 /**
  * Function: FPDF_LoadXFA
  *          If the document consists of XFA fields, there should call this