Change parameter type to IPWL_FocusHandler::OnSetFocus().
The parameter is a CPWL_Wnd* but the only caller passes in a CPWL_Edit*,
so change it to CPWL_Edit* and remove the type checks / casting.
Change-Id: Ic2c85427bea5bf3d257b63c1e2ce9db5bee22136
Reviewed-on: https://pdfium-review.googlesource.com/7430
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 006828d..6af65de 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -257,11 +257,7 @@
}
#endif // PDF_ENABLE_XFA
-void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) {
- if (pWnd->GetClassName() != PWL_CLASSNAME_EDIT)
- return;
-
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+void CFFL_ComboBox::OnSetFocus(CPWL_Edit* pEdit) {
pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h
index be14d8b..96e8ffd 100644
--- a/fpdfsdk/formfiller/cffl_combobox.h
+++ b/fpdfsdk/formfiller/cffl_combobox.h
@@ -47,7 +47,7 @@
bool bRestoreValue) override;
// IPWL_FocusHandler:
- void OnSetFocus(CPWL_Wnd* pWnd) override;
+ void OnSetFocus(CPWL_Edit* pEdit) override;
#ifdef PDF_ENABLE_XFA
// CFFL_FormFiller:
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index da8c14d..70bc202 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -255,11 +255,7 @@
}
#endif // PDF_ENABLE_XFA
-void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
- if (pWnd->GetClassName() != PWL_CLASSNAME_EDIT)
- return;
-
- CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+void CFFL_TextField::OnSetFocus(CPWL_Edit* pEdit) {
pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h
index 621c118..91771a1 100644
--- a/fpdfsdk/formfiller/cffl_textfield.h
+++ b/fpdfsdk/formfiller/cffl_textfield.h
@@ -52,7 +52,7 @@
bool bRestoreValue) override;
// IPWL_FocusHandler:
- void OnSetFocus(CPWL_Wnd* pWnd) override;
+ void OnSetFocus(CPWL_Edit* pEdit) override;
#ifdef PDF_ENABLE_XFA
// CFFL_FormFiller:
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h
index a3c4cbb..2689a10 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.h
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.h
@@ -19,6 +19,7 @@
#include "fpdfsdk/pdfwindow/cpwl_timer.h"
#include "fpdfsdk/pdfwindow/cpwl_timer_handler.h"
+class CPWL_Edit;
class CPWL_MsgControl;
class CPWL_ScrollBar;
class CPWL_Wnd;
@@ -114,7 +115,7 @@
class IPWL_FocusHandler {
public:
virtual ~IPWL_FocusHandler() {}
- virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0;
+ virtual void OnSetFocus(CPWL_Edit* pEdit) = 0;
};
struct PWL_CREATEPARAM {