Pass CPDF_Document instead of CPDF_AnnotList when constructing CPDF_Annot.

CPDF_AnnotList in CPDF_Annot is only used for getting CPDF_Document.

Review-Url: https://codereview.chromium.org/2166883002
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index c9e5d8e..e1a9760 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -42,7 +42,7 @@
       pDict = pAnnots->GetDictAt(i);
     }
     m_AnnotList.push_back(
-        std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, this)));
+        std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument)));
     if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
         CPDF_InterForm::IsUpdateAPEnabled()) {
       FPDF_GenerateAP(m_pDocument, pDict);
@@ -121,9 +121,9 @@
   }
 }
 
-CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList)
+CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument)
     : m_pAnnotDict(pDict),
-      m_pList(pList),
+      m_pDocument(pDocument),
       m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")) {}
 
 CPDF_Annot::~CPDF_Annot() {
@@ -200,7 +200,7 @@
     return it->second;
 
   CPDF_Form* pNewForm =
-      new CPDF_Form(m_pList->GetDocument(), pPage->m_pResources, pStream);
+      new CPDF_Form(m_pDocument, pPage->m_pResources, pStream);
   pNewForm->ParseContent(nullptr, nullptr, nullptr);
   m_APMap[pStream] = pNewForm;
   return pNewForm;
diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h
index fd5dde0..887b0dc 100644
--- a/core/fpdfdoc/include/fpdf_doc.h
+++ b/core/fpdfdoc/include/fpdf_doc.h
@@ -320,7 +320,7 @@
  public:
   enum AppearanceMode { Normal, Rollover, Down };
 
-  CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList);
+  CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument);
   ~CPDF_Annot();
 
   CFX_ByteString GetSubType() const;
@@ -345,7 +345,7 @@
 
  private:
   CPDF_Dictionary* const m_pAnnotDict;
-  CPDF_AnnotList* const m_pList;
+  CPDF_Document* const m_pDocument;
   const CFX_ByteString m_sSubtype;
   std::map<CPDF_Stream*, CPDF_Form*> m_APMap;
 };
@@ -378,7 +378,6 @@
   const std::vector<std::unique_ptr<CPDF_Annot>>& All() const {
     return m_AnnotList;
   }
-  CPDF_Document* GetDocument() const { return m_pDocument; }
 
  protected:
   void DisplayPass(CPDF_Page* pPage,