Tidy FFLCommon()

The polymorphic IPDF_Page::GetDocument() allows getting the document
without special cases. The subsequent retrieval of the page view
via the helper function is equivalent to the inline code in the other
branch of the ifdef.

Change-Id: I8c7008c18610e11e7dcc4151fa7369cfc3625049
Reviewed-on: https://pdfium-review.googlesource.com/35070
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index cd4a8c5..01bea1c 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -110,8 +110,8 @@
 }
 
 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
-                                       FPDF_PAGE page) {
-  IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+                                       FPDF_PAGE fpdf_page) {
+  IPDF_Page* pPage = IPDFPageFromFPDFPage(fpdf_page);
   if (!pPage)
     return nullptr;
 
@@ -123,7 +123,7 @@
 void FFLCommon(FPDF_FORMHANDLE hHandle,
                FPDF_BITMAP bitmap,
                FPDF_RECORDER recorder,
-               FPDF_PAGE page,
+               FPDF_PAGE fpdf_page,
                int start_x,
                int start_y,
                int size_x,
@@ -133,25 +133,12 @@
   if (!hHandle)
     return;
 
-  IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+  IPDF_Page* pPage = IPDFPageFromFPDFPage(fpdf_page);
   if (!pPage)
     return;
 
-#ifdef PDF_ENABLE_XFA
-  CPDF_Document::Extension* pExtension =
-      pPage->AsXFAPage()->GetDocumentExtension();
-  if (!pExtension)
-    return;
-  CPDF_Document* pPDFDoc = pExtension->GetPDFDoc();
-  if (!pPDFDoc)
-    return;
-  CPDFSDK_FormFillEnvironment* pFormFillEnv =
-      HandleToCPDFSDKEnvironment(hHandle);
-  if (!pFormFillEnv)
-    return;
-#else   // PDF_ENABLE_XFA
   CPDF_Document* pPDFDoc = pPage->GetDocument();
-#endif  // PDF_ENABLE_XFA
+  CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, fpdf_page);
 
   const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
   CFX_Matrix matrix = pPage->GetDisplayMatrix(rect, rotate);
@@ -160,6 +147,7 @@
 #ifdef _SKIA_SUPPORT_
   pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
 #endif
+
   RetainPtr<CFX_DIBitmap> holder(CFXDIBitmapFromFPDFBitmap(bitmap));
   pDevice->Attach(holder, false, nullptr, false);
   {
@@ -182,16 +170,10 @@
     options.SetOCContext(
         pdfium::MakeRetain<CPDF_OCContext>(pPDFDoc, CPDF_OCContext::View));
 
-#ifdef PDF_ENABLE_XFA
-    CPDFSDK_PageView* pPageView = pFormFillEnv->GetPageView(pPage, true);
-#else   // PDF_ENABLE_XFA
-    CPDFSDK_PageView* pPageView =
-        FormHandleToPageView(hHandle, FPDFPageFromIPDFPage(pPage));
-#endif  // PDF_ENABLE_XFA
-
     if (pPageView)
       pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, rect);
   }
+
 #ifdef _SKIA_SUPPORT_PATHS_
   pDevice->Flush(true);
   holder->UnPreMultiply();