From fc9b9880c79bd9e7864c009aad48c9b27bb352a0 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Mar 2017 09:18:18 -0500 Subject: Cleanup text code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl removes unused defines and methods. It also merges fx_arb into fx_arabic as the arb methods are only used in the arabic file and they are always included together. Change-Id: I1e6f75d5cb5f5bcc8db3b54cb2a14d284da5b7b1 Reviewed-on: https://pdfium-review.googlesource.com/2899 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- xfa/fgas/layout/fgas_rtfbreak.cpp | 9 ++------- xfa/fgas/layout/fgas_rtfbreak.h | 2 -- xfa/fgas/layout/fgas_textbreak.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 11 deletions(-) (limited to 'xfa') diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index d9e5f7f80b..8f5895f24c 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -9,7 +9,6 @@ #include #include "core/fxcrt/fx_arabic.h" -#include "core/fxcrt/fx_arb.h" #include "third_party/base/stl_util.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/layout/fgas_linebreak.h" @@ -470,7 +469,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine, } } - if (!m_bPagination && m_pCurLine->m_iMBCSChars <= 0) { + if (!m_bPagination) { if (bAllChars && !bDone) { int32_t endPos = m_pCurLine->GetLineEnd(); GetBreakPos(m_pCurLine->m_LineChars, endPos, bAllChars, true); @@ -1013,11 +1012,7 @@ CFX_RTFPiece::~CFX_RTFPiece() { } CFX_RTFLine::CFX_RTFLine() - : m_LinePieces(16), - m_iStart(0), - m_iWidth(0), - m_iArabicChars(0), - m_iMBCSChars(0) {} + : m_LinePieces(16), m_iStart(0), m_iWidth(0), m_iArabicChars(0) {} CFX_RTFLine::~CFX_RTFLine() { RemoveAll(false); diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 63ad67f6c0..8907871f74 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -127,7 +127,6 @@ class CFX_RTFLine { m_LinePieces.RemoveAll(bLeaveMemory); m_iWidth = 0; m_iArabicChars = 0; - m_iMBCSChars = 0; } std::vector m_LineChars; @@ -135,7 +134,6 @@ class CFX_RTFLine { int32_t m_iStart; int32_t m_iWidth; int32_t m_iArabicChars; - int32_t m_iMBCSChars; }; class CFX_RTFBreak { diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index 8be72f2c7b..153d575139 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -9,7 +9,6 @@ #include #include "core/fxcrt/fx_arabic.h" -#include "core/fxcrt/fx_arb.h" #include "core/fxcrt/fx_memory.h" #include "third_party/base/ptr_util.h" #include "xfa/fgas/font/cfgas_gefont.h" @@ -31,6 +30,11 @@ const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = { &CFX_TxtBreak::AppendChar_Others, &CFX_TxtBreak::AppendChar_Others, }; +bool IsCtrlCode(FX_WCHAR ch) { + uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); + return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; +} + } // namespace CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies) @@ -1561,7 +1565,7 @@ std::vector CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, iCharSize = *pWidths++; } fCharSize = static_cast(iCharSize) / 20000.0f; - bool bRet = (!bSingleLine && FX_IsCtrlCode(wch)); + bool bRet = (!bSingleLine && IsCtrlCode(wch)); if (!(wch == L'\v' || wch == L'\f' || wch == 0x2028 || wch == 0x2029 || (wLineBreakChar != 0xFEFF && wch == wLineBreakChar))) { bRet = false; -- cgit v1.2.3