Pass observed pointers by non-const ref.

Currently, we pass these as pointer to ObservedPtr<> per the old style
guide recomendation, but this has lead to at least one bug where this
pointer to pointer arrangement checked the wrong level of pointer.
The style guide now permits this, but we still like to use sparingly.

Change-Id: I11d289042264872063074e68b56736233bff500a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85392
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/observed_ptr.h b/core/fxcrt/observed_ptr.h
index e45cad6..6298c46 100644
--- a/core/fxcrt/observed_ptr.h
+++ b/core/fxcrt/observed_ptr.h
@@ -39,6 +39,8 @@
 };
 
 // Simple case of a self-nulling pointer.
+// Generally, pass ObservedPtr<> by non-const reference since this saves
+// considerable work compared to pass by value.
 template <typename T>
 class ObservedPtr final : public Observable::ObserverIface {
  public:
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index cc2841b..8d374d1 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -128,75 +128,75 @@
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnLButtonDown(pAnnot, nFlags, point);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnLButtonDown(pAnnot, nFlags, point);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnLButtonUp(pAnnot, nFlags, point);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnLButtonUp(pAnnot, nFlags, point);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnLButtonDblClk(pAnnot, nFlags, point);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnLButtonDblClk(pAnnot, nFlags, point);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnMouseMove(pAnnot, nFlags, point);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnMouseMove(pAnnot, nFlags, point);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point,
     const CFX_Vector& delta) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())
       ->OnMouseWheel(pAnnot, nFlags, point, delta);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnRButtonDown(pAnnot, nFlags, point);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnRButtonDown(pAnnot, nFlags, point);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnRButtonUp(pAnnot, nFlags, point);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnRButtonUp(pAnnot, nFlags, point);
 }
 
 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlag) {
-  DCHECK(pAnnot->HasObservable());
-  GetAnnotHandler(pAnnot->Get())->OnMouseEnter(pAnnot, nFlag);
+  DCHECK(pAnnot);
+  GetAnnotHandler(pAnnot.Get())->OnMouseEnter(pAnnot, nFlag);
 }
 
 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlag) {
-  DCHECK(pAnnot->HasObservable());
-  GetAnnotHandler(pAnnot->Get())->OnMouseExit(pAnnot, nFlag);
+  DCHECK(pAnnot);
+  GetAnnotHandler(pAnnot.Get())->OnMouseExit(pAnnot, nFlag);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot,
@@ -212,39 +212,39 @@
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlag) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnSetFocus(pAnnot, nFlag);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlag) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->OnKillFocus(pAnnot, nFlag);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_SetIndexSelected(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     int index,
     bool selected) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())
       ->SetIndexSelected(pAnnot, index, selected);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_IsIndexSelected(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     int index) {
-  DCHECK(pAnnot->HasObservable());
-  return GetAnnotHandler(pAnnot->Get())->IsIndexSelected(pAnnot, index);
+  DCHECK(pAnnot);
+  return GetAnnotHandler(pAnnot.Get())->IsIndexSelected(pAnnot, index);
 }
 
 #ifdef PDF_ENABLE_XFA
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(
-    ObservedPtr<CPDFSDK_Annot>* pSetAnnot) {
-  CPDFXFA_Widget* pSetXFAWidget = ToXFAWidget(pSetAnnot->Get());
+    ObservedPtr<CPDFSDK_Annot>& pSetAnnot) {
+  CPDFXFA_Widget* pSetXFAWidget = ToXFAWidget(pSetAnnot.Get());
   const bool bXFA = pSetXFAWidget && pSetXFAWidget->GetXFAFFWidget();
   return !bXFA || m_pXFAWidgetHandler->OnXFAChangedFocus(pSetAnnot);
 }
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 54a790e..a1c8331 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -61,30 +61,30 @@
                     const CFX_Matrix& mtUser2Device,
                     bool bDrawAnnots);
 
-  void Annot_OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void Annot_OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                           Mask<FWL_EVENTFLAG> nFlags);
-  void Annot_OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void Annot_OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                          Mask<FWL_EVENTFLAG> nFlags);
-  bool Annot_OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlags,
                            const CFX_PointF& point);
-  bool Annot_OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                          Mask<FWL_EVENTFLAG> nFlags,
                          const CFX_PointF& point);
-  bool Annot_OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                              Mask<FWL_EVENTFLAG> nFlags,
                              const CFX_PointF& point);
-  bool Annot_OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                          Mask<FWL_EVENTFLAG> nFlags,
                          const CFX_PointF& point);
-  bool Annot_OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                           Mask<FWL_EVENTFLAG> nFlags,
                           const CFX_PointF& point,
                           const CFX_Vector& delta);
-  bool Annot_OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlags,
                            const CFX_PointF& point);
-  bool Annot_OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                          Mask<FWL_EVENTFLAG> nFlags,
                          const CFX_PointF& point);
   bool Annot_OnChar(CPDFSDK_Annot* pAnnot,
@@ -93,17 +93,17 @@
   bool Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
                        FWL_VKEYCODE nKeyCode,
                        Mask<FWL_EVENTFLAG> nFlag);
-  bool Annot_OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                         Mask<FWL_EVENTFLAG> nFlag);
-  bool Annot_OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                          Mask<FWL_EVENTFLAG> nFlag);
-  bool Annot_SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool Annot_SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                               int index,
                               bool selected);
-  bool Annot_IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index);
+  bool Annot_IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot, int index);
 
 #ifdef PDF_ENABLE_XFA
-  bool Annot_OnChangeFocus(ObservedPtr<CPDFSDK_Annot>* pSetAnnot);
+  bool Annot_OnChangeFocus(ObservedPtr<CPDFSDK_Annot>& pSetAnnot);
 #endif  // PDF_ENABLE_XFA
 
   CFX_FloatRect Annot_OnGetViewBBox(CPDFSDK_Annot* pAnnot);
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 1e9b654..24a05f5 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -90,64 +90,64 @@
   }
 }
 
-void CPDFSDK_BAAnnotHandler::OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+void CPDFSDK_BAAnnotHandler::OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                           Mask<FWL_EVENTFLAG> nFlag) {
-  CPDFSDK_BAAnnot* pBAAnnot = (*pAnnot)->AsBAAnnot();
+  CPDFSDK_BAAnnot* pBAAnnot = pAnnot->AsBAAnnot();
   pBAAnnot->SetOpenState(true);
   UpdateAnnotRects(pBAAnnot);
 }
 
-void CPDFSDK_BAAnnotHandler::OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+void CPDFSDK_BAAnnotHandler::OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlag) {
-  CPDFSDK_BAAnnot* pBAAnnot = (*pAnnot)->AsBAAnnot();
+  CPDFSDK_BAAnnot* pBAAnnot = pAnnot->AsBAAnnot();
   pBAAnnot->SetOpenState(false);
   UpdateAnnotRects(pBAAnnot);
 }
 
-bool CPDFSDK_BAAnnotHandler::OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                            Mask<FWL_EVENTFLAG> nFlags,
                                            const CFX_PointF& point) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlags,
                                          const CFX_PointF& point) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlags,
                                              const CFX_PointF& point) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlags,
                                          const CFX_PointF& point) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                           Mask<FWL_EVENTFLAG> nFlags,
                                           const CFX_PointF& point,
                                           const CFX_Vector& delta) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                            Mask<FWL_EVENTFLAG> nFlags,
                                            const CFX_PointF& point) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlags,
                                          const CFX_PointF& point) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlags,
                                              const CFX_PointF& point) {
   return false;
@@ -211,34 +211,34 @@
   }
 }
 
