summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-14 13:54:22 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-14 13:54:22 -0700
commiteca866c64ec0319d4723798290a3155957fa733e (patch)
tree59c7bb72df8d4df62934ab4002108a57bf2df37e
parentae2d47b22d213cb36a66326c3167cfbbae90b9d4 (diff)
downloadpdfium-eca866c64ec0319d4723798290a3155957fa733e.tar.xz
Next round of master changes to match XFA
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1401423004 .
-rw-r--r--fpdfsdk/include/fsdk_define.h4
-rw-r--r--fpdfsdk/include/fsdk_mgr.h1
-rw-r--r--fpdfsdk/src/fpdf_dataavail.cpp1
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp1
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp1
-rw-r--r--fpdfsdk/src/fpdfview.cpp30
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp21
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp6
-rw-r--r--fpdfsdk/src/javascript/JS_Define.h18
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp43
-rw-r--r--fpdfsdk/src/javascript/app.cpp9
11 files changed, 47 insertions, 88 deletions
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index d2af1e17f7..12e3f2732d 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -10,7 +10,6 @@
#include "../../core/include/fpdfapi/fpdf_module.h"
#include "../../core/include/fpdfapi/fpdf_pageobj.h"
#include "../../core/include/fpdfapi/fpdf_parser.h"
-#include "../../core/include/fpdfapi/fpdf_parser.h"
#include "../../core/include/fpdfapi/fpdf_render.h"
#include "../../core/include/fpdfapi/fpdf_serial.h"
#include "../../core/include/fpdfapi/fpdfapi.h"
@@ -48,10 +47,9 @@ class CPDF_CustomAccess final : public IFX_FileRead {
CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
~CPDF_CustomAccess() override {}
+ // IFX_FileRead
FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; }
-
void Release() override { delete this; }
-
FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
private:
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index ca9a8cc263..5ddc8e6c57 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -325,7 +325,6 @@ class CPDFSDK_PageView final {
int GetPageIndex();
void LoadFXAnnots();
-
void SetValid(FX_BOOL bValid) { m_bValid = bValid; }
FX_BOOL IsValid() { return m_bValid; }
void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; }
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp
index 9ce298d0c5..5343723476 100644
--- a/fpdfsdk/src/fpdf_dataavail.cpp
+++ b/fpdfsdk/src/fpdf_dataavail.cpp
@@ -5,6 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../public/fpdf_dataavail.h"
+#include "../../public/fpdf_formfill.h"
#include "../include/fsdk_define.h"
class CFPDF_FileAvailWrap : public IFX_FileAvail {
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index d0dee59d0d..4a892f1320 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -138,7 +138,6 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc, pEndStream);
-
} else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) {
CPDF_Reference* pReference = (CPDF_Reference*)pContentObj;
CPDF_Object* pDirectObj = pReference->GetDirect();
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index cca4834f54..37af1fbf95 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -9,7 +9,6 @@
#include "../../third_party/base/nonstd_unique_ptr.h"
#include "../include/fsdk_define.h"
#include "../include/fsdk_mgr.h"
-#include "../include/javascript/IJavaScript.h"
namespace {
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index dfa91d1243..84dabe6864 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -64,30 +64,6 @@ FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy) {
CCodec_ModuleMgr* g_pCodecModule = nullptr;
-#if _FX_OS_ == _FX_LINUX_EMBEDDED_
-class CFontMapper : public IPDF_FontMapper {
- public:
- CFontMapper();
- ~CFontMapper() override;
-
- // IPDF_FontMapper
- FT_Face FindSubstFont(
- CPDF_Document* pDoc, // [IN] The PDF document
- const CFX_ByteString& face_name, // [IN] Original name
- FX_BOOL bTrueType, // [IN] TrueType or Type1
- FX_DWORD flags, // [IN] PDF font flags (see PDF Reference section 5.7.1)
- int font_weight, // [IN] original font weight. 0 for not specified
- int CharsetCP, // [IN] code page for charset (see Win32 GetACP())
- FX_BOOL bVertical,
- CPDF_SubstFont* pSubstFont // [OUT] Subst font data
- ) override;
-
- FT_Face m_SysFace;
-};
-
-CFontMapper* g_pFontMapper = NULL;
-#endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_
-
DLLEXPORT void STDCALL FPDF_InitLibrary() {
FPDF_InitLibraryWithConfig(nullptr);
}
@@ -115,10 +91,6 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
}
DLLEXPORT void STDCALL FPDF_DestroyLibrary() {
-#if _FX_OS_ == _FX_LINUX_EMBEDDED_
- delete g_pFontMapper;
- g_pFontMapper = nullptr;
-#endif
CPDF_ModuleMgr::Destroy();
CFX_GEModule::Destroy();
@@ -203,7 +175,7 @@ class CMemFile final : public IFX_FileRead {
}
private:
- ~CMemFile() {}
+ ~CMemFile() override {}
uint8_t* m_pBuf;
FX_FILESIZE m_size;
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index f6b6b14483..7d0346c797 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -38,7 +38,7 @@ CPDFSDK_Widget::~CPDFSDK_Widget() {}
FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
CPDF_Annot::AppearanceMode mode) {
CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
- if (pAP == NULL)
+ if (!pAP)
return FALSE;
// Choose the right sub-ap
@@ -52,7 +52,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
// Get the AP stream or subdirectory
CPDF_Object* psub = pAP->GetElementValue(ap_entry);
- if (psub == NULL)
+ if (!psub)
return FALSE;
int nFieldType = GetFieldType();
@@ -71,7 +71,6 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
}
return FALSE;
}
-
return TRUE;
}
@@ -186,15 +185,11 @@ FX_FLOAT CPDFSDK_Widget::GetFontSize() const {
int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
CPDF_FormField* pFormField = GetFormField();
- ASSERT(pFormField != NULL);
-
return pFormField->GetSelectedIndex(nIndex);
}
CFX_WideString CPDFSDK_Widget::GetValue() const {
CPDF_FormField* pFormField = GetFormField();
- ASSERT(pFormField != NULL);
-
return pFormField->GetValue();
}
@@ -221,8 +216,6 @@ int CPDFSDK_Widget::CountOptions() const {
FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
CPDF_FormField* pFormField = GetFormField();
- ASSERT(pFormField != NULL);
-
return pFormField->IsItemSelected(nIndex);
}
@@ -1464,19 +1457,11 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
if (action && action.GetType() != CPDF_Action::Unknown) {
CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
- ASSERT(pDocument != NULL);
-
CPDFDoc_Environment* pEnv = pDocument->GetEnv();
- ASSERT(pEnv != NULL);
-
- CPDFSDK_ActionHandler* pActionHandler =
- pEnv->GetActionHander(); /*(CPDFSDK_ActionHandler*)pApp->GetActionHandler();*/
- ASSERT(pActionHandler != NULL);
-
+ CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
return pActionHandler->DoAction_Field(action, type, pDocument,
GetFormField(), data);
}
-
return FALSE;
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index b7962d57f7..883ad60a93 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -6,9 +6,9 @@
#include "../../public/fpdf_ext.h"
#include "../../third_party/base/nonstd_unique_ptr.h"
+#include "../include/formfiller/FFL_FormFiller.h"
#include "../include/fsdk_define.h"
#include "../include/fsdk_mgr.h"
-#include "../include/formfiller/FFL_FormFiller.h"
#include "../include/javascript/IJavaScript.h"
#if _FX_OS_ == _FX_ANDROID_
@@ -660,11 +660,9 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
CPDFSDK_AnnotIterator annotIterator(this, TRUE);
- CPDFSDK_Annot* pSDKAnnot = nullptr;
int index = -1;
- while ((pSDKAnnot = annotIterator.Next(index))) {
+ while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next(index)) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
- ASSERT(pAnnotHandlerMgr);
pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device, 0);
}
}
diff --git a/fpdfsdk/src/javascript/JS_Define.h b/fpdfsdk/src/javascript/JS_Define.h
index 3e5b797d07..b21f894ec8 100644
--- a/fpdfsdk/src/javascript/JS_Define.h
+++ b/fpdfsdk/src/javascript/JS_Define.h
@@ -71,9 +71,8 @@ struct JSMethodSpec {
} \
;
-template <
- class C,
- FX_BOOL (C::*M)(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)>
+template <class C,
+ FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -97,9 +96,8 @@ void JSPropGetter(const char* prop_name_string,
info.GetReturnValue().Set((v8::Local<v8::Value>)value);
}
-template <
- class C,
- FX_BOOL (C::*M)(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)>
+template <class C,
+ FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -137,10 +135,10 @@ void JSPropSetter(const char* prop_name_string,
}
template <class C,
- FX_BOOL (C::*M)(IJS_Context* cc,
- const CJS_Parameters& params,
- CJS_Value& vRet,
- CFX_WideString& sError)>
+ FX_BOOL (C::*M)(IJS_Context*,
+ const CJS_Parameters&,
+ CJS_Value&,
+ CFX_WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 4743d3dff3..e898214cd8 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -48,14 +48,31 @@ END_JS_STATIC_GLOBAL_FUN()
IMPLEMENT_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods)
-static const FX_WCHAR* months[] = {L"Jan", L"Feb", L"Mar", L"Apr",
- L"May", L"Jun", L"Jul", L"Aug",
- L"Sep", L"Oct", L"Nov", L"Dec"};
-
-static const FX_WCHAR* fullmonths[] = {L"January", L"February", L"March",
- L"April", L"May", L"June",
- L"July", L"August", L"September",
- L"October", L"November", L"December"};
+static const FX_WCHAR* const months[] = {L"Jan",
+ L"Feb",
+ L"Mar",
+ L"Apr",
+ L"May",
+ L"Jun",
+ L"Jul",
+ L"Aug",
+ L"Sep",
+ L"Oct",
+ L"Nov",
+ L"Dec"};
+
+static const FX_WCHAR* const fullmonths[] = {L"January",
+ L"February",
+ L"March",
+ L"April",
+ L"May",
+ L"June",
+ L"July",
+ L"August",
+ L"September",
+ L"October",
+ L"November",
+ L"December"};
FX_BOOL CJS_PublicMethods::IsNumber(const FX_WCHAR* string) {
CFX_WideString sTrim = StrTrim(string);
@@ -984,10 +1001,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
else
cSeperator = '.';
- int iDecPositive;
- iDecPositive = iDec2;
-
- for (iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
+ for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
strValue.Insert(iDecPositive, cSeperator);
iMax++;
}
@@ -1273,10 +1287,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(IJS_Context* cc,
else
cSeperator = '.';
- int iDecPositive;
- iDecPositive = iDec2;
-
- for (iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
+ for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
strValue.Insert(iDecPositive, cSeperator);
iMax++;
}
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index 3db1e5b956..1bd089a431 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -194,12 +194,11 @@ FX_BOOL app::viewerVariation(IJS_Context* cc,
FX_BOOL app::viewerVersion(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- if (vp.IsGetting()) {
- vp << JS_NUM_VIEWERVERSION;
- return TRUE;
- }
+ if (!vp.IsGetting())
+ return FALSE;
- return FALSE;
+ vp << JS_NUM_VIEWERVERSION;
+ return TRUE;
}
FX_BOOL app::platform(IJS_Context* cc,