diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-05-09 10:12:39 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-09 17:43:04 +0000 |
commit | e02b2bc896b0872ce1a9d0997946b07dc76b9f7b (patch) | |
tree | 9b4fb6e9e64fc4bdc208042943e5e59f7a148eb4 | |
parent | efd4f944deaf4687911d39dbceb4c92f728e68a0 (diff) | |
download | pdfium-e02b2bc896b0872ce1a9d0997946b07dc76b9f7b.tar.xz |
Use CXFA_TextUserData in place of CFX_Retainable where possible.
Layering prevents the (newly-moved) CFX_Char from knowing about
this class, so some casting is still required.
Change-Id: I5b7556fdfa80d09e5116b171b01ab5e707763bf0
Reviewed-on: https://pdfium-review.googlesource.com/5172
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fxcrt/cfx_char.cpp | 6 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakpiece.cpp | 3 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_breakpiece.h | 3 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak.cpp | 10 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak.h | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/cxfa_textlayout.cpp | 6 |
6 files changed, 15 insertions, 18 deletions
diff --git a/core/fxcrt/cfx_char.cpp b/core/fxcrt/cfx_char.cpp index b23ae078cd..1c166353f1 100644 --- a/core/fxcrt/cfx_char.cpp +++ b/core/fxcrt/cfx_char.cpp @@ -20,8 +20,7 @@ CFX_Char::CFX_Char() m_iBidiOrder(0), m_wCharCode(0), m_iFontSize(0), - m_dwIdentity(0), - m_pUserData(nullptr) {} + m_dwIdentity(0) {} CFX_Char::CFX_Char(uint16_t wCharCode, uint32_t dwCharProps) : m_nBreakType(0), @@ -36,8 +35,7 @@ CFX_Char::CFX_Char(uint16_t wCharCode, uint32_t dwCharProps) m_iBidiOrder(0), m_wCharCode(wCharCode), m_iFontSize(0), - m_dwIdentity(0), - m_pUserData(nullptr) {} + m_dwIdentity(0) {} CFX_Char::CFX_Char(const CFX_Char& other) = default; diff --git a/xfa/fgas/layout/cfx_breakpiece.cpp b/xfa/fgas/layout/cfx_breakpiece.cpp index 8cb676b58f..605b900a6e 100644 --- a/xfa/fgas/layout/cfx_breakpiece.cpp +++ b/xfa/fgas/layout/cfx_breakpiece.cpp @@ -19,8 +19,7 @@ CFX_BreakPiece::CFX_BreakPiece() m_iVerticalScale(100), m_dwIdentity(0), m_dwCharStyles(0), - m_pChars(nullptr), - m_pUserData(nullptr) {} + m_pChars(nullptr) {} CFX_BreakPiece::CFX_BreakPiece(const CFX_BreakPiece& other) = default; diff --git a/xfa/fgas/layout/cfx_breakpiece.h b/xfa/fgas/layout/cfx_breakpiece.h index 87627fef40..1c51b1e42a 100644 --- a/xfa/fgas/layout/cfx_breakpiece.h +++ b/xfa/fgas/layout/cfx_breakpiece.h @@ -12,6 +12,7 @@ #include "core/fxcrt/cfx_char.h" #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_string.h" +#include "xfa/fxfa/app/cxfa_textuserdata.h" class CFX_BreakPiece { public: @@ -39,7 +40,7 @@ class CFX_BreakPiece { uint32_t m_dwIdentity; uint32_t m_dwCharStyles; std::vector<CFX_Char>* m_pChars; // not owned. - CFX_RetainPtr<CFX_Retainable> m_pUserData; + CFX_RetainPtr<CXFA_TextUserData> m_pUserData; }; #endif // XFA_FGAS_LAYOUT_CFX_BREAKPIECE_H_ diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp index 9acc082d8e..3bc8860ab8 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak.cpp @@ -16,8 +16,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwLayoutStyles) : CFX_Break(dwLayoutStyles), m_bPagination(false), - m_iAlignment(CFX_RTFLineAlignment::Left), - m_pUserData(nullptr) { + m_iAlignment(CFX_RTFLineAlignment::Left) { SetBreakStatus(); m_bPagination = !!(m_dwLayoutStyles & FX_LAYOUTSTYLE_Pagination); } @@ -41,7 +40,8 @@ void CFX_RTFBreak::AddPositionedTab(float fTabPos) { m_PositionedTabs.insert(it, iTabPos); } -void CFX_RTFBreak::SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData) { +void CFX_RTFBreak::SetUserData( + const CFX_RetainPtr<CXFA_TextUserData>& pUserData) { if (m_pUserData == pUserData) return; @@ -339,7 +339,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine, tp.m_iVerticalScale = pTC->m_iVerticalScale; dwIdentity = pTC->m_dwIdentity; tp.m_dwIdentity = dwIdentity; - tp.m_pUserData = pTC->m_pUserData; + tp.m_pUserData = pTC->m_pUserData.As<CXFA_TextUserData>(); j = i; bNew = false; } @@ -412,7 +412,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos, tp.m_iVerticalScale = pTC->m_iVerticalScale; dwIdentity = pTC->m_dwIdentity; tp.m_dwIdentity = dwIdentity; - tp.m_pUserData = pTC->m_pUserData; + tp.m_pUserData = pTC->m_pUserData.As<CXFA_TextUserData>(); tp.m_dwStatus = CFX_BreakType::Piece; ++i; } else if (iBidiLevel != pTC->m_iBidiLevel || diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h index 28adaa5d41..f900dcbe8a 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.h +++ b/xfa/fgas/layout/cfx_rtfbreak.h @@ -16,6 +16,7 @@ #include "core/fxcrt/fx_ucd.h" #include "core/fxge/cfx_renderdevice.h" #include "xfa/fgas/layout/cfx_break.h" +#include "xfa/fxfa/app/cxfa_textuserdata.h" class CFGAS_GEFont; @@ -51,7 +52,7 @@ class CFX_RTFBreak : public CFX_Break { void SetLineStartPos(float fLinePos); void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; } - void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData); + void SetUserData(const CFX_RetainPtr<CXFA_TextUserData>& pUserData); void AddPositionedTab(float fTabPos); @@ -92,7 +93,7 @@ class CFX_RTFBreak : public CFX_Break { bool m_bPagination; std::vector<int32_t> m_PositionedTabs; CFX_RTFLineAlignment m_iAlignment; - CFX_RetainPtr<CFX_Retainable> m_pUserData; + CFX_RetainPtr<CXFA_TextUserData> m_pUserData; }; #endif // XFA_FGAS_LAYOUT_CFX_RTFBREAK_H_ diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index 69f5f53db3..686ad4ee0d 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -1027,8 +1027,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, int32_t i = 0; for (i = 0; i < iPieces; i++) { const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i); - CXFA_TextUserData* pUserData = - static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get()); + CXFA_TextUserData* pUserData = pPiece->m_pUserData.Get(); if (pUserData) pStyle = pUserData->m_pStyle; float fVerScale = pPiece->m_iVerticalScale / 100.0f; @@ -1082,8 +1081,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, float fLineWidth = 0; for (int32_t i = 0; i < iPieces; i++) { const CFX_BreakPiece* pPiece = m_pBreak->GetBreakPieceUnstable(i); - CXFA_TextUserData* pUserData = - static_cast<CXFA_TextUserData*>(pPiece->m_pUserData.Get()); + CXFA_TextUserData* pUserData = pPiece->m_pUserData.Get(); if (pUserData) pStyle = pUserData->m_pStyle; float fVerScale = pPiece->m_iVerticalScale / 100.0f; |