summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_interform.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-10 18:38:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-10 18:38:03 +0000
commit461acb276e1c38c9ebb3546c5b3254fa5cf9c585 (patch)
tree1680a982413c0fc199af16392772e261fec97a71 /fpdfsdk/cpdfsdk_interform.cpp
parent8d8d3bc54593d2d86054d59669b86a959ec0b602 (diff)
downloadpdfium-461acb276e1c38c9ebb3546c5b3254fa5cf9c585.tar.xz
Remove impossible nullptr checks in CPDFSDK_InterForm.
Also remove dead code and move initialization to headers in CPDFSDK_InterForm. Change-Id: Ib75864ccfd3f1d0d255d9c7942cc610edce822a3 Reviewed-on: https://pdfium-review.googlesource.com/c/43599 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_interform.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index bd3c7fa1a3..549caafb51 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -122,15 +122,9 @@ bool FDFToURLEncodedData(std::vector<uint8_t>* pBuffer) {
CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_FormFillEnvironment* pFormFillEnv)
: m_pFormFillEnv(pFormFillEnv),
- m_pInterForm(
- pdfium::MakeUnique<CPDF_InterForm>(m_pFormFillEnv->GetPDFDocument())),
-#ifdef PDF_ENABLE_XFA
- m_bXfaCalculate(true),
- m_bXfaValidationsEnabled(true),
-#endif // PDF_ENABLE_XFA
- m_bCalculate(true),
- m_bBusy(false),
- m_HighlightAlpha(0) {
+ m_pInterForm(pdfium::MakeUnique<CPDF_InterForm>(
+ m_pFormFillEnv->GetPDFDocument())) {
+ ASSERT(m_pFormFillEnv);
m_pInterForm->SetFormNotify(this);
RemoveAllHighLights();
}
@@ -142,10 +136,6 @@ CPDFSDK_InterForm::~CPDFSDK_InterForm() {
#endif // PDF_ENABLE_XFA
}
-bool CPDFSDK_InterForm::HighlightWidgets() {
- return false;
-}
-
CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
bool bNext) const {
auto pIterator = pdfium::MakeUnique<CPDFSDK_AnnotIterator>(
@@ -156,7 +146,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
}
CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const {
- if (!pControl || !m_pInterForm)
+ if (!pControl)
return nullptr;
CPDFSDK_Widget* pWidget = nullptr;
@@ -527,9 +517,6 @@ bool CPDFSDK_InterForm::SubmitForm(const WideString& sDestination,
if (sDestination.IsEmpty())
return false;
- if (!m_pFormFillEnv || !m_pInterForm)
- return false;
-
std::unique_ptr<CFDF_Document> pFDFDoc =
m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false);
if (!pFDFDoc)
@@ -642,7 +629,7 @@ void CPDFSDK_InterForm::AfterFormReset(CPDF_InterForm* pForm) {
OnCalculate(nullptr);
}
-bool CPDFSDK_InterForm::IsNeedHighLight(FormFieldType fieldType) {
+bool CPDFSDK_InterForm::IsNeedHighLight(FormFieldType fieldType) const {
if (fieldType == FormFieldType::kUnknown)
return false;