Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: fpdfsdk/src/javascript/Field.cpp

Issue 1529553003: Merge to XFA: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/src/javascript/Field.cpp
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index d3531a4aa3cdfa4d71a076af1206ae8ad19be96f..89725ffb7fc62c28a5ec74edd8619914c0023370 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -19,8 +19,6 @@
#include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
#include "fpdfsdk/include/javascript/IJavaScript.h"
-/* ---------------------- Field ---------------------- */
-
BEGIN_JS_STATIC_CONST(CJS_Field)
END_JS_STATIC_CONST()
@@ -156,22 +154,14 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed,
FX_BOOL Field::AttachField(Document* pDocument,
const CFX_WideString& csFieldName) {
- ASSERT(pDocument != NULL);
m_pJSDoc = pDocument;
-
m_pDocument = pDocument->GetReaderDoc();
- ASSERT(m_pDocument != NULL);
-
m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) ||
m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
m_pDocument->GetPermissions(FPDFPERM_MODIFY);
CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
- ASSERT(pRDInterForm != NULL);
-
CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CFX_WideString swFieldNameTemp = csFieldName;
swFieldNameTemp.Replace(L"..", L".");
@@ -251,12 +241,9 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
FX_BOOL bChangeMark,
FX_BOOL bResetAP,
FX_BOOL bRefresh) {
- ASSERT(pDocument != NULL);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl);
if (pWidget) {
@@ -278,7 +265,6 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
if (bRefresh) {
CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
CPDFSDK_Document* pDoc = pInterForm->GetDocument();
- ASSERT(pDoc != NULL);
pDoc->UpdateAllViews(NULL, pWidget);
}
}
@@ -296,8 +282,6 @@ CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument,
FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField,
CFX_WideString csOptLabel) {
- ASSERT(pFormField != NULL);
-
for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) {
if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
return TRUE;
@@ -317,13 +301,10 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
return pFormField->GetControl(m_nFormControlIndex);
}
-/* ---------------------------------------- property
- * ---------------------------------------- */
-
FX_BOOL Field::alignment(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -379,7 +360,7 @@ void Field::SetAlignment(CPDFSDK_Document* pDocument,
FX_BOOL Field::borderStyle(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -439,7 +420,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CFX_ByteString& string) {
- ASSERT(pDocument != NULL);
+ ASSERT(pDocument);
int nBorderStyle = 0;
@@ -491,7 +472,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonAlignX(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -540,7 +521,7 @@ void Field::SetButtonAlignX(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonAlignY(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -589,7 +570,7 @@ void Field::SetButtonAlignY(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonFitBounds(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -634,7 +615,7 @@ void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonPosition(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -677,7 +658,7 @@ void Field::SetButtonPosition(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonScaleHow(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -725,7 +706,7 @@ void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonScaleWhen(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -784,7 +765,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument,
FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -811,11 +792,7 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
}
CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
- ASSERT(pRDInterForm != NULL);
-
CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
- ASSERT(pInterForm != NULL);
-
vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField);
}
@@ -832,7 +809,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument,
FX_BOOL Field::charLimit(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -870,7 +847,7 @@ void Field::SetCharLimit(CPDFSDK_Document* pDocument,
FX_BOOL Field::comb(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -912,7 +889,7 @@ void Field::SetComb(CPDFSDK_Document* pDocument,
FX_BOOL Field::commitOnSelChange(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1019,7 +996,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CFX_DWordArray& array) {
- ASSERT(pDocument != NULL);
+ ASSERT(pDocument);
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
@@ -1059,7 +1036,7 @@ void Field::SetDefaultStyle(CPDFSDK_Document* pDocument,
FX_BOOL Field::defaultValue(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1100,7 +1077,7 @@ void Field::SetDefaultValue(CPDFSDK_Document* pDocument,
FX_BOOL Field::doNotScroll(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1142,7 +1119,7 @@ void Field::SetDoNotScroll(CPDFSDK_Document* pDocument,
FX_BOOL Field::doNotSpellCheck(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1199,8 +1176,6 @@ FX_BOOL Field::delay(IJS_Context* cc,
FX_BOOL Field::display(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1251,11 +1226,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
int number) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
@@ -1263,7 +1234,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument,
FX_BOOL bSet = FALSE;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
FX_DWORD dwFlag = pWidget->GetFlags();
@@ -1353,7 +1324,6 @@ FX_BOOL Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
FX_BOOL Field::editable(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1426,8 +1396,6 @@ FX_BOOL Field::exportValues(IJS_Context* cc,
FX_BOOL Field::fileSelect(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -1524,8 +1492,6 @@ void Field::SetFillColor(CPDFSDK_Document* pDocument,
FX_BOOL Field::hidden(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1567,11 +1533,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
bool b) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
@@ -1634,7 +1596,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument,
FX_BOOL Field::highlight(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1695,8 +1657,6 @@ void Field::SetHighlight(CPDFSDK_Document* pDocument,
FX_BOOL Field::lineWidth(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1723,8 +1683,6 @@ FX_BOOL Field::lineWidth(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
if (!pFormField->CountControls())
return FALSE;
@@ -1742,10 +1700,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
int number) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
@@ -1754,7 +1709,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument,
FX_BOOL bSet = FALSE;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
if (number != pWidget->GetBorderWidth()) {
@@ -1784,7 +1739,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument,
FX_BOOL Field::multiline(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1826,7 +1781,7 @@ void Field::SetMultiline(CPDFSDK_Document* pDocument,
FX_BOOL Field::multipleSelection(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1941,7 +1896,7 @@ FX_BOOL Field::page(IJS_Context* cc,
FX_BOOL Field::password(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1983,12 +1938,8 @@ void Field::SetPassword(CPDFSDK_Document* pDocument,
FX_BOOL Field::print(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2062,8 +2013,6 @@ FX_BOOL Field::print(IJS_Context* cc,
FX_BOOL Field::radiosInUnison(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2092,8 +2041,6 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc,
FX_BOOL Field::readonly(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2183,10 +2130,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CPDF_Rect& rect) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
@@ -2195,7 +2139,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
FX_BOOL bSet = FALSE;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
CPDF_Rect crRect = rect;
@@ -2225,11 +2169,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
CPDF_Rect crRect = rect;
CPDF_Page* pPDFPage = pWidget->GetPDFPage();
- ASSERT(pPDFPage != NULL);
-
- // CPDF_Page* pPDFPage = pPage->GetPage();
- // ASSERT(pPDFPage != NULL);
-
crRect.Intersect(pPDFPage->GetPageBBox());
if (!crRect.IsEmpty()) {
@@ -2249,8 +2188,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
FX_BOOL Field::required(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2279,7 +2216,7 @@ FX_BOOL Field::required(IJS_Context* cc,
FX_BOOL Field::richText(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2333,7 +2270,7 @@ void Field::SetRichValue(CPDFSDK_Document* pDocument,
FX_BOOL Field::rotation(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2443,7 +2380,7 @@ void Field::SetStrokeColor(CPDFSDK_Document* pDocument,
FX_BOOL Field::style(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2578,7 +2515,7 @@ void Field::SetTextColor(CPDFSDK_Document* pDocument,
FX_BOOL Field::textFont(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2634,7 +2571,7 @@ void Field::SetTextFont(CPDFSDK_Document* pDocument,
FX_BOOL Field::textSize(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2682,8 +2619,6 @@ void Field::SetTextSize(CPDFSDK_Document* pDocument,
FX_BOOL Field::type(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!vp.IsGetting())
return FALSE;
@@ -2728,7 +2663,7 @@ FX_BOOL Field::type(IJS_Context* cc,
FX_BOOL Field::userName(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2881,7 +2816,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CJS_WideStringArray& strArray) {
- ASSERT(pDocument != NULL);
+ ASSERT(pDocument);
if (strArray.GetSize() < 1)
return;
@@ -2940,8 +2875,6 @@ void Field::SetValue(CPDFSDK_Document* pDocument,
FX_BOOL Field::valueAsString(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!vp.IsGetting())
return FALSE;
@@ -2981,15 +2914,10 @@ FX_BOOL Field::valueAsString(IJS_Context* cc,
return TRUE;
}
-/* --------------------------------- methods ---------------------------------
- */
-
FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -3012,8 +2940,6 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
@@ -3047,8 +2973,6 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
@@ -3116,7 +3040,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (!m_bCanSet)
return FALSE;
@@ -3161,8 +3085,6 @@ FX_BOOL Field::defaultIsChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!m_bCanSet)
return FALSE;
@@ -3195,9 +3117,6 @@ FX_BOOL Field::deleteItemAt(IJS_Context* cc,
}
int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) {
- ASSERT(ps1 != NULL);
- ASSERT(ps2 != NULL);
-
return ps1->Compare(*ps2);
}
@@ -3205,8 +3124,6 @@ FX_BOOL Field::getArray(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -3247,7 +3164,6 @@ FX_BOOL Field::getItemAt(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
int iSize = params.size();
int nIdx = -1;
@@ -3301,8 +3217,6 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt();
@@ -3334,8 +3248,6 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt();
@@ -3373,8 +3285,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -3386,8 +3296,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CPDFSDK_Widget* pWidget = NULL;
if (nCount == 1) {
pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
@@ -3483,12 +3391,7 @@ FX_BOOL Field::source(IJS_Context* cc,
return TRUE;
}
-/////////////////////////////////////////// delay
-////////////////////////////////////////////////
-
void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3499,8 +3402,6 @@ void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) {
}
void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3512,8 +3413,6 @@ void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) {
void Field::AddDelay_String(enum FIELD_PROP prop,
const CFX_ByteString& string) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3525,8 +3424,6 @@ void Field::AddDelay_String(enum FIELD_PROP prop,
void Field::AddDelay_WideString(enum FIELD_PROP prop,
const CFX_WideString& string) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3537,8 +3434,6 @@ void Field::AddDelay_WideString(enum FIELD_PROP prop,
}
void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3549,8 +3444,6 @@ void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) {
}
void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3562,8 +3455,6 @@ void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) {
void Field::AddDelay_WordArray(enum FIELD_PROP prop,
const CFX_DWordArray& array) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3577,8 +3468,6 @@ void Field::AddDelay_WordArray(enum FIELD_PROP prop,
void Field::AddDelay_WideStringArray(enum FIELD_PROP prop,
const CJS_WideStringArray& array) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3590,8 +3479,7 @@ void Field::AddDelay_WideStringArray(enum FIELD_PROP prop,
}
void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) {
- ASSERT(pDocument != NULL);
- ASSERT(pData != NULL);
+ ASSERT(pDocument);
switch (pData->eProp) {
case FP_ALIGNMENT:
@@ -3731,9 +3619,6 @@ void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) {
}
}
-#define JS_FIELD_MINWIDTH 1
-#define JS_FIELD_MINHEIGHT 1
-
void Field::AddField(CPDFSDK_Document* pDocument,
int nPageIndex,
int nFieldType,

Powered by Google App Engine
This is Rietveld 408576698