diff options
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r-- | fpdfsdk/javascript/Annot.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/Annot.h | 3 | ||||
-rw-r--r-- | fpdfsdk/javascript/Field.cpp | 10 |
3 files changed, 7 insertions, 8 deletions
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp index ab84247baa..d45aa6032a 100644 --- a/fpdfsdk/javascript/Annot.cpp +++ b/fpdfsdk/javascript/Annot.cpp @@ -106,5 +106,5 @@ FX_BOOL Annot::type(IJS_Context* cc, void Annot::SetSDKAnnot(CPDFSDK_BAAnnot* annot) { m_pAnnot = annot; - m_pObserver.reset(new CPDFSDK_Annot::Observer(&m_pAnnot)); + SetWatchedPtr(&m_pAnnot); } diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h index be850350ae..c8b0afb556 100644 --- a/fpdfsdk/javascript/Annot.h +++ b/fpdfsdk/javascript/Annot.h @@ -12,7 +12,7 @@ #include "fpdfsdk/include/cpdfsdk_baannot.h" #include "fpdfsdk/javascript/JS_Define.h" -class Annot : public CJS_EmbedObj { +class Annot : public CJS_EmbedObj, public CPDFSDK_Annot::Observer { public: explicit Annot(CJS_Object* pJSObject); ~Annot() override; @@ -25,7 +25,6 @@ class Annot : public CJS_EmbedObj { private: CPDFSDK_Annot* m_pAnnot = nullptr; - std::unique_ptr<CPDFSDK_Annot::Observer> m_pObserver; }; class CJS_Annot : public CJS_Object { diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 64c7735dcf..1f49482375 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -270,12 +270,12 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument, if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { for (CPDFSDK_Annot* pAnnot : widgets) { FX_BOOL bFormatted = FALSE; - CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); - CPDFSDK_Widget::Observer observer(&pAnnot); - CFX_WideString sValue = pWidget->OnFormat(bFormatted); + CPDFSDK_Annot::Observer observer(&pAnnot); + CFX_WideString sValue = + static_cast<CPDFSDK_Widget*>(pAnnot)->OnFormat(bFormatted); if (pAnnot) { - pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, - FALSE); + static_cast<CPDFSDK_Widget*>(pAnnot)->ResetAppearance( + bFormatted ? sValue.c_str() : nullptr, FALSE); } } } else { |