-bool CPDFSDK_BAAnnotHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlag) {
-  if (!IsFocusableAnnot(pAnnot->Get()->GetAnnotSubtype()))
+  if (!IsFocusableAnnot(pAnnot->GetAnnotSubtype()))
     return false;
 
   is_annotation_focused_ = true;
-  InvalidateRect(pAnnot->Get());
+  InvalidateRect(pAnnot.Get());
   return true;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlag) {
-  if (!IsFocusableAnnot(pAnnot->Get()->GetAnnotSubtype()))
+  if (!IsFocusableAnnot(pAnnot->GetAnnotSubtype()))
     return false;
 
   is_annotation_focused_ = false;
-  InvalidateRect(pAnnot->Get());
+  InvalidateRect(pAnnot.Get());
   return true;
 }
 
 bool CPDFSDK_BAAnnotHandler::SetIndexSelected(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     int index,
     bool selected) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_BAAnnotHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              int index) {
   return false;
 }
@@ -293,7 +293,7 @@
 }
 
 bool CPDFSDK_BAAnnotHandler::OnXFAChangedFocus(
-    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
+    ObservedPtr<CPDFSDK_Annot>& pNewAnnot) {
   NOTREACHED();
   return false;
 }
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index c055541..2da9db2 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -45,33 +45,33 @@
               bool bDrawAnnots) override;
   void OnLoad(CPDFSDK_Annot* pAnnot) override;
 
-  void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlag) override;
-  void OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point) override;
-  bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point) override;
-  bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlags,
                     const CFX_PointF& point,
                     const CFX_Vector& delta) override;
-  bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point) override;
-  bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point) override;
   bool OnChar(CPDFSDK_Annot* pAnnot,
@@ -83,20 +83,20 @@
   bool OnKeyUp(CPDFSDK_Annot* pAnnot,
                FWL_VKEYCODE nKeyCode,
                Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag) override;
-  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                         int index,
                         bool selected) override;
-  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override;
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot, int index) override;
 
 #ifdef PDF_ENABLE_XFA
   std::unique_ptr<CPDFSDK_Annot> NewAnnotForXFA(
       CXFA_FFWidget* pAnnot,
       CPDFSDK_PageView* pPageView) override;
-  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pNewAnnot) override;
+  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>& pNewAnnot) override;
 #endif  // PDF_ENABLE_XFA
 
  private:
diff --git a/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp b/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp
index 9beb114..f6d4bef 100644
--- a/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler_embeddertest.cpp
@@ -86,8 +86,8 @@
   EXPECT_EQ(pAnnot->GetAnnotSubtype(), CPDF_Annot::Subtype::LINK);
 
   ObservedPtr<CPDFSDK_Annot> pLinkAnnot(pAnnot);
-  EXPECT_TRUE(GetBAAnnotHandler()->OnSetFocus(&pLinkAnnot, {}));
-  EXPECT_TRUE(GetBAAnnotHandler()->OnKillFocus(&pLinkAnnot, {}));
+  EXPECT_TRUE(GetBAAnnotHandler()->OnSetFocus(pLinkAnnot, {}));
+  EXPECT_TRUE(GetBAAnnotHandler()->OnKillFocus(pLinkAnnot, {}));
 
   // Get highlight annot.
   pAnnot = GetNthFocusableAnnot(4);
@@ -95,6 +95,6 @@
   EXPECT_EQ(pAnnot->GetAnnotSubtype(), CPDF_Annot::Subtype::HIGHLIGHT);
 
   ObservedPtr<CPDFSDK_Annot> pHighlightAnnot(pAnnot);
-  EXPECT_TRUE(GetBAAnnotHandler()->OnSetFocus(&pHighlightAnnot, {}));
-  EXPECT_TRUE(GetBAAnnotHandler()->OnKillFocus(&pHighlightAnnot, {}));
+  EXPECT_TRUE(GetBAAnnotHandler()->OnSetFocus(pHighlightAnnot, {}));
+  EXPECT_TRUE(GetBAAnnotHandler()->OnKillFocus(pHighlightAnnot, {}));
 }
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index cfc71cb..cfbb422 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -411,19 +411,19 @@
 }
 
 void CPDFSDK_FormFillEnvironment::OnCalculate(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot) {
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+    ObservedPtr<CPDFSDK_Annot>& pAnnot) {
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (pWidget)
     m_pInteractiveForm->OnCalculate(pWidget->GetFormField());
 }
 
-void CPDFSDK_FormFillEnvironment::OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot) {
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+void CPDFSDK_FormFillEnvironment::OnFormat(ObservedPtr<CPDFSDK_Annot>& pAnnot) {
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   DCHECK(pWidget);
 
   Optional<WideString> sValue =
       m_pInteractiveForm->OnFormat(pWidget->GetFormField());
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return;
 
   if (sValue.has_value()) {
@@ -744,17 +744,16 @@
 }
 
 bool CPDFSDK_FormFillEnvironment::SetFocusAnnot(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot) {
+    ObservedPtr<CPDFSDK_Annot>& pAnnot) {
   if (m_bBeingDestroyed)
     return false;
-  if (m_pFocusAnnot == *pAnnot)
+  if (m_pFocusAnnot == pAnnot)
     return true;
   if (m_pFocusAnnot && !KillFocusAnnot({}))
     return false;
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return false;
-
-  if (!(*pAnnot)->GetPageView()->IsValid())
+  if (!pAnnot->GetPageView()->IsValid())
     return false;
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandler = GetAnnotHandlerMgr();
@@ -766,7 +765,7 @@
     return false;
 
   // |pAnnot| may be destroyed in |Annot_OnChangeFocus|.
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return false;
 #endif  // PDF_ENABLE_XFA
 
@@ -775,7 +774,7 @@
   if (m_pFocusAnnot)
     return false;
 
-  m_pFocusAnnot.Reset(pAnnot->Get());
+  m_pFocusAnnot.Reset(pAnnot.Get());
 
   // If we are not able to inform the client about the focus change, it
   // shouldn't be considered as failure.
@@ -791,7 +790,7 @@
   ObservedPtr<CPDFSDK_Annot> pFocusAnnot(m_pFocusAnnot.Get());
   m_pFocusAnnot.Reset();
 
-  if (!pAnnotHandler->Annot_OnKillFocus(&pFocusAnnot, nFlag)) {
+  if (!pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) {
     m_pFocusAnnot.Reset(pFocusAnnot.Get());
     return false;
   }
@@ -821,24 +820,23 @@
 }
 
 void CPDFSDK_FormFillEnvironment::SendOnFocusChange(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot) {
+    ObservedPtr<CPDFSDK_Annot>& pAnnot) {
   if (!m_pInfo || m_pInfo->version < 2 || !m_pInfo->FFI_OnFocusChange)
     return;
 
   // TODO(crbug.com/pdfium/1482): Handle XFA case.
-  if ((*pAnnot)->AsXFAWidget())
+  if (pAnnot->AsXFAWidget())
     return;
 
-  CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView();
+  CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
   if (!pPageView->IsValid())
     return;
 
-  IPDF_Page* page = (*pAnnot)->GetPage();
+  IPDF_Page* page = pAnnot->GetPage();
   if (!page)
     return;
 
-  CPDF_Dictionary* annot_dict = (*pAnnot)->GetPDFAnnot()->GetAnnotDict();
-
+  CPDF_Dictionary* annot_dict = pAnnot->GetPDFAnnot()->GetAnnotDict();
   auto focused_annot = std::make_unique<CPDF_AnnotContext>(annot_dict, page);
   FPDF_ANNOTATION fpdf_annot =
       FPDFAnnotationFromCPDFAnnotContext(focused_annot.get());
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index 59fe440..238d69f 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -72,15 +72,15 @@
 
   // CFFL_InteractiveFormFiller::CallbackIface:
   void OnSetFieldInputFocus(const WideString& text) override;
-  void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot) override;
-  void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot) override;
+  void OnCalculate(ObservedPtr<CPDFSDK_Annot>& pAnnot) override;
+  void OnFormat(ObservedPtr<CPDFSDK_Annot>& pAnnot) override;
   void Invalidate(IPDF_Page* page, const FX_RECT& rect) override;
   CPDFSDK_PageView* GetOrCreatePageView(IPDF_Page* pUnderlyingPage) override;
   CPDFSDK_PageView* GetPageView(IPDF_Page* pUnderlyingPage) override;
   CFX_Timer::HandlerIface* GetTimerHandler() override;
   IPWL_SystemHandler* GetSysHandler() override;
   CPDFSDK_Annot* GetFocusAnnot() const override;
-  bool SetFocusAnnot(ObservedPtr<CPDFSDK_Annot>* pAnnot) override;
+  bool SetFocusAnnot(ObservedPtr<CPDFSDK_Annot>& pAnnot) override;
   bool HasPermissions(uint32_t flags) const override;
   void OnChange() override;
 
@@ -227,7 +227,7 @@
  private:
   IPDF_Page* GetPage(int nIndex) const;
   void OnSetFieldInputFocusInternal(const WideString& text, bool bFocus);
-  void SendOnFocusChange(ObservedPtr<CPDFSDK_Annot>* pAnnot);
+  void SendOnFocusChange(ObservedPtr<CPDFSDK_Annot>& pAnnot);
 
   UnownedPtr<FPDF_FORMFILLINFO> const m_pInfo;
   std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 5740add..f22cd39 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -331,7 +331,7 @@
     return false;
   }
 
-  m_pFormFillEnv->SetFocusAnnot(&pAnnot);
+  m_pFormFillEnv->SetFocusAnnot(pAnnot);
   return true;
 }
 
