xref: /aosp_15_r20/external/pdfium/xfa/fgas/layout/cfgas_breakline.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "xfa/fgas/layout/cfgas_breakline.h"
8 
9 #include "core/fxcrt/stl_util.h"
10 #include "third_party/base/check.h"
11 
12 CFGAS_BreakLine::CFGAS_BreakLine() = default;
13 
14 CFGAS_BreakLine::~CFGAS_BreakLine() = default;
15 
LastChar()16 CFGAS_Char* CFGAS_BreakLine::LastChar() {
17   if (m_LineChars.empty())
18     return nullptr;
19 
20   return &m_LineChars.back();
21 }
22 
GetLineEnd() const23 int32_t CFGAS_BreakLine::GetLineEnd() const {
24   return m_iStart + m_iWidth;
25 }
26 
Clear()27 void CFGAS_BreakLine::Clear() {
28   m_LineChars.clear();
29   m_LinePieces.clear();
30   m_iWidth = 0;
31   m_iArabicChars = 0;
32 }
33 
IncrementArabicCharCount()34 void CFGAS_BreakLine::IncrementArabicCharCount() {
35   ++m_iArabicChars;
36 }
37 
DecrementArabicCharCount()38 void CFGAS_BreakLine::DecrementArabicCharCount() {
39   DCHECK(m_iArabicChars > 0);
40   --m_iArabicChars;
41 }
42