| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fde/cfde_txtedtbuf.h" | 7 #include "xfa/fde/cfde_txtedtbuf.h" |
| 8 | 8 |
| 9 #include "xfa/fgas/crt/fgas_memory.h" | 9 #include "xfa/fgas/crt/fgas_memory.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 ASSERT(m_nChunkSize); | 23 ASSERT(m_nChunkSize); |
| 24 ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize); | 24 ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize); |
| 25 } | 25 } |
| 26 | 26 |
| 27 CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() { | 27 CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() { |
| 28 Clear(TRUE); | 28 Clear(TRUE); |
| 29 delete m_pAllocator; | 29 delete m_pAllocator; |
| 30 m_Chunks.RemoveAll(); | 30 m_Chunks.RemoveAll(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 FX_BOOL CFDE_TxtEdtBuf::SetChunkSize(int32_t nChunkSize) { | |
| 34 ASSERT(nChunkSize); | |
| 35 ResetChunkBuffer(kDefaultChunkCount, nChunkSize); | |
| 36 return TRUE; | |
| 37 } | |
| 38 | |
| 39 int32_t CFDE_TxtEdtBuf::GetChunkSize() const { | 33 int32_t CFDE_TxtEdtBuf::GetChunkSize() const { |
| 40 return m_nChunkSize; | 34 return m_nChunkSize; |
| 41 } | 35 } |
| 42 | 36 |
| 43 int32_t CFDE_TxtEdtBuf::GetTextLength() const { | 37 int32_t CFDE_TxtEdtBuf::GetTextLength() const { |
| 44 return m_nTotal; | 38 return m_nTotal; |
| 45 } | 39 } |
| 46 | 40 |
| 47 void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { | 41 void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { |
| 48 ASSERT(!wsText.IsEmpty()); | 42 ASSERT(!wsText.IsEmpty()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 int32_t nCount = m_Chunks.GetSize(); | 309 int32_t nCount = m_Chunks.GetSize(); |
| 316 for (; i < nCount; i++) { | 310 for (; i < nCount; i++) { |
| 317 nTotal += m_Chunks[i]->nUsed; | 311 nTotal += m_Chunks[i]->nUsed; |
| 318 if (nTotal > nIndex) { | 312 if (nTotal > nIndex) { |
| 319 break; | 313 break; |
| 320 } | 314 } |
| 321 } | 315 } |
| 322 cp.nChunkIndex = i; | 316 cp.nChunkIndex = i; |
| 323 cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex); | 317 cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex); |
| 324 } | 318 } |
| OLD | NEW |