@@ -345,13 +345,13 @@
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  if (!pAnnotHandlerMgr->Annot_OnLButtonDown(&pAnnot, nFlag, point))
+  if (!pAnnotHandlerMgr->Annot_OnLButtonDown(pAnnot, nFlag, point))
     return false;
 
   if (!pAnnot)
     return false;
 
-  m_pFormFillEnv->SetFocusAnnot(&pAnnot);
+  m_pFormFillEnv->SetFocusAnnot(pAnnot);
   return true;
 }
 
@@ -363,11 +363,11 @@
   ObservedPtr<CPDFSDK_Annot> pFocusAnnot(GetFocusAnnot());
   if (pFocusAnnot && pFocusAnnot != pFXAnnot) {
     // Last focus Annot gets a chance to handle the event.
-    if (pAnnotHandlerMgr->Annot_OnLButtonUp(&pFocusAnnot, nFlag, point))
+    if (pAnnotHandlerMgr->Annot_OnLButtonUp(pFocusAnnot, nFlag, point))
       return true;
   }
   return pFXAnnot &&
-         pAnnotHandlerMgr->Annot_OnLButtonUp(&pFXAnnot, nFlag, point);
+         pAnnotHandlerMgr->Annot_OnLButtonUp(pFXAnnot, nFlag, point);
 }
 
 bool CPDFSDK_PageView::OnLButtonDblClk(Mask<FWL_EVENTFLAG> nFlag,
@@ -380,13 +380,13 @@
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  if (!pAnnotHandlerMgr->Annot_OnLButtonDblClk(&pAnnot, nFlag, point))
+  if (!pAnnotHandlerMgr->Annot_OnLButtonDblClk(pAnnot, nFlag, point))
     return false;
 
   if (!pAnnot)
     return false;
 
-  m_pFormFillEnv->SetFocusAnnot(&pAnnot);
+  m_pFormFillEnv->SetFocusAnnot(pAnnot);
   return true;
 }
 
@@ -398,12 +398,12 @@
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  bool ok = pAnnotHandlerMgr->Annot_OnRButtonDown(&pAnnot, nFlag, point);
+  bool ok = pAnnotHandlerMgr->Annot_OnRButtonDown(pAnnot, nFlag, point);
   if (!pAnnot)
     return false;
 
   if (ok)
-    m_pFormFillEnv->SetFocusAnnot(&pAnnot);
+    m_pFormFillEnv->SetFocusAnnot(pAnnot);
 
   return true;
 }
@@ -416,12 +416,12 @@
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  bool ok = pAnnotHandlerMgr->Annot_OnRButtonUp(&pAnnot, nFlag, point);
+  bool ok = pAnnotHandlerMgr->Annot_OnRButtonUp(pAnnot, nFlag, point);
   if (!pAnnot)
     return false;
 
   if (ok)
-    m_pFormFillEnv->SetFocusAnnot(&pAnnot);
+    m_pFormFillEnv->SetFocusAnnot(pAnnot);
 
   return true;
 }
@@ -442,7 +442,7 @@
     return false;
 
   if (!m_bOnWidget) {
-    EnterWidget(pAnnotHandlerMgr, &pFXAnnot, nFlag);
+    EnterWidget(pAnnotHandlerMgr, pFXAnnot, nFlag);
 
     // EnterWidget() may have invalidated objects.
     if (!pThis)
@@ -453,15 +453,15 @@
       return true;
     }
   }
-  pAnnotHandlerMgr->Annot_OnMouseMove(&pFXAnnot, nFlag, point);
+  pAnnotHandlerMgr->Annot_OnMouseMove(pFXAnnot, nFlag, point);
   return true;
 }
 
 void CPDFSDK_PageView::EnterWidget(CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr,
-                                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                                   ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                    Mask<FWL_EVENTFLAG> nFlag) {
   m_bOnWidget = true;
-  m_pCaptureWidget.Reset(pAnnot->Get());
+  m_pCaptureWidget.Reset(pAnnot.Get());
   pAnnotHandlerMgr->Annot_OnMouseEnter(pAnnot, nFlag);
 }
 
@@ -474,7 +474,7 @@
 
   if (callExitCallback) {
     ObservedPtr<CPDFSDK_PageView> pThis(this);
-    pAnnotHandlerMgr->Annot_OnMouseExit(&m_pCaptureWidget, nFlag);
+    pAnnotHandlerMgr->Annot_OnMouseExit(m_pCaptureWidget, nFlag);
 
     // Annot_OnMouseExit() may have invalidated |this|.
     if (!pThis)
@@ -493,7 +493,7 @@
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  return pAnnotHandlerMgr->Annot_OnMouseWheel(&pAnnot, nFlag, point, delta);
+  return pAnnotHandlerMgr->Annot_OnMouseWheel(pAnnot, nFlag, point, delta);
 }
 
 bool CPDFSDK_PageView::SetIndexSelected(int index, bool selected) {
@@ -501,7 +501,7 @@
     ObservedPtr<CPDFSDK_Annot> pAnnotObserved(pAnnot);
     CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
         m_pFormFillEnv->GetAnnotHandlerMgr();
-    return pAnnotHandlerMgr->Annot_SetIndexSelected(&pAnnotObserved, index,
+    return pAnnotHandlerMgr->Annot_SetIndexSelected(pAnnotObserved, index,
                                                     selected);
   }
 
@@ -513,7 +513,7 @@
     ObservedPtr<CPDFSDK_Annot> pAnnotObserved(pAnnot);
     CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
         m_pFormFillEnv->GetAnnotHandlerMgr();
-    return pAnnotHandlerMgr->Annot_IsIndexSelected(&pAnnotObserved, index);
+    return pAnnotHandlerMgr->Annot_IsIndexSelected(pAnnotObserved, index);
   }
 
   return false;
@@ -547,7 +547,7 @@
     ObservedPtr<CPDFSDK_Annot> end_annot(CPWL_Wnd::IsSHIFTKeyDown(nFlag)
                                              ? GetLastFocusableAnnot()
                                              : GetFirstFocusableAnnot());
-    return end_annot && m_pFormFillEnv->SetFocusAnnot(&end_annot);
+    return end_annot && m_pFormFillEnv->SetFocusAnnot(end_annot);
   }
 
   if (CPWL_Wnd::IsCTRLKeyDown(nFlag) || CPWL_Wnd::IsALTKeyDown(nFlag))
