diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-13 15:49:36 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-13 15:49:36 -0700 |
commit | 468e5896007c7fe7bb283c0161d807a76f403308 (patch) | |
tree | ae287c896702c071e58766fd2643ab7a803c9a66 | |
parent | 3342090d65e852f3f37a8f04d3fbe3ff2467d05c (diff) | |
download | pdfium-468e5896007c7fe7bb283c0161d807a76f403308.tar.xz |
Changes to XFA to more closely match master.
These files should change in XFA in order to reduce the number of
"noise diffs" between master and XFA as seen in
https://codereview.chromium.org/1399273003/
These include: blank lines and missed merges:
3c012fe else-after-returns (partial)
fb07e28 Tidy up CPDFDOC_Environment (partial, consts missing).
624b166 Allow FPDFBookmark_GetFirstChild to return the top level bookmark
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1403063003 .
-rw-r--r-- | fpdfsdk/include/fsdk_mgr.h | 10 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_TextField.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/fpdf_ext.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/fpdf_flatten.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/src/fpdf_transformpage.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfdoc.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfeditimg.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfformfill.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/src/fsdk_mgr.cpp | 1 |
9 files changed, 12 insertions, 17 deletions
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index aceb40fa3c..01579dcc7a 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -77,7 +77,7 @@ class CPDFDoc_Environment final { m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); } - FX_SYSTEMTIME FFI_GetLocalTime() { + FX_SYSTEMTIME FFI_GetLocalTime() const { FX_SYSTEMTIME fxtime; if (m_pInfo && m_pInfo->FFI_GetLocalTime) { FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo); @@ -98,19 +98,19 @@ class CPDFDoc_Environment final { m_pInfo->FFI_OnChange(m_pInfo); } - FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) { + FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) const { return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; } - FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) { + FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) const { return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; } - FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) { + FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) const { return (nFlag & FWL_EVENTFLAG_AltKey) != 0; } - FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) { return FALSE; } + FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) const { return FALSE; } int JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 3778c61312..6a786901ca 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -129,9 +129,8 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, if (CommitData(pPageView, nFlags)) { DestroyPDFWindow(pPageView); return TRUE; - } else { - return FALSE; } + return FALSE; } } break; diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp index 210c28dc43..f68a45f119 100644 --- a/fpdfsdk/src/fpdf_ext.cpp +++ b/fpdfsdk/src/fpdf_ext.cpp @@ -151,7 +151,8 @@ void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code) { if (pNameDict && pNameDict->KeyExist("EmbeddedFiles")) { FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT); return; - } else if (pNameDict && pNameDict->KeyExist("JavaScript")) { + } + if (pNameDict && pNameDict->KeyExist("JavaScript")) { CPDF_Dictionary* pJSDict = pNameDict->GetDict("JavaScript"); CPDF_Array* pArray = pJSDict ? pJSDict->GetArray("Names") : NULL; if (pArray) { diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index 3619ef4a99..73410b6c39 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.cpp @@ -362,12 +362,10 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (!rcOriginalMB.IsEmpty()) { CPDF_Array* pMediaBox = new CPDF_Array(); - pMediaBox->Add(new CPDF_Number(rcOriginalMB.left)); pMediaBox->Add(new CPDF_Number(rcOriginalMB.bottom)); pMediaBox->Add(new CPDF_Number(rcOriginalMB.right)); pMediaBox->Add(new CPDF_Number(rcOriginalMB.top)); - pPageDict->SetAt("MediaBox", pMediaBox); } @@ -380,8 +378,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { pPageDict->SetAt("ArtBox", pCropBox); } - CPDF_Dictionary* pRes = NULL; - pRes = pPageDict->GetDict("Resources"); + CPDF_Dictionary* pRes = pPageDict->GetDict("Resources"); if (!pRes) { pRes = new CPDF_Dictionary; pPageDict->SetAt("Resources", pRes); diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp index 7c13cb4170..d02876d740 100644 --- a/fpdfsdk/src/fpdf_transformpage.cpp +++ b/fpdfsdk/src/fpdf_transformpage.cpp @@ -140,7 +140,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(); @@ -311,7 +310,6 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, pContentArray = (CPDF_Array*)pContentObj; CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); pContentArray->InsertAt(0, pRef); - } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) { CPDF_Reference* pReference = (CPDF_Reference*)pContentObj; CPDF_Object* pDirectObj = pReference->GetDirect(); @@ -320,7 +318,6 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, pContentArray = (CPDF_Array*)pDirectObj; CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); pContentArray->InsertAt(0, pRef); - } else if (pDirectObj->GetType() == PDFOBJ_STREAM) { pContentArray = new CPDF_Array(); pContentArray->AddReference(pDoc, pStream->GetObjNum()); diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp index 34caf95b52..568622b842 100644 --- a/fpdfsdk/src/fpdfdoc.cpp +++ b/fpdfsdk/src/fpdfdoc.cpp @@ -54,7 +54,7 @@ CPDF_LinkList* GetLinkList(CPDF_Page* page) { DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) { - if (!document || !pDict) + if (!document) return NULL; CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); CPDF_BookmarkTree tree(pDoc); diff --git a/fpdfsdk/src/fpdfeditimg.cpp b/fpdfsdk/src/fpdfeditimg.cpp index 170a2dda8d..269b382d89 100644 --- a/fpdfsdk/src/fpdfeditimg.cpp +++ b/fpdfsdk/src/fpdfeditimg.cpp @@ -28,7 +28,6 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, return FALSE; IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); - CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object; pImgObj->m_GeneralState.GetModify(); for (int index = 0; index < nCount; index++) { diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index 51d90b7eab..07b58c1a68 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -639,6 +639,7 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, CPDF_Dictionary* pDic = pDoc->GetRoot(); if (!pDic) return; + CPDF_AAction aa = pDic->GetDict(FX_BSTRC("AA")); if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 2ab9d8bf78..c1ab1bd780 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -122,6 +122,7 @@ void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) { CPDF_Point righttop = CPDF_Point(rect.right, rect.top); CPDF_Point ptA = pFFL->PWLtoFFL(leftbottom); CPDF_Point ptB = pFFL->PWLtoFFL(righttop); + CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot(); ASSERT(pAnnot); CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage(); |