Cleanup CFX_SystemHandler.
- Remove check that can never be true.
- Move cursor styles to CPWL_Wnd.
Change-Id: I93fe0580f72dfaa9b8d36e19285f67a20a856492
Reviewed-on: https://pdfium-review.googlesource.com/c/47160
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index 7b4cf1a..fae3282 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -22,9 +22,11 @@
#include "third_party/base/ptr_util.h"
CFX_SystemHandler::CFX_SystemHandler(CPDFSDK_FormFillEnvironment* pFormFillEnv)
- : m_pFormFillEnv(pFormFillEnv) {}
+ : m_pFormFillEnv(pFormFillEnv) {
+ ASSERT(m_pFormFillEnv);
+}
-CFX_SystemHandler::~CFX_SystemHandler() {}
+CFX_SystemHandler::~CFX_SystemHandler() = default;
void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget,
const CFX_FloatRect& rect) {
@@ -48,7 +50,7 @@
}
void CFX_SystemHandler::OutputSelectedRect(CFFL_FormFiller* pFormFiller,
- CFX_FloatRect& rect) {
+ const CFX_FloatRect& rect) {
if (!pFormFiller)
return;
@@ -64,9 +66,6 @@
}
bool CFX_SystemHandler::IsSelectionImplemented() const {
- if (!m_pFormFillEnv)
- return false;
-
FPDF_FORMFILLINFO* pInfo = m_pFormFillEnv->GetFormFillInfo();
return pInfo && pInfo->FFI_OutputSelectedRect;
}
diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h
index 1513ae0..719ec34 100644
--- a/fpdfsdk/cfx_systemhandler.h
+++ b/fpdfsdk/cfx_systemhandler.h
@@ -14,14 +14,6 @@
using TimerCallback = void (*)(int32_t idEvent);
-// Cursor style. These must match the values in public/fpdf_formfill.h
-#define FXCT_ARROW 0
-#define FXCT_NESW 1
-#define FXCT_NWSE 2
-#define FXCT_VBEAM 3
-#define FXCT_HBEAM 4
-#define FXCT_HAND 5
-
class CFFL_FormFiller;
class CPDF_Document;
class CPDF_Font;
@@ -34,7 +26,8 @@
~CFX_SystemHandler();
void InvalidateRect(CPDFSDK_Widget* widget, const CFX_FloatRect& rect);
- void OutputSelectedRect(CFFL_FormFiller* pFormFiller, CFX_FloatRect& rect);
+ void OutputSelectedRect(CFFL_FormFiller* pFormFiller,
+ const CFX_FloatRect& rect);
bool IsSelectionImplemented() const;
void SetCursor(int32_t nCursorType);
bool FindNativeTrueTypeFont(ByteString sFontFaceName);
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 339c336..3801cad 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -63,6 +63,14 @@
// combobox styles
#define PCBS_ALLOWCUSTOMTEXT 0x0001L
+// Cursor style. These must match the values in public/fpdf_formfill.h
+#define FXCT_ARROW 0
+#define FXCT_NESW 1
+#define FXCT_NWSE 2
+#define FXCT_VBEAM 3
+#define FXCT_HBEAM 4
+#define FXCT_HAND 5
+
struct CPWL_Dash {
CPWL_Dash() : nDash(0), nGap(0), nPhase(0) {}
CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)