Move CPWL_AppStream to CPDFSDK_AppStream.

No other fpdfsdk/pwl files use cpwl_appstream.h, but cpwl_appstream.cpp
contains many circular includes to the top-level fpdfsdk/ layer.
Since CPWL_AppStream is only used by this top-level layer, putting
it here makes dependencies saner.

Change-Id: I3cd6f8f823fd9e316e885f69a2afe51283f2f88e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/58612
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/BUILD.gn b/fpdfsdk/BUILD.gn
index a8c7ec4..62df18b 100644
--- a/fpdfsdk/BUILD.gn
+++ b/fpdfsdk/BUILD.gn
@@ -22,6 +22,8 @@
     "cpdfsdk_annotiteration.h",
     "cpdfsdk_annotiterator.cpp",
     "cpdfsdk_annotiterator.h",
+    "cpdfsdk_appstream.cpp",
+    "cpdfsdk_appstream.h",
     "cpdfsdk_baannot.cpp",
     "cpdfsdk_baannot.h",
     "cpdfsdk_baannothandler.cpp",
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp
similarity index 98%
rename from fpdfsdk/pwl/cpwl_appstream.cpp
rename to fpdfsdk/cpdfsdk_appstream.cpp
index eeac642..2a12c11 100644
--- a/fpdfsdk/pwl/cpwl_appstream.cpp
+++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -4,7 +4,7 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "fpdfsdk/pwl/cpwl_appstream.h"
+#include "fpdfsdk/cpdfsdk_appstream.h"
 
 #include <utility>
 
@@ -1117,12 +1117,13 @@
 
 }  // namespace
 
-CPWL_AppStream::CPWL_AppStream(CPDFSDK_Widget* widget, CPDF_Dictionary* dict)
+CPDFSDK_AppStream::CPDFSDK_AppStream(CPDFSDK_Widget* widget,
+                                     CPDF_Dictionary* dict)
     : widget_(widget), dict_(dict) {}
 
-CPWL_AppStream::~CPWL_AppStream() {}
+CPDFSDK_AppStream::~CPDFSDK_AppStream() {}
 
-void CPWL_AppStream::SetAsPushButton() {
+void CPDFSDK_AppStream::SetAsPushButton() {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CFX_FloatRect rcWindow = widget_->GetRotatedRect();
   ButtonStyle nLayout = ButtonStyle::kLabel;
@@ -1310,7 +1311,7 @@
   }
 }
 