@@ -562,7 +562,7 @@
     if (!pNext)
       return false;
     if (pNext.Get() != pFocusAnnot) {
-      GetFormFillEnv()->SetFocusAnnot(&pNext);
+      GetFormFillEnv()->SetFocusAnnot(pNext);
       return true;
     }
   }
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index da074aa..c58357e 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -119,7 +119,7 @@
   int GetPageIndexForStaticPDF() const;
 
   void EnterWidget(CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr,
-                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag);
   void ExitWidget(CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr,
                   bool callExitCallback,
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 6b5c6cf..35f074b 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -92,80 +92,80 @@
   }
 }
 
-void CPDFSDK_WidgetHandler::OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+void CPDFSDK_WidgetHandler::OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlag) {
-  if (!(*pAnnot)->IsSignatureWidget()) {
+  if (!pAnnot->IsSignatureWidget()) {
     GetFormFillEnvironment()->GetInteractiveFormFiller()->OnMouseEnter(
-        (*pAnnot)->GetPageView(), pAnnot, nFlag);
+        pAnnot->GetPageView(), pAnnot, nFlag);
   }
 }
 
-void CPDFSDK_WidgetHandler::OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+void CPDFSDK_WidgetHandler::OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlag) {
-  if (!(*pAnnot)->IsSignatureWidget()) {
+  if (!pAnnot->IsSignatureWidget()) {
     GetFormFillEnvironment()->GetInteractiveFormFiller()->OnMouseExit(
-        (*pAnnot)->GetPageView(), pAnnot, nFlag);
+        pAnnot->GetPageView(), pAnnot, nFlag);
   }
 }
 
-bool CPDFSDK_WidgetHandler::OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                           Mask<FWL_EVENTFLAG> nFlags,
                                           const CFX_PointF& point) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnLButtonDown(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point);
+             pAnnot->GetPageView(), pAnnot, nFlags, point);
 }
 
-bool CPDFSDK_WidgetHandler::OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlags,
                                         const CFX_PointF& point) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnLButtonUp(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point);
+             pAnnot->GetPageView(), pAnnot, nFlags, point);
 }
 
-bool CPDFSDK_WidgetHandler::OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             Mask<FWL_EVENTFLAG> nFlags,
                                             const CFX_PointF& point) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnLButtonDblClk(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point);
+             pAnnot->GetPageView(), pAnnot, nFlags, point);
 }
 
-bool CPDFSDK_WidgetHandler::OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlags,
                                         const CFX_PointF& point) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnMouseMove(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point);
+             pAnnot->GetPageView(), pAnnot, nFlags, point);
 }
 
-bool CPDFSDK_WidgetHandler::OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlags,
                                          const CFX_PointF& point,
                                          const CFX_Vector& delta) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnMouseWheel(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point, delta);
+             pAnnot->GetPageView(), pAnnot, nFlags, point, delta);
 }
 
-bool CPDFSDK_WidgetHandler::OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                           Mask<FWL_EVENTFLAG> nFlags,
                                           const CFX_PointF& point) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnRButtonDown(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point);
+             pAnnot->GetPageView(), pAnnot, nFlags, point);
 }
 
-bool CPDFSDK_WidgetHandler::OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlags,
                                         const CFX_PointF& point) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnRButtonUp(
-             (*pAnnot)->GetPageView(), pAnnot, nFlags, point);
+             pAnnot->GetPageView(), pAnnot, nFlags, point);
 }
 
-bool CPDFSDK_WidgetHandler::OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             Mask<FWL_EVENTFLAG> nFlags,
                                             const CFX_PointF& point) {
   return false;
@@ -222,37 +222,37 @@
 #endif  // PDF_ENABLE_XFA
 }
 
-bool CPDFSDK_WidgetHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                        Mask<FWL_EVENTFLAG> nFlag) {
-  if (!IsFocusableAnnot((*pAnnot)->GetPDFAnnot()->GetSubtype()))
+  if (!IsFocusableAnnot(pAnnot->GetPDFAnnot()->GetSubtype()))
     return false;
 
-  return (*pAnnot)->IsSignatureWidget() ||
+  return pAnnot->IsSignatureWidget() ||
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnSetFocus(
              pAnnot, nFlag);
 }
 
-bool CPDFSDK_WidgetHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlag) {
-  if (!IsFocusableAnnot((*pAnnot)->GetPDFAnnot()->GetSubtype()))
+  if (!IsFocusableAnnot(pAnnot->GetPDFAnnot()->GetSubtype()))
     return false;
 
-  return (*pAnnot)->IsSignatureWidget() ||
+  return pAnnot->IsSignatureWidget() ||
          GetFormFillEnvironment()->GetInteractiveFormFiller()->OnKillFocus(
              pAnnot, nFlag);
 }
 
-bool CPDFSDK_WidgetHandler::SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              int index,
                                              bool selected) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->SetIndexSelected(
              pAnnot, index, selected);
 }
 
-bool CPDFSDK_WidgetHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFSDK_WidgetHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             int index) {
-  return !(*pAnnot)->IsSignatureWidget() &&
+  return !pAnnot->IsSignatureWidget() &&
          GetFormFillEnvironment()->GetInteractiveFormFiller()->IsIndexSelected(
              pAnnot, index);
 }
@@ -339,7 +339,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnXFAChangedFocus(
-    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
+    ObservedPtr<CPDFSDK_Annot>& pNewAnnot) {
   NOTREACHED();
   return false;
 }
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index c638f9c..e5b2c60 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -44,33 +44,33 @@
               const CFX_Matrix& mtUser2Device,
               bool bDrawAnnots) override;
   void OnLoad(CPDFSDK_Annot* pAnnot) override;
-  void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlag) override;
-  void OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point) override;
-  bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point) override;
-  bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlags,
                     const CFX_PointF& point,
                     const CFX_Vector& delta) override;
-  bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point) override;
-  bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point) override;
   bool OnChar(CPDFSDK_Annot* pAnnot,
@@ -82,20 +82,20 @@
   bool OnKeyUp(CPDFSDK_Annot* pAnnot,
                FWL_VKEYCODE nKeyCode,
                Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag) override;
-  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                         int index,
                         bool selected) override;
-  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override;
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot, int index) override;
 
 #ifdef PDF_ENABLE_XFA
   std::unique_ptr<CPDFSDK_Annot> NewAnnotForXFA(
       CXFA_FFWidget* pWiget,
       CPDFSDK_PageView* pPageView) override;
-  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pNewAnnot) override;
+  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>& pNewAnnot) override;
 #endif
 
  private:
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index d425d74..59c2ea6 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -52,7 +52,7 @@
       DCHECK(pPageView);
 
       ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
-      if (m_pFormFiller->OnButtonUp(&pObserved, pPageView, nFlags)) {
+      if (m_pFormFiller->OnButtonUp(pObserved, pPageView, nFlags)) {
         if (!pObserved)
           m_pWidget = nullptr;
         return true;
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index e926b8e..c67f0ec 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -465,8 +465,7 @@
     return true;
 
   ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
-
-  if (!m_pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, nFlag)) {
+  if (!m_pFormFiller->OnKeyStrokeCommit(pObserved, pPageView, nFlag)) {
     if (!pObserved)
       return false;
     ResetPWLWindow(pPageView);
@@ -475,7 +474,7 @@
   if (!pObserved)
     return false;
 
-  if (!m_pFormFiller->OnValidate(&pObserved, pPageView, nFlag)) {
+  if (!m_pFormFiller->OnValidate(pObserved, pPageView, nFlag)) {
     if (!pObserved)
       return false;
     ResetPWLWindow(pPageView);
@@ -488,11 +487,11 @@
   if (!pObserved)
     return false;
 
-  m_pFormFiller->OnCalculate(&pObserved);
+  m_pFormFiller->OnCalculate(pObserved);
   if (!pObserved)
     return false;
 
-  m_pFormFiller->OnFormat(&pObserved);
+  m_pFormFiller->OnFormat(pObserved);
   if (!pObserved)
     return false;
 
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 78f5255..91f17c4 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -96,12 +96,11 @@
 
 void CFFL_InteractiveFormFiller::OnMouseEnter(
     CPDFSDK_PageView* pPageView,
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlag) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
-    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
     if (pWidget->GetAAction(CPDF_AAction::kCursorEnter).GetDict()) {
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
@@ -115,7 +114,7 @@
         fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlag);
         pWidget->OnAAction(CPDF_AAction::kCursorEnter, &fa, pPageView);
       }
-      if (!pAnnot->HasObservable())
+      if (!pAnnot)
         return;
 
       if (pWidget->IsAppModified()) {
@@ -125,17 +124,16 @@
       }
     }
   }
-  if (CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot->Get()))
+  if (CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot.Get()))
     pFormField->OnMouseEnter(pPageView);
 }
 
 void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
