diff options
author | dsinclair <dsinclair@chromium.org> | 2016-12-07 17:12:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-07 17:12:59 -0800 |
commit | 919c0842b74d382e7ae60c85ff16642b646afbb9 (patch) | |
tree | 9518c8f10639f90cc63549a1bb068b43a0661d46 /xfa/fwl/core/cfwl_caret.cpp | |
parent | 4614b45a6592530c4cd930f139c366ce20d359f4 (diff) | |
download | pdfium-919c0842b74d382e7ae60c85ff16642b646afbb9.tar.xz |
Cleanup caret show/hide code
This CL splits the cursor code into specific show/hide methods to make it
clearer what is happening at each point.
Review-Url: https://codereview.chromium.org/2535623002
Diffstat (limited to 'xfa/fwl/core/cfwl_caret.cpp')
-rw-r--r-- | xfa/fwl/core/cfwl_caret.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xfa/fwl/core/cfwl_caret.cpp b/xfa/fwl/core/cfwl_caret.cpp index b4ebf2cec8..b42945c6a8 100644 --- a/xfa/fwl/core/cfwl_caret.cpp +++ b/xfa/fwl/core/cfwl_caret.cpp @@ -55,15 +55,19 @@ void CFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); } -void CFWL_Caret::ShowCaret(bool bFlag) { +void CFWL_Caret::ShowCaret() { + if (m_pTimerInfo) + m_pTimerInfo->StopTimer(); + m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); + SetStates(FWL_WGTSTATE_Invisible, false); +} + +void CFWL_Caret::HideCaret() { if (m_pTimerInfo) { m_pTimerInfo->StopTimer(); m_pTimerInfo = nullptr; } - if (bFlag) - m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); - - SetStates(FWL_WGTSTATE_Invisible, !bFlag); + SetStates(FWL_WGTSTATE_Invisible, true); } void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, |