From 68eefa6a6f6bbab73000a29e2cac3e104be1cc81 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 30 Aug 2017 12:16:16 -0400 Subject: Rebuild CFDE_TextEditEngine. This CL rebuilds the text edit engine in a simpler fashion. Instead of depending on multiple pages, paragraphs and buffer fields there is a single text edit engine which contains a gap buffer. This makes the code easier to understand and follow. Change-Id: I10fe85603fa9ed15a647eaac2d931f113cd0c7b0 Reviewed-on: https://pdfium-review.googlesource.com/11990 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima Reviewed-by: Ryan Harrison --- xfa/fxfa/cxfa_fftextedit.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'xfa/fxfa/cxfa_fftextedit.cpp') diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index dfa4c41309..35c20fab6f 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -60,9 +60,8 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { return; uint32_t dwStyle = 0; - uint32_t dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus | - FWL_STYLEEXT_EDT_OuterScrollbar | - FWL_STYLEEXT_EDT_LastLineHeight; + uint32_t dwExtendedStyle = + FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar; dwExtendedStyle |= UpdateUIProperty(); if (m_pDataAcc->IsMultiLine()) { dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine | FWL_STYLEEXT_EDT_WantReturn; @@ -300,14 +299,14 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) { CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit; eParam.m_wsNewText = pDateTime->GetEditText(); - int32_t iSels = pDateTime->CountSelRanges(); - if (iSels) - eParam.m_iSelEnd = pDateTime->GetSelRange(0, &eParam.m_iSelStart); + if (pDateTime->HasSelection()) { + std::tie(eParam.m_iSelStart, eParam.m_iSelEnd) = + pDateTime->GetSelection(); + } } else { eParam.m_wsNewText = pEdit->GetText(); - int32_t iSels = pEdit->CountSelRanges(); - if (iSels) - eParam.m_iSelEnd = pEdit->GetSelRange(0, &eParam.m_iSelStart); + if (pEdit->HasSelection()) + std::tie(eParam.m_iSelStart, eParam.m_iSelEnd) = pEdit->GetSelection(); } m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); } -- cgit v1.2.3