-                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlag) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
-    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
     if (pWidget->GetAAction(CPDF_AAction::kCursorExit).GetDict()) {
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
@@ -149,7 +147,7 @@
         fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlag);
         pWidget->OnAAction(CPDF_AAction::kCursorExit, &fa, pPageView);
       }
-      if (!pAnnot->HasObservable())
+      if (!pAnnot)
         return;
 
       if (pWidget->IsAppModified()) {
@@ -159,20 +157,19 @@
       }
     }
   }
-  if (CFFL_FormField* pFormField = GetFormField(pAnnot->Get()))
+  if (CFFL_FormField* pFormField = GetFormField(pAnnot.Get()))
     pFormField->OnMouseExit(pPageView);
 }
 
 bool CFFL_InteractiveFormFiller::OnLButtonDown(
     CPDFSDK_PageView* pPageView,
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
-    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
-    if (Annot_HitTest(pAnnot->Get(), point) &&
+    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
+    if (Annot_HitTest(pAnnot.Get(), point) &&
         pWidget->GetAAction(CPDF_AAction::kButtonDown).GetDict()) {
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
@@ -186,10 +183,10 @@
         fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlags);
         pWidget->OnAAction(CPDF_AAction::kButtonDown, &fa, pPageView);
       }
-      if (!pAnnot->HasObservable())
+      if (!pAnnot)
         return true;
 
-      if (!IsValidAnnot(pPageView, pAnnot->Get()))
+      if (!IsValidAnnot(pPageView, pAnnot.Get()))
         return true;
 
       if (pWidget->IsAppModified()) {
@@ -199,26 +196,25 @@
       }
     }
   }
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField &&
-         pFormField->OnLButtonDown(pPageView, ToCPDFSDKWidget(pAnnot->Get()),
+         pFormField->OnLButtonDown(pPageView, ToCPDFSDKWidget(pAnnot.Get()),
                                    nFlags, point);
 }
 
 bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
-                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlags,
                                              const CFX_PointF& point) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
 
   bool bSetFocus;
   switch (pWidget->GetFieldType()) {
     case FormFieldType::kPushButton:
     case FormFieldType::kCheckBox:
     case FormFieldType::kRadioButton: {
-      FX_RECT bbox = GetViewBBox(pPageView, pAnnot->Get());
+      FX_RECT bbox = GetViewBBox(pPageView, pAnnot.Get());
       bSetFocus =
           bbox.Contains(static_cast<int>(point.x), static_cast<int>(point.y));
       break;
@@ -230,11 +226,11 @@
   if (bSetFocus)
     m_pCallbackIface->SetFocusAnnot(pAnnot);
 
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   bool bRet = pFormField &&
-              pFormField->OnLButtonUp(pPageView, ToCPDFSDKWidget(pAnnot->Get()),
+              pFormField->OnLButtonUp(pPageView, ToCPDFSDKWidget(pAnnot.Get()),
                                       nFlags, point);
-  if (m_pCallbackIface->GetFocusAnnot() != pAnnot->Get())
+  if (m_pCallbackIface->GetFocusAnnot() != pAnnot.Get())
     return bRet;
   if (OnButtonUp(pAnnot, pPageView, nFlags) || !pAnnot)
     return true;
@@ -245,13 +241,13 @@
   return bRet;
 }
 
-bool CFFL_InteractiveFormFiller::OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             const CPDFSDK_PageView* pPageView,
                                             Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return false;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->GetAAction(CPDF_AAction::kButtonUp).GetDict())
     return false;
 
@@ -267,7 +263,7 @@
     fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlag);
     pWidget->OnAAction(CPDF_AAction::kButtonUp, &fa, pPageView);
   }
-  if (!pAnnot->HasObservable() || !IsValidAnnot(pPageView, pWidget))
+  if (!pAnnot || !IsValidAnnot(pPageView, pWidget))
     return true;
   if (nAge == pWidget->GetAppearanceAge())
     return false;
@@ -279,78 +275,71 @@
 }
 
 bool CFFL_InteractiveFormFiller::SetIndexSelected(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     int index,
     bool selected) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
 
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField && pFormField->SetIndexSelected(index, selected);
 }
 
 bool CFFL_InteractiveFormFiller::IsIndexSelected(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     int index) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
 
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField && pFormField->IsIndexSelected(index);
 }
 
 bool CFFL_InteractiveFormFiller::OnLButtonDblClk(
     CPDFSDK_PageView* pPageView,
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField && pFormField->OnLButtonDblClk(pPageView, nFlags, point);
 }
 
 bool CFFL_InteractiveFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
-                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlags,
                                              const CFX_PointF& point) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot.Get());
   return pFormField && pFormField->OnMouseMove(pPageView, nFlags, point);
 }
 
 bool CFFL_InteractiveFormFiller::OnMouseWheel(
     CPDFSDK_PageView* pPageView,
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point,
     const CFX_Vector& delta) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField &&
          pFormField->OnMouseWheel(pPageView, nFlags, point, delta);
 }
 
 bool CFFL_InteractiveFormFiller::OnRButtonDown(
     CPDFSDK_PageView* pPageView,
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     Mask<FWL_EVENTFLAG> nFlags,
     const CFX_PointF& point) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField && pFormField->OnRButtonDown(pPageView, nFlags, point);
 }
 
 bool CFFL_InteractiveFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
-                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlags,
                                              const CFX_PointF& point) {
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   return pFormField && pFormField->OnRButtonUp(pPageView, nFlags, point);
 }
 
@@ -375,15 +364,14 @@
          pFormField->OnChar(ToCPDFSDKWidget(pAnnot), nChar, nFlags);
 }
 
-bool CFFL_InteractiveFormFiller::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             Mask<FWL_EVENTFLAG> nFlag) {
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return false;
 
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
-    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+    CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
     if (pWidget->GetAAction(CPDF_AAction::kGetFocus).GetDict()) {
       uint32_t nValueAge = pWidget->GetValueAge();
       pWidget->ClearAppModified();
@@ -392,7 +380,7 @@
       if (!pFormField)
         return false;
 
-      CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView();
+      CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
       DCHECK(pPageView);
       {
         AutoRestorer<bool> restorer(&m_bNotifying);
@@ -404,7 +392,7 @@
         pFormField->GetActionData(pPageView, CPDF_AAction::kGetFocus, fa);
         pWidget->OnAAction(CPDF_AAction::kGetFocus, &fa, pPageView);
       }
-      if (!pAnnot->HasObservable())
+      if (!pAnnot)
         return false;
 
       if (pWidget->IsAppModified()) {
@@ -415,31 +403,30 @@
     }
   }
 
-  if (CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot->Get()))
-    pFormField->SetFocusForAnnot(ToCPDFSDKWidget(pAnnot->Get()), nFlag);
+  if (CFFL_FormField* pFormField = GetOrCreateFormField(pAnnot.Get()))
+    pFormField->SetFocusForAnnot(ToCPDFSDKWidget(pAnnot.Get()), nFlag);
 
   return true;
 }
 
