Use early returns in CFWL_NoteDriver::DoKey().
Change-Id: I2ee75260ebd21a69c72bc9516e876c70fc62a5ba
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56513
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 88655e3..3114733 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -185,20 +185,21 @@
}
#endif
- if (!m_pFocus) {
- if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
- pMsg->m_dwKeyCode == XFA_FWL_VKEY_Return) {
- CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
- CFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
- if (defButton) {
- pMsg->SetDstTarget(defButton);
- return true;
- }
- }
- return false;
+ if (m_pFocus) {
+ pMsg->SetDstTarget(m_pFocus.Get());
+ return true;
}
- pMsg->SetDstTarget(m_pFocus.Get());
- return true;
+
+ if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
+ pMsg->m_dwKeyCode == XFA_FWL_VKEY_Return) {
+ CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
+ CFWL_Widget* pDefButton = pWidgetMgr->GetDefaultButton(pMessageForm);
+ if (pDefButton) {
+ pMsg->SetDstTarget(pDefButton);
+ return true;
+ }
+ }
+ return false;
}
bool CFWL_NoteDriver::DoMouse(CFWL_Message* pMessage,