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_txtedtpage.h" | 7 #include "xfa/fde/cfde_txtedtpage.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
| 11 #include "third_party/base/ptr_util.h" |
11 #include "xfa/fde/cfde_txtedtbuf.h" | 12 #include "xfa/fde/cfde_txtedtbuf.h" |
12 #include "xfa/fde/cfde_txtedtbufiter.h" | 13 #include "xfa/fde/cfde_txtedtbufiter.h" |
13 #include "xfa/fde/cfde_txtedtengine.h" | 14 #include "xfa/fde/cfde_txtedtengine.h" |
14 #include "xfa/fde/cfde_txtedtparag.h" | 15 #include "xfa/fde/cfde_txtedtparag.h" |
15 #include "xfa/fde/cfde_txtedttextset.h" | 16 #include "xfa/fde/cfde_txtedttextset.h" |
16 #include "xfa/fde/cfx_wordbreak.h" | 17 #include "xfa/fde/cfx_wordbreak.h" |
17 #include "xfa/fde/ifde_txtedtengine.h" | 18 #include "xfa/fde/ifde_txtedtengine.h" |
18 #include "xfa/fde/ifde_txtedtpage.h" | 19 #include "xfa/fde/ifde_txtedtpage.h" |
19 | 20 |
20 namespace { | 21 namespace { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 bool bLineReserve = | 297 bool bLineReserve = |
297 !!(pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); | 298 !!(pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); |
298 FX_FLOAT fLineStart = | 299 FX_FLOAT fLineStart = |
299 bVertial | 300 bVertial |
300 ? (bLineReserve ? (pParams->fPlateWidth - pParams->fLineSpace) : 0.0f) | 301 ? (bLineReserve ? (pParams->fPlateWidth - pParams->fLineSpace) : 0.0f) |
301 : 0.0f; | 302 : 0.0f; |
302 FX_FLOAT fLineStep = | 303 FX_FLOAT fLineStep = |
303 (bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace; | 304 (bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace; |
304 FX_FLOAT fLinePos = fLineStart; | 305 FX_FLOAT fLinePos = fLineStart; |
305 if (!m_pTextSet) | 306 if (!m_pTextSet) |
306 m_pTextSet.reset(new CFDE_TxtEdtTextSet(this)); | 307 m_pTextSet = pdfium::MakeUnique<CFDE_TxtEdtTextSet>(this); |
307 | 308 |
308 m_PieceMassArr.RemoveAll(true); | 309 m_PieceMassArr.RemoveAll(true); |
309 uint32_t dwBreakStatus = FX_TXTBREAK_None; | 310 uint32_t dwBreakStatus = FX_TXTBREAK_None; |
310 int32_t nPieceStart = 0; | 311 int32_t nPieceStart = 0; |
311 | 312 |
312 m_CharWidths.resize(nPageEnd - nPageStart + 1, 0); | 313 m_CharWidths.resize(nPageEnd - nPageStart + 1, 0); |
313 pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); | 314 pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); |
314 pBreak->ClearBreakPieces(); | 315 pBreak->ClearBreakPieces(); |
315 m_nPageStart = nPageStart; | 316 m_nPageStart = nPageStart; |
316 m_nCharCount = nPageEnd - nPageStart + 1; | 317 m_nCharCount = nPageEnd - nPageStart + 1; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 ptF.x = rtF.left; | 509 ptF.x = rtF.left; |
509 } else if (ptF.x >= rtF.right()) { | 510 } else if (ptF.x >= rtF.right()) { |
510 ptF.x = rtF.right() - fTolerance; | 511 ptF.x = rtF.right() - fTolerance; |
511 } | 512 } |
512 if (ptF.y < rtF.top) { | 513 if (ptF.y < rtF.top) { |
513 ptF.y = rtF.top; | 514 ptF.y = rtF.top; |
514 } else if (ptF.y >= rtF.bottom()) { | 515 } else if (ptF.y >= rtF.bottom()) { |
515 ptF.y = rtF.bottom() - fTolerance; | 516 ptF.y = rtF.bottom() - fTolerance; |
516 } | 517 } |
517 } | 518 } |
OLD | NEW |