diff options
author | Lei Zhang <thestig@chromium.org> | 2017-06-29 21:33:34 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-30 04:45:24 +0000 |
commit | a173900b19e158130df049dd1c31b7494baefffd (patch) | |
tree | 68a10871f738b3dca78a9341138ca5e7680d973b /xfa/fxfa/app/cxfa_fftextedit.cpp | |
parent | 91e39d2218c1b4e67321f845daf0fdb8d171982b (diff) | |
download | pdfium-a173900b19e158130df049dd1c31b7494baefffd.tar.xz |
Fix nits in a bunch of random XFA files.
- Simplify if (cond) return true; return false; pattern.
- Use size_t in CXFA_FFDocView::RunCalculateRecursive().
Change-Id: I1c426556bc927a118cb062999812ab06bbfcfec7
Reviewed-on: https://pdfium-review.googlesource.com/7130
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/app/cxfa_fftextedit.cpp')
-rw-r--r-- | xfa/fxfa/app/cxfa_fftextedit.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/xfa/fxfa/app/cxfa_fftextedit.cpp b/xfa/fxfa/app/cxfa_fftextedit.cpp index b61d4ab125..7248abf908 100644 --- a/xfa/fxfa/app/cxfa_fftextedit.cpp +++ b/xfa/fxfa/app/cxfa_fftextedit.cpp @@ -249,6 +249,7 @@ bool CXFA_FFTextEdit::UpdateFWLData() { if (!m_pNormalWidget) return false; + CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get()); XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display; if (IsFocused()) eType = XFA_VALUEPICTURE_Edit; @@ -260,28 +261,24 @@ bool CXFA_FFTextEdit::UpdateFWLData() { int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType); if (elementType == XFA_Element::ExData) iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0; - if (static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetLimit() != - iMaxChars) { - static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(iMaxChars); + if (pEdit->GetLimit() != iMaxChars) { + pEdit->SetLimit(iMaxChars); bUpdate = true; } - } - - if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) { + } else if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) { int32_t nDataLen = 0; if (eType == XFA_VALUEPICTURE_Edit) m_pDataAcc->GetBarcodeAttribute_DataLength(&nDataLen); - static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetLimit(nDataLen); + pEdit->SetLimit(nDataLen); bUpdate = true; } CFX_WideString wsText; m_pDataAcc->GetValue(wsText, eType); - CFX_WideString wsOldText = - static_cast<CFWL_Edit*>(m_pNormalWidget.get())->GetText(); + CFX_WideString wsOldText = pEdit->GetText(); if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) { - static_cast<CFWL_Edit*>(m_pNormalWidget.get())->SetText(wsText); + pEdit->SetText(wsText); bUpdate = true; } if (bUpdate) @@ -323,9 +320,7 @@ void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) { } bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { - if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) - return true; - return false; + return sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit; } void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { |