summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_annothandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-23 14:42:09 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-23 14:42:09 -0700
commit2f2ffece124e4ed4b96d2846263015d4b5ad6c00 (patch)
tree6966e44279e8d9e1516b7c71219cf66f77a89ca2 /fpdfsdk/src/fsdk_annothandler.cpp
parentd07958fd2d1c4134d865f4ccb056eb925aaa7d2a (diff)
downloadpdfium-2f2ffece124e4ed4b96d2846263015d4b5ad6c00.tar.xz
Merge to XFA - else after returns.
(cherry picked from commit 3c012fef2bb72c8ec1faa73e11ee35539b2559d6) Original Review URL: https://codereview.chromium.org/1243953004 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1239313005 .
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp75
1 files changed, 22 insertions, 53 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 50ef9cf3c1..ebdd67e4ef 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -309,35 +309,18 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
if (pAnnotHandler->OnSetFocus(pAnnot, nFlag))
{
CPDFSDK_PageView* pPage = pAnnot->GetPageView();
- ASSERT(pPage != NULL);
-
pPage->GetSDKDocument();
- // pDocument->SetTopmostAnnot(pAnnot);
-
return TRUE;
}
- else
- {
- return FALSE;
- }
}
-
return FALSE;
}
FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag)
{
- ASSERT(pAnnot != NULL);
-
+ ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
- {
- if (pAnnotHandler->OnKillFocus(pAnnot, nFlag))
- {
- return TRUE;
- }
- else
- return FALSE;
- }
+ return pAnnotHandler->OnKillFocus(pAnnot, nFlag);
return FALSE;
}
@@ -360,9 +343,8 @@ CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
{
ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
- {
return pAnnotHandler->GetViewBBox(pPageView, pAnnot);
- }
+
return pAnnot->GetRect();
}
@@ -371,7 +353,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
ASSERT(pAnnot);
if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot))
{
- if(pAnnotHandler->CanAnswer(pAnnot))
+ if (pAnnotHandler->CanAnswer(pAnnot))
return pAnnotHandler->HitTest(pPageView, pAnnot, point);
}
return FALSE;
@@ -407,38 +389,26 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot)
{
- ASSERT(pAnnot);
ASSERT(pAnnot->GetType() == "Widget");
- CFX_ByteString sSubType = pAnnot->GetSubType();
-
- if (sSubType == BFFT_SIGNATURE)
- {
- }
- else
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (!pWidget->IsVisible()) return FALSE;
+ if (pAnnot->GetSubType() == BFFT_SIGNATURE)
+ return FALSE;
- int nFieldFlags = pWidget->GetFieldFlags();
- if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FALSE;
- if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return TRUE;
- else
- {
- CPDF_Page* pPage = pWidget->GetPDFPage();
- ASSERT(pPage != NULL);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (!pWidget->IsVisible())
+ return FALSE;
- CPDF_Document* pDocument = pPage->m_pDocument;
- ASSERT(pDocument != NULL);
+ int nFieldFlags = pWidget->GetFieldFlags();
+ if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
+ return FALSE;
- FX_DWORD dwPermissions = pDocument->GetUserPermissions();
- return (dwPermissions&FPDFPERM_FILL_FORM) ||
- (dwPermissions&FPDFPERM_ANNOT_FORM) ||
- (dwPermissions&FPDFPERM_ANNOT_FORM);
- }
- }
+ if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
+ return TRUE;
- return FALSE;
+ CPDF_Page* pPage = pWidget->GetPDFPage();
+ CPDF_Document* pDocument = pPage->m_pDocument;
+ FX_DWORD dwPermissions = pDocument->GetUserPermissions();
+ return (dwPermissions & FPDFPERM_FILL_FORM) ||
+ (dwPermissions & FPDFPERM_ANNOT_FORM);
}
CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage)
@@ -1338,12 +1308,11 @@ void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp
int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2)
{
- if(p1->GetLayoutOrder() < p2->GetLayoutOrder())
+ if (p1->GetLayoutOrder() < p2->GetLayoutOrder())
return -1;
- else if (p1->GetLayoutOrder() == p2->GetLayoutOrder())
- return 0;
- else
+ if (p1->GetLayoutOrder() > p2->GetLayoutOrder())
return 1;
+ return 0;
}
FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView,CFX_PtrArray * pAnnotList)