-bool CFFL_InteractiveFormFiller::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              Mask<FWL_EVENTFLAG> nFlag) {
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return false;
 
-  DCHECK_EQ((*pAnnot)->GetPDFAnnot()->GetSubtype(),
-            CPDF_Annot::Subtype::WIDGET);
-  CFFL_FormField* pFormField = GetFormField(pAnnot->Get());
+  DCHECK_EQ(pAnnot->GetPDFAnnot()->GetSubtype(), CPDF_Annot::Subtype::WIDGET);
+  CFFL_FormField* pFormField = GetFormField(pAnnot.Get());
   if (!pFormField)
     return true;
 
   pFormField->KillFocusForAnnot(nFlag);
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return false;
 
   if (m_bNotifying)
     return true;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->GetAAction(CPDF_AAction::kLoseFocus).GetDict())
     return true;
 
@@ -457,7 +444,7 @@
     pFormField->GetActionData(pPageView, CPDF_AAction::kLoseFocus, fa);
     pWidget->OnAAction(CPDF_AAction::kLoseFocus, &fa, pPageView);
   }
-  return pAnnot->HasObservable();
+  return !!pAnnot;
 }
 
 bool CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) {
@@ -645,13 +632,13 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnKeyStrokeCommit(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>& pAnnot,
     const CPDFSDK_PageView* pPageView,
     Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return true;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->GetAAction(CPDF_AAction::kKeyStroke).GetDict())
     return true;
 
@@ -673,19 +660,19 @@
   pFormField->SavePWLWindowState(pPageView);
   pWidget->OnAAction(CPDF_AAction::kKeyStroke, &fa, pPageView);
 
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return true;
 
   return fa.bRC;
 }
 
-bool CFFL_InteractiveFormFiller::OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnValidate(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             const CPDFSDK_PageView* pPageView,
                                             Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return true;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->GetAAction(CPDF_AAction::kValidate).GetDict())
     return true;
 
@@ -706,21 +693,21 @@
   pFormField->SavePWLWindowState(pPageView);
   pWidget->OnAAction(CPDF_AAction::kValidate, &fa, pPageView);
 
-  if (!pAnnot->HasObservable())
+  if (!pAnnot)
     return true;
 
   return fa.bRC;
 }
 
 void CFFL_InteractiveFormFiller::OnCalculate(
-    ObservedPtr<CPDFSDK_Annot>* pAnnot) {
+    ObservedPtr<CPDFSDK_Annot>& pAnnot) {
   if (m_bNotifying)
     return;
 
   m_pCallbackIface->OnCalculate(pAnnot);
 }
 
-void CFFL_InteractiveFormFiller::OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot) {
+void CFFL_InteractiveFormFiller::OnFormat(ObservedPtr<CPDFSDK_Annot>& pAnnot) {
   if (m_bNotifying)
     return;
 
@@ -728,13 +715,13 @@
 }
 
 #ifdef PDF_ENABLE_XFA
-bool CFFL_InteractiveFormFiller::OnClick(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnClick(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          const CPDFSDK_PageView* pPageView,
                                          Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return false;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->HasXFAAAction(PDFSDK_XFA_Click))
     return false;
 
@@ -750,7 +737,7 @@
 
     pWidget->OnXFAAAction(PDFSDK_XFA_Click, &fa, pPageView);
   }
-  if (!pAnnot->HasObservable() || !IsValidAnnot(pPageView, pWidget))
+  if (!pAnnot || !IsValidAnnot(pPageView, pWidget))
     return true;
   if (nAge == pWidget->GetAppearanceAge())
     return false;
@@ -761,13 +748,13 @@
   return false;
 }
 
-bool CFFL_InteractiveFormFiller::OnFull(ObservedPtr<CPDFSDK_Widget>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnFull(ObservedPtr<CPDFSDK_Widget>& pAnnot,
                                         const CPDFSDK_PageView* pPageView,
                                         Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return false;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->HasXFAAAction(PDFSDK_XFA_Full))
     return false;
 
@@ -782,7 +769,7 @@
     fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlag);
     pWidget->OnXFAAAction(PDFSDK_XFA_Full, &fa, pPageView);
   }
-  if (!pAnnot->HasObservable() || !IsValidAnnot(pPageView, pWidget))
+  if (!pAnnot || !IsValidAnnot(pPageView, pWidget))
     return true;
   if (nAge == pWidget->GetAppearanceAge())
     return false;
@@ -793,13 +780,13 @@
   return true;
 }
 
-bool CFFL_InteractiveFormFiller::OnPreOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnPreOpen(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                            const CPDFSDK_PageView* pPageView,
                                            Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return false;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen))
     return false;
 
@@ -814,7 +801,7 @@
     fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlag);
     pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, &fa, pPageView);
   }
-  if (!pAnnot->HasObservable() || !IsValidAnnot(pPageView, pWidget))
+  if (!pAnnot || !IsValidAnnot(pPageView, pWidget))
     return true;
   if (nAge == pWidget->GetAppearanceAge())
     return false;
@@ -825,13 +812,13 @@
   return true;
 }
 
-bool CFFL_InteractiveFormFiller::OnPostOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CFFL_InteractiveFormFiller::OnPostOpen(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             const CPDFSDK_PageView* pPageView,
                                             Mask<FWL_EVENTFLAG> nFlag) {
   if (m_bNotifying)
     return false;
 
-  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot->Get());
+  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot.Get());
   if (!pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen))
     return false;
 
@@ -846,7 +833,7 @@
     fa.bShift = CPWL_Wnd::IsSHIFTKeyDown(nFlag);
     pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, &fa, pPageView);
   }
-  if (!pAnnot->HasObservable() || !IsValidAnnot(pPageView, pWidget))
+  if (!pAnnot || !IsValidAnnot(pPageView, pWidget))
     return true;
 
   if (nAge == pWidget->GetAppearanceAge())
@@ -883,7 +870,7 @@
 
 #ifdef PDF_ENABLE_XFA
   if (pFormField->IsFieldFull(pPageView)) {
-    if (OnFull(&pWidget, pPageView, nFlag) || !pWidget)
+    if (OnFull(pWidget, pPageView, nFlag) || !pWidget)
       return {true, true};
   }
 #endif  // PDF_ENABLE_XFA
@@ -954,7 +941,7 @@
   DCHECK(pData->GetWidget());
 
   ObservedPtr<CPDFSDK_Annot> pObserved(pData->GetWidget());
-  return OnPreOpen(&pObserved, pData->GetPageView(), nFlag) || !pObserved;
+  return OnPreOpen(pObserved, pData->GetPageView(), nFlag) || !pObserved;
 #else
   return false;
 #endif
@@ -968,7 +955,7 @@
   DCHECK(pData->GetWidget());
 
   ObservedPtr<CPDFSDK_Annot> pObserved(pData->GetWidget());
-  return OnPostOpen(&pObserved, pData->GetPageView(), nFlag) || !pObserved;
+  return OnPostOpen(pObserved, pData->GetPageView(), nFlag) || !pObserved;
 #else
   return false;
 #endif
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 5682c94..33f014d 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -30,15 +30,15 @@
     virtual ~CallbackIface() = default;
 
     virtual void OnSetFieldInputFocus(const WideString& text) = 0;
-    virtual void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot) = 0;
-    virtual void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot) = 0;
+    virtual void OnCalculate(ObservedPtr<CPDFSDK_Annot>& pAnnot) = 0;
+    virtual void OnFormat(ObservedPtr<CPDFSDK_Annot>& pAnnot) = 0;
     virtual void Invalidate(IPDF_Page* pPage, const FX_RECT& rect) = 0;
     virtual CPDFSDK_PageView* GetOrCreatePageView(IPDF_Page* pPage) = 0;
     virtual CPDFSDK_PageView* GetPageView(IPDF_Page* pPage) = 0;
     virtual CFX_Timer::HandlerIface* GetTimerHandler() = 0;
     virtual IPWL_SystemHandler* GetSysHandler() = 0;
     virtual CPDFSDK_Annot* GetFocusAnnot() const = 0;
