From bfeab62b37a701dc82f180e49d26c602f96f96f9 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 6 Feb 2018 21:36:45 +0000 Subject: Fix caret not appearing in XFA Edits. This makes the caret appear (again?), blink, and fixes its positioning to be a little spaced from the last character. Known issue: when the edit is empty, the caret is not necessarily aligned with where the text will be. Bug: chromium:592750 Change-Id: I950b0ea236db8855c6ed50f48ec1935d97e6ccf8 Reviewed-on: https://pdfium-review.googlesource.com/25451 Reviewed-by: dsinclair Commit-Queue: Henrique Nakashima --- xfa/fwl/cfwl_caret.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'xfa/fwl/cfwl_caret.cpp') diff --git a/xfa/fwl/cfwl_caret.cpp b/xfa/fwl/cfwl_caret.cpp index cd85041d92..03c8ffde68 100644 --- a/xfa/fwl/cfwl_caret.cpp +++ b/xfa/fwl/cfwl_caret.cpp @@ -58,17 +58,21 @@ void CFWL_Caret::DrawWidget(CXFA_Graphics* pGraphics, } void CFWL_Caret::ShowCaret() { - if (m_pTimerInfo) - m_pTimerInfo->StopTimer(); + if (m_pTimerInfo) { + CFWL_TimerInfo* pOldTimerInfo = m_pTimerInfo.Release(); + pOldTimerInfo->StopTimer(); + } + m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); RemoveStates(FWL_WGTSTATE_Invisible); } void CFWL_Caret::HideCaret() { if (m_pTimerInfo) { - m_pTimerInfo->StopTimer(); - m_pTimerInfo = nullptr; + CFWL_TimerInfo* pOldTimerInfo = m_pTimerInfo.Release(); + pOldTimerInfo->StopTimer(); } + SetStates(FWL_WGTSTATE_Invisible); } -- cgit v1.2.3