summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_annot.cpp
diff options
context:
space:
mode:
authortonikitoo <tonikitoo@igalia.com>2016-08-16 13:34:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-16 13:34:35 -0700
commit66c26e84e6e154f0466db6fce4f3f36d445c579a (patch)
treeefa79443b3e0bf04abcb4bade437e75ce30f7cff /core/fpdfdoc/cpdf_annot.cpp
parentf85e7e2ea29179dfe4ddc25ab410f8898391999c (diff)
downloadpdfium-66c26e84e6e154f0466db6fce4f3f36d445c579a.tar.xz
Hidden annotations should not be drawn
Now that PDFium supports drawing of more annotation types, it should also respect the "hidden" flag that annotations might feature. For instance, in IE/Acroread if an annotation is flagged as "hidden" it does not get drawn. CL adds a check for the specific "hidden" flag, not drawing annotation that are flagged with it, in order to match IE + acrobat reader behavior. The "flags" definition can be seen by looking at "/F {value}" syntax in a PDF file source, where {value} is an predefined integer value. Test: PDF files being added in [1]. [1] https://codereview.chromium.org/2239713003/ BUG=62625 Review-Url: https://codereview.chromium.org/2239853002
Diffstat (limited to 'core/fpdfdoc/cpdf_annot.cpp')
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 2b9b936cd1..617ea0fdc3 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -133,11 +133,20 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
matrix.Concat(*pUser2Device);
return pForm;
}
+
+// static
+bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) {
+ return !!(pAnnotDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN);
+}
+
FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
const CFX_Matrix* pUser2Device,
AppearanceMode mode,
const CPDF_RenderOptions* pOptions) {
+ if (IsAnnotationHidden(m_pAnnotDict))
+ return FALSE;
+
CFX_Matrix matrix;
CPDF_Form* pForm =
FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);