-    virtual bool SetFocusAnnot(ObservedPtr<CPDFSDK_Annot>* pAnnot) = 0;
+    virtual bool SetFocusAnnot(ObservedPtr<CPDFSDK_Annot>& pAnnot) = 0;
 
     // See PDF Reference 1.7, table 3.20 for the permission bits. Returns true
     // if any bit in |flags| is set.
@@ -60,38 +60,38 @@
   void OnDelete(CPDFSDK_Annot* pAnnot);
 
   void OnMouseEnter(CPDFSDK_PageView* pPageView,
-                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlag);
   void OnMouseExit(CPDFSDK_PageView* pPageView,
-                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag);
   bool OnLButtonDown(CPDFSDK_PageView* pPageView,
-                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point);
   bool OnLButtonUp(CPDFSDK_PageView* pPageView,
-                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point);
   bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point);
   bool OnMouseMove(CPDFSDK_PageView* pPageView,
-                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point);
   bool OnMouseWheel(CPDFSDK_PageView* pPageView,
-                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlags,
                     const CFX_PointF& point,
                     const CFX_Vector& delta);
   bool OnRButtonDown(CPDFSDK_PageView* pPageView,
-                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point);
   bool OnRButtonUp(CPDFSDK_PageView* pPageView,
-                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point);
 
@@ -102,9 +102,9 @@
               uint32_t nChar,
               Mask<FWL_EVENTFLAG> nFlags);
 
-  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   Mask<FWL_EVENTFLAG> nFlag);
-  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag);
 
   CFFL_FormField* GetFormFieldForTesting(CPDFSDK_Annot* pAnnot) {
@@ -126,22 +126,22 @@
   static bool IsValidAnnot(const CPDFSDK_PageView* pPageView,
                            CPDFSDK_Annot* pAnnot);
 
-  bool OnKeyStrokeCommit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnKeyStrokeCommit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                          const CPDFSDK_PageView* pPageView,
                          Mask<FWL_EVENTFLAG> nFlag);
-  bool OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnValidate(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   const CPDFSDK_PageView* pPageView,
                   Mask<FWL_EVENTFLAG> nFlag);
-  void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot);
-  void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot);
-  bool OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnCalculate(ObservedPtr<CPDFSDK_Annot>& pAnnot);
+  void OnFormat(ObservedPtr<CPDFSDK_Annot>& pAnnot);
+  bool OnButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   const CPDFSDK_PageView* pPageView,
                   Mask<FWL_EVENTFLAG> nFlag);
 
-  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                         int index,
                         bool selected);
-  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index);
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot, int index);
 
  private:
   using WidgetToFormFillerMap =
@@ -169,16 +169,16 @@
 
 #ifdef PDF_ENABLE_XFA
   void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, bool bSameField, bool bNext);
-  bool OnClick(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnClick(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                const CPDFSDK_PageView* pPageView,
                Mask<FWL_EVENTFLAG> nFlag);
-  bool OnFull(ObservedPtr<CPDFSDK_Widget>* pAnnot,
+  bool OnFull(ObservedPtr<CPDFSDK_Widget>& pAnnot,
               const CPDFSDK_PageView* pPageView,
               Mask<FWL_EVENTFLAG> nFlag);
-  bool OnPreOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnPreOpen(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                  const CPDFSDK_PageView* pPageView,
                  Mask<FWL_EVENTFLAG> nFlag);
-  bool OnPostOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnPostOpen(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   const CPDFSDK_PageView* pPageView,
                   Mask<FWL_EVENTFLAG> nFlag);
 #endif  // PDF_ENABLE_XFA
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 54a5d50..402a1c5 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -52,7 +52,7 @@
       DCHECK(pPageView);
 
       ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
-      if (m_pFormFiller->OnButtonUp(&pObserved, pPageView, nFlags) ||
+      if (m_pFormFiller->OnButtonUp(pObserved, pPageView, nFlags) ||
           !pObserved) {
         return true;
       }
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 58c9d03..0d07c2f 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -668,7 +668,7 @@
   if (!cpdfsdk_annot)
     return false;
 
-  return form_fill_env->SetFocusAnnot(&cpdfsdk_annot);
+  return form_fill_env->SetFocusAnnot(cpdfsdk_annot);
 }
 
 FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 2814217..e2bf59b 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -555,7 +555,7 @@
 
   if (!hWidget) {
     ObservedPtr<CPDFSDK_Annot> pNull;
-    m_pContext->GetFormFillEnv()->SetFocusAnnot(&pNull);
+    m_pContext->GetFormFillEnv()->SetFocusAnnot(pNull);
     return;
   }
 
@@ -568,7 +568,7 @@
 
     ObservedPtr<CPDFSDK_Annot> pAnnot(pPageView->GetAnnotByXFAWidget(hWidget));
     if (pAnnot) {
-      m_pContext->GetFormFillEnv()->SetFocusAnnot(&pAnnot);
+      m_pContext->GetFormFillEnv()->SetFocusAnnot(pAnnot);
       break;
     }
   }
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
index 54633c8..ac36a66 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.cpp
@@ -355,9 +355,9 @@
              FWL_WidgetHit::Unknown;
 }
 
-void CPDFXFA_WidgetHandler::OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+void CPDFXFA_WidgetHandler::OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlag) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return;
 
@@ -365,9 +365,9 @@
   pWidgetHandler->OnMouseEnter(pXFAWidget->GetXFAFFWidget());
 }
 
-void CPDFXFA_WidgetHandler::OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+void CPDFXFA_WidgetHandler::OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlag) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return;
 
@@ -375,10 +375,10 @@
   pWidgetHandler->OnMouseExit(pXFAWidget->GetXFAFFWidget());
 }
 
-bool CPDFXFA_WidgetHandler::OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                           Mask<FWL_EVENTFLAG> nFlags,
                                           const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -387,10 +387,10 @@
                                        GetKeyFlags(nFlags), point);
 }
 
-bool CPDFXFA_WidgetHandler::OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlags,
                                         const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -399,10 +399,10 @@
                                      GetKeyFlags(nFlags), point);
 }
 
-bool CPDFXFA_WidgetHandler::OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             Mask<FWL_EVENTFLAG> nFlags,
                                             const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -411,10 +411,10 @@
                                          GetKeyFlags(nFlags), point);
 }
 
-bool CPDFXFA_WidgetHandler::OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlags,
                                         const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -423,11 +423,11 @@
                                      GetKeyFlags(nFlags), point);
 }
 
-bool CPDFXFA_WidgetHandler::OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                          Mask<FWL_EVENTFLAG> nFlags,
                                          const CFX_PointF& point,
                                          const CFX_Vector& delta) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -436,10 +436,10 @@
                                       GetKeyFlags(nFlags), point, delta);
 }
 
-bool CPDFXFA_WidgetHandler::OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                           Mask<FWL_EVENTFLAG> nFlags,
                                           const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -448,10 +448,10 @@
                                        GetKeyFlags(nFlags), point);
 }
 
-bool CPDFXFA_WidgetHandler::OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlags,
                                         const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -460,10 +460,10 @@
                                      GetKeyFlags(nFlags), point);
 }
 
-bool CPDFXFA_WidgetHandler::OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             Mask<FWL_EVENTFLAG> nFlags,
                                             const CFX_PointF& point) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return false;
 
@@ -510,14 +510,14 @@
                                  GetKeyFlags(nFlag));
 }
 
-bool CPDFXFA_WidgetHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                        Mask<FWL_EVENTFLAG> nFlag) {
   return true;
 }
 
-bool CPDFXFA_WidgetHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                         Mask<FWL_EVENTFLAG> nFlag) {
-  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot->Get());
+  CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
   if (!pXFAWidget)
     return true;
 
