Fix nits in CPWL_Caret and delete dead code.
Change-Id: Ifee583a83e2828d6d87b6853efa397d851e15a1c
Reviewed-on: https://pdfium-review.googlesource.com/c/47071
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp
index 4dfda8a..7447955 100644
--- a/fpdfsdk/pwl/cpwl_caret.cpp
+++ b/fpdfsdk/pwl/cpwl_caret.cpp
@@ -14,8 +14,6 @@
#include "core/fxge/cfx_renderdevice.h"
#include "fpdfsdk/pwl/cpwl_wnd.h"
-#define PWL_CARET_FLASHINTERVAL 500
-
CPWL_Caret::CPWL_Caret(const CreateParams& cp,
std::unique_ptr<PrivateData> pAttachedData)
: CPWL_Wnd(cp, std::move(pAttachedData)) {}
@@ -53,11 +51,6 @@
}
void CPWL_Caret::TimerProc() {
- if (m_nDelay > 0) {
- --m_nDelay;
- return;
- }
-
m_bFlash = !m_bFlash;
InvalidateRect(nullptr);
// Note, |this| may no longer be viable at this point. If more work needs
@@ -87,10 +80,12 @@
}
if (!IsVisible()) {
+ static constexpr int32_t kCaretFlashIntervalMs = 500;
+
m_ptHead = ptHead;
m_ptFoot = ptFoot;
EndTimer();
- BeginTimer(PWL_CARET_FLASHINTERVAL);
+ BeginTimer(kCaretFlashIntervalMs);
if (!CPWL_Wnd::SetVisible(true))
return;
diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h
index f576fe3..44c20f3 100644
--- a/fpdfsdk/pwl/cpwl_caret.h
+++ b/fpdfsdk/pwl/cpwl_caret.h
@@ -27,7 +27,7 @@
void SetCaret(bool bVisible,
const CFX_PointF& ptHead,
const CFX_PointF& ptFoot);
- void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; }
+ void SetInvalidRect(const CFX_FloatRect& rc) { m_rcInvalid = rc; }
private:
CFX_FloatRect GetCaretRect() const;
@@ -36,7 +36,6 @@
CFX_PointF m_ptHead;
CFX_PointF m_ptFoot;
float m_fWidth = 0.4f;
- int32_t m_nDelay = 0;
CFX_FloatRect m_rcInvalid;
};