Remove some dead code in xfa/fwl.

CFWL_WidgetMgr::GetFirstSiblingWidget() is uncalled.
CFWL_NoteDriver::{Get,Set}Focus() is uncalled.
CFWL_NoteDriver::GetMessageForm() is uncalled.
In turn, that makes CFWL_WidgetMgr::GetSystemFormWidget() uncalled.
In turn, that makes CFWL_WidgetMgr::IsAbleWidget() uncalled.

-- make CFWL_NoteDriver::SetGrab() simpler while we're at it.

Change-Id: Ib70c5bc9c1de052f73d0076ace08b0d1ea180e88
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72731
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 6259c3c..a9a688c 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -62,27 +62,6 @@
     it->second->FlagInvalid();
 }
 
-bool CFWL_NoteDriver::SetFocus(CFWL_Widget* pFocus) {
-  if (m_pFocus == pFocus)
-    return true;
-
-  CFWL_Widget* pPrev = m_pFocus.Get();
-  m_pFocus = pFocus;
-  if (pPrev) {
-    if (IFWL_WidgetDelegate* pDelegate = pPrev->GetDelegate()) {
-      CFWL_MessageKillFocus ms(pPrev, pPrev);
-      pDelegate->OnProcessMessage(&ms);
-    }
-  }
-  if (pFocus) {
-    if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) {
-      CFWL_MessageSetFocus ms(nullptr, pFocus);
-      pDelegate->OnProcessMessage(&ms);
-    }
-  }
-  return true;
-}
-
 void CFWL_NoteDriver::NotifyTargetHide(CFWL_Widget* pNoteTarget) {
   if (m_pFocus == pNoteTarget)
     m_pFocus = nullptr;
@@ -260,11 +239,3 @@
   CFWL_MessageMouse msHover(pTarget, FWL_MouseCommand::Hover, 0, pMsg->m_pos);
   DispatchMessage(&msHover, nullptr);
 }
-
-CFWL_Widget* CFWL_NoteDriver::GetMessageForm(CFWL_Widget* pDstTarget) {
-  if (!pDstTarget)
-    return nullptr;
-
-  CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr();
-  return pWidgetMgr->GetSystemFormWidget(pDstTarget);
-}
diff --git a/xfa/fwl/cfwl_notedriver.h b/xfa/fwl/cfwl_notedriver.h
index bcf29da..343625b 100644
--- a/xfa/fwl/cfwl_notedriver.h
+++ b/xfa/fwl/cfwl_notedriver.h
@@ -27,12 +27,7 @@
   void SendEvent(CFWL_Event* pNote);
   void RegisterEventTarget(CFWL_Widget* pListener, CFWL_Widget* pEventSource);
   void UnregisterEventTarget(CFWL_Widget* pListener);
-
-  CFWL_Widget* GetFocus() const { return m_pFocus.Get(); }
-  bool SetFocus(CFWL_Widget* pFocus);
-  void SetGrab(CFWL_Widget* pGrab, bool bSet) {
-    m_pGrab = bSet ? pGrab : nullptr;
-  }
+  void SetGrab(CFWL_Widget* pGrab) { m_pGrab = pGrab; }
 
   void NotifyTargetHide(CFWL_Widget* pNoteTarget);
   void NotifyTargetDestroy(CFWL_Widget* pNoteTarget);
@@ -47,7 +42,6 @@
   bool DoWheel(CFWL_Message* pMsg, CFWL_Widget* pMessageForm);
   bool DoMouseEx(CFWL_Message* pMsg, CFWL_Widget* pMessageForm);
   void MouseSecondary(CFWL_Message* pMsg);
-  CFWL_Widget* GetMessageForm(CFWL_Widget* pDstTarget);
 
   std::map<uint64_t, std::unique_ptr<CFWL_EventTarget>> m_eventTargets;
   UnownedPtr<CFWL_Widget> m_pHover;
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index 2cb94d5..6733f19 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -279,7 +279,7 @@
 
 void CFWL_Widget::SetGrab(bool bSet) {
   CFWL_NoteDriver* pDriver = GetOwnerApp()->GetNoteDriver();
-  pDriver->SetGrab(this, bSet);
+  pDriver->SetGrab(bSet ? this : nullptr);
 }
 
 void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource) {
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index b03e739..a9b61b4 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -34,21 +34,6 @@
   return pItem && pItem->pOwner ? pItem->pOwner->pWidget : nullptr;
 }
 
-CFWL_Widget* CFWL_WidgetMgr::GetFirstSiblingWidget(CFWL_Widget* pWidget) const {
-  Item* pItem = GetWidgetMgrItem(pWidget);
-  if (!pItem)
-    return nullptr;
-
-  pItem = pItem->GetPrevSibling();  // Item is never its own first sibling.
-  if (!pItem)
-    return nullptr;
-
-  while (pItem->GetPrevSibling())
-    pItem = pItem->GetPrevSibling();
-
-  return pItem->pWidget;
-}
-
 CFWL_Widget* CFWL_WidgetMgr::GetPriorSiblingWidget(CFWL_Widget* pWidget) const {
   Item* pItem = GetWidgetMgrItem(pWidget);
   if (!pItem)
@@ -85,17 +70,6 @@
   return pChild ? pChild->pWidget : nullptr;
 }
 
-CFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(CFWL_Widget* pWidget) const {
-  Item* pItem = GetWidgetMgrItem(pWidget);
-  while (pItem) {
-    if (IsAbleNative(pItem->pWidget))
-      return pItem->pWidget;
-    pItem = pItem->GetParent();
-  }
-  return nullptr;
-}
-
-
 void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget,
                                    const CFX_RectF& rect) {
   CFWL_Widget* pNative = pWidget;
@@ -204,13 +178,6 @@
   return pItem;
 }
 
-bool CFWL_WidgetMgr::IsAbleNative(CFWL_Widget* pWidget) const {
-  if (!pWidget || !pWidget->IsForm())
-    return false;
-
-  return pWidget->IsOverLapper() || pWidget->IsPopup();
-}
-
 void CFWL_WidgetMgr::GetAdapterPopupPos(CFWL_Widget* pWidget,
                                         float fMinHeight,
                                         float fMaxHeight,
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index c4c401e..9da6ae5 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -44,7 +44,6 @@
   CFWL_Widget* GetOwnerWidget(const CFWL_Widget* pWidget) const;
   CFWL_Widget* GetNextSiblingWidget(CFWL_Widget* pWidget) const;
   CFWL_Widget* GetFirstChildWidget(CFWL_Widget* pWidget) const;
-  CFWL_Widget* GetSystemFormWidget(CFWL_Widget* pWidget) const;
 
   void RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF& pRect);
 
@@ -76,7 +75,6 @@
     int32_t iRedrawCounter = 0;
   };
 
-  CFWL_Widget* GetFirstSiblingWidget(CFWL_Widget* pWidget) const;
   CFWL_Widget* GetPriorSiblingWidget(CFWL_Widget* pWidget) const;
   CFWL_Widget* GetLastChildWidget(CFWL_Widget* pWidget) const;
 
@@ -90,8 +88,6 @@
                  CXFA_Graphics* pGraphics,
                  const CFX_Matrix* pMatrix);
 
-  bool IsAbleNative(CFWL_Widget* pWidget) const;
-
   std::map<const CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem;
   UnownedPtr<AdapterIface> const m_pAdapter;
 };