Fix naming for CPDF_FormField::Type enum.

The preferred Google C++ style is kFoo.

Change-Id: I167b147aab91245a4dfce1185008f0b412078260
Reviewed-on: https://pdfium-review.googlesource.com/c/43934
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 6ce14ed..06b578d 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -37,8 +37,8 @@
 }
 
 ByteString CPDF_FormControl::GetOnStateName() const {
-  ASSERT(GetType() == CPDF_FormField::CheckBox ||
-         GetType() == CPDF_FormField::RadioButton);
+  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+         GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn;
   CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
   if (!pAP)
@@ -56,11 +56,11 @@
 }
 
 ByteString CPDF_FormControl::GetCheckedAPState() const {
-  ASSERT(GetType() == CPDF_FormField::CheckBox ||
-         GetType() == CPDF_FormField::RadioButton);
+  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+         GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn = GetOnStateName();
-  if (GetType() == CPDF_FormField::RadioButton ||
-      GetType() == CPDF_FormField::CheckBox) {
+  if (GetType() == CPDF_FormField::kRadioButton ||
+      GetType() == CPDF_FormField::kCheckBox) {
     if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt")))
       csOn = ByteString::Format("%d", m_pField->GetControlIndex(this));
   }
@@ -70,11 +70,11 @@
 }
 
 WideString CPDF_FormControl::GetExportValue() const {
-  ASSERT(GetType() == CPDF_FormField::CheckBox ||
-         GetType() == CPDF_FormField::RadioButton);
+  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+         GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn = GetOnStateName();
-  if (GetType() == CPDF_FormField::RadioButton ||
-      GetType() == CPDF_FormField::CheckBox) {
+  if (GetType() == CPDF_FormField::kRadioButton ||
+      GetType() == CPDF_FormField::kCheckBox) {
     if (CPDF_Array* pArray =
             ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt"))) {
       int iIndex = m_pField->GetControlIndex(this);
@@ -87,16 +87,16 @@
 }
 
 bool CPDF_FormControl::IsChecked() const {
-  ASSERT(GetType() == CPDF_FormField::CheckBox ||
-         GetType() == CPDF_FormField::RadioButton);
+  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+         GetType() == CPDF_FormField::kRadioButton);
   ByteString csOn = GetOnStateName();
   ByteString csAS = m_pWidgetDict->GetStringFor("AS");
   return csAS == csOn;
 }
 
 bool CPDF_FormControl::IsDefaultChecked() const {
-  ASSERT(GetType() == CPDF_FormField::CheckBox ||
-         GetType() == CPDF_FormField::RadioButton);
+  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+         GetType() == CPDF_FormField::kRadioButton);
   CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->GetDict(), "DV");
   if (!pDV)
     return false;
@@ -107,8 +107,8 @@
 }
 
 void CPDF_FormControl::CheckControl(bool bChecked) {
-  ASSERT(GetType() == CPDF_FormField::CheckBox ||
-         GetType() == CPDF_FormField::RadioButton);
+  ASSERT(GetType() == CPDF_FormField::kCheckBox ||
+         GetType() == CPDF_FormField::kRadioButton);
   ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
   ByteString csAS = "Off";
   if (bChecked)
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index b149ef6e..8399e79 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -42,7 +42,7 @@
 const int kFormTextComb = 0x800;
 
 bool IsUnison(CPDF_FormField* pField) {
-  if (pField->GetType() == CPDF_FormField::CheckBox)
+  if (pField->GetType() == CPDF_FormField::kCheckBox)
     return true;
   return (pField->GetFieldFlags() & 0x2000000) != 0;
 }
@@ -130,23 +130,23 @@
 
   if (type_name == "Btn") {
     if (flags & 0x8000) {
-      m_Type = RadioButton;
+      m_Type = kRadioButton;
       if (flags & 0x4000)
         m_Flags |= kFormRadioNoToggleOff;
       if (flags & 0x2000000)
         m_Flags |= kFormRadioUnison;
     } else if (flags & 0x10000) {
-      m_Type = PushButton;
+      m_Type = kPushButton;
     } else {
-      m_Type = CheckBox;
+      m_Type = kCheckBox;
     }
   } else if (type_name == "Tx") {
     if (flags & 0x100000) {
-      m_Type = File;
+      m_Type = kFile;
     } else if (flags & 0x2000000) {
-      m_Type = RichText;
+      m_Type = kRichText;
     } else {
-      m_Type = Text;
+      m_Type = kText;
       if (flags & 0x1000)
         m_Flags |= kFormTextMultiLine;
       if (flags & 0x2000)
@@ -159,17 +159,17 @@
     LoadDA();
   } else if (type_name == "Ch") {
     if (flags & 0x20000) {
-      m_Type = ComboBox;
+      m_Type = kComboBox;
       if (flags & 0x40000)
         m_Flags |= kFormComboEdit;
     } else {
-      m_Type = ListBox;
+      m_Type = kListBox;
       if (flags & 0x200000)
         m_Flags |= kFormListMultiSelect;
     }
     LoadDA();
   } else if (type_name == "Sig") {
-    m_Type = Sign;
+    m_Type = kSign;
   }
 }
 
@@ -179,8 +179,8 @@
 
 bool CPDF_FormField::ResetField(NotificationOption notify) {
   switch (m_Type) {
-    case CPDF_FormField::CheckBox:
-    case CPDF_FormField::RadioButton: {
+    case kCheckBox:
+    case kRadioButton: {
       int iCount = CountControls();
       // TODO(weili): Check whether anything special needs to be done for
       // unison field. (When IsUnison(this) returns true/false.)
@@ -192,8 +192,8 @@
         m_pForm->GetFormNotify()->AfterCheckedStatusChange(this);
       break;
     }
-    case CPDF_FormField::ComboBox:
-    case CPDF_FormField::ListBox: {
+    case kComboBox:
+    case kListBox: {
       ClearSelection(NotificationOption::kDoNotNotify);
       WideString csValue;
       int iIndex = GetDefaultSelectedItem();
@@ -208,9 +208,9 @@
         NotifyListOrComboBoxAfterChange();
       break;
     }
-    case CPDF_FormField::Text:
-    case CPDF_FormField::RichText:
-    case CPDF_FormField::File:
+    case kText:
+    case kRichText:
+    case kFile:
     default: {
       const CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
       WideString csDValue;
@@ -260,21 +260,21 @@
 
 FormFieldType CPDF_FormField::GetFieldType() const {
   switch (m_Type) {
-    case PushButton:
+    case kPushButton:
       return FormFieldType::kPushButton;
-    case CheckBox:
+    case kCheckBox:
       return FormFieldType::kCheckBox;
-    case RadioButton:
+    case kRadioButton:
       return FormFieldType::kRadioButton;
-    case ComboBox:
+    case kComboBox:
       return FormFieldType::kComboBox;
-    case ListBox:
+    case kListBox:
       return FormFieldType::kListBox;
-    case Text:
-    case RichText:
-    case File:
+    case kText:
+    case kRichText:
+    case kFile:
       return FormFieldType::kTextField;
-    case Sign:
+    case kSign:
       return FormFieldType::kSignature;
     default:
       return FormFieldType::kUnknown;
@@ -311,16 +311,16 @@
 }
 
 WideString CPDF_FormField::GetValue(bool bDefault) const {
-  if (GetType() == CheckBox || GetType() == RadioButton)
+  if (GetType() == kCheckBox || GetType() == kRadioButton)
     return GetCheckValue(bDefault);
 
   const CPDF_Object* pValue =
       FPDF_GetFieldAttr(m_pDict.Get(), bDefault ? "DV" : "V");
   if (!pValue) {
     if (!bDefault) {
-      if (m_Type == RichText)
+      if (m_Type == kRichText)
         pValue = FPDF_GetFieldAttr(m_pDict.Get(), "V");
-      if (!pValue && m_Type != Text)
+      if (!pValue && m_Type != kText)
         pValue = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
     }
     if (!pValue)
@@ -354,15 +354,15 @@
                               bool bDefault,
                               NotificationOption notify) {
   switch (m_Type) {
-    case CheckBox:
-    case RadioButton: {
+    case kCheckBox:
+    case kRadioButton: {
       SetCheckValue(value, bDefault, notify);
       return true;
     }
-    case File:
-    case RichText:
-    case Text:
-    case ComboBox: {
+    case kFile:
+    case kRichText:
+    case kText:
+    case kComboBox: {
       WideString csValue = value;
       if (notify == NotificationOption::kNotify &&
           !NotifyBeforeValueChange(csValue)) {
@@ -373,7 +373,7 @@
       if (iIndex < 0) {
         ByteString bsEncodeText = PDF_EncodeText(csValue);
         m_pDict->SetNewFor<CPDF_String>(key, bsEncodeText, false);
-        if (m_Type == RichText && !bDefault)
+        if (m_Type == kRichText && !bDefault)
           m_pDict->SetNewFor<CPDF_String>("RV", bsEncodeText, false);
         m_pDict->RemoveFor("I");
       } else {
@@ -387,7 +387,7 @@
         NotifyAfterValueChange();
       break;
     }
-    case ListBox: {
+    case kListBox: {
       int iIndex = FindOptionValue(value);
       if (iIndex < 0)
         return false;
@@ -499,7 +499,7 @@
 }
 
 bool CPDF_FormField::IsItemSelected(int index) const {
-  ASSERT(GetType() == ComboBox || GetType() == ListBox);
+  ASSERT(GetType() == kComboBox || GetType() == kListBox);
   if (index < 0 || index >= CountOptions())
     return false;
   if (IsOptionSelected(index))
@@ -544,7 +544,7 @@
 bool CPDF_FormField::SetItemSelection(int index,
                                       bool bSelected,
                                       NotificationOption notify) {
-  ASSERT(GetType() == ComboBox || GetType() == ListBox);
+  ASSERT(GetType() == kComboBox || GetType() == kListBox);
   if (index < 0 || index >= CountOptions())
     return false;
 
@@ -554,7 +554,7 @@
     return false;
   }
   if (bSelected) {
-    if (GetType() == ListBox) {
+    if (GetType() == kListBox) {
       SelectOption(index, true, NotificationOption::kDoNotNotify);
       if (!(m_Flags & kFormListMultiSelect)) {
         m_pDict->SetNewFor<CPDF_String>("V", PDF_EncodeText(opt_value), false);
@@ -575,7 +575,7 @@
   } else {
     const CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict.Get(), "V");
     if (pValue) {
-      if (GetType() == ListBox) {
+      if (GetType() == kListBox) {
         SelectOption(index, false, NotificationOption::kDoNotNotify);
         if (pValue->IsString()) {
           if (pValue->GetUnicodeText() == opt_value)
@@ -603,7 +603,7 @@
 }
 
 bool CPDF_FormField::IsItemDefaultSelected(int index) const {
-  ASSERT(GetType() == ComboBox || GetType() == ListBox);
+  ASSERT(GetType() == kComboBox || GetType() == kListBox);
   if (index < 0 || index >= CountOptions())
     return false;
   int iDVIndex = GetDefaultSelectedItem();
@@ -611,7 +611,7 @@
 }
 
 int CPDF_FormField::GetDefaultSelectedItem() const {
-  ASSERT(GetType() == ComboBox || GetType() == ListBox);
+  ASSERT(GetType() == kComboBox || GetType() == kListBox);
   const CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict.Get(), "DV");
   if (!pValue)
     return -1;
@@ -672,7 +672,7 @@
 bool CPDF_FormField::CheckControl(int iControlIndex,
                                   bool bChecked,
                                   NotificationOption notify) {
-  ASSERT(GetType() == CheckBox || GetType() == RadioButton);
+  ASSERT(GetType() == kCheckBox || GetType() == kRadioButton);
   CPDF_FormControl* pControl = GetControl(iControlIndex);
   if (!pControl)
     return false;
@@ -724,7 +724,7 @@
 }
 
 WideString CPDF_FormField::GetCheckValue(bool bDefault) const {
-  ASSERT(GetType() == CheckBox || GetType() == RadioButton);
+  ASSERT(GetType() == kCheckBox || GetType() == kRadioButton);
   WideString csExport = L"Off";
   int iCount = CountControls();
   for (int i = 0; i < iCount; i++) {
@@ -742,7 +742,7 @@
 bool CPDF_FormField::SetCheckValue(const WideString& value,
                                    bool bDefault,
                                    NotificationOption notify) {
-  ASSERT(GetType() == CheckBox || GetType() == RadioButton);
+  ASSERT(GetType() == kCheckBox || GetType() == kRadioButton);
   int iCount = CountControls();
   for (int i = 0; i < iCount; i++) {
     CPDF_FormControl* pControl = GetControl(i);
@@ -908,9 +908,9 @@
 
 bool CPDF_FormField::NotifyListOrComboBoxBeforeChange(const WideString& value) {
   switch (GetType()) {
-    case ListBox:
+    case kListBox:
       return NotifyBeforeSelectionChange(value);
-    case ComboBox:
+    case kComboBox:
       return NotifyBeforeValueChange(value);
     default:
       return true;
@@ -919,10 +919,10 @@
 
 void CPDF_FormField::NotifyListOrComboBoxAfterChange() {
   switch (GetType()) {
-    case ListBox:
+    case kListBox:
       NotifyAfterSelectionChange();
       break;
-    case ComboBox:
+    case kComboBox:
       NotifyAfterValueChange();
       break;
     default:
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index 8e7d9e4..a718cec 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -86,16 +86,16 @@
 class CPDF_FormField {
  public:
   enum Type {
-    Unknown,
-    PushButton,
-    RadioButton,
-    CheckBox,
-    Text,
-    RichText,
-    File,
-    ListBox,
-    ComboBox,
-    Sign
+    kUnknown,
+    kPushButton,
+    kRadioButton,
+    kCheckBox,
+    kText,
+    kRichText,
+    kFile,
+    kListBox,
+    kComboBox,
+    kSign
   };
 
   CPDF_FormField(CPDF_InteractiveForm* pForm, CPDF_Dictionary* pDict);
@@ -200,7 +200,7 @@
   bool NotifyListOrComboBoxBeforeChange(const WideString& value);
   void NotifyListOrComboBoxAfterChange();
 
-  CPDF_FormField::Type m_Type = Unknown;
+  CPDF_FormField::Type m_Type = kUnknown;
   uint32_t m_Flags = 0;
   bool m_bReadOnly = false;
   bool m_bRequired = false;
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index 50cdb2e..58b1a61 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -969,8 +969,9 @@
       continue;
 
     int32_t iType = pField->GetType();
-    if (iType == CPDF_FormField::PushButton ||
-        iType == CPDF_FormField::CheckBox || iType == CPDF_FormField::ListBox) {
+    if (iType == CPDF_FormField::kPushButton ||
+        iType == CPDF_FormField::kCheckBox ||
+        iType == CPDF_FormField::kListBox) {
       continue;
     }
     if (pField->IsNoExport())
@@ -1029,7 +1030,7 @@
   size_t nCount = m_pFieldTree->m_Root.CountFields();
   for (size_t i = 0; i < nCount; ++i) {
     CPDF_FormField* pField = m_pFieldTree->m_Root.GetFieldAtIndex(i);
-    if (!pField || pField->GetType() == CPDF_FormField::PushButton)
+    if (!pField || pField->GetType() == CPDF_FormField::kPushButton)
       continue;
 
     uint32_t dwFlags = pField->GetFieldFlags();
@@ -1048,8 +1049,8 @@
     auto pFieldDict =
         pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool());
     pFieldDict->SetNewFor<CPDF_String>("T", fullname);
-    if (pField->GetType() == CPDF_FormField::CheckBox ||
-        pField->GetType() == CPDF_FormField::RadioButton) {
+    if (pField->GetType() == CPDF_FormField::kCheckBox ||
+        pField->GetType() == CPDF_FormField::kRadioButton) {
       WideString csExport = pField->GetCheckValue(false);
       ByteString csBExport = PDF_EncodeText(csExport);
       CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->GetDict(), "Opt");