summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fwl/cfwl_combolist.cpp4
-rw-r--r--xfa/fwl/cfwl_messagekillfocus.cpp5
-rw-r--r--xfa/fwl/cfwl_messagekillfocus.h11
3 files changed, 15 insertions, 5 deletions
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index 004fbb46b9..5aae3cddd4 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -122,8 +122,8 @@ void CFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet) {
CFWL_MessageKillFocus* pKill = static_cast<CFWL_MessageKillFocus*>(pMsg);
CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter);
- if (pKill->m_pSetFocus == m_pOuter ||
- pKill->m_pSetFocus == pOuter->GetComboEdit()) {
+ if (pKill->IsFocusedOnWidget(m_pOuter) ||
+ pKill->IsFocusedOnWidget(pOuter->GetComboEdit())) {
pOuter->ShowDropList(false);
}
}
diff --git a/xfa/fwl/cfwl_messagekillfocus.cpp b/xfa/fwl/cfwl_messagekillfocus.cpp
index 55247d1f2e..34c4c053e7 100644
--- a/xfa/fwl/cfwl_messagekillfocus.cpp
+++ b/xfa/fwl/cfwl_messagekillfocus.cpp
@@ -17,7 +17,10 @@ CFWL_MessageKillFocus::CFWL_MessageKillFocus(CFWL_Widget* pSrcTarget,
CFWL_Widget* pDstTarget)
: CFWL_Message(CFWL_Message::Type::KillFocus, pSrcTarget, pDstTarget) {}
-CFWL_MessageKillFocus::~CFWL_MessageKillFocus() {}
+CFWL_MessageKillFocus::CFWL_MessageKillFocus(
+ const CFWL_MessageKillFocus& that) = default;
+
+CFWL_MessageKillFocus::~CFWL_MessageKillFocus() = default;
std::unique_ptr<CFWL_Message> CFWL_MessageKillFocus::Clone() {
return pdfium::MakeUnique<CFWL_MessageKillFocus>(*this);
diff --git a/xfa/fwl/cfwl_messagekillfocus.h b/xfa/fwl/cfwl_messagekillfocus.h
index d6ca799efb..79aaebed6c 100644
--- a/xfa/fwl/cfwl_messagekillfocus.h
+++ b/xfa/fwl/cfwl_messagekillfocus.h
@@ -9,18 +9,25 @@
#include <memory>
+#include "core/fxcrt/unowned_ptr.h"
#include "xfa/fwl/cfwl_message.h"
class CFWL_MessageKillFocus : public CFWL_Message {
public:
explicit CFWL_MessageKillFocus(CFWL_Widget* pSrcTarget);
CFWL_MessageKillFocus(CFWL_Widget* pSrcTarget, CFWL_Widget* pDstTarget);
+ CFWL_MessageKillFocus(const CFWL_MessageKillFocus& that);
~CFWL_MessageKillFocus() override;
- // CFWL_Message
+ // CFWL_Message:
std::unique_ptr<CFWL_Message> Clone() override;
- CFWL_Widget* m_pSetFocus;
+ bool IsFocusedOnWidget(const CFWL_Widget* pWidget) const {
+ return pWidget == m_pSetFocus.Get();
+ }
+
+ private:
+ UnownedPtr<CFWL_Widget> m_pSetFocus;
};
#endif // XFA_FWL_CFWL_MESSAGEKILLFOCUS_H_