diff options
-rw-r--r-- | core/fxcrt/include/fx_basic.h | 8 | ||||
-rw-r--r-- | core/fxcrt/include/fx_ucd.h | 2 | ||||
-rw-r--r-- | xfa/fde/css/fde_css.h | 4 | ||||
-rw-r--r-- | xfa/fde/css/fde_csscache.cpp | 3 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.h | 7 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.h | 20 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.cpp | 8 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.h | 14 |
11 files changed, 46 insertions, 40 deletions
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index d3dce8c749..848429e8f3 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -911,11 +911,13 @@ typedef CFX_ListArrayTemplate<CFX_SortListArray<sizeof(FX_FILESIZE)>, FX_FILESIZE> CFX_FileSizeListArray; #ifdef PDF_ENABLE_XFA -class IFX_Unknown { +class IFX_Retainable { public: - virtual ~IFX_Unknown() {} + virtual uint32_t Retain() = 0; virtual uint32_t Release() = 0; - virtual uint32_t AddRef() = 0; + + protected: + virtual ~IFX_Retainable() {} }; #define FX_IsOdd(a) ((a)&1) #endif // PDF_ENABLE_XFA diff --git a/core/fxcrt/include/fx_ucd.h b/core/fxcrt/include/fx_ucd.h index 0eb159d703..fbf3187c86 100644 --- a/core/fxcrt/include/fx_ucd.h +++ b/core/fxcrt/include/fx_ucd.h @@ -189,7 +189,7 @@ class CFX_RTFChar : public CFX_Char { int16_t m_iBidiOrder; uint32_t m_dwLayoutStyles; uint32_t m_dwIdentity; - IFX_Unknown* m_pUserData; + IFX_Retainable* m_pUserData; }; typedef CFX_ArrayTemplate<CFX_RTFChar> CFX_RTFCharArray; #endif // PDF_ENABLE_XFA diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index b949ace778..551f8f8962 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -739,7 +739,7 @@ class IFDE_CSSFontFaceRule : public IFDE_CSSRule { virtual CFDE_CSSDeclaration* GetDeclaration() = 0; }; -class IFDE_CSSStyleSheet : public IFX_Unknown { +class IFDE_CSSStyleSheet : public IFX_Retainable { public: static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet(); static IFDE_CSSStyleSheet* LoadFromStream( @@ -882,7 +882,7 @@ class IFDE_CSSParagraphStyle { virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; }; -class IFDE_CSSComputedStyle : public IFX_Unknown { +class IFDE_CSSComputedStyle : public IFX_Retainable { public: virtual void Reset() = 0; virtual IFDE_CSSFontStyle* GetFontStyles() = 0; diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp index 0b21dcdea3..76a893d2d1 100644 --- a/xfa/fde/css/fde_csscache.cpp +++ b/xfa/fde/css/fde_csscache.cpp @@ -13,8 +13,7 @@ FDE_CSSCacheItem::FDE_CSSCacheItem(IFDE_CSSStyleSheet* p) : pStylesheet(p), dwActivity(0) { - ASSERT(pStylesheet); - pStylesheet->AddRef(); + pStylesheet->Retain(); } FDE_CSSCacheItem::~FDE_CSSCacheItem() { diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index cb54aaed7f..7227f9aab9 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -388,11 +388,10 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, CFDE_CSSComputedStyle(IFX_MemoryAllocator* pAlloc) : m_dwRefCount(1), m_pAllocator(pAlloc) {} - ~CFDE_CSSComputedStyle() {} - - // IFX_Unknown: - uint32_t AddRef() override { return ++m_dwRefCount; } + ~CFDE_CSSComputedStyle() override {} + // IFX_Retainable: + uint32_t Retain() override { return ++m_dwRefCount; } uint32_t Release() override { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount == 0) { diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index 80da3b042e..5a3cc76f5b 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -106,7 +106,7 @@ void CFDE_CSSStyleSheet::Reset() { delete m_pAllocator; m_pAllocator = nullptr; } -uint32_t CFDE_CSSStyleSheet::AddRef() { +uint32_t CFDE_CSSStyleSheet::Retain() { return ++m_wRefCount; } uint32_t CFDE_CSSStyleSheet::Release() { diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index 9362fb15b4..76eddda4a3 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -98,18 +98,22 @@ class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule, public CFX_Target { class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { public: CFDE_CSSStyleSheet(uint32_t dwMediaList); - ~CFDE_CSSStyleSheet(); - virtual uint32_t AddRef(); - virtual uint32_t Release(); + ~CFDE_CSSStyleSheet() override; - virtual FX_BOOL GetUrl(CFX_WideString& szUrl) { + // IFX_Retainable: + uint32_t Retain() override; + uint32_t Release() override; + + // IFDE_CSSStyleSheet: + FX_BOOL GetUrl(CFX_WideString& szUrl) override { szUrl = m_szUrl; return szUrl.GetLength() > 0; } - virtual uint32_t GetMediaList() const { return m_dwMediaList; } - virtual uint16_t GetCodePage() const { return m_wCodePage; } - virtual int32_t CountRules() const; - virtual IFDE_CSSRule* GetRule(int32_t index); + uint32_t GetMediaList() const override { return m_dwMediaList; } + uint16_t GetCodePage() const override { return m_wCodePage; } + int32_t CountRules() const override; + IFDE_CSSRule* GetRule(int32_t index) override; + FX_BOOL LoadFromStream(const CFX_WideString& szUrl, IFX_Stream* pStream, uint16_t wCodePage); diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 62b3f5f28e..dcb3c3953a 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -239,7 +239,7 @@ void CFX_RTFBreak::SetAlignment(int32_t iAlignment) { iAlignment <= FX_RTFLINEALIGNMENT_Distributed); m_iAlignment = iAlignment; } -void CFX_RTFBreak::SetUserData(IFX_Unknown* pUserData) { +void CFX_RTFBreak::SetUserData(IFX_Retainable* pUserData) { if (m_pUserData == pUserData) { return; } @@ -249,7 +249,7 @@ void CFX_RTFBreak::SetUserData(IFX_Unknown* pUserData) { } m_pUserData = pUserData; if (m_pUserData != NULL) { - m_pUserData->AddRef(); + m_pUserData->Retain(); } } static const int32_t gs_FX_RTFLineRotations[8] = {0, 3, 1, 0, 2, 1, 3, 2}; @@ -362,7 +362,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) { pCurChar->m_iCharWidth = 0; pCurChar->m_dwIdentity = m_dwIdentity; if (m_pUserData != NULL) { - m_pUserData->AddRef(); + m_pUserData->Retain(); } pCurChar->m_pUserData = m_pUserData; uint32_t dwRet1 = FX_RTFBREAK_None; @@ -409,7 +409,7 @@ uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) { pCurChar->m_iCharWidth = 0; pCurChar->m_dwIdentity = m_dwIdentity; if (m_pUserData != NULL) { - m_pUserData->AddRef(); + m_pUserData->Retain(); } pCurChar->m_pUserData = m_pUserData; int32_t iCharWidth = 0; diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index be3717f584..c090a0dd5d 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -7,6 +7,7 @@ #ifndef XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ #define XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ +#include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_ucd.h" #include "core/fxge/include/fx_ge.h" #include "xfa/fgas/crt/fgas_memory.h" @@ -14,7 +15,6 @@ #include "xfa/fgas/layout/fgas_textbreak.h" #include "xfa/fgas/layout/fgas_unicode.h" -class IFX_Unknown; class IFX_Font; #define FX_RTFBREAKPOLICY_None 0x00 @@ -186,7 +186,7 @@ class CFX_RTFPiece : public CFX_Target { uint32_t m_dwLayoutStyles; uint32_t m_dwIdentity; CFX_RTFCharArray* m_pChars; - IFX_Unknown* m_pUserData; + IFX_Retainable* m_pUserData; }; typedef CFX_BaseArrayTemplate<CFX_RTFPiece> CFX_RTFPieceArray; @@ -220,7 +220,7 @@ class CFX_RTFLine { int32_t GetLineEnd() const { return m_iStart + m_iWidth; } void RemoveAll(FX_BOOL bLeaveMemory = FALSE) { CFX_RTFChar* pChar; - IFX_Unknown* pUnknown; + IFX_Retainable* pUnknown; int32_t iCount = m_LineChars.GetSize(); for (int32_t i = 0; i < iCount; i++) { pChar = m_LineChars.GetDataPtr(i); @@ -267,7 +267,7 @@ class CFX_RTFBreak { void SetWordSpace(FX_BOOL bDefault, FX_FLOAT fWordSpace); void SetReadingOrder(FX_BOOL bRTL = FALSE); void SetAlignment(int32_t iAlignment = FX_RTFLINEALIGNMENT_Left); - void SetUserData(IFX_Unknown* pUserData); + void SetUserData(IFX_Retainable* pUserData); uint32_t AppendChar(FX_WCHAR wch); uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak); int32_t CountBreakPieces() const; @@ -318,7 +318,7 @@ class CFX_RTFBreak { int32_t m_iWordSpace; FX_BOOL m_bRTL; int32_t m_iAlignment; - IFX_Unknown* m_pUserData; + IFX_Retainable* m_pUserData; FX_CHARTYPE m_eCharType; uint32_t m_dwIdentity; CFX_RTFLine m_RTFLine1; diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 5dac289404..a382d83bd9 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -193,7 +193,7 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( if (!pContext) return nullptr; pContext->m_pParentStyle = pParentStyle; - pParentStyle->AddRef(); + pParentStyle->Retain(); CXFA_CSSTagProvider tagProvider; ParseTagInfo(pXMLNode, tagProvider); if (tagProvider.m_bContent) @@ -1444,7 +1444,7 @@ FX_BOOL CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, if (wsText.GetLength() > 0) { if (m_pLoader == NULL || m_pLoader->m_iChar == 0) { if (pLinkData) { - pLinkData->AddRef(); + pLinkData->Retain(); } CXFA_TextUserData* pUserData = FXTARGET_NewWith(m_pAllocator.get()) CXFA_TextUserData(m_pAllocator.get(), @@ -1722,7 +1722,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, } fLineStep = std::max(fLineStep, fLineHeight); if (pUserData && pUserData->m_pLinkData) { - pUserData->m_pLinkData->AddRef(); + pUserData->m_pLinkData->Retain(); pTP->pLinkData = pUserData->m_pLinkData; } else { pTP->pLinkData = NULL; @@ -1768,7 +1768,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, } } if (pStyle) { - pStyle->AddRef(); + pStyle->Retain(); } m_pBreak->ClearBreakPieces(); if (dwStatus == FX_RTFBREAK_ParagraphBreak) { diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 0b3ec94604..30399a6217 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -171,14 +171,15 @@ class CXFA_LoaderContext { CFX_FloatArray m_BlocksHeight; }; -class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { +class CXFA_LinkUserData : public IFX_Retainable, public CFX_Target { public: CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText) : m_pAllocator(pAllocator), m_dwRefCount(1), m_wsURLContent(pszText) {} ~CXFA_LinkUserData() override {} - uint32_t AddRef() override { return ++m_dwRefCount; } + // IFX_Retainable: + uint32_t Retain() override { return ++m_dwRefCount; } uint32_t Release() override { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount <= 0) @@ -194,7 +195,7 @@ class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { CFX_WideString m_wsURLContent; }; -class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { +class CXFA_TextUserData : public IFX_Retainable, public CFX_Target { public: CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle) @@ -204,7 +205,7 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { m_dwRefCount(0) { ASSERT(m_pAllocator); if (m_pStyle) - m_pStyle->AddRef(); + m_pStyle->Retain(); } CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle, @@ -215,7 +216,7 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { m_dwRefCount(0) { ASSERT(m_pAllocator); if (m_pStyle) - m_pStyle->AddRef(); + m_pStyle->Retain(); } ~CXFA_TextUserData() override { if (m_pStyle) @@ -224,7 +225,8 @@ class CXFA_TextUserData : public IFX_Unknown, public CFX_Target { m_pLinkData->Release(); } - uint32_t AddRef() override { return ++m_dwRefCount; } + // IFX_Retainable: + uint32_t Retain() override { return ++m_dwRefCount; } uint32_t Release() override { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount == 0) |