-void CPWL_AppStream::SetAsCheckBox() {
+void CPDFSDK_AppStream::SetAsCheckBox() {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CFX_Color crBackground, crBorder, crText;
   int iColorType;
@@ -1425,7 +1426,7 @@
     widget_->SetAppState("Off");
 }
 
-void CPWL_AppStream::SetAsRadioButton() {
+void CPDFSDK_AppStream::SetAsRadioButton() {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CFX_Color crBackground;
   CFX_Color crBorder;
@@ -1578,7 +1579,7 @@
     widget_->SetAppState("Off");
 }
 
-void CPWL_AppStream::SetAsComboBox(Optional<WideString> sValue) {
+void CPDFSDK_AppStream::SetAsComboBox(Optional<WideString> sValue) {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CPDF_FormField* pField = pControl->GetField();
   std::ostringstream sBody;
@@ -1648,7 +1649,7 @@
         ByteString());
 }
 
-void CPWL_AppStream::SetAsListBox() {
+void CPDFSDK_AppStream::SetAsListBox() {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CPDF_FormField* pField = pControl->GetField();
   CFX_FloatRect rcClient = widget_->GetClientRect();
@@ -1732,7 +1733,7 @@
         ByteString());
 }
 
-void CPWL_AppStream::SetAsTextField(Optional<WideString> sValue) {
+void CPDFSDK_AppStream::SetAsTextField(Optional<WideString> sValue) {
   CPDF_FormControl* pControl = widget_->GetFormControl();
   CPDF_FormField* pField = pControl->GetField();
   std::ostringstream sBody;
@@ -1880,7 +1881,8 @@
         ByteString());
 }
 
-void CPWL_AppStream::AddImage(const ByteString& sAPType, CPDF_Stream* pImage) {
+void CPDFSDK_AppStream::AddImage(const ByteString& sAPType,
+                                 CPDF_Stream* pImage) {
   CPDF_Stream* pStream = dict_->GetStreamFor(sAPType);
   CPDF_Dictionary* pStreamDict = pStream->GetDict();
   ByteString sImageAlias = "IMG";
@@ -1902,9 +1904,9 @@
                                       pImage->GetObjNum());
 }
 
-void CPWL_AppStream::Write(const ByteString& sAPType,
-                           const ByteString& sContents,
-                           const ByteString& sAPState) {
+void CPDFSDK_AppStream::Write(const ByteString& sAPType,
+                              const ByteString& sContents,
+                              const ByteString& sAPState) {
   CPDF_Stream* pStream = nullptr;
   CPDF_Dictionary* pParentDict = nullptr;
   if (sAPState.IsEmpty()) {
@@ -1940,11 +1942,11 @@
   pStream->SetDataAndRemoveFilter(sContents.raw_span());
 }
 
-void CPWL_AppStream::Remove(const ByteString& sAPType) {
+void CPDFSDK_AppStream::Remove(const ByteString& sAPType) {
   dict_->RemoveFor(sAPType);
 }
 
-ByteString CPWL_AppStream::GetBackgroundAppStream() const {
+ByteString CPDFSDK_AppStream::GetBackgroundAppStream() const {
   CFX_Color crBackground = widget_->GetFillPWLColor();
   if (crBackground.nColorType != CFX_Color::kTransparent)
     return GetRectFillAppStream(widget_->GetRotatedRect(), crBackground);
@@ -1952,7 +1954,7 @@
   return ByteString();
 }
 
-ByteString CPWL_AppStream::GetBorderAppStream() const {
+ByteString CPDFSDK_AppStream::GetBorderAppStream() const {
   CFX_FloatRect rcWindow = widget_->GetRotatedRect();
   CFX_Color crBorder = widget_->GetBorderPWLColor();
   CFX_Color crBackground = widget_->GetFillPWLColor();
diff --git a/fpdfsdk/pwl/cpwl_appstream.h b/fpdfsdk/cpdfsdk_appstream.h
similarity index 81%
rename from fpdfsdk/pwl/cpwl_appstream.h
rename to fpdfsdk/cpdfsdk_appstream.h
index bf839cf..8a38a86 100644
--- a/fpdfsdk/pwl/cpwl_appstream.h
+++ b/fpdfsdk/cpdfsdk_appstream.h
@@ -4,8 +4,8 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#ifndef FPDFSDK_PWL_CPWL_APPSTREAM_H_
-#define FPDFSDK_PWL_CPWL_APPSTREAM_H_
+#ifndef FPDFSDK_CPDFSDK_APPSTREAM_H_
+#define FPDFSDK_CPDFSDK_APPSTREAM_H_
 
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/unowned_ptr.h"
@@ -15,10 +15,10 @@
 class CPDF_Dictionary;
 class CPDF_Stream;
 
-class CPWL_AppStream {
+class CPDFSDK_AppStream {
  public:
-  CPWL_AppStream(CPDFSDK_Widget* widget, CPDF_Dictionary* dict);
-  ~CPWL_AppStream();
+  CPDFSDK_AppStream(CPDFSDK_Widget* widget, CPDF_Dictionary* dict);
+  ~CPDFSDK_AppStream();
 
   void SetAsPushButton();
   void SetAsCheckBox();
@@ -41,4 +41,4 @@
   RetainPtr<CPDF_Dictionary> const dict_;
 };
 
-#endif  // FPDFSDK_PWL_CPWL_APPSTREAM_H_
+#endif  // FPDFSDK_CPDFSDK_APPSTREAM_H_
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 2eae13f..5ea5f03 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -26,10 +26,10 @@
 #include "core/fxge/cfx_pathdata.h"
 #include "core/fxge/cfx_renderdevice.h"
 #include "fpdfsdk/cpdfsdk_actionhandler.h"
+#include "fpdfsdk/cpdfsdk_appstream.h"
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
 #include "fpdfsdk/cpdfsdk_interactiveform.h"
 #include "fpdfsdk/cpdfsdk_pageview.h"
-#include "fpdfsdk/pwl/cpwl_appstream.h"
 #include "fpdfsdk/pwl/cpwl_edit.h"
 
 #ifdef PDF_ENABLE_XFA
@@ -605,7 +605,7 @@
   if (bValueChanged)
     m_nValueAge++;
 
-  CPWL_AppStream appStream(this, GetAPDict());
+  CPDFSDK_AppStream appStream(this, GetAPDict());
   switch (GetFieldType()) {
     case FormFieldType::kPushButton:
       appStream.SetAsPushButton();
diff --git a/fpdfsdk/pwl/BUILD.gn b/fpdfsdk/pwl/BUILD.gn
index 60dc957..a771aa5 100644
--- a/fpdfsdk/pwl/BUILD.gn
+++ b/fpdfsdk/pwl/BUILD.gn
@@ -8,8 +8,6 @@
 
 jumbo_source_set("pwl") {
   sources = [
-    "cpwl_appstream.cpp",
-    "cpwl_appstream.h",
     "cpwl_button.cpp",
     "cpwl_button.h",
     "cpwl_caret.cpp",
diff --git a/fpdfsdk/pwl/README.md b/fpdfsdk/pwl/README.md
index 1a73250..d9be3b1 100644
--- a/fpdfsdk/pwl/README.md
+++ b/fpdfsdk/pwl/README.md
@@ -17,5 +17,5 @@
     * CPWL_ScrollBar
 
 Widgets are rendered to Appearance Streams, with the case all centralized in
-CPWL_AppStream.
+CPDFSDK_AppStream.