diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-01 09:31:51 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-01 15:33:07 +0000 |
commit | 17f31183d59ee5371c1fafdb4a72390e863320ae (patch) | |
tree | f9db49f036a6b31a654c013301598cd560f6e397 /xfa/fgas/layout/fgas_rtfbreak.h | |
parent | e3409535a6ecad8006d872df680ae7eda8120c1c (diff) | |
download | pdfium-17f31183d59ee5371c1fafdb4a72390e863320ae.tar.xz |
Fixup RTFBreak and TextBreak nits
Change-Id: Ied5d23e18e9194e66d8be8d1057f55d83faada88
Reviewed-on: https://pdfium-review.googlesource.com/2880
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/layout/fgas_rtfbreak.h')
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 2389442c0d..d99a56bfa1 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -53,11 +53,10 @@ class CFX_RTFPiece { void AppendChar(const CFX_RTFChar& tc) { ASSERT(m_pChars); m_pChars->push_back(tc); - if (m_iWidth < 0) { + if (m_iWidth < 0) m_iWidth = tc.m_iCharWidth; - } else { + else m_iWidth += tc.m_iCharWidth; - } m_iChars++; } @@ -100,9 +99,9 @@ class CFX_RTFPiece { void Reset() { m_dwStatus = CFX_RTFBreakType::Piece; - if (m_iWidth > -1) { + if (m_iWidth > -1) m_iStartPos += m_iWidth; - } + m_iWidth = -1; m_iStartChar += m_iChars; m_iChars = 0; @@ -138,23 +137,28 @@ class CFX_RTFLine { int32_t CountChars() const { return pdfium::CollectionSize<int32_t>(m_LineChars); } + CFX_RTFChar& GetChar(int32_t index) { ASSERT(index >= 0 && index < pdfium::CollectionSize<int32_t>(m_LineChars)); return m_LineChars[index]; } + CFX_RTFChar* GetCharPtr(int32_t index) { ASSERT(index > -1 && index < pdfium::CollectionSize<int32_t>(m_LineChars)); return &m_LineChars[index]; } + int32_t CountPieces() const { return m_LinePieces.GetSize(); } CFX_RTFPiece& GetPiece(int32_t index) const { ASSERT(index > -1 && index < m_LinePieces.GetSize()); return m_LinePieces.GetAt(index); } + CFX_RTFPiece* GetPiecePtr(int32_t index) const { ASSERT(index > -1 && index < m_LinePieces.GetSize()); return m_LinePieces.GetPtrAt(index); } + int32_t GetLineEnd() const { return m_iStart + m_iWidth; } void RemoveAll(bool bLeaveMemory = false) { m_LineChars.clear(); @@ -208,13 +212,14 @@ class CFX_RTFBreak { CFX_RTFBreakType AppendChar_Others(CFX_RTFChar* pCurChar); protected: + void FontChanged(); void SetBreakStatus(); CFX_RTFChar* GetLastChar(int32_t index) const; - CFX_RTFLine* GetRTFLine() const; - CFX_RTFPieceArray* GetRTFPieces() const; + const CFX_RTFLine* GetRTFLine() const; + const CFX_RTFPieceArray* GetRTFPieces() const; FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; int32_t GetLastPositionedTab() const; - bool GetPositionedTab(int32_t& iTabPos) const; + bool GetPositionedTab(int32_t* iTabPos) const; int32_t GetBreakPos(std::vector<CFX_RTFChar>& tca, int32_t& iEndPos, @@ -226,8 +231,8 @@ class CFX_RTFBreak { bool EndBreak_SplitLine(CFX_RTFLine* pNextLine, bool bAllChars, CFX_RTFBreakType dwStatus); - void EndBreak_BidiLine(CFX_TPOArray& tpos, CFX_RTFBreakType dwStatus); - void EndBreak_Alignment(CFX_TPOArray& tpos, + void EndBreak_BidiLine(CFX_TPOArray* tpos, CFX_RTFBreakType dwStatus); + void EndBreak_Alignment(const CFX_TPOArray& tpos, bool bAllChars, CFX_RTFBreakType dwStatus); |