Rename CFX_Char to CFGAS_Char
Bug: pdfium:1567
Change-Id: Id644478976c846742cc73abc2c6c031a6741322f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/78671
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/fuzzers/pdf_bidi_fuzzer.cc b/testing/fuzzers/pdf_bidi_fuzzer.cc
index 9a54b32..aa4b893 100644
--- a/testing/fuzzers/pdf_bidi_fuzzer.cc
+++ b/testing/fuzzers/pdf_bidi_fuzzer.cc
@@ -9,7 +9,7 @@
#include "core/fxge/cfx_font.h"
#include "core/fxge/fx_font.h"
#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/cfx_rtfbreak.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
@@ -31,8 +31,8 @@
for (wchar_t ch : input)
rtf_break.AppendChar(ch);
- std::vector<CFX_Char> chars =
+ std::vector<CFGAS_Char> chars =
rtf_break.GetCurrentLineForTesting()->m_LineChars;
- CFX_Char::BidiLine(&chars, chars.size());
+ CFGAS_Char::BidiLine(&chars, chars.size());
return 0;
}
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index 24192b7..5c02c26 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -1072,7 +1072,7 @@
}
void CFDE_TextEditEngine::RebuildPieces() {
- text_break_.EndBreak(CFX_Char::BreakType::kParagraph);
+ text_break_.EndBreak(CFGAS_Char::BreakType::kParagraph);
text_break_.ClearBreakPieces();
char_widths_.clear();
@@ -1091,10 +1091,10 @@
while (!iter.IsEOF(false)) {
iter.Next(false);
- CFX_Char::BreakType break_status = text_break_.AppendChar(
+ CFGAS_Char::BreakType break_status = text_break_.AppendChar(
password_mode_ ? password_alias_ : iter.GetChar());
if (iter.IsEOF(false) && CFX_BreakTypeNoneOrPiece(break_status))
- break_status = text_break_.EndBreak(CFX_Char::BreakType::kParagraph);
+ break_status = text_break_.EndBreak(CFGAS_Char::BreakType::kParagraph);
if (CFX_BreakTypeNoneOrPiece(break_status))
continue;
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 9c24ea3..5e4ab9f 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -213,7 +213,7 @@
float fWidth = 0.0f;
float fHeight = 0.0f;
float fStartPos = pRect->right();
- CFX_Char::BreakType dwBreakStatus = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwBreakStatus = CFGAS_Char::BreakType::kNone;
bool break_char_is_set = false;
for (const wchar_t& wch : str) {
if (!break_char_is_set && (wch == L'\n' || wch == L'\r')) {
@@ -225,7 +225,7 @@
RetrieveLineWidth(dwBreakStatus, &fStartPos, &fWidth, &fHeight);
}
- dwBreakStatus = m_pTxtBreak->EndBreak(CFX_Char::BreakType::kParagraph);
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFGAS_Char::BreakType::kParagraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveLineWidth(dwBreakStatus, &fStartPos, &fWidth, &fHeight);
@@ -244,7 +244,7 @@
pRect->height -= m_fLineSpace - m_fFontSize;
}
-bool CFDE_TextOut::RetrieveLineWidth(CFX_Char::BreakType dwBreakStatus,
+bool CFDE_TextOut::RetrieveLineWidth(CFGAS_Char::BreakType dwBreakStatus,
float* pStartPos,
float* pWidth,
float* pHeight) {
@@ -261,9 +261,9 @@
}
m_pTxtBreak->ClearBreakPieces();
- if (dwBreakStatus == CFX_Char::BreakType::kParagraph)
+ if (dwBreakStatus == CFGAS_Char::BreakType::kParagraph)
m_pTxtBreak->Reset();
- if (!m_Styles.line_wrap_ && dwBreakStatus == CFX_Char::BreakType::kLine) {
+ if (!m_Styles.line_wrap_ && dwBreakStatus == CFGAS_Char::BreakType::kLine) {
*pWidth += fLineWidth;
} else {
*pWidth = std::max(*pWidth, fLineWidth);
@@ -329,7 +329,7 @@
m_fLinePos = rect.top;
size_t start_char = 0;
int32_t iPieceWidths = 0;
- CFX_Char::BreakType dwBreakStatus;
+ CFGAS_Char::BreakType dwBreakStatus;
bool bRet = false;
for (const auto& wch : str) {
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
@@ -339,8 +339,8 @@
bool bEndofLine =
RetrievePieces(dwBreakStatus, false, rect, &start_char, &iPieceWidths);
if (bEndofLine && (m_Styles.line_wrap_ ||
- dwBreakStatus == CFX_Char::BreakType::kParagraph ||
- dwBreakStatus == CFX_Char::BreakType::kPage)) {
+ dwBreakStatus == CFGAS_Char::BreakType::kParagraph ||
+ dwBreakStatus == CFGAS_Char::BreakType::kPage)) {
iPieceWidths = 0;
++m_iCurLine;
m_fLinePos += fLineStep;
@@ -353,7 +353,7 @@
}
}
- dwBreakStatus = m_pTxtBreak->EndBreak(CFX_Char::BreakType::kParagraph);
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFGAS_Char::BreakType::kParagraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus) && !bRet)
RetrievePieces(dwBreakStatus, false, rect, &start_char, &iPieceWidths);
@@ -361,7 +361,7 @@
m_pTxtBreak->Reset();
}
-bool CFDE_TextOut::RetrievePieces(CFX_Char::BreakType dwBreakStatus,
+bool CFDE_TextOut::RetrievePieces(CFGAS_Char::BreakType dwBreakStatus,
bool bReload,
const CFX_RectF& rect,
size_t* pStartChar,
@@ -377,7 +377,7 @@
int32_t iWidth = 0;
int32_t j = 0;
for (; j < iPieceChars; j++) {
- const CFX_Char* pTC = pPiece->GetChar(j);
+ const CFGAS_Char* pTC = pPiece->GetChar(j);
int32_t iCurCharWidth = std::max(pTC->m_iCharWidth, 0);
if (m_Styles.single_line_ || !m_Styles.line_wrap_) {
if (iLineWidth - *pPieceWidths - iWidth < iCurCharWidth) {
@@ -411,7 +411,7 @@
m_pTxtBreak->ClearBreakPieces();
return m_Styles.single_line_ || m_Styles.line_wrap_ || bNeedReload ||
- dwBreakStatus == CFX_Char::BreakType::kParagraph;
+ dwBreakStatus == CFGAS_Char::BreakType::kParagraph;
}
void CFDE_TextOut::AppendPiece(const Piece& piece,
@@ -456,7 +456,7 @@
size_t start_char = 0;
size_t piece_count = line->GetSize();
int32_t piece_widths = 0;
- CFX_Char::BreakType break_status = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType break_status = CFGAS_Char::BreakType::kNone;
for (size_t piece_index = 0; piece_index < piece_count; ++piece_index) {
const Piece* piece = line->GetPieceAtIndex(piece_index);
if (piece_index == 0) {
@@ -471,7 +471,7 @@
}
}
- break_status = m_pTxtBreak->EndBreak(CFX_Char::BreakType::kParagraph);
+ break_status = m_pTxtBreak->EndBreak(CFGAS_Char::BreakType::kParagraph);
if (!CFX_BreakTypeNoneOrPiece(break_status))
RetrievePieces(break_status, true, rect, &start_char, &piece_widths);
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 97f0d19..da59c82 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -14,7 +14,7 @@
#include "core/fxge/dib/fx_dib.h"
#include "third_party/base/span.h"
#include "xfa/fde/cfde_data.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
class CFGAS_GEFont;
class CFX_RenderDevice;
@@ -81,7 +81,7 @@
std::deque<Piece> pieces_;
};
- bool RetrieveLineWidth(CFX_Char::BreakType dwBreakStatus,
+ bool RetrieveLineWidth(CFGAS_Char::BreakType dwBreakStatus,
float* pStartPos,
float* pWidth,
float* pHeight);
@@ -89,7 +89,7 @@
void Reload(const CFX_RectF& rect);
void ReloadLinePiece(Line* pLine, const CFX_RectF& rect);
- bool RetrievePieces(CFX_Char::BreakType dwBreakStatus,
+ bool RetrievePieces(CFGAS_Char::BreakType dwBreakStatus,
bool bReload,
const CFX_RectF& rect,
size_t* pStartChar,
diff --git a/xfa/fgas/layout/BUILD.gn b/xfa/fgas/layout/BUILD.gn
index 99cae13..220751e 100644
--- a/xfa/fgas/layout/BUILD.gn
+++ b/xfa/fgas/layout/BUILD.gn
@@ -9,14 +9,14 @@
source_set("layout") {
sources = [
+ "cfgas_char.cpp",
+ "cfgas_char.h",
"cfx_break.cpp",
"cfx_break.h",
"cfx_breakline.cpp",
"cfx_breakline.h",
"cfx_breakpiece.cpp",
"cfx_breakpiece.h",
- "cfx_char.cpp",
- "cfx_char.h",
"cfx_linkuserdata.cpp",
"cfx_linkuserdata.h",
"cfx_rtfbreak.cpp",
diff --git a/xfa/fgas/layout/cfx_char.cpp b/xfa/fgas/layout/cfgas_char.cpp
similarity index 91%
rename from xfa/fgas/layout/cfx_char.cpp
rename to xfa/fgas/layout/cfgas_char.cpp
index 6c600ae..e36e98e 100644
--- a/xfa/fgas/layout/cfx_char.cpp
+++ b/xfa/fgas/layout/cfgas_char.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
#include <algorithm>
@@ -265,14 +265,16 @@
[static_cast<size_t>(eClass)];
}
-void ReverseString(std::vector<CFX_Char>* chars, size_t iStart, size_t iCount) {
+void ReverseString(std::vector<CFGAS_Char>* chars,
+ size_t iStart,
+ size_t iCount) {
DCHECK(pdfium::IndexInBounds(*chars, iStart));
DCHECK(iStart + iCount <= chars->size());
std::reverse(chars->begin() + iStart, chars->begin() + iStart + iCount);
}
-void SetDeferredRunClass(std::vector<CFX_Char>* chars,
+void SetDeferredRunClass(std::vector<CFGAS_Char>* chars,
size_t iStart,
size_t iCount,
FX_BIDICLASS eValue) {
@@ -284,7 +286,7 @@
(*chars)[i - 1].m_iBidiClass = eValue;
}
-void SetDeferredRunLevel(std::vector<CFX_Char>* chars,
+void SetDeferredRunLevel(std::vector<CFGAS_Char>* chars,
size_t iStart,
size_t iCount,
int32_t iValue) {
@@ -296,27 +298,27 @@
(*chars)[i - 1].m_iBidiLevel = static_cast<int16_t>(iValue);
}
-void Classify(std::vector<CFX_Char>* chars, size_t iCount) {
+void Classify(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
- CFX_Char& cur = (*chars)[i];
+ CFGAS_Char& cur = (*chars)[i];
cur.m_iBidiClass = FX_GetBidiClass(cur.char_code());
}
}
-void ClassifyWithTransform(std::vector<CFX_Char>* chars, size_t iCount) {
+void ClassifyWithTransform(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
- CFX_Char& cur = (*chars)[i];
+ CFGAS_Char& cur = (*chars)[i];
cur.m_iBidiClass =
kNTypes[static_cast<size_t>(FX_GetBidiClass(cur.char_code()))];
}
}
-void ResolveExplicit(std::vector<CFX_Char>* chars, size_t iCount) {
+void ResolveExplicit(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i)
(*chars)[i].m_iBidiLevel = 0;
}
-void ResolveWeak(std::vector<CFX_Char>* chars, size_t iCount) {
+void ResolveWeak(std::vector<CFGAS_Char>* chars, size_t iCount) {
if (iCount <= 1)
return;
--iCount;
@@ -329,7 +331,7 @@
FX_BIDICLASS eClsNew;
size_t i = 0;
for (; i <= iCount; ++i) {
- CFX_Char* pTC = &(*chars)[i];
+ CFGAS_Char* pTC = &(*chars)[i];
eClsCur = pTC->m_iBidiClass;
if (eClsCur == FX_BIDICLASS::kBN) {
pTC->m_iBidiLevel = (int16_t)iLevelCur;
@@ -337,7 +339,7 @@
eClsCur = Direction(iLevelCur);
pTC->m_iBidiClass = eClsCur;
} else if (i < iCount) {
- CFX_Char* pTCNext = &(*chars)[i + 1];
+ CFGAS_Char* pTCNext = &(*chars)[i + 1];
int32_t iLevelNext, iLevelNew;
eClsNew = pTCNext->m_iBidiClass;
iLevelNext = pTCNext->m_iBidiLevel;
@@ -384,12 +386,12 @@
SetDeferredRunClass(chars, i, iNum, eClsRun);
}
-void ResolveNeutrals(std::vector<CFX_Char>* chars, size_t iCount) {
+void ResolveNeutrals(std::vector<CFGAS_Char>* chars, size_t iCount) {
if (iCount <= 1)
return;
--iCount;
- CFX_Char* pTC;
+ CFGAS_Char* pTC;
int32_t iLevel = 0;
size_t i = 0;
size_t iNum = 0;
@@ -433,7 +435,7 @@
SetDeferredRunClass(chars, i, iNum, eClsRun);
}
-void ResolveImplicit(std::vector<CFX_Char>* chars, size_t iCount) {
+void ResolveImplicit(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
FX_BIDICLASS eCls = (*chars)[i].m_iBidiClass;
if (eCls == FX_BIDICLASS::kBN || eCls <= FX_BIDICLASS::kON ||
@@ -445,7 +447,7 @@
}
}
-void ResolveWhitespace(std::vector<CFX_Char>* chars, size_t iCount) {
+void ResolveWhitespace(std::vector<CFGAS_Char>* chars, size_t iCount) {
if (iCount <= 1)
return;
iCount--;
@@ -485,7 +487,7 @@
SetDeferredRunLevel(chars, i, iNum, 0);
}
-size_t ReorderLevel(std::vector<CFX_Char>* chars,
+size_t ReorderLevel(std::vector<CFGAS_Char>* chars,
size_t iCount,
int32_t iBaseLevel,
size_t iStart,
@@ -516,12 +518,12 @@
return iNum;
}
-void Reorder(std::vector<CFX_Char>* chars, size_t iCount) {
+void Reorder(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount;)
i += ReorderLevel(chars, iCount, 0, i, false);
}
-void Position(std::vector<CFX_Char>* chars, size_t iCount) {
+void Position(std::vector<CFGAS_Char>* chars, size_t iCount) {
for (size_t i = 0; i < iCount; ++i) {
if ((*chars)[i].m_iBidiPos > iCount)
continue;
@@ -533,7 +535,7 @@
} // namespace
// static
-void CFX_Char::BidiLine(std::vector<CFX_Char>* chars, size_t iCount) {
+void CFGAS_Char::BidiLine(std::vector<CFGAS_Char>* chars, size_t iCount) {
DCHECK(iCount <= chars->size());
if (iCount < 2)
return;
@@ -549,19 +551,19 @@
Position(chars, iCount);
}
-CFX_Char::CFX_Char(uint16_t wCharCode) : CFX_Char(wCharCode, 100, 100) {}
+CFGAS_Char::CFGAS_Char(uint16_t wCharCode) : CFGAS_Char(wCharCode, 100, 100) {}
-CFX_Char::CFX_Char(uint16_t wCharCode,
- int32_t iHorizontalScale,
- int32_t iVerticalScale)
+CFGAS_Char::CFGAS_Char(uint16_t wCharCode,
+ int32_t iHorizontalScale,
+ int32_t iVerticalScale)
: m_wCharCode(wCharCode),
m_iHorizontalScale(iHorizontalScale),
m_iVerticalScale(iVerticalScale) {}
-CFX_Char::CFX_Char(const CFX_Char& other) = default;
+CFGAS_Char::CFGAS_Char(const CFGAS_Char& other) = default;
-CFX_Char::~CFX_Char() = default;
+CFGAS_Char::~CFGAS_Char() = default;
-FX_CHARTYPE CFX_Char::GetCharType() const {
+FX_CHARTYPE CFGAS_Char::GetCharType() const {
return FX_GetCharType(m_wCharCode);
}
diff --git a/xfa/fgas/layout/cfx_char.h b/xfa/fgas/layout/cfgas_char.h
similarity index 75%
rename from xfa/fgas/layout/cfx_char.h
rename to xfa/fgas/layout/cfgas_char.h
index 3e26a62..bfb3472 100644
--- a/xfa/fgas/layout/cfx_char.h
+++ b/xfa/fgas/layout/cfgas_char.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FGAS_LAYOUT_CFX_CHAR_H_
-#define XFA_FGAS_LAYOUT_CFX_CHAR_H_
+#ifndef XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
+#define XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
#include <stdint.h>
@@ -16,7 +16,7 @@
#include "xfa/fgas/layout/cfx_textuserdata.h"
#include "xfa/fgas/layout/fx_linebreak.h"
-class CFX_Char {
+class CFGAS_Char {
public:
enum class BreakType : uint8_t {
kNone = 0,
@@ -26,14 +26,14 @@
kPage
};
- static void BidiLine(std::vector<CFX_Char>* chars, size_t iCount);
+ static void BidiLine(std::vector<CFGAS_Char>* chars, size_t iCount);
- explicit CFX_Char(uint16_t wCharCode);
- CFX_Char(uint16_t wCharCode,
- int32_t iHorizontalScale,
- int32_t iVerticalScale);
- CFX_Char(const CFX_Char& other);
- ~CFX_Char();
+ explicit CFGAS_Char(uint16_t wCharCode);
+ CFGAS_Char(uint16_t wCharCode,
+ int32_t iHorizontalScale,
+ int32_t iVerticalScale);
+ CFGAS_Char(const CFGAS_Char& other);
+ ~CFGAS_Char();
FX_CHARTYPE GetCharType() const;
uint16_t char_code() const { return m_wCharCode; }
@@ -58,4 +58,4 @@
int32_t m_iVerticalScale;
};
-#endif // XFA_FGAS_LAYOUT_CFX_CHAR_H_
+#endif // XFA_FGAS_LAYOUT_CFGAS_CHAR_H_
diff --git a/xfa/fgas/layout/cfx_break.cpp b/xfa/fgas/layout/cfx_break.cpp
index 39ed44c..efe1060 100644
--- a/xfa/fgas/layout/cfx_break.cpp
+++ b/xfa/fgas/layout/cfx_break.cpp
@@ -74,9 +74,9 @@
if (m_pCurLine->m_LineChars.empty())
return;
- CFX_Char* tc = m_pCurLine->GetChar(m_pCurLine->m_LineChars.size() - 1);
- if (tc->m_dwStatus == CFX_Char::BreakType::kNone)
- tc->m_dwStatus = CFX_Char::BreakType::kPiece;
+ CFGAS_Char* tc = m_pCurLine->GetChar(m_pCurLine->m_LineChars.size() - 1);
+ if (tc->m_dwStatus == CFGAS_Char::BreakType::kNone)
+ tc->m_dwStatus = CFGAS_Char::BreakType::kPiece;
}
bool CFX_Break::IsGreaterThanLineWidth(int32_t width) const {
@@ -121,16 +121,16 @@
m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iLineStart);
}
-CFX_Char* CFX_Break::GetLastChar(int32_t index,
- bool bOmitChar,
- bool bRichText) const {
- std::vector<CFX_Char>& tca = m_pCurLine->m_LineChars;
+CFGAS_Char* CFX_Break::GetLastChar(int32_t index,
+ bool bOmitChar,
+ bool bRichText) const {
+ std::vector<CFGAS_Char>& tca = m_pCurLine->m_LineChars;
if (!pdfium::IndexInBounds(tca, index))
return nullptr;
int32_t iStart = pdfium::CollectionSize<int32_t>(tca) - 1;
while (iStart > -1) {
- CFX_Char* pTC = &tca[iStart--];
+ CFGAS_Char* pTC = &tca[iStart--];
if (((bRichText && pTC->m_iCharWidth < 0) || bOmitChar) &&
pTC->GetCharType() == FX_CHARTYPE::kCombination) {
continue;
diff --git a/xfa/fgas/layout/cfx_break.h b/xfa/fgas/layout/cfx_break.h
index 4f0dcb3..405f4ed 100644
--- a/xfa/fgas/layout/cfx_break.h
+++ b/xfa/fgas/layout/cfx_break.h
@@ -56,7 +56,7 @@
const CFX_BreakPiece* GetBreakPieceUnstable(int32_t index) const;
void ClearBreakPieces();
- CFX_Char* GetLastChar(int32_t index, bool bOmitChar, bool bRichText) const;
+ CFGAS_Char* GetLastChar(int32_t index, bool bOmitChar, bool bRichText) const;
const CFX_BreakLine* GetCurrentLineForTesting() const {
return m_pCurLine.Get();
}
diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp
index 32b50f3..350743a 100644
--- a/xfa/fgas/layout/cfx_breakline.cpp
+++ b/xfa/fgas/layout/cfx_breakline.cpp
@@ -13,7 +13,7 @@
CFX_BreakLine::~CFX_BreakLine() = default;
-CFX_Char* CFX_BreakLine::GetChar(int32_t index) {
+CFGAS_Char* CFX_BreakLine::GetChar(int32_t index) {
DCHECK(pdfium::IndexInBounds(m_LineChars, index));
return &m_LineChars[index];
}
diff --git a/xfa/fgas/layout/cfx_breakline.h b/xfa/fgas/layout/cfx_breakline.h
index c432b35..4b69322 100644
--- a/xfa/fgas/layout/cfx_breakline.h
+++ b/xfa/fgas/layout/cfx_breakline.h
@@ -9,15 +9,15 @@
#include <vector>
+#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/cfx_breakpiece.h"
-#include "xfa/fgas/layout/cfx_char.h"
class CFX_BreakLine {
public:
CFX_BreakLine();
~CFX_BreakLine();
- CFX_Char* GetChar(int32_t index);
+ CFGAS_Char* GetChar(int32_t index);
int32_t GetLineEnd() const;
void Clear();
@@ -26,7 +26,7 @@
void DecrementArabicCharCount();
bool HasArabicChar() const { return m_iArabicChars > 0; }
- std::vector<CFX_Char> m_LineChars;
+ std::vector<CFGAS_Char> m_LineChars;
std::vector<CFX_BreakPiece> m_LinePieces;
int32_t m_iStart = 0;
int32_t m_iWidth = 0;
diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp
index a954e61..a74c2e5 100644
--- a/xfa/fgas/layout/cfx_breakpiece.cpp
+++ b/xfa/fgas/layout/cfx_breakpiece.cpp
@@ -19,7 +19,7 @@
return m_iWidth < 0 ? m_iStartPos : m_iStartPos + m_iWidth;
}
-CFX_Char* CFX_BreakPiece::GetChar(int32_t index) const {
+CFGAS_Char* CFX_BreakPiece::GetChar(int32_t index) const {
DCHECK(index >= 0);
DCHECK(index < m_iCharCount);
DCHECK(m_pChars);
diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h
index a61b764..6dabc46 100644
--- a/xfa/fgas/layout/cfx_breakpiece.h
+++ b/xfa/fgas/layout/cfx_breakpiece.h
@@ -12,7 +12,7 @@
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/retain_ptr.h"
#include "core/fxcrt/unowned_ptr.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
class CFX_TextUserData;
@@ -25,11 +25,11 @@
int32_t GetEndPos() const;
int32_t GetLength() const { return m_iCharCount; }
- CFX_Char* GetChar(int32_t index) const;
+ CFGAS_Char* GetChar(int32_t index) const;
WideString GetString() const;
std::vector<int32_t> GetWidths() const;
- CFX_Char::BreakType m_dwStatus = CFX_Char::BreakType::kPiece;
+ CFGAS_Char::BreakType m_dwStatus = CFGAS_Char::BreakType::kPiece;
int32_t m_iStartPos = 0;
int32_t m_iWidth = -1;
int32_t m_iStartChar = 0;
@@ -41,7 +41,7 @@
int32_t m_iVerticalScale = 100;
uint32_t m_dwIdentity = 0;
uint32_t m_dwCharStyles = 0;
- UnownedPtr<std::vector<CFX_Char>> m_pChars;
+ UnownedPtr<std::vector<CFGAS_Char>> m_pChars;
RetainPtr<CFX_TextUserData> m_pUserData;
};
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index fdc14d8..85fc027 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -17,7 +17,7 @@
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/cfx_textpiece.h"
#include "xfa/fgas/layout/cfx_textuserdata.h"
#include "xfa/fgas/layout/fx_arabic.h"
@@ -68,30 +68,30 @@
return true;
}
-CFX_Char::BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
+CFGAS_Char::BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
DCHECK(m_pCurLine);
FX_CHARTYPE chartype = FX_GetCharType(wch);
m_pCurLine->m_LineChars.emplace_back(wch, m_iHorizontalScale,
m_iVerticalScale);
- CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back();
+ CFGAS_Char* pCurChar = &m_pCurLine->m_LineChars.back();
pCurChar->m_iFontSize = m_iFontSize;
pCurChar->m_dwIdentity = m_dwIdentity;
pCurChar->m_pUserData = m_pUserData;
- CFX_Char::BreakType dwRet1 = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwRet1 = CFGAS_Char::BreakType::kNone;
if (chartype != FX_CHARTYPE::kCombination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
m_eCharType != FX_CHARTYPE::kUnknown &&
IsGreaterThanLineWidth(m_pCurLine->GetLineEnd()) &&
(m_eCharType != FX_CHARTYPE::kSpace ||
chartype != FX_CHARTYPE::kControl)) {
- dwRet1 = EndBreak(CFX_Char::BreakType::kLine);
+ dwRet1 = EndBreak(CFGAS_Char::BreakType::kLine);
if (!m_pCurLine->m_LineChars.empty())
pCurChar = &m_pCurLine->m_LineChars.back();
}
- CFX_Char::BreakType dwRet2 = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwRet2 = CFGAS_Char::BreakType::kNone;
switch (chartype) {
case FX_CHARTYPE::kTab:
AppendChar_Tab(pCurChar);
@@ -123,7 +123,7 @@
return std::max(dwRet1, dwRet2);
}
-void CFX_RTFBreak::AppendChar_Combination(CFX_Char* pCurChar) {
+void CFX_RTFBreak::AppendChar_Combination(CFGAS_Char* pCurChar) {
FX_SAFE_INT32 iCharWidth = 0;
int32_t iCharWidthOut;
if (m_pFont && m_pFont->GetCharWidth(pCurChar->char_code(), &iCharWidthOut))
@@ -132,7 +132,7 @@
iCharWidth *= m_iFontSize;
iCharWidth *= m_iHorizontalScale;
iCharWidth /= 100;
- CFX_Char* pLastChar = GetLastChar(0, false, true);
+ CFGAS_Char* pLastChar = GetLastChar(0, false, true);
if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE::kCombination)
iCharWidth *= -1;
else
@@ -150,7 +150,7 @@
}
}
-void CFX_RTFBreak::AppendChar_Tab(CFX_Char* pCurChar) {
+void CFX_RTFBreak::AppendChar_Tab(CFGAS_Char* pCurChar) {
if (!(m_dwLayoutStyles & FX_LAYOUTSTYLE_ExpandTab))
return;
@@ -173,34 +173,34 @@
iLineWidth += iCharWidth;
}
-CFX_Char::BreakType CFX_RTFBreak::AppendChar_Control(CFX_Char* pCurChar) {
- CFX_Char::BreakType dwRet2 = CFX_Char::BreakType::kNone;
+CFGAS_Char::BreakType CFX_RTFBreak::AppendChar_Control(CFGAS_Char* pCurChar) {
+ CFGAS_Char::BreakType dwRet2 = CFGAS_Char::BreakType::kNone;
switch (pCurChar->char_code()) {
case L'\v':
case 0x2028:
- dwRet2 = CFX_Char::BreakType::kLine;
+ dwRet2 = CFGAS_Char::BreakType::kLine;
break;
case L'\f':
- dwRet2 = CFX_Char::BreakType::kPage;
+ dwRet2 = CFGAS_Char::BreakType::kPage;
break;
case 0x2029:
- dwRet2 = CFX_Char::BreakType::kParagraph;
+ dwRet2 = CFGAS_Char::BreakType::kParagraph;
break;
default:
if (pCurChar->char_code() == m_wParagraphBreakChar)
- dwRet2 = CFX_Char::BreakType::kParagraph;
+ dwRet2 = CFGAS_Char::BreakType::kParagraph;
break;
}
- if (dwRet2 != CFX_Char::BreakType::kNone)
+ if (dwRet2 != CFGAS_Char::BreakType::kNone)
dwRet2 = EndBreak(dwRet2);
return dwRet2;
}
-CFX_Char::BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
+CFGAS_Char::BreakType CFX_RTFBreak::AppendChar_Arabic(CFGAS_Char* pCurChar) {
m_pCurLine->IncrementArabicCharCount();
- CFX_Char* pLastChar = nullptr;
+ CFGAS_Char* pLastChar = nullptr;
wchar_t wForm;
bool bAlef = false;
if (m_eCharType >= FX_CHARTYPE::kArabicAlef &&
@@ -208,7 +208,7 @@
pLastChar = GetLastChar(1, false, true);
if (pLastChar) {
m_pCurLine->m_iWidth -= pLastChar->m_iCharWidth;
- CFX_Char* pPrevChar = GetLastChar(2, false, true);
+ CFGAS_Char* pPrevChar = GetLastChar(2, false, true);
wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE::kArabicAlef);
@@ -232,7 +232,7 @@
FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
checked_width += iCharWidthValid;
if (!checked_width.IsValid())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
m_pCurLine->m_iWidth = checked_width.ValueOrDie();
iCharWidth = 0;
@@ -261,16 +261,16 @@
FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
checked_width += iCharWidthValid;
if (!checked_width.IsValid())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
m_pCurLine->m_iWidth = checked_width.ValueOrDie();
if (IsGreaterThanLineWidth(m_pCurLine->GetLineEnd()))
- return EndBreak(CFX_Char::BreakType::kLine);
- return CFX_Char::BreakType::kNone;
+ return EndBreak(CFGAS_Char::BreakType::kLine);
+ return CFGAS_Char::BreakType::kNone;
}
-CFX_Char::BreakType CFX_RTFBreak::AppendChar_Others(CFX_Char* pCurChar) {
+CFGAS_Char::BreakType CFX_RTFBreak::AppendChar_Others(CFGAS_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
wchar_t wForm = pCurChar->char_code();
FX_SAFE_INT32 iCharWidth;
@@ -291,41 +291,41 @@
FX_SAFE_INT32 checked_width = m_pCurLine->m_iWidth;
checked_width += iCharWidthValid;
if (!checked_width.IsValid())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
m_pCurLine->m_iWidth = checked_width.ValueOrDie();
if (chartype != FX_CHARTYPE::kSpace &&
IsGreaterThanLineWidth(m_pCurLine->GetLineEnd())) {
- return EndBreak(CFX_Char::BreakType::kLine);
+ return EndBreak(CFGAS_Char::BreakType::kLine);
}
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
}
-CFX_Char::BreakType CFX_RTFBreak::EndBreak(CFX_Char::BreakType dwStatus) {
- DCHECK(dwStatus != CFX_Char::BreakType::kNone);
+CFGAS_Char::BreakType CFX_RTFBreak::EndBreak(CFGAS_Char::BreakType dwStatus) {
+ DCHECK(dwStatus != CFGAS_Char::BreakType::kNone);
++m_dwIdentity;
if (!m_pCurLine->m_LinePieces.empty()) {
- if (dwStatus != CFX_Char::BreakType::kPiece)
+ if (dwStatus != CFGAS_Char::BreakType::kPiece)
m_pCurLine->m_LinePieces.back().m_dwStatus = dwStatus;
return m_pCurLine->m_LinePieces.back().m_dwStatus;
}
if (HasLine()) {
if (m_Lines[m_iReadyLineIndex].m_LinePieces.empty())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
- if (dwStatus != CFX_Char::BreakType::kPiece)
+ if (dwStatus != CFGAS_Char::BreakType::kPiece)
m_Lines[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus = dwStatus;
return m_Lines[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus;
}
if (m_pCurLine->m_LineChars.empty())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
- CFX_Char* tc = m_pCurLine->GetChar(m_pCurLine->m_LineChars.size() - 1);
+ CFGAS_Char* tc = m_pCurLine->GetChar(m_pCurLine->m_LineChars.size() - 1);
tc->m_dwStatus = dwStatus;
- if (dwStatus == CFX_Char::BreakType::kPiece)
+ if (dwStatus == CFGAS_Char::BreakType::kPiece)
return dwStatus;
m_iReadyLineIndex = m_pCurLine == &m_Lines[0] ? 0 : 1;
@@ -342,17 +342,17 @@
m_pCurLine = pNextLine;
m_pCurLine->m_iStart = m_iLineStart;
- CFX_Char* pTC = GetLastChar(0, false, true);
+ CFGAS_Char* pTC = GetLastChar(0, false, true);
m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE::kUnknown;
return dwStatus;
}
bool CFX_RTFBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine,
bool bAllChars,
- CFX_Char::BreakType dwStatus) {
+ CFGAS_Char::BreakType dwStatus) {
bool bDone = false;
if (IsGreaterThanLineWidth(m_pCurLine->GetLineEnd())) {
- const CFX_Char* tc =
+ const CFGAS_Char* tc =
m_pCurLine->GetChar(m_pCurLine->m_LineChars.size() - 1);
switch (tc->GetCharType()) {
case FX_CHARTYPE::kTab:
@@ -374,7 +374,7 @@
return false;
}
- const CFX_Char* pCurChars = m_pCurLine->m_LineChars.data();
+ const CFGAS_Char* pCurChars = m_pCurLine->m_LineChars.data();
CFX_BreakPiece tp;
tp.m_pChars = &m_pCurLine->m_LineChars;
bool bNew = true;
@@ -382,7 +382,7 @@
int32_t iLast = pdfium::CollectionSize<int32_t>(m_pCurLine->m_LineChars) - 1;
int32_t j = 0;
for (int32_t i = 0; i <= iLast;) {
- const CFX_Char* pTC = pCurChars + i;
+ const CFGAS_Char* pTC = pCurChars + i;
if (bNew) {
tp.m_iStartChar = i;
tp.m_iStartPos += tp.m_iWidth;
@@ -398,7 +398,7 @@
bNew = false;
}
- if (i == iLast || pTC->m_dwStatus != CFX_Char::BreakType::kNone ||
+ if (i == iLast || pTC->m_dwStatus != CFGAS_Char::BreakType::kNone ||
pTC->m_dwIdentity != dwIdentity) {
tp.m_iCharCount = i - j;
if (pTC->m_dwIdentity == dwIdentity) {
@@ -418,9 +418,9 @@
}
void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- CFX_Char::BreakType dwStatus) {
- CFX_Char* pTC;
- std::vector<CFX_Char>& chars = m_pCurLine->m_LineChars;
+ CFGAS_Char::BreakType dwStatus) {
+ CFGAS_Char* pTC;
+ std::vector<CFGAS_Char>& chars = m_pCurLine->m_LineChars;
if (!m_bPagination && m_pCurLine->HasArabicChar()) {
size_t iBidiNum = 0;
for (size_t i = 0; i < m_pCurLine->m_LineChars.size(); ++i) {
@@ -431,7 +431,7 @@
if (i == 0)
pTC->m_iBidiLevel = 1;
}
- CFX_Char::BidiLine(&chars, iBidiNum + 1);
+ CFGAS_Char::BidiLine(&chars, iBidiNum + 1);
} else {
for (size_t i = 0; i < m_pCurLine->m_LineChars.size(); ++i) {
pTC = &chars[i];
@@ -442,7 +442,7 @@
}
CFX_BreakPiece tp;
- tp.m_dwStatus = CFX_Char::BreakType::kPiece;
+ tp.m_dwStatus = CFGAS_Char::BreakType::kPiece;
tp.m_iStartPos = m_pCurLine->m_iStart;
tp.m_pChars = &chars;
@@ -467,7 +467,7 @@
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData;
- tp.m_dwStatus = CFX_Char::BreakType::kPiece;
+ tp.m_dwStatus = CFGAS_Char::BreakType::kPiece;
++i;
} else if (iBidiLevel != pTC->m_iBidiLevel ||
pTC->m_dwIdentity != dwIdentity) {
@@ -509,7 +509,7 @@
void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_Char::BreakType dwStatus) {
+ CFGAS_Char::BreakType dwStatus) {
int32_t iNetWidth = m_pCurLine->m_iWidth;
int32_t iGapChars = 0;
bool bFind = false;
@@ -521,7 +521,7 @@
bool bArabic = FX_IsOdd(ttp.m_iBidiLevel);
int32_t j = bArabic ? 0 : ttp.m_iCharCount - 1;
while (j > -1 && j < ttp.m_iCharCount) {
- const CFX_Char* tc = ttp.GetChar(j);
+ const CFGAS_Char* tc = ttp.GetChar(j);
if (tc->m_eLineBreakType == FX_LINEBREAKTYPE::kDIRECT_BRK)
++iGapChars;
@@ -549,7 +549,7 @@
int32_t iOffset = m_iLineWidth - iNetWidth;
if (iGapChars > 0 && (m_iAlignment == CFX_RTFLineAlignment::Distributed ||
(m_iAlignment == CFX_RTFLineAlignment::Justified &&
- dwStatus != CFX_Char::BreakType::kParagraph))) {
+ dwStatus != CFGAS_Char::BreakType::kParagraph))) {
int32_t iStart = -1;
for (const auto& tpo : tpos) {
CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
@@ -559,7 +559,7 @@
ttp.m_iStartPos = iStart;
for (int32_t j = 0; j < ttp.m_iCharCount; ++j) {
- CFX_Char* tc = ttp.GetChar(j);
+ CFGAS_Char* tc = ttp.GetChar(j);
if (tc->m_eLineBreakType != FX_LINEBREAKTYPE::kDIRECT_BRK ||
tc->m_iCharWidth < 0) {
continue;
@@ -585,7 +585,7 @@
}
}
-int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
+int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFGAS_Char>& tca,
bool bAllChars,
bool bOnlyBrk,
int32_t* pEndPos) {
@@ -607,8 +607,8 @@
iBreakPos = *pEndPos;
}
- CFX_Char* pCharArray = tca.data();
- CFX_Char* pCur = pCharArray + iLength;
+ CFGAS_Char* pCharArray = tca.data();
+ CFGAS_Char* pCur = pCharArray + iLength;
--iLength;
if (bAllChars)
pCur->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
@@ -690,7 +690,7 @@
return;
int32_t iEndPos = pCurLine->GetLineEnd();
- std::vector<CFX_Char>& curChars = pCurLine->m_LineChars;
+ std::vector<CFGAS_Char>& curChars = pCurLine->m_LineChars;
int32_t iCharPos = GetBreakPos(curChars, bAllChars, false, &iEndPos);
if (iCharPos < 0)
iCharPos = 0;
@@ -703,7 +703,7 @@
}
pNextLine->m_LineChars =
- std::vector<CFX_Char>(curChars.begin() + iCharPos, curChars.end());
+ std::vector<CFGAS_Char>(curChars.begin() + iCharPos, curChars.end());
curChars.erase(curChars.begin() + iCharPos, curChars.end());
pNextLine->m_iStart = pCurLine->m_iStart;
pNextLine->m_iWidth = pCurLine->GetLineEnd() - iEndPos;
@@ -715,7 +715,7 @@
pCurLine->DecrementArabicCharCount();
pNextLine->IncrementArabicCharCount();
}
- pNextLine->m_LineChars[i].m_dwStatus = CFX_Char::BreakType::kNone;
+ pNextLine->m_LineChars[i].m_dwStatus = CFGAS_Char::BreakType::kNone;
}
}
diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h
index 6d2475c..07db8e2 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.h
+++ b/xfa/fgas/layout/cfx_rtfbreak.h
@@ -39,22 +39,22 @@
void AddPositionedTab(float fTabPos);
- CFX_Char::BreakType EndBreak(CFX_Char::BreakType dwStatus);
+ CFGAS_Char::BreakType EndBreak(CFGAS_Char::BreakType dwStatus);
size_t GetDisplayPos(const CFX_TextPiece* pPiece,
std::vector<TextCharPos>* pCharPos) const;
- CFX_Char::BreakType AppendChar(wchar_t wch);
+ CFGAS_Char::BreakType AppendChar(wchar_t wch);
private:
- void AppendChar_Combination(CFX_Char* pCurChar);
- void AppendChar_Tab(CFX_Char* pCurChar);
- CFX_Char::BreakType AppendChar_Control(CFX_Char* pCurChar);
- CFX_Char::BreakType AppendChar_Arabic(CFX_Char* pCurChar);
- CFX_Char::BreakType AppendChar_Others(CFX_Char* pCurChar);
+ void AppendChar_Combination(CFGAS_Char* pCurChar);
+ void AppendChar_Tab(CFGAS_Char* pCurChar);
+ CFGAS_Char::BreakType AppendChar_Control(CFGAS_Char* pCurChar);
+ CFGAS_Char::BreakType AppendChar_Arabic(CFGAS_Char* pCurChar);
+ CFGAS_Char::BreakType AppendChar_Others(CFGAS_Char* pCurChar);
bool GetPositionedTab(int32_t* iTabPos) const;
- int32_t GetBreakPos(std::vector<CFX_Char>& tca,
+ int32_t GetBreakPos(std::vector<CFGAS_Char>& tca,
bool bAllChars,
bool bOnlyBrk,
int32_t* pEndPos);
@@ -63,12 +63,12 @@
bool bAllChars);
bool EndBreak_SplitLine(CFX_BreakLine* pNextLine,
bool bAllChars,
- CFX_Char::BreakType dwStatus);
+ CFGAS_Char::BreakType dwStatus);
void EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- CFX_Char::BreakType dwStatus);
+ CFGAS_Char::BreakType dwStatus);
void EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_Char::BreakType dwStatus);
+ CFGAS_Char::BreakType dwStatus);
bool m_bPagination;
std::vector<int32_t> m_PositionedTabs;
diff --git a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp
index b300cd8..95f2174 100644
--- a/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak_unittest.cpp
@@ -14,7 +14,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
class CFX_RTFBreakTest : public testing::Test {
public:
@@ -41,9 +41,9 @@
WideString str(L"Input String.");
for (wchar_t ch : str)
- EXPECT_EQ(CFX_Char::BreakType::kNone, rtf_break->AppendChar(ch));
+ EXPECT_EQ(CFGAS_Char::BreakType::kNone, rtf_break->AppendChar(ch));
- EXPECT_EQ(CFX_Char::BreakType::kParagraph, rtf_break->AppendChar(L'\n'));
+ EXPECT_EQ(CFGAS_Char::BreakType::kParagraph, rtf_break->AppendChar(L'\n'));
ASSERT_EQ(1, rtf_break->CountBreakPieces());
EXPECT_EQ(str + L"\n", rtf_break->GetBreakPieceUnstable(0)->GetString());
@@ -53,22 +53,22 @@
str = L"Second str.";
for (wchar_t ch : str)
- EXPECT_EQ(CFX_Char::BreakType::kNone, rtf_break->AppendChar(ch));
+ EXPECT_EQ(CFGAS_Char::BreakType::kNone, rtf_break->AppendChar(ch));
// Force the end of the break at the end of the string.
- rtf_break->EndBreak(CFX_Char::BreakType::kParagraph);
+ rtf_break->EndBreak(CFGAS_Char::BreakType::kParagraph);
ASSERT_EQ(1, rtf_break->CountBreakPieces());
EXPECT_EQ(str, rtf_break->GetBreakPieceUnstable(0)->GetString());
}
TEST_F(CFX_RTFBreakTest, ControlCharacters) {
auto rtf_break = CreateBreak(FX_LAYOUTSTYLE_ExpandTab);
- EXPECT_EQ(CFX_Char::BreakType::kLine, rtf_break->AppendChar(L'\v'));
- EXPECT_EQ(CFX_Char::BreakType::kPage, rtf_break->AppendChar(L'\f'));
+ EXPECT_EQ(CFGAS_Char::BreakType::kLine, rtf_break->AppendChar(L'\v'));
+ EXPECT_EQ(CFGAS_Char::BreakType::kPage, rtf_break->AppendChar(L'\f'));
const wchar_t kUnicodeParagraphSeparator = 0x2029;
- EXPECT_EQ(CFX_Char::BreakType::kParagraph,
+ EXPECT_EQ(CFGAS_Char::BreakType::kParagraph,
rtf_break->AppendChar(kUnicodeParagraphSeparator));
- EXPECT_EQ(CFX_Char::BreakType::kParagraph, rtf_break->AppendChar(L'\n'));
+ EXPECT_EQ(CFGAS_Char::BreakType::kParagraph, rtf_break->AppendChar(L'\n'));
ASSERT_EQ(1, rtf_break->CountBreakPieces());
EXPECT_EQ(L"\v", rtf_break->GetBreakPieceUnstable(0)->GetString());
@@ -83,8 +83,8 @@
for (wchar_t ch : input)
rtf_break->AppendChar(ch);
- std::vector<CFX_Char> chars =
+ std::vector<CFGAS_Char> chars =
rtf_break->GetCurrentLineForTesting()->m_LineChars;
- CFX_Char::BidiLine(&chars, chars.size());
+ CFGAS_Char::BidiLine(&chars, chars.size());
EXPECT_EQ(3u, chars.size());
}
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp
index 3de42fc..7d5bf9a 100644
--- a/xfa/fgas/layout/cfx_txtbreak.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -16,7 +16,7 @@
#include "third_party/base/containers/adapters.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/fx_arabic.h"
#include "xfa/fgas/layout/fx_linebreak.h"
@@ -51,7 +51,7 @@
m_iCombWidth = FXSYS_roundf(fCombWidth * kConversionFactor);
}
-void CFX_TxtBreak::AppendChar_Combination(CFX_Char* pCurChar) {
+void CFX_TxtBreak::AppendChar_Combination(CFGAS_Char* pCurChar) {
wchar_t wch = pCurChar->char_code();
wchar_t wForm;
FX_SAFE_INT32 iCharWidth = 0;
@@ -60,7 +60,7 @@
iCharWidth = m_iCombWidth;
} else {
wForm = wch;
- CFX_Char* pLastChar = GetLastChar(0, false, false);
+ CFGAS_Char* pLastChar = GetLastChar(0, false, false);
if (pLastChar &&
(pLastChar->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicShadda) == 0) {
bool bShadda = false;
@@ -97,42 +97,42 @@
pCurChar->m_iCharWidth = iCharWidth.ValueOrDefault(0);
}
-void CFX_TxtBreak::AppendChar_Tab(CFX_Char* pCurChar) {
+void CFX_TxtBreak::AppendChar_Tab(CFGAS_Char* pCurChar) {
m_eCharType = FX_CHARTYPE::kTab;
}
-CFX_Char::BreakType CFX_TxtBreak::AppendChar_Control(CFX_Char* pCurChar) {
+CFGAS_Char::BreakType CFX_TxtBreak::AppendChar_Control(CFGAS_Char* pCurChar) {
m_eCharType = FX_CHARTYPE::kControl;
- CFX_Char::BreakType dwRet = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwRet = CFGAS_Char::BreakType::kNone;
if (!m_bSingleLine) {
wchar_t wch = pCurChar->char_code();
switch (wch) {
case L'\v':
case 0x2028:
- dwRet = CFX_Char::BreakType::kLine;
+ dwRet = CFGAS_Char::BreakType::kLine;
break;
case L'\f':
- dwRet = CFX_Char::BreakType::kPage;
+ dwRet = CFGAS_Char::BreakType::kPage;
break;
case 0x2029:
- dwRet = CFX_Char::BreakType::kParagraph;
+ dwRet = CFGAS_Char::BreakType::kParagraph;
break;
default:
if (wch == m_wParagraphBreakChar)
- dwRet = CFX_Char::BreakType::kParagraph;
+ dwRet = CFGAS_Char::BreakType::kParagraph;
break;
}
- if (dwRet != CFX_Char::BreakType::kNone)
+ if (dwRet != CFGAS_Char::BreakType::kNone)
dwRet = EndBreak(dwRet);
}
return dwRet;
}
-CFX_Char::BreakType CFX_TxtBreak::AppendChar_Arabic(CFX_Char* pCurChar) {
+CFGAS_Char::BreakType CFX_TxtBreak::AppendChar_Arabic(CFGAS_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
int32_t& iLineWidth = m_pCurLine->m_iWidth;
wchar_t wForm;
- CFX_Char* pLastChar = nullptr;
+ CFGAS_Char* pLastChar = nullptr;
bool bAlef = false;
if (!m_bCombText && m_eCharType >= FX_CHARTYPE::kArabicAlef &&
m_eCharType <= FX_CHARTYPE::kArabicDistortion) {
@@ -143,7 +143,7 @@
iLineWidth -= pLastChar->m_iCharWidth;
iCharWidth = pLastChar->m_iCharWidth;
- CFX_Char* pPrevChar = GetLastChar(2, true, false);
+ CFGAS_Char* pPrevChar = GetLastChar(2, true, false);
wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
bAlef = (wForm == 0xFEFF &&
pLastChar->GetCharType() == FX_CHARTYPE::kArabicAlef);
@@ -191,11 +191,11 @@
m_pCurLine->IncrementArabicCharCount();
if (!m_bSingleLine && IsGreaterThanLineWidth(iLineWidth))
- return EndBreak(CFX_Char::BreakType::kLine);
- return CFX_Char::BreakType::kNone;
+ return EndBreak(CFGAS_Char::BreakType::kLine);
+ return CFGAS_Char::BreakType::kNone;
}
-CFX_Char::BreakType CFX_TxtBreak::AppendChar_Others(CFX_Char* pCurChar) {
+CFGAS_Char::BreakType CFX_TxtBreak::AppendChar_Others(CFGAS_Char* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
int32_t& iLineWidth = m_pCurLine->m_iWidth;
FX_SAFE_INT32 iCharWidth = 0;
@@ -224,37 +224,37 @@
iLineWidth += iCharWidthValid;
if (!m_bSingleLine && chartype != FX_CHARTYPE::kSpace &&
IsGreaterThanLineWidth(iLineWidth)) {
- return EndBreak(CFX_Char::BreakType::kLine);
+ return EndBreak(CFGAS_Char::BreakType::kLine);
}
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
}
-CFX_Char::BreakType CFX_TxtBreak::AppendChar(wchar_t wch) {
+CFGAS_Char::BreakType CFX_TxtBreak::AppendChar(wchar_t wch) {
FX_CHARTYPE chartype = FX_GetCharType(wch);
m_pCurLine->m_LineChars.emplace_back(wch, m_iHorizontalScale,
m_iVerticalScale);
- CFX_Char* pCurChar = &m_pCurLine->m_LineChars.back();
+ CFGAS_Char* pCurChar = &m_pCurLine->m_LineChars.back();
pCurChar->m_dwCharStyles = m_iAlignment | (1 << 8);
- CFX_Char::BreakType dwRet1 = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwRet1 = CFGAS_Char::BreakType::kNone;
if (chartype != FX_CHARTYPE::kCombination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
m_eCharType != FX_CHARTYPE::kUnknown && !m_bSingleLine &&
IsGreaterThanLineWidth(m_pCurLine->m_iWidth) &&
(m_eCharType != FX_CHARTYPE::kSpace ||
chartype != FX_CHARTYPE::kControl)) {
- dwRet1 = EndBreak(CFX_Char::BreakType::kLine);
+ dwRet1 = EndBreak(CFGAS_Char::BreakType::kLine);
if (!m_pCurLine->m_LineChars.empty())
pCurChar = &m_pCurLine->m_LineChars.back();
}
- CFX_Char::BreakType dwRet2 = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwRet2 = CFGAS_Char::BreakType::kNone;
if (wch == m_wParagraphBreakChar) {
// This is handled in AppendChar_Control, but it seems like \n and \r
// don't get matched as control characters so we go into AppendChar_other
// and never detect the new paragraph ...
- dwRet2 = CFX_Char::BreakType::kParagraph;
+ dwRet2 = CFGAS_Char::BreakType::kParagraph;
EndBreak(dwRet2);
} else {
switch (chartype) {
@@ -290,7 +290,7 @@
void CFX_TxtBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine,
bool bAllChars) {
bool bDone = false;
- CFX_Char* pTC;
+ CFGAS_Char* pTC;
if (!m_bSingleLine && IsGreaterThanLineWidth(m_pCurLine->m_iWidth)) {
pTC = m_pCurLine->GetChar(m_pCurLine->m_LineChars.size() - 1);
switch (pTC->GetCharType()) {
@@ -311,11 +311,11 @@
}
void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- CFX_Char::BreakType dwStatus) {
+ CFGAS_Char::BreakType dwStatus) {
CFX_BreakPiece tp;
FX_TPO tpo;
- CFX_Char* pTC;
- std::vector<CFX_Char>& chars = m_pCurLine->m_LineChars;
+ CFGAS_Char* pTC;
+ std::vector<CFGAS_Char>& chars = m_pCurLine->m_LineChars;
if (!m_pCurLine->HasArabicChar()) {
tp.m_dwStatus = dwStatus;
tp.m_iStartPos = m_pCurLine->m_iStart;
@@ -341,9 +341,9 @@
if (i == 0)
pTC->m_iBidiLevel = 1;
}
- CFX_Char::BidiLine(&chars, iBidiNum + 1);
+ CFGAS_Char::BidiLine(&chars, iBidiNum + 1);
- tp.m_dwStatus = CFX_Char::BreakType::kPiece;
+ tp.m_dwStatus = CFGAS_Char::BreakType::kPiece;
tp.m_iStartPos = m_pCurLine->m_iStart;
tp.m_pChars = &m_pCurLine->m_LineChars;
int32_t iBidiLevel = -1;
@@ -361,10 +361,10 @@
tp.m_dwCharStyles = pTC->m_dwCharStyles;
tp.m_iHorizontalScale = pTC->horizonal_scale();
tp.m_iVerticalScale = pTC->vertical_scale();
- tp.m_dwStatus = CFX_Char::BreakType::kPiece;
+ tp.m_dwStatus = CFGAS_Char::BreakType::kPiece;
}
if (iBidiLevel != pTC->m_iBidiLevel ||
- pTC->m_dwStatus != CFX_Char::BreakType::kNone) {
+ pTC->m_dwStatus != CFGAS_Char::BreakType::kNone) {
if (iBidiLevel == pTC->m_iBidiLevel) {
tp.m_dwStatus = pTC->m_dwStatus;
iCharWidth = pTC->m_iCharWidth;
@@ -414,7 +414,7 @@
void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_Char::BreakType dwStatus) {
+ CFGAS_Char::BreakType dwStatus) {
int32_t iNetWidth = m_pCurLine->m_iWidth;
int32_t iGapChars = 0;
bool bFind = false;
@@ -426,7 +426,7 @@
bool bArabic = FX_IsOdd(ttp.m_iBidiLevel);
int32_t j = bArabic ? 0 : ttp.m_iCharCount - 1;
while (j > -1 && j < ttp.m_iCharCount) {
- const CFX_Char* pTC = ttp.GetChar(j);
+ const CFGAS_Char* pTC = ttp.GetChar(j);
if (pTC->m_eLineBreakType == FX_LINEBREAKTYPE::kDIRECT_BRK)
iGapChars++;
if (!bFind || !bAllChars) {
@@ -449,7 +449,7 @@
int32_t iOffset = m_iLineWidth - iNetWidth;
if (iGapChars > 0 && m_iAlignment & CFX_TxtLineAlignment_Justified &&
- dwStatus != CFX_Char::BreakType::kParagraph) {
+ dwStatus != CFGAS_Char::BreakType::kParagraph) {
int32_t iStart = -1;
for (auto& tpo : tpos) {
CFX_BreakPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
@@ -460,7 +460,7 @@
for (int32_t j = 0; j < ttp.m_iCharCount && iGapChars > 0;
j++, iGapChars--) {
- CFX_Char* pTC = ttp.GetChar(j);
+ CFGAS_Char* pTC = ttp.GetChar(j);
if (pTC->m_eLineBreakType != FX_LINEBREAKTYPE::kDIRECT_BRK ||
pTC->m_iCharWidth < 0) {
continue;
@@ -485,29 +485,29 @@
}
}
-CFX_Char::BreakType CFX_TxtBreak::EndBreak(CFX_Char::BreakType dwStatus) {
- DCHECK(dwStatus != CFX_Char::BreakType::kNone);
+CFGAS_Char::BreakType CFX_TxtBreak::EndBreak(CFGAS_Char::BreakType dwStatus) {
+ DCHECK(dwStatus != CFGAS_Char::BreakType::kNone);
if (!m_pCurLine->m_LinePieces.empty()) {
- if (dwStatus != CFX_Char::BreakType::kPiece)
+ if (dwStatus != CFGAS_Char::BreakType::kPiece)
m_pCurLine->m_LinePieces.back().m_dwStatus = dwStatus;
return m_pCurLine->m_LinePieces.back().m_dwStatus;
}
if (HasLine()) {
if (m_Lines[m_iReadyLineIndex].m_LinePieces.empty())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
- if (dwStatus != CFX_Char::BreakType::kPiece)
+ if (dwStatus != CFGAS_Char::BreakType::kPiece)
m_Lines[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus = dwStatus;
return m_Lines[m_iReadyLineIndex].m_LinePieces.back().m_dwStatus;
}
if (m_pCurLine->m_LineChars.empty())
- return CFX_Char::BreakType::kNone;
+ return CFGAS_Char::BreakType::kNone;
m_pCurLine->m_LineChars.back().m_dwStatus = dwStatus;
- if (dwStatus == CFX_Char::BreakType::kPiece)
+ if (dwStatus == CFGAS_Char::BreakType::kPiece)
return dwStatus;
m_iReadyLineIndex = m_pCurLine == &m_Lines[0] ? 0 : 1;
@@ -521,17 +521,17 @@
EndBreak_Alignment(tpos, bAllChars, dwStatus);
m_pCurLine = pNextLine;
- CFX_Char* pTC = GetLastChar(0, false, false);
+ CFGAS_Char* pTC = GetLastChar(0, false, false);
m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE::kUnknown;
return dwStatus;
}
-int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_Char>* pChars,
+int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFGAS_Char>* pChars,
bool bAllChars,
bool bOnlyBrk,
int32_t* pEndPos) {
- std::vector<CFX_Char>& chars = *pChars;
+ std::vector<CFGAS_Char>& chars = *pChars;
int32_t iLength = pdfium::CollectionSize<int32_t>(chars) - 1;
if (iLength < 1)
return iLength;
@@ -553,7 +553,7 @@
FX_LINEBREAKTYPE eType;
FX_BREAKPROPERTY nCur;
FX_BREAKPROPERTY nNext;
- CFX_Char* pCur = &chars[iLength--];
+ CFGAS_Char* pCur = &chars[iLength--];
if (bAllChars)
pCur->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
@@ -622,7 +622,7 @@
return;
int32_t iEndPos = pCurLine->m_iWidth;
- std::vector<CFX_Char>& curChars = pCurLine->m_LineChars;
+ std::vector<CFGAS_Char>& curChars = pCurLine->m_LineChars;
int32_t iCharPos = GetBreakPos(&curChars, bAllChars, false, &iEndPos);
if (iCharPos < 0)
iCharPos = 0;
@@ -630,16 +630,16 @@
iCharPos++;
if (iCharPos >= pdfium::CollectionSize<int32_t>(pCurLine->m_LineChars)) {
pNextLine->Clear();
- CFX_Char* pTC = &curChars[iCharPos - 1];
+ CFGAS_Char* pTC = &curChars[iCharPos - 1];
pTC->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
return;
}
pNextLine->m_LineChars =
- std::vector<CFX_Char>(curChars.begin() + iCharPos, curChars.end());
+ std::vector<CFGAS_Char>(curChars.begin() + iCharPos, curChars.end());
curChars.erase(curChars.begin() + iCharPos, curChars.end());
pCurLine->m_iWidth = iEndPos;
- CFX_Char* pTC = &curChars[iCharPos - 1];
+ CFGAS_Char* pTC = &curChars[iCharPos - 1];
pTC->m_eLineBreakType = FX_LINEBREAKTYPE::kUNKNOWN;
int32_t iWidth = 0;
for (size_t i = 0; i < pNextLine->m_LineChars.size(); ++i) {
@@ -648,7 +648,7 @@
pNextLine->IncrementArabicCharCount();
}
iWidth += std::max(0, pNextLine->m_LineChars[i].m_iCharWidth);
- pNextLine->m_LineChars[i].m_dwStatus = CFX_Char::BreakType::kNone;
+ pNextLine->m_LineChars[i].m_dwStatus = CFGAS_Char::BreakType::kNone;
}
pNextLine->m_iWidth = iWidth;
}
diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h
index 81e157d..6430f2b 100644
--- a/xfa/fgas/layout/cfx_txtbreak.h
+++ b/xfa/fgas/layout/cfx_txtbreak.h
@@ -11,8 +11,8 @@
#include <vector>
#include "core/fxcrt/fx_coordinates.h"
+#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/cfx_break.h"
-#include "xfa/fgas/layout/cfx_char.h"
class CFGAS_GEFont;
class TextCharPos;
@@ -27,9 +27,9 @@
CFX_TxtLineAlignment_Justified = 1 << 2
};
-inline bool CFX_BreakTypeNoneOrPiece(CFX_Char::BreakType type) {
- return type == CFX_Char::BreakType::kNone ||
- type == CFX_Char::BreakType::kPiece;
+inline bool CFX_BreakTypeNoneOrPiece(CFGAS_Char::BreakType type) {
+ return type == CFGAS_Char::BreakType::kNone ||
+ type == CFGAS_Char::BreakType::kPiece;
}
class CFX_TxtBreak final : public CFX_Break {
@@ -69,27 +69,27 @@
void SetLineWidth(float fLineWidth);
void SetAlignment(int32_t iAlignment);
void SetCombWidth(float fCombWidth);
- CFX_Char::BreakType EndBreak(CFX_Char::BreakType dwStatus);
+ CFGAS_Char::BreakType EndBreak(CFGAS_Char::BreakType dwStatus);
size_t GetDisplayPos(const Run* pTxtRun, TextCharPos* pCharPos) const;
std::vector<CFX_RectF> GetCharRects(const Run* pTxtRun, bool bCharBBox) const;
- CFX_Char::BreakType AppendChar(wchar_t wch);
+ CFGAS_Char::BreakType AppendChar(wchar_t wch);
private:
- void AppendChar_Combination(CFX_Char* pCurChar);
- void AppendChar_Tab(CFX_Char* pCurChar);
- CFX_Char::BreakType AppendChar_Control(CFX_Char* pCurChar);
- CFX_Char::BreakType AppendChar_Arabic(CFX_Char* pCurChar);
- CFX_Char::BreakType AppendChar_Others(CFX_Char* pCurChar);
+ void AppendChar_Combination(CFGAS_Char* pCurChar);
+ void AppendChar_Tab(CFGAS_Char* pCurChar);
+ CFGAS_Char::BreakType AppendChar_Control(CFGAS_Char* pCurChar);
+ CFGAS_Char::BreakType AppendChar_Arabic(CFGAS_Char* pCurChar);
+ CFGAS_Char::BreakType AppendChar_Others(CFGAS_Char* pCurChar);
void ResetContextCharStyles();
void EndBreak_SplitLine(CFX_BreakLine* pNextLine, bool bAllChars);
void EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- CFX_Char::BreakType dwStatus);
+ CFGAS_Char::BreakType dwStatus);
void EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_Char::BreakType dwStatus);
- int32_t GetBreakPos(std::vector<CFX_Char>* pChars,
+ CFGAS_Char::BreakType dwStatus);
+ int32_t GetBreakPos(std::vector<CFGAS_Char>* pChars,
bool bAllChars,
bool bOnlyBrk,
int32_t* pEndPos);
diff --git a/xfa/fgas/layout/cfx_txtbreak_unittest.cpp b/xfa/fgas/layout/cfx_txtbreak_unittest.cpp
index 8d1ed6d..5da0635 100644
--- a/xfa/fgas/layout/cfx_txtbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak_unittest.cpp
@@ -11,7 +11,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_gefont.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
class CFX_TxtBreakTest : public testing::Test {
public:
@@ -39,8 +39,8 @@
for (wchar_t ch : input)
txt_break->AppendChar(ch);
- std::vector<CFX_Char> chars =
+ std::vector<CFGAS_Char> chars =
txt_break->GetCurrentLineForTesting()->m_LineChars;
- CFX_Char::BidiLine(&chars, chars.size());
+ CFGAS_Char::BidiLine(&chars, chars.size());
EXPECT_EQ(3u, chars.size());
}
diff --git a/xfa/fgas/layout/fx_arabic.cpp b/xfa/fgas/layout/fx_arabic.cpp
index 9681b01..2812c8a 100644
--- a/xfa/fgas/layout/fx_arabic.cpp
+++ b/xfa/fgas/layout/fx_arabic.cpp
@@ -139,7 +139,7 @@
return g_FX_ArabicFormTables + (unicode - 0x622);
}
-const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC,
+const FX_ARBFORMTABLE* ParseChar(const CFGAS_Char* pTC,
wchar_t* wChar,
FX_CHARTYPE* eType) {
if (!pTC) {
@@ -173,15 +173,15 @@
namespace arabic {
wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next) {
- CFX_Char c(wch);
- CFX_Char p(prev);
- CFX_Char n(next);
+ CFGAS_Char c(wch);
+ CFGAS_Char p(prev);
+ CFGAS_Char n(next);
return GetFormChar(&c, &p, &n);
}
-wchar_t GetFormChar(const CFX_Char* cur,
- const CFX_Char* prev,
- const CFX_Char* next) {
+wchar_t GetFormChar(const CFGAS_Char* cur,
+ const CFGAS_Char* prev,
+ const CFGAS_Char* next) {
FX_CHARTYPE eCur;
wchar_t wCur;
const FX_ARBFORMTABLE* ft = ParseChar(cur, &wCur, &eCur);
diff --git a/xfa/fgas/layout/fx_arabic.h b/xfa/fgas/layout/fx_arabic.h
index ca33aa5..425ba14 100644
--- a/xfa/fgas/layout/fx_arabic.h
+++ b/xfa/fgas/layout/fx_arabic.h
@@ -8,15 +8,15 @@
#define XFA_FGAS_LAYOUT_FX_ARABIC_H_
#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
namespace pdfium {
namespace arabic {
wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next);
-wchar_t GetFormChar(const CFX_Char* cur,
- const CFX_Char* prev,
- const CFX_Char* next);
+wchar_t GetFormChar(const CFGAS_Char* cur,
+ const CFGAS_Char* prev,
+ const CFGAS_Char* next);
} // namespace arabic
} // namespace pdfium
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp
index 3904e34..df118e4 100644
--- a/xfa/fxfa/cxfa_textlayout.cpp
+++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -722,7 +722,7 @@
if (bRet && m_pLoader)
m_pLoader->pNode = pNode;
else
- EndBreak(CFX_Char::BreakType::kParagraph, pLinePos, bSavePieces);
+ EndBreak(CFGAS_Char::BreakType::kParagraph, pLinePos, bSavePieces);
}
bool CXFA_TextLayout::LoadRichText(
@@ -874,7 +874,7 @@
m_pLoader->bFilterSpace = true;
}
if (bCurLi)
- EndBreak(CFX_Char::BreakType::kLine, pLinePos, bSavePieces);
+ EndBreak(CFGAS_Char::BreakType::kLine, pLinePos, bSavePieces);
} else {
if (pContext)
eDisplay = pContext->GetDisplay();
@@ -883,9 +883,9 @@
if (!pContext || bContentNode)
return true;
- CFX_Char::BreakType dwStatus = (eDisplay == CFX_CSSDisplay::Block)
- ? CFX_Char::BreakType::kParagraph
- : CFX_Char::BreakType::kPiece;
+ CFGAS_Char::BreakType dwStatus = (eDisplay == CFX_CSSDisplay::Block)
+ ? CFGAS_Char::BreakType::kParagraph
+ : CFGAS_Char::BreakType::kPiece;
EndBreak(dwStatus, pLinePos, bSavePieces);
if (eDisplay == CFX_CSSDisplay::Block) {
*pLinePos += fSpaceBelow;
@@ -906,7 +906,7 @@
float* pLinePos,
float fSpaceAbove,
bool bSavePieces) {
- CFX_Char::BreakType dwStatus = CFX_Char::BreakType::kNone;
+ CFGAS_Char::BreakType dwStatus = CFGAS_Char::BreakType::kNone;
int32_t iChar = 0;
if (m_pLoader)
iChar = m_pLoader->iChar;
@@ -918,15 +918,15 @@
wch = 0x20;
dwStatus = m_pBreak->AppendChar(wch);
- if (dwStatus != CFX_Char::BreakType::kNone &&
- dwStatus != CFX_Char::BreakType::kPiece) {
+ if (dwStatus != CFGAS_Char::BreakType::kNone &&
+ dwStatus != CFGAS_Char::BreakType::kPiece) {
AppendTextLine(dwStatus, pLinePos, bSavePieces, false);
if (IsEnd(bSavePieces)) {
if (m_pLoader)
m_pLoader->iChar = i;
return true;
}
- if (dwStatus == CFX_Char::BreakType::kParagraph && m_bRichText)
+ if (dwStatus == CFGAS_Char::BreakType::kParagraph && m_bRichText)
*pLinePos += fSpaceAbove;
}
}
@@ -944,12 +944,12 @@
return false;
}
-void CXFA_TextLayout::EndBreak(CFX_Char::BreakType dwStatus,
+void CXFA_TextLayout::EndBreak(CFGAS_Char::BreakType dwStatus,
float* pLinePos,
bool bSavePieces) {
dwStatus = m_pBreak->EndBreak(dwStatus);
- if (dwStatus != CFX_Char::BreakType::kNone &&
- dwStatus != CFX_Char::BreakType::kPiece)
+ if (dwStatus != CFGAS_Char::BreakType::kNone &&
+ dwStatus != CFGAS_Char::BreakType::kPiece)
AppendTextLine(dwStatus, pLinePos, bSavePieces, true);
}
@@ -1008,7 +1008,7 @@
}
}
-void CXFA_TextLayout::AppendTextLine(CFX_Char::BreakType dwStatus,
+void CXFA_TextLayout::AppendTextLine(CFGAS_Char::BreakType dwStatus,
float* pLinePos,
bool bSavePieces,
bool bEndBreak) {
@@ -1112,7 +1112,7 @@
}
m_pBreak->ClearBreakPieces();
- if (dwStatus == CFX_Char::BreakType::kParagraph) {
+ if (dwStatus == CFGAS_Char::BreakType::kParagraph) {
m_pBreak->Reset();
if (!pStyle && bEndBreak) {
CXFA_Para* para = m_pTextProvider->GetParaIfExists();
diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h
index 398bb0b..41e1197 100644
--- a/xfa/fxfa/cxfa_textlayout.h
+++ b/xfa/fxfa/cxfa_textlayout.h
@@ -20,7 +20,7 @@
#include "v8/include/cppgc/garbage-collected.h"
#include "v8/include/cppgc/member.h"
#include "v8/include/cppgc/visitor.h"
-#include "xfa/fgas/layout/cfx_char.h"
+#include "xfa/fgas/layout/cfgas_char.h"
#include "xfa/fgas/layout/cfx_textpiece.h"
#include "xfa/fxfa/fxfa_basic.h"
@@ -147,11 +147,11 @@
float* pLinePos,
float fSpaceAbove,
bool bSavePieces);
- void AppendTextLine(CFX_Char::BreakType dwStatus,
+ void AppendTextLine(CFGAS_Char::BreakType dwStatus,
float* pLinePos,
bool bSavePieces,
bool bEndBreak);
- void EndBreak(CFX_Char::BreakType dwStatus, float* pLinePos, bool bDefault);
+ void EndBreak(CFGAS_Char::BreakType dwStatus, float* pLinePos, bool bDefault);
bool IsEnd(bool bSavePieces);
void UpdateAlign(float fHeight, float fBottom);
void RenderString(CFX_RenderDevice* pDevice,