summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-07-25 20:25:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-25 20:25:49 +0000
commit35b51e95b9a4d0c064efd905e946a554d6f47890 (patch)
tree820111017d8453b4d369a110e72bf549b16a2b65 /core/fpdfdoc
parenta5d2bf1131fed479195011cbf6463df3612d31f6 (diff)
downloadpdfium-35b51e95b9a4d0c064efd905e946a554d6f47890.tar.xz
Create popup with Contents only for same annotations subtypes.
The subtypes are listed in "PDF Reference 1.7", page 617. Bug: chromium:856331 Change-Id: I41d6094949ff22007a72ef7c1493c413c5af5f7b Reviewed-on: https://pdfium-review.googlesource.com/38790 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 5fbe69977a..496fcc6db3 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -28,9 +28,48 @@
namespace {
+bool PopupAppearsForAnnotType(CPDF_Annot::Subtype subtype) {
+ switch (subtype) {
+ case CPDF_Annot::Subtype::TEXT:
+ case CPDF_Annot::Subtype::LINE:
+ case CPDF_Annot::Subtype::SQUARE:
+ case CPDF_Annot::Subtype::CIRCLE:
+ case CPDF_Annot::Subtype::POLYGON:
+ case CPDF_Annot::Subtype::POLYLINE:
+ case CPDF_Annot::Subtype::HIGHLIGHT:
+ case CPDF_Annot::Subtype::UNDERLINE:
+ case CPDF_Annot::Subtype::SQUIGGLY:
+ case CPDF_Annot::Subtype::STRIKEOUT:
+ case CPDF_Annot::Subtype::STAMP:
+ case CPDF_Annot::Subtype::CARET:
+ case CPDF_Annot::Subtype::INK:
+ case CPDF_Annot::Subtype::FILEATTACHMENT:
+ return true;
+ case CPDF_Annot::Subtype::UNKNOWN:
+ case CPDF_Annot::Subtype::LINK:
+ case CPDF_Annot::Subtype::FREETEXT:
+ case CPDF_Annot::Subtype::POPUP:
+ case CPDF_Annot::Subtype::SOUND:
+ case CPDF_Annot::Subtype::MOVIE:
+ case CPDF_Annot::Subtype::WIDGET:
+ case CPDF_Annot::Subtype::SCREEN:
+ case CPDF_Annot::Subtype::PRINTERMARK:
+ case CPDF_Annot::Subtype::TRAPNET:
+ case CPDF_Annot::Subtype::WATERMARK:
+ case CPDF_Annot::Subtype::THREED:
+ case CPDF_Annot::Subtype::RICHMEDIA:
+ case CPDF_Annot::Subtype::XFAWIDGET:
+ default:
+ return false;
+ }
+}
+
std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot,
CPDF_Document* pDocument,
CPDF_Page* pPage) {
+ if (!PopupAppearsForAnnotType(pAnnot->GetSubtype()))
+ return nullptr;
+
CPDF_Dictionary* pParentDict = pAnnot->GetAnnotDict();
if (!pParentDict)
return nullptr;