Fix fallthroughs in XFA code.

Change-Id: I1fd4bf85cd709de1c14ed2895d045018f79bc61f
Reviewed-on: https://pdfium-review.googlesource.com/26950
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
index 0391258..ea6e2ba 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
@@ -205,12 +205,14 @@
           Error();
           NOTREACHED();
         }
+        break;
       }
       case 32:
         break;
       default:
         Error();
         NOTREACHED();
+        break;
     }
     src_row_bytes_ = BMP_WIDTHBYTES(width_, bit_counts_);
     switch (bit_counts_) {
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index 37e83f7..db5886a 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -10,6 +10,7 @@
 
 #include "core/fxcodec/codec/codec_int.h"
 #include "core/fxcodec/fx_codec.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "core/fxcrt/unowned_ptr.h"
 #include "core/fxge/fx_dib.h"
 #include "third_party/base/ptr_util.h"
@@ -155,6 +156,7 @@
       if (color_type1 != PNG_COLOR_TYPE_PALETTE) {
         png_error(pContext->m_pPng, "Not Support Output Palette Now");
       }
+      FX_FALLTHROUGH;
     case PNG_COLOR_TYPE_RGB:
     case PNG_COLOR_TYPE_RGB_ALPHA:
       if (!(color_type1 & PNG_COLOR_MASK_COLOR)) {
diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp
index b557bf0..30352a5 100644
--- a/core/fxcrt/css/cfx_csssyntaxparser.cpp
+++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp
@@ -12,6 +12,7 @@
 #include "core/fxcrt/css/cfx_cssdeclaration.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "third_party/base/logging.h"
 
 namespace {
@@ -73,6 +74,7 @@
                 SwitchMode(CFX_CSSSyntaxMode::Comment);
                 break;
               }
+              FX_FALLTHROUGH;
             default:
               if (wch <= ' ') {
                 m_TextPlane.MoveNext();
@@ -109,6 +111,7 @@
                   return CFX_CSSSyntaxStatus::Selector;
                 break;
               }
+              FX_FALLTHROUGH;
             default:
               AppendChar(wch);
               break;
@@ -133,6 +136,7 @@
                   return CFX_CSSSyntaxStatus::PropertyName;
                 break;
               }
+              FX_FALLTHROUGH;
             default:
               AppendChar(wch);
               break;
@@ -142,6 +146,7 @@
           switch (wch) {
             case ';':
               m_TextPlane.MoveNext();
+              FX_FALLTHROUGH;
             case '}':
               SwitchMode(CFX_CSSSyntaxMode::PropertyName);
               return CFX_CSSSyntaxStatus::PropertyValue;
@@ -151,6 +156,7 @@
                   return CFX_CSSSyntaxStatus::PropertyValue;
                 break;
               }
+              FX_FALLTHROUGH;
             default:
               AppendChar(wch);
               break;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 9f07714..79599e1 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -10,6 +10,7 @@
 #include <utility>
 
 #include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
 #include "fpdfsdk/cpdfsdk_interform.h"
 #include "fpdfsdk/cpdfsdk_pageview.h"
@@ -135,9 +136,11 @@
     case FormType::kXFAForeground:
       if (m_pPDFDoc)
         return m_pPDFDoc->GetPageCount();
+      FX_FALLTHROUGH;
     case FormType::kXFAFull:
       if (m_pXFADoc)
         return m_pXFADocView->CountPageViews();
+      break;
   }
   return 0;
 }
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index fbea90d..87cb4ba 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -8,6 +8,7 @@
 
 #include "core/fpdfapi/page/cpdf_page.h"
 #include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
 #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
 #include "fpdfsdk/fsdk_define.h"
@@ -95,9 +96,11 @@
     case FormType::kXFAForeground:
       if (m_pPDFPage)
         return m_pPDFPage->GetPageWidth();
+      FX_FALLTHROUGH;
     case FormType::kXFAFull:
       if (m_pXFAPageView)
         return m_pXFAPageView->GetPageViewRect().width;
+      break;
   }
 
   return 0.0f;
@@ -113,9 +116,11 @@
     case FormType::kXFAForeground:
       if (m_pPDFPage)
         return m_pPDFPage->GetPageHeight();
+      FX_FALLTHROUGH;
     case FormType::kXFAFull:
       if (m_pXFAPageView)
         return m_pXFAPageView->GetPageViewRect().height;
+      break;
   }
 
   return 0.0f;
@@ -178,10 +183,12 @@
     case FormType::kXFAForeground:
       if (m_pPDFPage)
         return m_pPDFPage->GetDisplayMatrix(xPos, yPos, xSize, ySize, iRotate);
+      FX_FALLTHROUGH;
     case FormType::kXFAFull:
       if (m_pXFAPageView)
         return m_pXFAPageView->GetDisplayMatrix(
             CFX_Rect(xPos, yPos, xSize, ySize), iRotate);
+      break;
   }
 
   return CFX_Matrix();
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 3f69035..5a2c4bd1 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -10,6 +10,7 @@
 
 #include "core/fxcrt/cfx_decimal.h"
 #include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "core/fxcrt/xml/cfx_xmltext.h"
 #include "fxjs/cfxjse_engine.h"
 #include "fxjs/cfxjse_value.h"
@@ -847,6 +848,7 @@
     case XFA_ObjectType::NodeV:
     case XFA_ObjectType::TextNode:
       pNode = ToNode(GetXFAObject());
+      FX_FALLTHROUGH;
     default:
       if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::DataValue)
         pNode = ToNode(GetXFAObject());
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 6b8aa76..2a37065 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -48,6 +48,7 @@
       }
       FillSoildRect(pParams->m_pGraphics, color, &pParams->m_rtPart,
                     &pParams->m_matrix);
