Remove CFWL_WidgetMgr::SetParent().

It is only called in one place, right after a widget is created. The
widget constructor does an InsertWidget() with the same parent and
widget arguments that will subsequently be passed to SetParent(). The
result is two calls to AppendLastChild() with the same arguments, with
the second one being essentially a no-op.

Change-Id: Ibee59582fe81e72e37e6fa76d73930edc35c004c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72710
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index fc13fb5..553f74e 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -961,7 +961,6 @@
 
   m_pCaret = std::make_unique<CFWL_Caret>(
       GetOwnerApp(), std::make_unique<CFWL_WidgetProperties>(), this);
-  GetWidgetMgr()->SetParent(this, m_pCaret.get());
   m_pCaret->SetStates(GetProperties()->m_dwStates);
   UpdateCursorRect();
 }
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index a7beabd..b03e739 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -137,19 +137,6 @@
   m_mapWidgetItem.erase(pWidget);
 }
 
-void CFWL_WidgetMgr::SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild) {
-  Item* pItem = GetWidgetMgrItem(pChild);
-  if (!pItem)
-    return;
-
-  Item* pParentItem = GetWidgetMgrItem(pParent);
-  if (!pParentItem) {
-    pItem->RemoveSelfIfParented();
-    return;
-  }
-  pParentItem->AppendLastChild(pItem);
-}
-
 CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent,
                                               const CFX_PointF& point) const {
   if (!parent)
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 6f4e763..c4c401e 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -50,7 +50,6 @@
 
   void InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild);
   void RemoveWidget(CFWL_Widget* pWidget);
-  void SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild);
 
   CFWL_Widget* GetWidgetAtPoint(CFWL_Widget* pParent,
                                 const CFX_PointF& point) const;