From 75f84a56fed36111ece82d0ac96e87289622b093 Mon Sep 17 00:00:00 2001 From: jaepark Date: Fri, 9 Sep 2016 15:39:09 -0700 Subject: Define behaviors of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. Previously, PDFium only supported widget annotations to draw forms. As we've implemented other annotations, the behavior of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw changed. So, this CL clearly defines what needs to be done in FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. This CL first assumes that PDFium users will always call FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw to render PDF pages, because otherwise they are not able to support PDF forms. FPDF_RenderPageBitmap_Retail should only deal with non-widget annotations, such as highlight, underline, text, etc. If FPDF_ANNOT flag is passed, non-widget annotations are drawn. Otherwise, they are hidden. FPDF_FFLDraw should only deal with annotations that requires user-interaction, such as widget annotations and popup annotation. Since popup annotation is associated with non-widget annotation, they should not be drawn if the associated annotation is hidden. Thus, if FPDF_ANNOT flag is passed, popup annotations are drawn. Otherwise, they are hidden. Widget annotations should be always drawn regardless of FPDF_ANNOT flag since they need to be always displayed for PDF forms. Also, roll DEPS for testing/corpus to 8485b30. BUG=pdfium:594 Review-Url: https://codereview.chromium.org/2323203002 --- fpdfsdk/include/cpdfsdk_annothandlermgr.h | 3 ++- fpdfsdk/include/cpdfsdk_baannothandler.h | 3 ++- fpdfsdk/include/cpdfsdk_widgethandler.h | 3 ++- fpdfsdk/include/cpdfsdk_xfawidgethandler.h | 3 ++- fpdfsdk/include/ipdfsdk_annothandler.h | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) (limited to 'fpdfsdk/include') diff --git a/fpdfsdk/include/cpdfsdk_annothandlermgr.h b/fpdfsdk/include/cpdfsdk_annothandlermgr.h index 540bd985ac..f4be66a432 100644 --- a/fpdfsdk/include/cpdfsdk_annothandlermgr.h +++ b/fpdfsdk/include/cpdfsdk_annothandlermgr.h @@ -48,7 +48,8 @@ class CPDFSDK_AnnotHandlerMgr { virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device); + CFX_Matrix* pUser2Device, + bool bDrawAnnots); virtual void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, diff --git a/fpdfsdk/include/cpdfsdk_baannothandler.h b/fpdfsdk/include/cpdfsdk_baannothandler.h index 5425b0bf36..ba50df3ccb 100644 --- a/fpdfsdk/include/cpdfsdk_baannothandler.h +++ b/fpdfsdk/include/cpdfsdk_baannothandler.h @@ -44,7 +44,8 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; + CFX_Matrix* pUser2Device, + bool bDrawAnnots) override; void OnCreate(CPDFSDK_Annot* pAnnot) override; void OnLoad(CPDFSDK_Annot* pAnnot) override; void OnDelete(CPDFSDK_Annot* pAnnot) override; diff --git a/fpdfsdk/include/cpdfsdk_widgethandler.h b/fpdfsdk/include/cpdfsdk_widgethandler.h index b8cb182bf9..d34510d092 100644 --- a/fpdfsdk/include/cpdfsdk_widgethandler.h +++ b/fpdfsdk/include/cpdfsdk_widgethandler.h @@ -44,7 +44,8 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; + CFX_Matrix* pUser2Device, + bool bDrawAnnots) override; void OnCreate(CPDFSDK_Annot* pAnnot) override; void OnLoad(CPDFSDK_Annot* pAnnot) override; void OnDelete(CPDFSDK_Annot* pAnnot) override; diff --git a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h index 10eb1eeb87..dec2675ed8 100644 --- a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h +++ b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h @@ -39,7 +39,8 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; + CFX_Matrix* pUser2Device, + bool bDrawAnnots) override; void OnCreate(CPDFSDK_Annot* pAnnot) override; void OnLoad(CPDFSDK_Annot* pAnnot) override; void OnDelete(CPDFSDK_Annot* pAnnot) override; diff --git a/fpdfsdk/include/ipdfsdk_annothandler.h b/fpdfsdk/include/ipdfsdk_annothandler.h index 289d48007f..d2f9010b76 100644 --- a/fpdfsdk/include/ipdfsdk_annothandler.h +++ b/fpdfsdk/include/ipdfsdk_annothandler.h @@ -43,7 +43,8 @@ class IPDFSDK_AnnotHandler { virtual void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) = 0; + CFX_Matrix* pUser2Device, + bool bDrawAnnots) = 0; virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0; virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0; virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0; -- cgit v1.2.3