@@ -534,11 +534,11 @@
 }
 
 bool CPDFXFA_WidgetHandler::OnXFAChangedFocus(
-    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
-  if (!pNewAnnot->HasObservable() || !GetXFAFFWidgetHandler(pNewAnnot->Get()))
+    ObservedPtr<CPDFSDK_Annot>& pNewAnnot) {
+  if (!pNewAnnot || !GetXFAFFWidgetHandler(pNewAnnot.Get()))
     return true;
 
-  CPDFXFA_Widget* pNewXFAWidget = ToXFAWidget(pNewAnnot->Get());
+  CPDFXFA_Widget* pNewXFAWidget = ToXFAWidget(pNewAnnot.Get());
   if (!pNewXFAWidget)
     return true;
 
@@ -556,13 +556,13 @@
   return pXFAPageView->GetDocView()->GetFocusWidget() == hWidget;
 }
 
-bool CPDFXFA_WidgetHandler::SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                              int index,
                                              bool selected) {
   return false;
 }
 
-bool CPDFXFA_WidgetHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+bool CPDFXFA_WidgetHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                             int index) {
   return false;
 }
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
index 1ec32bf..eab6cf6 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widgethandler.h
@@ -48,33 +48,33 @@
               const CFX_Matrix& mtUser2Device,
               bool bDrawAnnots) override;
   void OnLoad(CPDFSDK_Annot* pAnnot) override;
-  void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlag) override;
-  void OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  void OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point) override;
-  bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point) override;
-  bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                     Mask<FWL_EVENTFLAG> nFlags,
                     const CFX_PointF& point,
                     const CFX_Vector& delta) override;
-  bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                      Mask<FWL_EVENTFLAG> nFlags,
                      const CFX_PointF& point) override;
-  bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlags,
                    const CFX_PointF& point) override;
-  bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                        Mask<FWL_EVENTFLAG> nFlags,
                        const CFX_PointF& point) override;
   bool OnChar(CPDFSDK_Annot* pAnnot,
@@ -86,18 +86,18 @@
   bool OnKeyUp(CPDFSDK_Annot* pAnnot,
                FWL_VKEYCODE nKeyCode,
                Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                   Mask<FWL_EVENTFLAG> nFlag) override;
-  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                    Mask<FWL_EVENTFLAG> nFlag) override;
-  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                         int index,
                         bool selected) override;
-  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override;
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot, int index) override;
   std::unique_ptr<CPDFSDK_Annot> NewAnnotForXFA(
       CXFA_FFWidget* pFFWidget,
       CPDFSDK_PageView* pPageView) override;
-  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pNewAnnot) override;
+  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>& pNewAnnot) override;
 
  private:
   CXFA_FFWidgetHandler* GetXFAFFWidgetHandler(CPDFSDK_Annot* pAnnot);
diff --git a/fpdfsdk/ipdfsdk_annothandler.cpp b/fpdfsdk/ipdfsdk_annothandler.cpp
index 65aa389..926cf07 100644
--- a/fpdfsdk/ipdfsdk_annothandler.cpp
+++ b/fpdfsdk/ipdfsdk_annothandler.cpp
@@ -21,7 +21,7 @@
 }
 
 bool IPDFSDK_AnnotHandler::OnXFAChangedFocus(
-    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
+    ObservedPtr<CPDFSDK_Annot>& pNewAnnot) {
   NOTREACHED();
   return false;
 }
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index 1c42dcf..63daebb 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -61,33 +61,33 @@
                       const CFX_Matrix& mtUser2Device,
                       bool bDrawAnnots) = 0;
   virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
-  virtual void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual void OnMouseEnter(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                             Mask<FWL_EVENTFLAG> nFlag) = 0;
-  virtual void OnMouseExit(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual void OnMouseExit(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlag) = 0;
-  virtual bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnLButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                              Mask<FWL_EVENTFLAG> nFlags,
                              const CFX_PointF& point) = 0;
-  virtual bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnLButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlags,
                            const CFX_PointF& point) = 0;
-  virtual bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnLButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                Mask<FWL_EVENTFLAG> nFlags,
                                const CFX_PointF& point) = 0;
-  virtual bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnMouseMove(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlags,
                            const CFX_PointF& point) = 0;
-  virtual bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnMouseWheel(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                             Mask<FWL_EVENTFLAG> nFlags,
                             const CFX_PointF& point,
                             const CFX_Vector& delta) = 0;
-  virtual bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnRButtonDown(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                              Mask<FWL_EVENTFLAG> nFlags,
                              const CFX_PointF& point) = 0;
-  virtual bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnRButtonUp(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlags,
                            const CFX_PointF& point) = 0;
-  virtual bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnRButtonDblClk(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                Mask<FWL_EVENTFLAG> nFlags,
                                const CFX_PointF& point) = 0;
   virtual bool OnChar(CPDFSDK_Annot* pAnnot,
@@ -99,21 +99,21 @@
   virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot,
                        FWL_VKEYCODE nKeyCode,
                        Mask<FWL_EVENTFLAG> nFlag) = 0;
-  virtual bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                           Mask<FWL_EVENTFLAG> nFlag) = 0;
-  virtual bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                            Mask<FWL_EVENTFLAG> nFlag) = 0;
-  virtual bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                 int index,
                                 bool selected) = 0;
-  virtual bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
+  virtual bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>& pAnnot,
                                int index) = 0;
 
 #ifdef PDF_ENABLE_XFA
   virtual std::unique_ptr<CPDFSDK_Annot> NewAnnotForXFA(
       CXFA_FFWidget* pFFWidget,
       CPDFSDK_PageView* pPageView);
-  virtual bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pNewAnnot);
+  virtual bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>& pNewAnnot);
 #endif  // PDF_ENABLE_XFA
 
  private:
diff --git a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
index ae60a4d..e79fbbe 100644
--- a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
@@ -55,7 +55,7 @@
         m_pFormFillEnv->GetInteractiveFormFiller();
     {
       ObservedPtr<CPDFSDK_Annot> pObserved(pAnnotCombobox);
-      EXPECT_TRUE(pInteractiveFormFiller->OnSetFocus(&pObserved, {}));
+      EXPECT_TRUE(pInteractiveFormFiller->OnSetFocus(pObserved, {}));
     }
 
     m_pFormFiller =
diff --git a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
index 739b440..fe44647 100644
--- a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
@@ -60,7 +60,7 @@
         m_pFormFillEnv->GetInteractiveFormFiller();
     {
       ObservedPtr<CPDFSDK_Annot> pObserved(pAnnotTextField);
-      EXPECT_TRUE(pInteractiveFormFiller->OnSetFocus(&pObserved, {}));
+      EXPECT_TRUE(pInteractiveFormFiller->OnSetFocus(pObserved, {}));
     }
 
     m_pFormFiller =
diff --git a/fpdfsdk/pwl/cpwl_special_button_embeddertest.cpp b/fpdfsdk/pwl/cpwl_special_button_embeddertest.cpp
index 3bde235..31f366e 100644
--- a/fpdfsdk/pwl/cpwl_special_button_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_special_button_embeddertest.cpp
@@ -68,7 +68,7 @@
         formfill_env_->GetInteractiveFormFiller();
     {
       ObservedPtr<CPDFSDK_Annot> observed(annot);
-      EXPECT_TRUE(interactive_formfiller->OnSetFocus(&observed, {}));
+      EXPECT_TRUE(interactive_formfiller->OnSetFocus(observed, {}));
     }
 
     form_filler_ = interactive_formfiller->GetFormFieldForTesting(annot);
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 6469d69..70027fe 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -2509,7 +2509,7 @@
 
   if (pWidget) {
     ObservedPtr<CPDFSDK_Annot> pObserved(pWidget);
-    m_pFormFillEnv->SetFocusAnnot(&pObserved);
+    m_pFormFillEnv->SetFocusAnnot(pObserved);
   }
 
   return CJS_Result::Success();