From 60bd1e720ee241c64d730be2678498ba56fe1420 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 28 May 2020 23:33:35 +0000 Subject: [PATCH] Move more static asserts into pdfium_assert_matching_enums.cc. There are a few static_assert() calls in pdfium_engine.cc. Consolidate them into pdfium_assert_matching_enums.cc. Change-Id: Ica2328418fd6e73d8cdc1390b53bccb8bf006386 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220332 Commit-Queue: Daniel Hosseinian Reviewed-by: Daniel Hosseinian Cr-Commit-Position: refs/heads/master@{#772938} --- pdf/pdfium/pdfium_assert_matching_enums.cc | 11 +++++++++++ pdf/pdfium/pdfium_engine.cc | 14 -------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/pdf/pdfium/pdfium_assert_matching_enums.cc b/pdf/pdfium/pdfium_assert_matching_enums.cc index a58ecff0daab70..136f7c8cdf51c2 100644 --- a/pdf/pdfium/pdfium_assert_matching_enums.cc +++ b/pdf/pdfium/pdfium_assert_matching_enums.cc @@ -4,10 +4,12 @@ #include "build/build_config.h" #include "pdf/pdf.h" +#include "pdf/pdf_engine.h" #include "ppapi/c/pp_input_event.h" #include "ppapi/c/private/ppb_pdf.h" #include "ppapi/c/private/ppp_pdf.h" #include "third_party/pdfium/public/fpdf_edit.h" +#include "third_party/pdfium/public/fpdf_formfill.h" #include "third_party/pdfium/public/fpdf_fwlevent.h" #include "third_party/pdfium/public/fpdf_sysfontinfo.h" #include "third_party/pdfium/public/fpdfview.h" @@ -229,6 +231,15 @@ STATIC_ASSERT_ENUM(PP_TEXTRENDERINGMODE_FILLSTROKECLIP, FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP); STATIC_ASSERT_ENUM(PP_TEXTRENDERINGMODE_CLIP, FPDF_TEXTRENDERMODE_CLIP); +STATIC_ASSERT_ENUM(chrome_pdf::PDFEngine::FormType::kNone, FORMTYPE_NONE); +STATIC_ASSERT_ENUM(chrome_pdf::PDFEngine::FormType::kAcroForm, + FORMTYPE_ACRO_FORM); +STATIC_ASSERT_ENUM(chrome_pdf::PDFEngine::FormType::kXFAFull, + FORMTYPE_XFA_FULL); +STATIC_ASSERT_ENUM(chrome_pdf::PDFEngine::FormType::kXFAForeground, + FORMTYPE_XFA_FOREGROUND); +STATIC_ASSERT_ENUM(chrome_pdf::PDFEngine::FormType::kCount, FORMTYPE_COUNT); + #if defined(OS_WIN) STATIC_ASSERT_ENUM(chrome_pdf::kEmf, FPDF_PRINTMODE_EMF); STATIC_ASSERT_ENUM(chrome_pdf::kTextOnly, FPDF_PRINTMODE_TEXTONLY); diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index 82b75dc50fcd55..c791e8ed471242 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc @@ -68,20 +68,6 @@ using printing::kPixelsPerInch; namespace chrome_pdf { -static_assert(static_cast(PDFEngine::FormType::kNone) == FORMTYPE_NONE, - "None form types must match"); -static_assert(static_cast(PDFEngine::FormType::kAcroForm) == - FORMTYPE_ACRO_FORM, - "AcroForm form types must match"); -static_assert(static_cast(PDFEngine::FormType::kXFAFull) == - FORMTYPE_XFA_FULL, - "XFA full form types must match"); -static_assert(static_cast(PDFEngine::FormType::kXFAForeground) == - FORMTYPE_XFA_FOREGROUND, - "XFA foreground form types must match"); -static_assert(static_cast(PDFEngine::FormType::kCount) == FORMTYPE_COUNT, - "Form type counts must match"); - namespace { constexpr int32_t kHighlightColorR = 153;