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

Unified Diff: fpdfsdk/javascript/Annot.cpp

Issue 2306663002: Add observer for BAAnnots from Javascript (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
« fpdfsdk/javascript/Annot.h ('K') | « fpdfsdk/javascript/Annot.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/Annot.cpp
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index a23d42f72abb48a902ae9c9eb3cfc1ae4c4ed28e..587539b6c79749f682db562cb1dd12629f520a54 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -32,6 +32,9 @@ Annot::~Annot() {}
FX_BOOL Annot::hidden(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
+ if (!m_BAAnnot)
+ return FALSE;
+
if (vp.IsGetting()) {
CPDF_Annot* pPDFAnnot = m_BAAnnot->GetPDFAnnot();
vp << CPDF_Annot::IsAnnotationHidden(pPDFAnnot->GetAnnotDict());
@@ -60,6 +63,9 @@ FX_BOOL Annot::hidden(IJS_Context* cc,
FX_BOOL Annot::name(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
+ if (!m_BAAnnot)
+ return FALSE;
+
if (vp.IsGetting()) {
vp << m_BAAnnot->GetAnnotName();
return TRUE;
@@ -80,10 +86,14 @@ FX_BOOL Annot::type(IJS_Context* cc,
return FALSE;
}
+ if (!m_BAAnnot)
+ return FALSE;
+
vp << CPDF_Annot::AnnotSubtypeToString(m_BAAnnot->GetAnnotSubtype());
return TRUE;
}
-void Annot::SetSDKAnnot(CPDFSDK_BAAnnot* annot) {
- m_BAAnnot = annot;
+void Annot::SetSDKAnnot(CPDFSDK_BAAnnot* baannot) {
+ m_BAAnnot = baannot;
Tom Sepez 2016/09/01 18:04:24 m_BAAnnot can't be a widget?
dsinclair 2016/09/01 18:11:58 I don't think so as the Widget inherits from BAAnn
Tom Sepez 2016/09/01 18:12:06 I mean, what if we repalce m_BAAnont with a CPDFSD
+ m_pObserver.reset(new CPDFSDK_BAAnnot::Observer(&m_BAAnnot));
}
« fpdfsdk/javascript/Annot.h ('K') | « fpdfsdk/javascript/Annot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698