+      break;
     }
     default:
       break;
diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp
index 6ef3d1d..75d142c 100644
--- a/xfa/fxfa/cxfa_ffline.cpp
+++ b/xfa/fxfa/cxfa_ffline.cpp
@@ -44,6 +44,7 @@
         break;
       case XFA_AttributeEnum::Right:
         rect.top += fHalfWidth;
+        break;
       case XFA_AttributeEnum::Even:
         break;
       default:
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index d4506c7..4586664 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -11,6 +11,7 @@
 #include <utility>
 #include <vector>
 
+#include "core/fxcrt/fx_fallthrough.h"
 #include "fxjs/xfa/cjx_object.h"
 #include "third_party/base/logging.h"
 #include "third_party/base/ptr_util.h"
@@ -867,6 +868,7 @@
     }
     case XFA_ItemLayoutProcessorStages::None: {
       pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+      FX_FALLTHROUGH;
       case XFA_ItemLayoutProcessorStages::BookendLeader:
         for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
                                            ? pEntireContainer->GetFirstChild()
@@ -885,6 +887,7 @@
     }
       {
         pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+        FX_FALLTHROUGH;
         case XFA_ItemLayoutProcessorStages::BreakBefore:
           if (pCurActionNode != XFA_LAYOUT_INVALIDNODE) {
             CXFA_Node* pBreakBeforeNode = pCurActionNode->GetNextSibling();
@@ -908,6 +911,7 @@
       }
     case XFA_ItemLayoutProcessorStages::Container: {
       pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+      FX_FALLTHROUGH;
       case XFA_ItemLayoutProcessorStages::BreakAfter: {
         if (pCurActionNode == XFA_LAYOUT_INVALIDNODE) {
           CXFA_Node* pBreakAfterNode = pChildContainer->GetFirstChild();
@@ -962,6 +966,7 @@
 
     NoMoreChildContainer : {
       pCurActionNode = XFA_LAYOUT_INVALIDNODE;
+      FX_FALLTHROUGH;
       case XFA_ItemLayoutProcessorStages::BookendTrailer:
         for (CXFA_Node* pBookendNode = pCurActionNode == XFA_LAYOUT_INVALIDNODE
                                            ? pEntireContainer->GetFirstChild()
@@ -978,6 +983,7 @@
           }
         }
     }
+      FX_FALLTHROUGH;
     default:
       pCurActionNode = nullptr;
       *nCurStage = XFA_ItemLayoutProcessorStages::Done;
@@ -1959,8 +1965,10 @@
           switch (rs) {
             case XFA_ItemLayoutProcessorResult::ManualBreak:
               bIsManualBreak = true;
+              FX_FALLTHROUGH;
             case XFA_ItemLayoutProcessorResult::PageFullBreak:
               bForceEndPage = true;
+              FX_FALLTHROUGH;
             case XFA_ItemLayoutProcessorResult::RowFullBreak:
               goto SuspendAndCreateNewRow;
             case XFA_ItemLayoutProcessorResult::Done:
@@ -1968,6 +1976,7 @@
               fContentCurRowY +=
                   pProcessor->InsertPendingItems(m_pCurChildNode);
               pProcessor.reset();
+              break;
           }
           break;
         }
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index bfee8fa..77b6f74 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -18,6 +18,7 @@
 #include "core/fxcrt/cfx_memorystream.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "core/fxcrt/xml/cfx_xmlelement.h"
 #include "core/fxcrt/xml/cfx_xmlnode.h"
 #include "core/fxcrt/xml/cfx_xmltext.h"
@@ -2622,6 +2623,7 @@
     }
     case XFA_FFWidgetType::kChoiceList:
       ClearAllSelections();
+      FX_FALLTHROUGH;
     default: {
       CXFA_Value* defValue = GetDefaultValueIfExists();
       if (defValue)
@@ -2762,6 +2764,7 @@
       case XFA_AttributeEnum::Bottom: {
         size.height += szCap.height;
         size.width = std::max(size.width, szCap.width);
+        break;
       }
       default:
         break;
@@ -2858,6 +2861,7 @@
         case XFA_AttributeEnum::Right:
         case XFA_AttributeEnum::Inline: {
           size.width -= szCap.width;
+          break;
         }
         default:
           break;
@@ -2881,6 +2885,7 @@
         case XFA_AttributeEnum::Top:
         case XFA_AttributeEnum::Bottom: {
           size.height += szCap.height;
+          break;
         }
         default:
           break;
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index b7cab02..ac14731 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -11,6 +11,7 @@
 #include <vector>
 
 #include "core/fxcrt/fx_extension.h"
+#include "core/fxcrt/fx_fallthrough.h"
 #include "core/fxcrt/xml/cfx_xmlelement.h"
 #include "core/fxcrt/xml/cfx_xmlnode.h"
 #include "fxjs/cfxjse_engine.h"
@@ -630,6 +631,7 @@
           pResult = pGlobalBindNode;
           break;
         }
+        FX_FALLTHROUGH;
       case XFA_AttributeEnum::Once: {
         bAccessedDataDOM = true;
         CXFA_Node* pOnceBindNode = FindOnceDataNode(
diff --git a/xfa/fxgraphics/cxfa_gecolor.cpp b/xfa/fxgraphics/cxfa_gecolor.cpp
index 3dca4a7..b0dc661 100644
--- a/xfa/fxgraphics/cxfa_gecolor.cpp
+++ b/xfa/fxgraphics/cxfa_gecolor.cpp
@@ -39,6 +39,7 @@
       case Shading:
         m_argb = 0;
         m_pointer.shading = that.m_pointer.shading;
+        break;
       default:
         break;
     }