summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 960ec9967a..051c39f74e 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -79,7 +79,6 @@ CFWL_Edit::CFWL_Edit(const CFWL_App* app,
m_rtEngine.Reset();
m_rtStatic.Reset();
- InitCaret();
m_EdtEngine.SetDelegate(this);
}
@@ -1065,8 +1064,14 @@ bool CFWL_Edit::ValidateNumberChar(wchar_t cNum) {
}
void CFWL_Edit::InitCaret() {
- m_pCaret.reset();
- m_rtCaret = CFX_RectF();
+ if (m_pCaret)
+ return;
+
+ m_pCaret = pdfium::MakeUnique<CFWL_Caret>(
+ m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(), this);
+ m_pCaret->SetParent(this);
+ m_pCaret->SetStates(m_pProperties->m_dwStates);
+ UpdateCursorRect();
}
void CFWL_Edit::UpdateCursorRect() {
@@ -1076,10 +1081,12 @@ void CFWL_Edit::UpdateCursorRect() {
m_EdtEngine.GetCharacterInfo(m_CursorPosition);
// TODO(dsinclair): This should handle bidi level ...
- if (m_rtCaret.width == 0 && m_rtCaret.left > 1.0f)
- m_rtCaret.left -= 1.0f;
-
m_rtCaret.width = 1.0f;
+
+ // TODO(hnakashima): Handle correctly edits with empty text instead of using
+ // these defaults.
+ if (m_rtCaret.height == 0)
+ m_rtCaret.height = 8.0f;
}
void CFWL_Edit::SetCursorPosition(size_t position) {