Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: core/fpdfdoc/cpdf_annot.cpp

Issue 2310873002: Move ShouldGenerateAPForAnnotation check to CPDF_Annot::GenerateAPIfNeeded (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fpdfdoc/cpvt_generateap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_annot.cpp
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 942d334a2d87c9b206131c9e52e6719050b2d29c..4e0b04e9b623195c36ff47093d66f53cf7d53941 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -18,6 +18,19 @@
#include "core/fxge/include/cfx_pathdata.h"
#include "core/fxge/include/cfx_renderdevice.h"
+namespace {
+
+bool ShouldGenerateAPForAnnotation(CPDF_Dictionary* pAnnotDict) {
+ // If AP dictionary exists, we use the appearance defined in the
+ // existing AP dictionary.
+ if (pAnnotDict->KeyExist("AP"))
+ return false;
+
+ return !CPDF_Annot::IsAnnotationHidden(pAnnotDict);
+}
+
+} // namespace
+
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict,
CPDF_Document* pDocument,
bool bToOwnDict)
@@ -37,6 +50,9 @@ CPDF_Annot::~CPDF_Annot() {
}
void CPDF_Annot::GenerateAPIfNeeded() {
+ if (!ShouldGenerateAPForAnnotation(m_pAnnotDict))
+ return;
+
if (m_nSubtype == CPDF_Annot::Subtype::CIRCLE)
CPVT_GenerateAP::GenerateCircleAP(m_pDocument, m_pAnnotDict);
else if (m_nSubtype == CPDF_Annot::Subtype::HIGHLIGHT)
@@ -149,7 +165,7 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
return pForm;
}
-// static
+// Static.
bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) {
return !!(pAnnotDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN);
}
« no previous file with comments | « no previous file | core/fpdfdoc/cpvt_generateap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698