From 0cb9b8cb094532ff868314350680d3fb0ca2fe51 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 10 Jan 2017 16:38:10 -0500 Subject: Strip out custom allocator code This Cl replaces the custom IFX_MemoryAllocator code with new/delete as needed. Change-Id: Ie786f607c9e0b3035ffd87733bc3e29a4b6426d9 Reviewed-on: https://pdfium-review.googlesource.com/2164 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- BUILD.gn | 2 - xfa/fde/cfde_path.h | 3 +- xfa/fde/cfde_txtedtbuf.cpp | 1 - xfa/fde/css/cfde_cssrulecollection.cpp | 9 +- xfa/fde/css/fde_csscache.h | 13 +- xfa/fde/css/fde_cssdatatable.cpp | 5 +- xfa/fde/css/fde_cssdatatable.h | 13 +- xfa/fde/css/fde_cssdeclaration.cpp | 478 ++++++++++++++------------------- xfa/fde/css/fde_cssdeclaration.h | 25 +- xfa/fde/css/fde_cssstyleselector.cpp | 28 +- xfa/fde/css/fde_cssstyleselector.h | 22 +- xfa/fde/css/fde_cssstylesheet.cpp | 39 ++- xfa/fde/css/fde_cssstylesheet.h | 18 +- xfa/fde/css/fde_csssyntax.h | 9 +- xfa/fde/fde_gedevice.h | 5 +- xfa/fde/fde_iterator.h | 5 +- xfa/fde/fde_object.h | 7 +- xfa/fde/fde_render.cpp | 1 - xfa/fde/fde_render.h | 4 +- xfa/fde/fde_visualset.h | 1 - xfa/fde/tto/fde_textout.cpp | 1 - xfa/fde/tto/fde_textout.h | 8 +- xfa/fde/xml/fde_xml_imp.h | 17 +- xfa/fgas/crt/fgas_memory.cpp | 254 ------------------ xfa/fgas/crt/fgas_memory.h | 53 ---- xfa/fgas/crt/fgas_utils.cpp | 4 +- xfa/fgas/crt/fgas_utils.h | 21 +- xfa/fgas/font/cfgas_fontmgr.h | 1 - xfa/fgas/layout/fgas_rtfbreak.h | 5 +- xfa/fgas/layout/fgas_textbreak.h | 2 +- xfa/fxfa/app/cxfa_linkuserdata.cpp | 7 +- xfa/fxfa/app/cxfa_linkuserdata.h | 8 +- xfa/fxfa/app/cxfa_pieceline.h | 5 +- xfa/fxfa/app/cxfa_textlayout.cpp | 30 +-- xfa/fxfa/app/cxfa_textlayout.h | 2 - xfa/fxfa/app/cxfa_textparsecontext.h | 5 +- xfa/fxfa/app/cxfa_textparser.cpp | 24 +- xfa/fxfa/app/cxfa_textparser.h | 5 +- xfa/fxfa/app/cxfa_textuserdata.cpp | 20 +- xfa/fxfa/app/cxfa_textuserdata.h | 11 +- xfa/fxfa/app/xfa_textpiece.h | 4 +- 41 files changed, 343 insertions(+), 832 deletions(-) delete mode 100644 xfa/fgas/crt/fgas_memory.cpp delete mode 100644 xfa/fgas/crt/fgas_memory.h diff --git a/BUILD.gn b/BUILD.gn index 627cc07d55..9a5c29c82e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1169,8 +1169,6 @@ if (pdf_enable_xfa) { "xfa/fgas/crt/fgas_codepage.cpp", "xfa/fgas/crt/fgas_codepage.h", "xfa/fgas/crt/fgas_language.h", - "xfa/fgas/crt/fgas_memory.cpp", - "xfa/fgas/crt/fgas_memory.h", "xfa/fgas/crt/fgas_stream.cpp", "xfa/fgas/crt/fgas_stream.h", "xfa/fgas/crt/fgas_utils.cpp", diff --git a/xfa/fde/cfde_path.h b/xfa/fde/cfde_path.h index b0359cd198..936a5c8a78 100644 --- a/xfa/fde/cfde_path.h +++ b/xfa/fde/cfde_path.h @@ -9,9 +9,8 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" -#include "xfa/fgas/crt/fgas_memory.h" -class CFDE_Path : public CFX_Target { +class CFDE_Path { public: bool StartFigure(); bool CloseFigure(); diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 9bb16f6076..1c2e0d1f3f 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -11,7 +11,6 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fgas/crt/fgas_memory.h" namespace { diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index 8c22c9a99e..f96396e319 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -22,15 +22,11 @@ void CFDE_CSSRuleCollection::Clear() { m_TagRules.clear(); m_ClassRules.clear(); m_pUniversalRules = nullptr; - m_pStaticStore = nullptr; m_iSelectors = 0; } CFDE_CSSRuleCollection::CFDE_CSSRuleCollection() - : m_pStaticStore(nullptr), - m_pUniversalRules(nullptr), - m_pPseudoRules(nullptr), - m_iSelectors(0) {} + : m_pUniversalRules(nullptr), m_pPseudoRules(nullptr), m_iSelectors(0) {} CFDE_CSSRuleCollection::~CFDE_CSSRuleCollection() { Clear(); @@ -140,6 +136,5 @@ bool CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData** pList, FDE_CSSRuleData* CFDE_CSSRuleCollection::NewRuleData( CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl) { - return FXTARGET_NewWith(m_pStaticStore) - FDE_CSSRuleData(pSel, pDecl, ++m_iSelectors); + return new FDE_CSSRuleData(pSel, pDecl, ++m_iSelectors); } diff --git a/xfa/fde/css/fde_csscache.h b/xfa/fde/css/fde_csscache.h index 10f4d9e0fa..40494fade5 100644 --- a/xfa/fde/css/fde_csscache.h +++ b/xfa/fde/css/fde_csscache.h @@ -10,22 +10,21 @@ #include #include "xfa/fde/css/fde_css.h" -#include "xfa/fgas/crt/fgas_memory.h" -class FDE_CSSCacheItem : public CFX_Target { +class FDE_CSSCacheItem { public: explicit FDE_CSSCacheItem(IFDE_CSSStyleSheet* p); - ~FDE_CSSCacheItem() override; + ~FDE_CSSCacheItem(); IFDE_CSSStyleSheet* pStylesheet; uint32_t dwActivity; }; -class FDE_CSSTagCache : public CFX_Target { +class FDE_CSSTagCache { public: FDE_CSSTagCache(FDE_CSSTagCache* parent, CXFA_CSSTagProvider* tag); FDE_CSSTagCache(const FDE_CSSTagCache& it); - ~FDE_CSSTagCache() override; + ~FDE_CSSTagCache(); FDE_CSSTagCache* GetParent() const { return pParent; } CXFA_CSSTagProvider* GetTag() const { return pTag; } @@ -50,10 +49,10 @@ class FDE_CSSTagCache : public CFX_Target { CFX_BaseArrayTemplate dwClassHashs; }; -class CFDE_CSSAccelerator : public CFX_Target { +class CFDE_CSSAccelerator { public: CFDE_CSSAccelerator(); - ~CFDE_CSSAccelerator() override; + ~CFDE_CSSAccelerator(); void OnEnterTag(CXFA_CSSTagProvider* pTag); void OnLeaveTag(CXFA_CSSTagProvider* pTag); diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 992fe80fd3..b0e86c8a7e 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -788,11 +788,10 @@ bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, return true; } -CFDE_CSSValueList::CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list) { +CFDE_CSSValueList::CFDE_CSSValueList(const CFDE_CSSValueArray& list) { m_iCount = list.GetSize(); int32_t iByteCount = m_iCount * sizeof(IFDE_CSSValue*); - m_ppList = (IFDE_CSSValue**)pStaticStore->Alloc(iByteCount); + m_ppList = (IFDE_CSSValue**)FX_Alloc(uint8_t, iByteCount); FXSYS_memcpy(m_ppList, list.GetData(), iByteCount); } diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index 305b58df51..2790188318 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -9,9 +9,8 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fde/css/fde_css.h" -#include "xfa/fgas/crt/fgas_memory.h" -class CFDE_CSSFunction : public CFX_Target { +class CFDE_CSSFunction { public: CFDE_CSSFunction(const FX_WCHAR* pszFuncName, IFDE_CSSValueList* pArgList) : m_pArgList(pArgList), m_pszFuncName(pszFuncName) { @@ -28,8 +27,7 @@ class CFDE_CSSFunction : public CFX_Target { const FX_WCHAR* m_pszFuncName; }; -class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, - public CFX_Target { +class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue { public: explicit CFDE_CSSPrimitiveValue(FX_ARGB color); explicit CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue); @@ -61,10 +59,9 @@ class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, typedef CFX_ArrayTemplate CFDE_CSSPrimitiveArray; typedef CFX_ArrayTemplate CFDE_CSSValueArray; -class CFDE_CSSValueList : public IFDE_CSSValueList, public CFX_Target { +class CFDE_CSSValueList : public IFDE_CSSValueList { public: - CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list); + explicit CFDE_CSSValueList(const CFDE_CSSValueArray& list); // IFDE_CSSValueList int32_t CountValues() const override; @@ -75,7 +72,7 @@ class CFDE_CSSValueList : public IFDE_CSSValueList, public CFX_Target { int32_t m_iCount; }; -class CFDE_CSSValueListParser : public CFX_Target { +class CFDE_CSSValueListParser { public: CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator) : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index f6af900042..a5385af0db 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -59,8 +59,7 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( if (it != pCache->end()) return it->second; } - FX_WCHAR* psz = - (FX_WCHAR*)pArgs->pStaticStore->Alloc((iValueLen + 1) * sizeof(FX_WCHAR)); + FX_WCHAR* psz = FX_Alloc(FX_WCHAR, iValueLen + 1); FXSYS_wcsncpy(psz, pszValue, iValueLen); psz[iValueLen] = '\0'; if (pCache) @@ -69,26 +68,22 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( return psz; } IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( - IFX_MemoryAllocator* pStaticStore, FDE_CSSPRIMITIVETYPE eUnit, FX_FLOAT fValue) const { static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); if (eUnit == FDE_CSSPRIMITIVETYPE_Number && FXSYS_fabs(fValue) < 0.001f) { return &s_ZeroValue; } - return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eUnit, fValue); + return new CFDE_CSSPrimitiveValue(eUnit, fValue); } inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( - IFX_MemoryAllocator* pStaticStore, FDE_CSSPROPERTYVALUE eValue) const { - return FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(eValue); + return new CFDE_CSSPrimitiveValue(eValue); } -void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, - FDE_CSSPROPERTY eProperty, +void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSPROPERTY eProperty, IFDE_CSSValue* pValue, bool bImportant) { - FDE_CSSPropertyHolder* pHolder = - FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder; + FDE_CSSPropertyHolder* pHolder = new FDE_CSSPropertyHolder; pHolder->bImportant = bImportant; pHolder->eProperty = eProperty; pHolder->pValue = pValue; @@ -150,8 +145,7 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, break; } if (pCSSValue) { - AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName, - pCSSValue, bImportant); + AddPropertyHolder(pArgs->pProperty->eName, pCSSValue, bImportant); return true; } if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) { @@ -160,7 +154,6 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } } break; case FDE_CSSVALUETYPE_Shorthand: { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; IFDE_CSSValue *pColor, *pStyle, *pWidth; switch (pArgs->pProperty->eName) { case FDE_CSSPROPERTY_Font: @@ -171,21 +164,21 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSPROPERTY_ListStyle: return ParseListStyleProperty(pArgs, pszValue, iValueLen, bImportant); case FDE_CSSPROPERTY_Border: - if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, - pStyle, pWidth)) { - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, + pWidth)) { + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderLeftColor, FDE_CSSPROPERTY_BorderLeftStyle, FDE_CSSPROPERTY_BorderLeftWidth); - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderTopWidth); - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderRightColor, FDE_CSSPROPERTY_BorderRightStyle, FDE_CSSPROPERTY_BorderRightWidth); - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderBottomColor, FDE_CSSPROPERTY_BorderBottomStyle, FDE_CSSPROPERTY_BorderBottomWidth); @@ -193,9 +186,9 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } break; case FDE_CSSPROPERTY_BorderLeft: - if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, - pStyle, pWidth)) { - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, + pWidth)) { + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderLeftColor, FDE_CSSPROPERTY_BorderLeftStyle, FDE_CSSPROPERTY_BorderLeftWidth); @@ -203,9 +196,9 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } break; case FDE_CSSPROPERTY_BorderTop: - if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, - pStyle, pWidth)) { - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, + pWidth)) { + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderTopWidth); @@ -213,9 +206,9 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } break; case FDE_CSSPROPERTY_BorderRight: - if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, - pStyle, pWidth)) { - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, + pWidth)) { + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderRightColor, FDE_CSSPROPERTY_BorderRightStyle, FDE_CSSPROPERTY_BorderRightWidth); @@ -223,9 +216,9 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } break; case FDE_CSSPROPERTY_BorderBottom: - if (ParseBorderPropoerty(pStaticStore, pszValue, iValueLen, pColor, - pStyle, pWidth)) { - AddBorderProperty(pStaticStore, pColor, pStyle, pWidth, bImportant, + if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, + pWidth)) { + AddBorderProperty(pColor, pStyle, pWidth, bImportant, FDE_CSSPROPERTY_BorderBottomColor, FDE_CSSPROPERTY_BorderBottomStyle, FDE_CSSPROPERTY_BorderBottomWidth); @@ -262,8 +255,7 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, int32_t iNameLen, const FX_WCHAR* pszValue, int32_t iValueLen) { - FDE_CSSCustomProperty* pProperty = - FXTARGET_NewWith(pArgs->pStaticStore) FDE_CSSCustomProperty; + FDE_CSSCustomProperty* pProperty = new FDE_CSSCustomProperty; pProperty->pwsName = CopyToLocal(pArgs, pszName, iNameLen); pProperty->pwsValue = CopyToLocal(pArgs, pszValue, iValueLen); pProperty->pNext = nullptr; @@ -283,14 +275,14 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber( if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) { return nullptr; } - return NewNumberValue(pArgs->pStaticStore, eUnit, fValue); + return NewNumberValue(eUnit, fValue); } IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { const FDE_CSSPROPERTYVALUETABLE* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - return pValue ? NewEnumValue(pArgs->pStaticStore, pValue->eName) : nullptr; + return pValue ? NewEnumValue(pValue->eName) : nullptr; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, @@ -299,7 +291,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, if (!FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { return nullptr; } - return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(dwColor); + return new CFDE_CSSPrimitiveValue(dwColor); } IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, @@ -314,8 +306,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); return pszValue - ? FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue) + ? new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue) : nullptr; } @@ -332,8 +323,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); return pszValue - ? FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue) + ? new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue) : nullptr; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( @@ -366,8 +356,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( const FDE_CSSPROPERTYVALUETABLE* pPropertyValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pPropertyValue) { - argumentArr.Add( - NewEnumValue(pArgs->pStaticStore, pPropertyValue->eName)); + argumentArr.Add(NewEnumValue(pPropertyValue->eName)); continue; } IFDE_CSSValue* pFunctionValue = @@ -376,45 +365,39 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( argumentArr.Add(pFunctionValue); continue; } - argumentArr.Add(FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, - CopyToLocal(pArgs, pszValue, iValueLen))); + argumentArr.Add(new CFDE_CSSPrimitiveValue( + FDE_CSSPRIMITIVETYPE_String, + CopyToLocal(pArgs, pszValue, iValueLen))); } break; case FDE_CSSPRIMITIVETYPE_Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, ePrimitiveType)) { - argumentArr.Add( - NewNumberValue(pArgs->pStaticStore, ePrimitiveType, fValue)); + argumentArr.Add(NewNumberValue(ePrimitiveType, fValue)); } } break; default: - argumentArr.Add(FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, - CopyToLocal(pArgs, pszValue, iValueLen))); + argumentArr.Add(new CFDE_CSSPrimitiveValue( + FDE_CSSPRIMITIVETYPE_String, + CopyToLocal(pArgs, pszValue, iValueLen))); break; } } - IFDE_CSSValueList* pArgumentList = FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSValueList(pArgs->pStaticStore, argumentArr); - CFDE_CSSFunction* pFunction = FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSFunction(pszFuncName, pArgumentList); - return FXTARGET_NewWith(pArgs->pStaticStore) - CFDE_CSSPrimitiveValue(pFunction); + IFDE_CSSValueList* pArgumentList = new CFDE_CSSValueList(argumentArr); + CFDE_CSSFunction* pFunction = + new CFDE_CSSFunction(pszFuncName, pArgumentList); + return new CFDE_CSSPrimitiveValue(pFunction); } bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); FDE_CSSPRIMITIVETYPE eType; CFDE_CSSValueArray list; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { case FDE_CSSPRIMITIVETYPE_URI: - list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( + list.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); break; case FDE_CSSPRIMITIVETYPE_Number: @@ -427,7 +410,7 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSPROPERTYVALUE_Normal: case FDE_CSSPROPERTYVALUE_None: { if (list.GetSize() == 0) { - list.Add(NewEnumValue(pStaticStore, pValue->eName)); + list.Add(NewEnumValue(pValue->eName)); } else { return false; } @@ -436,7 +419,7 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSPROPERTYVALUE_CloseQuote: case FDE_CSSPROPERTYVALUE_NoOpenQuote: case FDE_CSSPROPERTYVALUE_NoCloseQuote: - list.Add(NewEnumValue(pStaticStore, pValue->eName)); + list.Add(NewEnumValue(pValue->eName)); break; default: return false; @@ -448,7 +431,7 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, list.Add(pFunction); continue; } - list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( + list.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); } break; case FDE_CSSPRIMITIVETYPE_RGB: @@ -460,9 +443,7 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, if (list.GetSize() == 0) { return false; } - AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, - FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, list), + AddPropertyHolder(pArgs->pProperty->eName, new CFDE_CSSValueList(list), bImportant); return true; } @@ -470,7 +451,6 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray list; CFDE_CSSValueArray listFull; @@ -481,9 +461,8 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { if (list.GetSize() == 1) { - list.Add(NewNumberValue(pStaticStore, eType, fValue)); - listFull.Add(FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, list)); + list.Add(NewNumberValue(eType, fValue)); + listFull.Add(new CFDE_CSSValueList(list)); list.RemoveAll(); } else { return false; @@ -493,15 +472,14 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSPRIMITIVETYPE_String: { if (list.GetSize() == 0) { pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, pszValue)); + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + pszValue)); } else { - listFull.Add(FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, list)); + listFull.Add(new CFDE_CSSValueList(list)); list.RemoveAll(); pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, pszValue)); + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + pszValue)); } } break; default: @@ -509,15 +487,12 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, } } if (list.GetSize() == 1) { - listFull.Add(FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, list)); + listFull.Add(new CFDE_CSSValueList(list)); } if (listFull.GetSize() == 0) { return false; } - AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, - FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, listFull), + AddPropertyHolder(pArgs->pProperty->eName, new CFDE_CSSValueList(listFull), bImportant); return true; } @@ -526,7 +501,6 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; FX_WCHAR separator = (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); @@ -539,7 +513,7 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { - list.Add(NewNumberValue(pStaticStore, eType, fValue)); + list.Add(NewNumberValue(eType, fValue)); } } break; @@ -547,8 +521,7 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( if (dwType & FDE_CSSVALUETYPE_MaybeColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - list.Add(FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue(dwColor)); + list.Add(new CFDE_CSSPrimitiveValue(dwColor)); continue; } } @@ -557,22 +530,21 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( FDE_GetCSSPropertyValueByName( CFX_WideStringC(pszValue, iValueLen)); if (pValue) { - list.Add(NewEnumValue(pStaticStore, pValue->eName)); + list.Add(NewEnumValue(pValue->eName)); continue; } } if (dwType & FDE_CSSVALUETYPE_MaybeString) { pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, pszValue)); + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + pszValue)); } break; case FDE_CSSPRIMITIVETYPE_RGB: if (dwType & FDE_CSSVALUETYPE_MaybeColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - list.Add(FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue(dwColor)); + list.Add(new CFDE_CSSPrimitiveValue(dwColor)); } } break; @@ -586,41 +558,38 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( switch (pArgs->pProperty->eName) { case FDE_CSSPROPERTY_BorderColor: return Add4ValuesProperty( - pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftColor, + list, bImportant, FDE_CSSPROPERTY_BorderLeftColor, FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderRightColor, FDE_CSSPROPERTY_BorderBottomColor); case FDE_CSSPROPERTY_BorderStyle: return Add4ValuesProperty( - pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftStyle, + list, bImportant, FDE_CSSPROPERTY_BorderLeftStyle, FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderRightStyle, FDE_CSSPROPERTY_BorderBottomStyle); case FDE_CSSPROPERTY_BorderWidth: return Add4ValuesProperty( - pStaticStore, list, bImportant, FDE_CSSPROPERTY_BorderLeftWidth, + list, bImportant, FDE_CSSPROPERTY_BorderLeftWidth, FDE_CSSPROPERTY_BorderTopWidth, FDE_CSSPROPERTY_BorderRightWidth, FDE_CSSPROPERTY_BorderBottomWidth); case FDE_CSSPROPERTY_Margin: - return Add4ValuesProperty( - pStaticStore, list, bImportant, FDE_CSSPROPERTY_MarginLeft, - FDE_CSSPROPERTY_MarginTop, FDE_CSSPROPERTY_MarginRight, - FDE_CSSPROPERTY_MarginBottom); + return Add4ValuesProperty(list, bImportant, FDE_CSSPROPERTY_MarginLeft, + FDE_CSSPROPERTY_MarginTop, + FDE_CSSPROPERTY_MarginRight, + FDE_CSSPROPERTY_MarginBottom); case FDE_CSSPROPERTY_Padding: - return Add4ValuesProperty( - pStaticStore, list, bImportant, FDE_CSSPROPERTY_PaddingLeft, - FDE_CSSPROPERTY_PaddingTop, FDE_CSSPROPERTY_PaddingRight, - FDE_CSSPROPERTY_PaddingBottom); + return Add4ValuesProperty(list, bImportant, FDE_CSSPROPERTY_PaddingLeft, + FDE_CSSPROPERTY_PaddingTop, + FDE_CSSPROPERTY_PaddingRight, + FDE_CSSPROPERTY_PaddingBottom); default: { - CFDE_CSSValueList* pList = - FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list); - AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList, - bImportant); + CFDE_CSSValueList* pList = new CFDE_CSSValueList(list); + AddPropertyHolder(pArgs->pProperty->eName, pList, bImportant); return true; } break; } return false; } -bool CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list, +bool CFDE_CSSDeclaration::Add4ValuesProperty(const CFDE_CSSValueArray& list, bool bImportant, FDE_CSSPROPERTY eLeft, FDE_CSSPROPERTY eTop, @@ -628,28 +597,28 @@ bool CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, FDE_CSSPROPERTY eBottom) { switch (list.GetSize()) { case 1: - AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant); - AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); - AddPropertyHolder(pStaticStore, eRight, list[0], bImportant); - AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); + AddPropertyHolder(eLeft, list[0], bImportant); + AddPropertyHolder(eTop, list[0], bImportant); + AddPropertyHolder(eRight, list[0], bImportant); + AddPropertyHolder(eBottom, list[0], bImportant); return true; case 2: - AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); - AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); - AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); - AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); + AddPropertyHolder(eLeft, list[1], bImportant); + AddPropertyHolder(eTop, list[0], bImportant); + AddPropertyHolder(eRight, list[1], bImportant); + AddPropertyHolder(eBottom, list[0], bImportant); return true; case 3: - AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); - AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); - AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); - AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); + AddPropertyHolder(eLeft, list[1], bImportant); + AddPropertyHolder(eTop, list[0], bImportant); + AddPropertyHolder(eRight, list[1], bImportant); + AddPropertyHolder(eBottom, list[2], bImportant); return true; case 4: - AddPropertyHolder(pStaticStore, eLeft, list[3], bImportant); - AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); - AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); - AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); + AddPropertyHolder(eLeft, list[3], bImportant); + AddPropertyHolder(eTop, list[0], bImportant); + AddPropertyHolder(eRight, list[1], bImportant); + AddPropertyHolder(eBottom, list[2], bImportant); return true; default: break; @@ -657,7 +626,6 @@ bool CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, return false; } bool CFDE_CSSDeclaration::ParseBorderPropoerty( - IFX_MemoryAllocator* pStaticStore, const FX_WCHAR* pszValue, int32_t iValueLen, IFDE_CSSValue*& pColor, @@ -672,7 +640,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( if (!pWidth) { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { - pWidth = NewNumberValue(pStaticStore, eType, fValue); + pWidth = NewNumberValue(eType, fValue); } } break; @@ -680,8 +648,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( if (!pColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pColor = - FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); + pColor = new CFDE_CSSPrimitiveValue(dwColor); } } break; @@ -690,8 +657,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (pColorItem) { if (!pColor) { - pColor = FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue(pColorItem->dwValue); + pColor = new CFDE_CSSPrimitiveValue(pColorItem->dwValue); } continue; } @@ -703,15 +669,14 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_Transparent: if (!pColor) { - pColor = FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue((FX_ARGB)0); + pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } break; case FDE_CSSPROPERTYVALUE_Thin: case FDE_CSSPROPERTYVALUE_Thick: case FDE_CSSPROPERTYVALUE_Medium: if (!pWidth) - pWidth = NewEnumValue(pStaticStore, pValue->eName); + pWidth = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_None: case FDE_CSSPROPERTYVALUE_Hidden: @@ -724,7 +689,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( case FDE_CSSPROPERTYVALUE_Inset: case FDE_CSSPROPERTYVALUE_Outset: if (!pStyle) - pStyle = NewEnumValue(pStaticStore, pValue->eName); + pStyle = NewEnumValue(pValue->eName); break; default: break; @@ -735,31 +700,29 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } } if (!pColor) - pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); + pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); if (!pStyle) - pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); + pStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_None); if (!pWidth) - pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pWidth = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); return true; } -void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, - IFDE_CSSValue* pColor, +void CFDE_CSSDeclaration::AddBorderProperty(IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, bool bImportant, FDE_CSSPROPERTY eColor, FDE_CSSPROPERTY eStyle, FDE_CSSPROPERTY eWidth) { - AddPropertyHolder(pStaticStore, eStyle, pStyle, bImportant); - AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant); - AddPropertyHolder(pStaticStore, eColor, pColor, bImportant); + AddPropertyHolder(eStyle, pStyle, bImportant); + AddPropertyHolder(eWidth, pWidth, bImportant); + AddPropertyHolder(eColor, pColor, bImportant); } bool CFDE_CSSDeclaration::ParseListStyleProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pType = nullptr; IFDE_CSSPrimitiveValue* pImage = nullptr; @@ -769,7 +732,7 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( switch (eType) { case FDE_CSSPRIMITIVETYPE_URI: if (!pImage) { - pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( + pImage = new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen)); } break; @@ -782,14 +745,14 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_None: if (!pImage) - pImage = NewEnumValue(pStaticStore, pValue->eName); + pImage = NewEnumValue(pValue->eName); else if (!pType) - pImage = NewEnumValue(pStaticStore, pValue->eName); + pImage = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Inside: case FDE_CSSPROPERTYVALUE_Outside: if (!pPosition) - pPosition = NewEnumValue(pStaticStore, pValue->eName); + pPosition = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Disc: case FDE_CSSPROPERTYVALUE_Circle: @@ -806,7 +769,7 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( case FDE_CSSPROPERTYVALUE_LowerAlpha: case FDE_CSSPROPERTYVALUE_UpperAlpha: if (!pType) - pType = NewEnumValue(pStaticStore, pValue->eName); + pType = NewEnumValue(pValue->eName); break; default: break; @@ -817,17 +780,14 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( } } if (!pPosition) - pPosition = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Outside); + pPosition = NewEnumValue(FDE_CSSPROPERTYVALUE_Outside); if (!pImage) - pImage = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); + pImage = NewEnumValue(FDE_CSSPROPERTYVALUE_None); if (!pType) - pType = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStylePosition, pPosition, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleImage, pImage, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType, - bImportant); + pType = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + AddPropertyHolder(FDE_CSSPROPERTY_ListStylePosition, pPosition, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ListStyleImage, pImage, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ListStyleType, pType, bImportant); return true; } bool CFDE_CSSDeclaration::ParseBackgroundProperty( @@ -835,7 +795,6 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColor = nullptr; IFDE_CSSPrimitiveValue* pImage = nullptr; @@ -848,7 +807,7 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( switch (eType) { case FDE_CSSPRIMITIVETYPE_URI: if (!pImage) { - pImage = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( + pImage = new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen)); } break; @@ -858,9 +817,9 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( break; } if (!pPosX) - pPosX = NewNumberValue(pStaticStore, eType, fValue); + pPosX = NewNumberValue(eType, fValue); else if (!pPosY) - pPosY = NewNumberValue(pStaticStore, eType, fValue); + pPosY = NewNumberValue(eType, fValue); } break; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = @@ -869,41 +828,40 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( switch (pValue->eName) { case FDE_CSSPROPERTYVALUE_None: if (!pImage) - pImage = NewEnumValue(pStaticStore, pValue->eName); + pImage = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Transparent: if (!pColor) { - pColor = FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue((FX_ARGB)0); + pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } break; case FDE_CSSPROPERTYVALUE_Fixed: case FDE_CSSPROPERTYVALUE_Scroll: if (!pAttachment) - pAttachment = NewEnumValue(pStaticStore, pValue->eName); + pAttachment = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Repeat: case FDE_CSSPROPERTYVALUE_RepeatX: case FDE_CSSPROPERTYVALUE_RepeatY: case FDE_CSSPROPERTYVALUE_NoRepeat: if (!pRepeat) - pRepeat = NewEnumValue(pStaticStore, pValue->eName); + pRepeat = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Left: case FDE_CSSPROPERTYVALUE_Right: if (!pPosX) - pPosX = NewEnumValue(pStaticStore, pValue->eName); + pPosX = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Top: case FDE_CSSPROPERTYVALUE_Bottom: if (!pPosY) - pPosX = NewEnumValue(pStaticStore, pValue->eName); + pPosX = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Center: if (!pPosX) - pPosX = NewEnumValue(pStaticStore, pValue->eName); + pPosX = NewEnumValue(pValue->eName); else if (!pPosY) - pPosX = NewEnumValue(pStaticStore, pValue->eName); + pPosX = NewEnumValue(pValue->eName); break; default: break; @@ -914,8 +872,7 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (pColorItem) { if (!pColor) { - pColor = FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue(pColorItem->dwValue); + pColor = new CFDE_CSSPrimitiveValue(pColorItem->dwValue); } } } break; @@ -923,8 +880,7 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( if (!pColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pColor = - FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); + pColor = new CFDE_CSSPrimitiveValue(dwColor); } } break; @@ -933,45 +889,39 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( } } if (!pColor) { - pColor = FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); + pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } if (!pImage) - pImage = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); + pImage = NewEnumValue(FDE_CSSPROPERTYVALUE_None); if (!pRepeat) - pRepeat = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Repeat); + pRepeat = NewEnumValue(FDE_CSSPROPERTYVALUE_Repeat); if (!pAttachment) - pAttachment = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Scroll); + pAttachment = NewEnumValue(FDE_CSSPROPERTYVALUE_Scroll); if (!pPosX) { - pPosX = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); - pPosY = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosX = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosY = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); } else if (!pPosY) { - pPosY = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosY = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); } CFDE_CSSValueArray position; position.Add(pPosX); position.Add(pPosY); - CFDE_CSSValueList* pPosList = - FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, position); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundColor, pColor, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundImage, pImage, + CFDE_CSSValueList* pPosList = new CFDE_CSSValueList(position); + AddPropertyHolder(FDE_CSSPROPERTY_BackgroundColor, pColor, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_BackgroundImage, pImage, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_BackgroundRepeat, pRepeat, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_BackgroundPosition, pPosList, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_BackgroundAttachment, pAttachment, bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundRepeat, pRepeat, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundPosition, pPosList, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment, - pAttachment, bImportant); return true; } bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); IFDE_CSSPrimitiveValue* pStyle = nullptr; IFDE_CSSPrimitiveValue* pVariant = nullptr; @@ -997,41 +947,41 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSPROPERTYVALUE_Smaller: case FDE_CSSPROPERTYVALUE_Larger: if (!pFontSize) - pFontSize = NewEnumValue(pStaticStore, pValue->eName); + pFontSize = NewEnumValue(pValue->eName); continue; case FDE_CSSPROPERTYVALUE_Bold: case FDE_CSSPROPERTYVALUE_Bolder: case FDE_CSSPROPERTYVALUE_Lighter: if (!pWeight) - pWeight = NewEnumValue(pStaticStore, pValue->eName); + pWeight = NewEnumValue(pValue->eName); continue; case FDE_CSSPROPERTYVALUE_Italic: case FDE_CSSPROPERTYVALUE_Oblique: if (!pStyle) - pStyle = NewEnumValue(pStaticStore, pValue->eName); + pStyle = NewEnumValue(pValue->eName); continue; case FDE_CSSPROPERTYVALUE_SmallCaps: if (!pVariant) - pVariant = NewEnumValue(pStaticStore, pValue->eName); + pVariant = NewEnumValue(pValue->eName); continue; case FDE_CSSPROPERTYVALUE_Normal: if (!pStyle) - pStyle = NewEnumValue(pStaticStore, pValue->eName); + pStyle = NewEnumValue(pValue->eName); else if (!pVariant) - pVariant = NewEnumValue(pStaticStore, pValue->eName); + pVariant = NewEnumValue(pValue->eName); else if (!pWeight) - pWeight = NewEnumValue(pStaticStore, pValue->eName); + pWeight = NewEnumValue(pValue->eName); else if (!pFontSize) - pFontSize = NewEnumValue(pStaticStore, pValue->eName); + pFontSize = NewEnumValue(pValue->eName); else if (!pLineHeight) - pLineHeight = NewEnumValue(pStaticStore, pValue->eName); + pLineHeight = NewEnumValue(pValue->eName); continue; default: break; } } if (pFontSize) { - familyList.Add(FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue( + familyList.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); } parser.m_Separator = ','; @@ -1053,47 +1003,39 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, case 800: case 900: if (!pWeight) { - pWeight = NewNumberValue(pStaticStore, - FDE_CSSPRIMITIVETYPE_Number, fValue); + pWeight = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, fValue); } continue; } } if (!pFontSize) - pFontSize = NewNumberValue(pStaticStore, eType, fValue); + pFontSize = NewNumberValue(eType, fValue); else if (!pLineHeight) - pLineHeight = NewNumberValue(pStaticStore, eType, fValue); + pLineHeight = NewNumberValue(eType, fValue); } break; default: break; } } if (!pStyle) - pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal); + pStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); if (!pVariant) - pVariant = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal); + pVariant = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); if (!pWeight) - pWeight = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal); + pWeight = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); if (!pFontSize) - pFontSize = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Medium); + pFontSize = NewEnumValue(FDE_CSSPROPERTYVALUE_Medium); if (!pLineHeight) - pLineHeight = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Normal); + pLineHeight = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontStyle, pStyle, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontVariant, pVariant, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontWeight, pWeight, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontSize, pFontSize, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_LineHeight, pLineHeight, - bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_FontStyle, pStyle, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_FontVariant, pVariant, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_FontWeight, pWeight, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_FontSize, pFontSize, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_LineHeight, pLineHeight, bImportant); if (familyList.GetSize() > 0) { - CFDE_CSSValueList* pList = FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, familyList); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList, - bImportant); + CFDE_CSSValueList* pList = new CFDE_CSSValueList(familyList); + AddPropertyHolder(FDE_CSSPROPERTY_FontFamily, pList, bImportant); } return true; } @@ -1102,7 +1044,6 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr; @@ -1126,17 +1067,17 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( case FDE_CSSPROPERTYVALUE_Inset: case FDE_CSSPROPERTYVALUE_Outset: if (!pColumnRuleStyle) - pColumnRuleStyle = NewEnumValue(pStaticStore, pValue->eName); + pColumnRuleStyle = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Transparent: if (!pColumnRuleColor) - pColumnRuleColor = NewEnumValue(pStaticStore, pValue->eName); + pColumnRuleColor = NewEnumValue(pValue->eName); break; case FDE_CSSPROPERTYVALUE_Thin: case FDE_CSSPROPERTYVALUE_Medium: case FDE_CSSPROPERTYVALUE_Thick: if (!pColumnRuleWidth) - pColumnRuleWidth = NewEnumValue(pStaticStore, pValue->eName); + pColumnRuleWidth = NewEnumValue(pValue->eName); break; default: break; @@ -1146,8 +1087,7 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor) && !pColumnRuleColor) { - pColumnRuleColor = FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); + pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); continue; } } break; @@ -1155,15 +1095,14 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType) && !pColumnRuleWidth) { - pColumnRuleWidth = NewNumberValue(pStaticStore, eType, fValue); + pColumnRuleWidth = NewNumberValue(eType, fValue); } } break; case FDE_CSSPRIMITIVETYPE_RGB: { FX_ARGB dwColor; if (!pColumnRuleColor && FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pColumnRuleColor = FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); + pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); } } break; default: @@ -1174,26 +1113,24 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( return false; if (!pColumnRuleStyle) - pColumnRuleStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); + pColumnRuleStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_None); if (!pColumnRuleWidth) - pColumnRuleWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Medium); + pColumnRuleWidth = NewEnumValue(FDE_CSSPROPERTYVALUE_Medium); if (!pColumnRuleColor) { - pColumnRuleColor = - FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue((FX_ARGB)0); + pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleStyle, - pColumnRuleStyle, bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleWidth, - pColumnRuleWidth, bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor, - pColumnRuleColor, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleStyle, pColumnRuleStyle, + bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleWidth, pColumnRuleWidth, + bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleColor, pColumnRuleColor, + bImportant); return true; } bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray arrEmphasisStyle; FDE_CSSPRIMITIVETYPE eType; @@ -1204,25 +1141,22 @@ bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, const FDE_CSSPROPERTYVALUETABLE* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { - arrEmphasisStyle.Add(NewEnumValue(pStaticStore, pValue->eName)); + arrEmphasisStyle.Add(NewEnumValue(pValue->eName)); continue; } FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pEmphasisColor = - FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); + pEmphasisColor = new CFDE_CSSPrimitiveValue(dwColor); continue; } pszValue = CopyToLocal(pArgs, pszValue, iValueLen); arrEmphasisStyle.Add( - FXTARGET_NewWith(pStaticStore) - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue)); + new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue)); } break; case FDE_CSSPRIMITIVETYPE_RGB: { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pEmphasisColor = - FXTARGET_NewWith(pStaticStore) CFDE_CSSPrimitiveValue(dwColor); + pEmphasisColor = new CFDE_CSSPrimitiveValue(dwColor); } } break; default: @@ -1230,14 +1164,12 @@ bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, } } if (arrEmphasisStyle.GetSize() != 0) { - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisStyle, - FXTARGET_NewWith(pStaticStore) - CFDE_CSSValueList(pStaticStore, arrEmphasisStyle), - bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_TextEmphasisStyle, + new CFDE_CSSValueList(arrEmphasisStyle), bImportant); } if (pEmphasisColor) { - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor, - pEmphasisColor, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_TextEmphasisColor, pEmphasisColor, + bImportant); } return true; } @@ -1245,7 +1177,6 @@ bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnWidth = nullptr; IFDE_CSSPrimitiveValue* pColumnCount = nullptr; @@ -1256,7 +1187,7 @@ bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, const FDE_CSSPROPERTYVALUETABLE* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (!pValue && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { - pColumnWidth = NewEnumValue(pStaticStore, pValue->eName); + pColumnWidth = NewEnumValue(pValue->eName); } } break; case FDE_CSSPRIMITIVETYPE_Number: { @@ -1265,11 +1196,11 @@ bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, switch (eType) { case FDE_CSSPRIMITIVETYPE_Number: if (!pColumnCount) - pColumnCount = NewNumberValue(pStaticStore, eType, fValue); + pColumnCount = NewNumberValue(eType, fValue); break; default: if (!pColumnWidth) - pColumnWidth = NewNumberValue(pStaticStore, eType, fValue); + pColumnWidth = NewNumberValue(eType, fValue); break; } } @@ -1282,14 +1213,12 @@ bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, return false; if (!pColumnWidth) - pColumnWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto); + pColumnWidth = NewEnumValue(FDE_CSSPROPERTYVALUE_Auto); else if (!pColumnCount) - pColumnCount = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto); + pColumnCount = NewEnumValue(FDE_CSSPROPERTYVALUE_Auto); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnWidth, pColumnWidth, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount, - bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ColumnWidth, pColumnWidth, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_ColumnCount, pColumnCount, bImportant); return true; } bool CFDE_CSSDeclaration::ParseOverflowProperty( @@ -1297,7 +1226,6 @@ bool CFDE_CSSDeclaration::ParseOverflowProperty( const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { - IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pOverflowX = nullptr; IFDE_CSSPrimitiveValue* pOverflowY = nullptr; @@ -1317,9 +1245,9 @@ bool CFDE_CSSDeclaration::ParseOverflowProperty( if (pOverflowX && pOverflowY) return false; if (!pOverflowX) { - pOverflowX = NewEnumValue(pStaticStore, pValue->eName); + pOverflowX = NewEnumValue(pValue->eName); } else if (!pOverflowY) { - pOverflowY = NewEnumValue(pStaticStore, pValue->eName); + pOverflowY = NewEnumValue(pValue->eName); } break; default: @@ -1332,11 +1260,9 @@ bool CFDE_CSSDeclaration::ParseOverflowProperty( return false; if (!pOverflowY) - pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); + pOverflowY = NewEnumValue(pOverflowX->GetEnum()); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowX, pOverflowX, - bImportant); - AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, - bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_OverflowX, pOverflowX, bImportant); + AddPropertyHolder(FDE_CSSPROPERTY_OverflowY, pOverflowY, bImportant); return true; } diff --git a/xfa/fde/css/fde_cssdeclaration.h b/xfa/fde/css/fde_cssdeclaration.h index f03b0c616a..38b1626566 100644 --- a/xfa/fde/css/fde_cssdeclaration.h +++ b/xfa/fde/css/fde_cssdeclaration.h @@ -11,7 +11,7 @@ #include "xfa/fde/css/fde_cssdatatable.h" -class FDE_CSSPropertyHolder : public CFX_Target { +class FDE_CSSPropertyHolder { public: int16_t eProperty; bool bImportant; @@ -19,7 +19,7 @@ class FDE_CSSPropertyHolder : public CFX_Target { FDE_CSSPropertyHolder* pNext; }; -class FDE_CSSCustomProperty : public CFX_Target { +class FDE_CSSCustomProperty { public: const FX_WCHAR* pwsName; const FX_WCHAR* pwsValue; @@ -27,12 +27,11 @@ class FDE_CSSCustomProperty : public CFX_Target { }; struct FDE_CSSPROPERTYARGS { - IFX_MemoryAllocator* pStaticStore; std::unordered_map* pStringCache; const FDE_CSSPROPERTYTABLE* pProperty; }; -class CFDE_CSSDeclaration : public CFX_Target { +class CFDE_CSSDeclaration { public: CFDE_CSSDeclaration() : m_pFirstProperty(nullptr), @@ -88,14 +87,12 @@ class CFDE_CSSDeclaration : public CFX_Target { const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseBorderPropoerty(IFX_MemoryAllocator* pStaticStore, - const FX_WCHAR* pszValue, + bool ParseBorderPropoerty(const FX_WCHAR* pszValue, int32_t iValueLen, IFDE_CSSValue*& pColor, IFDE_CSSValue*& pStyle, IFDE_CSSValue*& pWidth) const; - void AddBorderProperty(IFX_MemoryAllocator* pStaticStore, - IFDE_CSSValue* pColor, + void AddBorderProperty(IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, bool bImportant, @@ -114,8 +111,7 @@ class CFDE_CSSDeclaration : public CFX_Target { const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list, + bool Add4ValuesProperty(const CFDE_CSSValueArray& list, bool bImportant, FDE_CSSPROPERTY eLeft, FDE_CSSPROPERTY eTop, @@ -142,15 +138,12 @@ class CFDE_CSSDeclaration : public CFX_Target { const FX_WCHAR* CopyToLocal(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - void AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, - FDE_CSSPROPERTY eProperty, + void AddPropertyHolder(FDE_CSSPROPERTY eProperty, IFDE_CSSValue* pValue, bool bImportant); - IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MemoryAllocator* pStaticStore, - FDE_CSSPRIMITIVETYPE eUnit, + IFDE_CSSPrimitiveValue* NewNumberValue(FDE_CSSPRIMITIVETYPE eUnit, FX_FLOAT fValue) const; - IFDE_CSSPrimitiveValue* NewEnumValue(IFX_MemoryAllocator* pStaticStore, - FDE_CSSPROPERTYVALUE eValue) const; + IFDE_CSSPrimitiveValue* NewEnumValue(FDE_CSSPROPERTYVALUE eValue) const; FDE_CSSPropertyHolder* m_pFirstProperty; FDE_CSSPropertyHolder* m_pLastProperty; diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index ae928dbd12..d10cbf1d49 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -134,12 +134,7 @@ CFDE_CSSAccelerator* CFDE_CSSStyleSelector::InitAccelerator() { IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( IFDE_CSSComputedStyle* pParentStyle) { - if (!m_pFixedStyleStore) { - m_pFixedStyleStore = IFX_MemoryAllocator::Create( - FX_ALLOCTYPE_Fixed, 16, sizeof(CFDE_CSSComputedStyle)); - } - CFDE_CSSComputedStyle* pStyle = FXTARGET_NewWith(m_pFixedStyleStore.get()) - CFDE_CSSComputedStyle(m_pFixedStyleStore.get()); + CFDE_CSSComputedStyle* pStyle = new CFDE_CSSComputedStyle(); if (pParentStyle) { pStyle->m_InheritedData = static_cast(pParentStyle)->m_InheritedData; @@ -180,10 +175,9 @@ void CFDE_CSSStyleSelector::SetStylePriority( void CFDE_CSSStyleSelector::UpdateStyleIndex(uint32_t dwMediaList) { Reset(); - m_pRuleDataStore = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 1024, 0); + for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { CFDE_CSSRuleCollection& rules = m_RuleCollection[iGroup]; - rules.m_pStaticStore = m_pRuleDataStore.get(); rules.AddRulesFrom(m_SheetGroups[iGroup], dwMediaList, m_pFontMgr); } } @@ -192,7 +186,6 @@ void CFDE_CSSStyleSelector::Reset() { for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { m_RuleCollection[iGroup].Clear(); } - m_pRuleDataStore.reset(); } int32_t CFDE_CSSStyleSelector::MatchDeclarations( @@ -310,10 +303,6 @@ void CFDE_CSSStyleSelector::ComputeStyle( static const uint32_t s_dwAlignHash = FX_HashCode_GetW(L"align", true); if (!pTag->empty()) { - if (!m_pInlineStyleStore) { - m_pInlineStyleStore = - IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 2048, 0); - } CFDE_CSSDeclaration* pDecl = nullptr; for (auto it : *pTag) { CFX_WideString wsAttri = it.first; @@ -321,18 +310,15 @@ void CFDE_CSSStyleSelector::ComputeStyle( uint32_t dwAttriHash = FX_HashCode_GetW(wsAttri.AsStringC(), true); if (dwAttriHash == s_dwStyleHash) { if (!pDecl) - pDecl = - FXTARGET_NewWith(m_pInlineStyleStore.get()) CFDE_CSSDeclaration; + pDecl = new CFDE_CSSDeclaration; AppendInlineStyle(pDecl, wsValue.c_str(), wsValue.GetLength()); } else if (dwAttriHash == s_dwAlignHash) { if (!pDecl) - pDecl = - FXTARGET_NewWith(m_pInlineStyleStore.get()) CFDE_CSSDeclaration; + pDecl = new CFDE_CSSDeclaration; FDE_CSSPROPERTYARGS args; args.pStringCache = nullptr; - args.pStaticStore = m_pInlineStyleStore.get(); args.pProperty = FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY_TextAlign); pDecl->AddProperty(&args, wsValue.c_str(), wsValue.GetLength()); } @@ -442,7 +428,6 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz2; FDE_CSSPROPERTYARGS args; args.pStringCache = nullptr; - args.pStaticStore = m_pInlineStyleStore.get(); args.pProperty = nullptr; CFX_WideString wsName; while (1) { @@ -1709,8 +1694,7 @@ FDE_CSSFONTVARIANT CFDE_CSSStyleSelector::ToFontVariant( : FDE_CSSFONTVARIANT_Normal; } -CFDE_CSSComputedStyle::CFDE_CSSComputedStyle(IFX_MemoryAllocator* pAlloc) - : m_dwRefCount(1), m_pAllocator(pAlloc) {} +CFDE_CSSComputedStyle::CFDE_CSSComputedStyle() : m_dwRefCount(1) {} CFDE_CSSComputedStyle::~CFDE_CSSComputedStyle() {} @@ -1722,7 +1706,7 @@ uint32_t CFDE_CSSComputedStyle::Release() { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount == 0) { delete m_NonInheritedData.m_pCounterStyle; - FXTARGET_DeleteWith(CFDE_CSSComputedStyle, m_pAllocator, this); + delete this; } return dwRefCount; } diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index f4ad422c96..13ed58910b 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -15,13 +15,12 @@ #include "xfa/fde/css/fde_css.h" #include "xfa/fde/css/fde_csscache.h" #include "xfa/fde/css/fde_cssdeclaration.h" -#include "xfa/fgas/crt/fgas_memory.h" class CFDE_CSSAccelerator; class CFDE_CSSComputedStyle; class CXFA_CSSTagProvider; -class FDE_CSSRuleData : public CFX_Target { +class FDE_CSSRuleData { public: FDE_CSSRuleData(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl, @@ -33,10 +32,10 @@ class FDE_CSSRuleData : public CFX_Target { FDE_CSSRuleData* pNext; }; -class CFDE_CSSRuleCollection : public CFX_Target { +class CFDE_CSSRuleCollection { public: CFDE_CSSRuleCollection(); - ~CFDE_CSSRuleCollection() override; + ~CFDE_CSSRuleCollection(); void AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, uint32_t dwMediaList, @@ -62,8 +61,6 @@ class CFDE_CSSRuleCollection : public CFX_Target { FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; } FDE_CSSRuleData* GetPseudoRuleData() { return m_pPseudoRules; } - IFX_MemoryAllocator* m_pStaticStore; - protected: void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, IFDE_CSSRule* pRule, @@ -85,10 +82,10 @@ class CFDE_CSSRuleCollection : public CFX_Target { int32_t m_iSelectors; }; -class CFDE_CSSStyleSelector : public CFX_Target { +class CFDE_CSSStyleSelector { public: explicit CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr); - ~CFDE_CSSStyleSelector() override; + ~CFDE_CSSStyleSelector(); void SetDefFontSize(FX_FLOAT fFontSize); @@ -173,12 +170,9 @@ class CFDE_CSSStyleSelector : public CFX_Target { CFGAS_FontMgr* const m_pFontMgr; FX_FLOAT m_fDefFontSize; - std::unique_ptr m_pRuleDataStore; CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; - std::unique_ptr m_pInlineStyleStore; - std::unique_ptr m_pFixedStyleStore; std::unique_ptr m_pAccelerator; std::vector m_MatchedRules; }; @@ -349,10 +343,9 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, public IFDE_CSSBoundaryStyle, public IFDE_CSSFontStyle, public IFDE_CSSPositionStyle, - public IFDE_CSSParagraphStyle, - public CFX_Target { + public IFDE_CSSParagraphStyle { public: - explicit CFDE_CSSComputedStyle(IFX_MemoryAllocator* pAlloc); + CFDE_CSSComputedStyle(); ~CFDE_CSSComputedStyle() override; // IFX_Retainable @@ -410,7 +403,6 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, const CFX_WideString& wsValue); uint32_t m_dwRefCount; - IFX_MemoryAllocator* const m_pAllocator; CFDE_CSSInheritedData m_InheritedData; CFDE_CSSNonInheritedData m_NonInheritedData; std::vector m_CustomProperties; diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index a373994798..1779ad95f8 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -108,7 +108,6 @@ void CFDE_CSSStyleSheet::Reset() { m_RuleArray.RemoveAll(false); m_Selectors.RemoveAll(); m_StringCache.clear(); - m_pAllocator.reset(); } uint32_t CFDE_CSSStyleSheet::Retain() { @@ -172,7 +171,6 @@ bool CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, bool CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { Reset(); - m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 1024, 0); FDE_CSSSYNTAXSTATUS eStatus; do { switch (eStatus = pSyntax->DoSyntaxParse()) { @@ -227,8 +225,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( break; case FDE_CSSSYNTAXSTATUS_DeclOpen: if ((dwMediaList & m_dwMediaList) > 0 && !pMediaRule) { - pMediaRule = FXTARGET_NewWith(m_pAllocator.get()) - CFDE_CSSMediaRule(dwMediaList); + pMediaRule = new CFDE_CSSMediaRule(dwMediaList); m_RuleArray.Add(pMediaRule); } break; @@ -247,7 +244,6 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( const FX_WCHAR* pszValue = nullptr; int32_t iValueLen = 0; FDE_CSSPROPERTYARGS propertyArgs; - propertyArgs.pStaticStore = m_pAllocator.get(); propertyArgs.pStringCache = &m_StringCache; propertyArgs.pProperty = nullptr; CFX_WideString wsName; @@ -255,8 +251,8 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( switch (pSyntax->DoSyntaxParse()) { case FDE_CSSSYNTAXSTATUS_Selector: { pszValue = pSyntax->GetCurrentString(iValueLen); - CFDE_CSSSelector* pSelector = CFDE_CSSSelector::FromString( - m_pAllocator.get(), pszValue, iValueLen); + CFDE_CSSSelector* pSelector = + CFDE_CSSSelector::FromString(pszValue, iValueLen); if (pSelector) m_Selectors.Add(pSelector); } break; @@ -285,8 +281,8 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( break; case FDE_CSSSYNTAXSTATUS_DeclOpen: if (!pStyleRule && m_Selectors.GetSize() > 0) { - pStyleRule = FXTARGET_NewWith(m_pAllocator.get()) CFDE_CSSStyleRule; - pStyleRule->SetSelector(m_pAllocator.get(), m_Selectors); + pStyleRule = new CFDE_CSSStyleRule; + pStyleRule->SetSelector(m_Selectors); ruleArray.Add(pStyleRule); } else { SkipRuleSet(pSyntax); @@ -311,7 +307,6 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule( const FX_WCHAR* pszValue = nullptr; int32_t iValueLen = 0; FDE_CSSPROPERTYARGS propertyArgs; - propertyArgs.pStaticStore = m_pAllocator.get(); propertyArgs.pStringCache = &m_StringCache; propertyArgs.pProperty = nullptr; for (;;) { @@ -332,8 +327,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule( break; case FDE_CSSSYNTAXSTATUS_DeclOpen: if (!pFontFaceRule) { - pFontFaceRule = - FXTARGET_NewWith(m_pAllocator.get()) CFDE_CSSFontFaceRule; + pFontFaceRule = new CFDE_CSSFontFaceRule; ruleArray.Add(pFontFaceRule); } break; @@ -394,12 +388,11 @@ CFDE_CSSDeclaration* CFDE_CSSStyleRule::GetDeclaration() { } void CFDE_CSSStyleRule::SetSelector( - IFX_MemoryAllocator* pStaticStore, const CFX_ArrayTemplate& list) { ASSERT(!m_ppSelector); m_iSelectors = list.GetSize(); m_ppSelector = static_cast( - pStaticStore->Alloc(m_iSelectors * sizeof(CFDE_CSSSelector*))); + FX_Alloc(CFDE_CSSSelector*, m_iSelectors)); for (int32_t i = 0; i < m_iSelectors; ++i) { m_ppSelector[i] = list.GetAt(i); } @@ -487,10 +480,9 @@ CFDE_CSSSelector* CFDE_CSSSelector::GetNextSelector() const { } CFDE_CSSSelector* CFDE_CSSSelector::FromString( - IFX_MemoryAllocator* pStaticStore, const FX_WCHAR* psz, int32_t iLen) { - ASSERT(pStaticStore && psz && iLen > 0); + ASSERT(psz && iLen > 0); const FX_WCHAR* pStart = psz; const FX_WCHAR* pEnd = psz + iLen; @@ -510,8 +502,8 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( FX_WCHAR wch = *psz; if (wch == '.' || wch == '#') { if (psz == pStart || psz[-1] == ' ') { - CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore) - CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, L"*", 1, true); + CFDE_CSSSelector* p = + new CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, L"*", 1, true); if (!p) return nullptr; @@ -528,8 +520,7 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( } FDE_CSSSELECTORTYPE eType = wch == '.' ? FDE_CSSSELECTORTYPE_Class : FDE_CSSSELECTORTYPE_ID; - CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore) - CFDE_CSSSelector(eType, psz, iNameLen, false); + CFDE_CSSSelector* p = new CFDE_CSSSelector(eType, psz, iNameLen, false); if (!p) return nullptr; @@ -542,8 +533,8 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( if (iNameLen == 0) { return nullptr; } - CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore) - CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, psz, iNameLen, true); + CFDE_CSSSelector* p = new CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, + psz, iNameLen, true); if (!p) return nullptr; @@ -559,8 +550,8 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( if (iNameLen == 0) { return nullptr; } - CFDE_CSSSelector* p = FXTARGET_NewWith(pStaticStore) - CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Pseudo, psz, iNameLen, true); + CFDE_CSSSelector* p = + new CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Pseudo, psz, iNameLen, true); if (!p) return nullptr; diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index ad1f8dfbe3..a67c2d816f 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -15,7 +15,7 @@ class CFDE_CSSSyntaxParser; -class CFDE_CSSSelector : public CFX_Target { +class CFDE_CSSSelector { public: CFDE_CSSSelector(FDE_CSSSELECTORTYPE eType, const FX_WCHAR* psz, @@ -26,9 +26,7 @@ class CFDE_CSSSelector : public CFX_Target { virtual uint32_t GetNameHash() const; virtual CFDE_CSSSelector* GetNextSelector() const; - static CFDE_CSSSelector* FromString(IFX_MemoryAllocator* pStaticStore, - const FX_WCHAR* psz, - int32_t iLen); + static CFDE_CSSSelector* FromString(const FX_WCHAR* psz, int32_t iLen); void SetNext(CFDE_CSSSelector* pNext) { m_pNext = pNext; } @@ -40,7 +38,7 @@ class CFDE_CSSSelector : public CFX_Target { CFDE_CSSSelector* m_pNext; }; -class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { +class CFDE_CSSStyleRule : public IFDE_CSSStyleRule { public: CFDE_CSSStyleRule(); @@ -50,8 +48,7 @@ class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { CFDE_CSSDeclaration* GetDeclaration() override; CFDE_CSSDeclaration& GetDeclImp() { return m_Declaration; } - void SetSelector(IFX_MemoryAllocator* pStaticStore, - const CFX_ArrayTemplate& list); + void SetSelector(const CFX_ArrayTemplate& list); protected: CFDE_CSSDeclaration m_Declaration; @@ -59,7 +56,7 @@ class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { int32_t m_iSelectors; }; -class CFDE_CSSMediaRule : public IFDE_CSSMediaRule, public CFX_Target { +class CFDE_CSSMediaRule : public IFDE_CSSMediaRule { public: explicit CFDE_CSSMediaRule(uint32_t dwMediaList); ~CFDE_CSSMediaRule() override; @@ -76,7 +73,7 @@ class CFDE_CSSMediaRule : public IFDE_CSSMediaRule, public CFX_Target { CFX_MassArrayTemplate m_RuleArray; }; -class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule, public CFX_Target { +class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule { public: // IFDE_CSSFontFaceRule CFDE_CSSDeclaration* GetDeclaration() override; @@ -94,7 +91,7 @@ class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule, public CFX_Target { default: \ return FDE_CSSSYNTAXSTATUS_Error; -class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { +class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet { public: explicit CFDE_CSSStyleSheet(uint32_t dwMediaList); ~CFDE_CSSStyleSheet() override; @@ -134,7 +131,6 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { uint16_t m_wCodePage; uint16_t m_wRefCount; uint32_t m_dwMediaList; - std::unique_ptr m_pAllocator; CFX_MassArrayTemplate m_RuleArray; CFX_WideString m_szUrl; CFX_ArrayTemplate m_Selectors; diff --git a/xfa/fde/css/fde_csssyntax.h b/xfa/fde/css/fde_csssyntax.h index 6417df07d4..993eb4c7dc 100644 --- a/xfa/fde/css/fde_csssyntax.h +++ b/xfa/fde/css/fde_csssyntax.h @@ -9,13 +9,12 @@ #include "core/fxcrt/cfx_retain_ptr.h" #include "xfa/fde/css/fde_css.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_stream.h" -class CFDE_CSSTextBuf : public CFX_Target { +class CFDE_CSSTextBuf { public: CFDE_CSSTextBuf(); - ~CFDE_CSSTextBuf() override; + ~CFDE_CSSTextBuf(); bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); bool EstimateSize(int32_t iAllocSize); @@ -76,10 +75,10 @@ enum FDE_CSSSYNTAXMODE { FDE_CSSSYNTAXMODE_PropertyValue, }; -class CFDE_CSSSyntaxParser : public CFX_Target { +class CFDE_CSSSyntaxParser { public: CFDE_CSSSyntaxParser(); - ~CFDE_CSSSyntaxParser() override; + ~CFDE_CSSSyntaxParser(); bool Init(const CFX_RetainPtr& pStream, int32_t iCSSPlaneSize, diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h index 35efab2b2d..170bef595f 100644 --- a/xfa/fde/fde_gedevice.h +++ b/xfa/fde/fde_gedevice.h @@ -8,7 +8,6 @@ #define XFA_FDE_FDE_GEDEVICE_H_ #include "core/fxge/cfx_renderdevice.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/font/cfgas_gefont.h" class CFDE_Brush; @@ -16,10 +15,10 @@ class CFDE_Path; class CFDE_Pen; class CFX_GraphStateData; -class CFDE_RenderDevice : public CFX_Target { +class CFDE_RenderDevice { public: CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice); - ~CFDE_RenderDevice() override; + ~CFDE_RenderDevice(); int32_t GetWidth() const; int32_t GetHeight() const; diff --git a/xfa/fde/fde_iterator.h b/xfa/fde/fde_iterator.h index 444c92a191..45659ce87c 100644 --- a/xfa/fde/fde_iterator.h +++ b/xfa/fde/fde_iterator.h @@ -8,7 +8,6 @@ #define XFA_FDE_FDE_ITERATOR_H_ #include "xfa/fde/fde_visualset.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_utils.h" struct FDE_CANVASITEM { @@ -17,10 +16,10 @@ struct FDE_CANVASITEM { FX_POSITION hPos; }; -class CFDE_VisualSetIterator : public CFX_Target { +class CFDE_VisualSetIterator { public: CFDE_VisualSetIterator(); - ~CFDE_VisualSetIterator() override; + ~CFDE_VisualSetIterator(); bool AttachCanvas(IFDE_CanvasSet* pCanvas); bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF); diff --git a/xfa/fde/fde_object.h b/xfa/fde/fde_object.h index bf1ec41dac..5c66b202b6 100644 --- a/xfa/fde/fde_object.h +++ b/xfa/fde/fde_object.h @@ -10,9 +10,8 @@ #include #include "core/fxge/fx_dib.h" -#include "xfa/fgas/crt/fgas_memory.h" -class CFDE_Brush : public CFX_Target { +class CFDE_Brush { public: CFDE_Brush() : m_Color(0xFF000000) {} @@ -23,10 +22,10 @@ class CFDE_Brush : public CFX_Target { FX_ARGB m_Color; }; -class CFDE_Pen : public CFX_Target { +class CFDE_Pen { public: CFDE_Pen() : m_Color(0) {} - ~CFDE_Pen() override {} + ~CFDE_Pen() {} FX_ARGB GetColor() const { return m_Color; } void SetColor(FX_ARGB color) { m_Color = color; } diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp index 1cdea421e1..c0fb926c36 100644 --- a/xfa/fde/fde_render.cpp +++ b/xfa/fde/fde_render.cpp @@ -9,7 +9,6 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/fde_gedevice.h" #include "xfa/fde/fde_object.h" -#include "xfa/fgas/crt/fgas_memory.h" #define FDE_PATHRENDER_Stroke 1 #define FDE_PATHRENDER_Fill 2 diff --git a/xfa/fde/fde_render.h b/xfa/fde/fde_render.h index 8bd09510a5..a24d6b5496 100644 --- a/xfa/fde/fde_render.h +++ b/xfa/fde/fde_render.h @@ -24,10 +24,10 @@ enum FDE_RENDERSTATUS { FDE_RENDERSTATUS_Failed, }; -class CFDE_RenderContext : public CFX_Target { +class CFDE_RenderContext { public: CFDE_RenderContext(); - ~CFDE_RenderContext() override; + ~CFDE_RenderContext(); bool StartRender(CFDE_RenderDevice* pRenderDevice, IFDE_CanvasSet* pCanvasSet, diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h index 77aa6c7253..8aef237ba1 100644 --- a/xfa/fde/fde_visualset.h +++ b/xfa/fde/fde_visualset.h @@ -13,7 +13,6 @@ #include "core/fxge/fx_dib.h" #include "xfa/fde/cfde_path.h" #include "xfa/fde/fde_object.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/font/cfgas_fontmgr.h" struct FXTEXT_CHARPOS; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 1081526148..4d207fb734 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -14,7 +14,6 @@ #include "xfa/fde/cfde_path.h" #include "xfa/fde/fde_gedevice.h" #include "xfa/fde/fde_object.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_utils.h" #include "xfa/fgas/layout/fgas_textbreak.h" diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index f9eeb82ddc..94b72f806d 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -54,11 +54,11 @@ struct FDE_TTOPIECE { }; typedef CFX_MassArrayTemplate CFDE_TTOPieceArray; -class CFDE_TTOLine : public CFX_Target { +class CFDE_TTOLine { public: CFDE_TTOLine(); CFDE_TTOLine(const CFDE_TTOLine& ttoLine); - ~CFDE_TTOLine() override; + ~CFDE_TTOLine(); int32_t AddPiece(int32_t index, const FDE_TTOPIECE& ttoPiece); int32_t GetSize() const; @@ -74,10 +74,10 @@ class CFDE_TTOLine : public CFX_Target { }; typedef CFX_ObjectMassArrayTemplate CFDE_TTOLineArray; -class CFDE_TextOut : public CFX_Target { +class CFDE_TextOut { public: CFDE_TextOut(); - ~CFDE_TextOut() override; + ~CFDE_TextOut(); void SetFont(const CFX_RetainPtr& pFont); void SetFontSize(FX_FLOAT fFontSize); diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h index 126b0355a3..49c5c51f77 100644 --- a/xfa/fde/xml/fde_xml_imp.h +++ b/xfa/fde/xml/fde_xml_imp.h @@ -12,7 +12,6 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fde/xml/fde_xml.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_stream.h" #include "xfa/fgas/crt/fgas_utils.h" @@ -25,7 +24,7 @@ class CFDE_XMLDOMParser; class CFDE_XMLSyntaxParser; class IFDE_XMLParser; -class CFDE_XMLNode : public CFX_Target { +class CFDE_XMLNode { public: enum NodeItem { Root = 0, @@ -43,7 +42,7 @@ class CFDE_XMLNode : public CFX_Target { }; CFDE_XMLNode(); - ~CFDE_XMLNode() override; + virtual ~CFDE_XMLNode(); virtual void Release(); virtual FDE_XMLNODETYPE GetType() const; @@ -191,10 +190,10 @@ class CFDE_XMLCharData : public CFDE_XMLDeclaration { CFX_WideString m_wsCharData; }; -class CFDE_XMLDoc : public CFX_Target { +class CFDE_XMLDoc { public: CFDE_XMLDoc(); - ~CFDE_XMLDoc() override; + ~CFDE_XMLDoc(); bool LoadXML(std::unique_ptr pXMLParser); int32_t DoLoad(IFX_Pause* pPause = nullptr); @@ -221,10 +220,10 @@ class IFDE_XMLParser { virtual int32_t DoParser(IFX_Pause* pPause) = 0; }; -class CFDE_BlockBuffer : public CFX_Target { +class CFDE_BlockBuffer { public: explicit CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024); - ~CFDE_BlockBuffer() override; + ~CFDE_BlockBuffer(); bool InitBuffer(int32_t iBufferSize = 1024 * 1024); bool IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } @@ -257,10 +256,10 @@ class CFDE_BlockBuffer : public CFX_Target { int32_t m_iStartPosition; }; -class CFDE_XMLSyntaxParser : public CFX_Target { +class CFDE_XMLSyntaxParser { public: CFDE_XMLSyntaxParser(); - ~CFDE_XMLSyntaxParser() override; + ~CFDE_XMLSyntaxParser(); void Release() { delete this; } void Init(const CFX_RetainPtr& pStream, diff --git a/xfa/fgas/crt/fgas_memory.cpp b/xfa/fgas/crt/fgas_memory.cpp deleted file mode 100644 index 9625f95203..0000000000 --- a/xfa/fgas/crt/fgas_memory.cpp +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fgas/crt/fgas_memory.h" - -#ifndef MEMORY_TOOL_REPLACES_ALLOCATOR -// Use CFX_DefStore to replace CFX_FixedStore to simplify memory -// management so that some problems such Use-After-Free can be -// detected by Asan or ClusterFuzz tools. -#define MEMORY_TOOL_REPLACES_ALLOCATOR -#endif - -#include - -namespace { - -struct FX_STATICSTORECHUNK { - FX_STATICSTORECHUNK* pNextChunk; - size_t iChunkSize; - size_t iFreeSize; -}; - -class CFX_StaticStore : public IFX_MemoryAllocator, public CFX_Target { - public: - explicit CFX_StaticStore(size_t iDefChunkSize); - ~CFX_StaticStore() override; - - void* Alloc(size_t size) override; - void Free(void* pBlock) override {} - - private: - size_t m_iAllocatedSize; - size_t m_iDefChunkSize; - FX_STATICSTORECHUNK* m_pChunk; - FX_STATICSTORECHUNK* m_pLastChunk; - FX_STATICSTORECHUNK* AllocChunk(size_t size); - FX_STATICSTORECHUNK* FindChunk(size_t size); -}; - -#ifdef MEMORY_TOOL_REPLACES_ALLOCATOR - -class CFX_DefStore : public IFX_MemoryAllocator, public CFX_Target { - public: - CFX_DefStore() {} - ~CFX_DefStore() override {} - - void* Alloc(size_t size) override { return FX_Alloc(uint8_t, size); } - void Free(void* pBlock) override { FX_Free(pBlock); } -}; - -#else - -struct FX_FIXEDSTORECHUNK { - uint8_t* FirstFlag() { return reinterpret_cast(this + 1); } - uint8_t* FirstBlock() { return FirstFlag() + iChunkSize; } - - FX_FIXEDSTORECHUNK* pNextChunk; - size_t iChunkSize; - size_t iFreeNum; -}; - -class CFX_FixedStore : public IFX_MemoryAllocator, public CFX_Target { - public: - CFX_FixedStore(size_t iBlockSize, size_t iBlockNumsInChunk); - ~CFX_FixedStore() override; - void* Alloc(size_t size) override; - void Free(void* pBlock) override; - - private: - FX_FIXEDSTORECHUNK* AllocChunk(); - - size_t m_iBlockSize; - size_t m_iDefChunkSize; - FX_FIXEDSTORECHUNK* m_pChunk; -}; - -#endif // MEMORY_TOOL_REPLACES_ALLOCATOR - -} // namespace - -#define FX_4BYTEALIGN(size) (((size) + 3) & ~3) - -std::unique_ptr IFX_MemoryAllocator::Create( - FX_ALLOCTYPE eType, - size_t chunkSize, - size_t blockSize) { - switch (eType) { - case FX_ALLOCTYPE_Static: - return std::unique_ptr( - new CFX_StaticStore(chunkSize)); - case FX_ALLOCTYPE_Fixed: -#ifdef MEMORY_TOOL_REPLACES_ALLOCATOR - return std::unique_ptr(new CFX_DefStore()); -#else - return std::unique_ptr( - new CFX_FixedStore(blockSize, chunkSize)); -#endif // MEMORY_TOOL_REPLACES_ALLOCATOR - default: - ASSERT(0); - return nullptr; - } -} - -CFX_StaticStore::CFX_StaticStore(size_t iDefChunkSize) - : m_iAllocatedSize(0), - m_iDefChunkSize(iDefChunkSize), - m_pChunk(nullptr), - m_pLastChunk(nullptr) { - ASSERT(m_iDefChunkSize != 0); -} - -CFX_StaticStore::~CFX_StaticStore() { - FX_STATICSTORECHUNK* pChunk = m_pChunk; - while (pChunk) { - FX_STATICSTORECHUNK* pNext = pChunk->pNextChunk; - FX_Free(pChunk); - pChunk = pNext; - } -} - -FX_STATICSTORECHUNK* CFX_StaticStore::AllocChunk(size_t size) { - ASSERT(size != 0); - FX_STATICSTORECHUNK* pChunk = (FX_STATICSTORECHUNK*)FX_Alloc( - uint8_t, sizeof(FX_STATICSTORECHUNK) + size); - pChunk->iChunkSize = size; - pChunk->iFreeSize = size; - pChunk->pNextChunk = nullptr; - if (!m_pLastChunk) { - m_pChunk = pChunk; - } else { - m_pLastChunk->pNextChunk = pChunk; - } - m_pLastChunk = pChunk; - return pChunk; -} - -FX_STATICSTORECHUNK* CFX_StaticStore::FindChunk(size_t size) { - ASSERT(size != 0); - if (!m_pLastChunk || m_pLastChunk->iFreeSize < size) { - return AllocChunk(std::max(m_iDefChunkSize, size)); - } - return m_pLastChunk; -} - -void* CFX_StaticStore::Alloc(size_t size) { - size = FX_4BYTEALIGN(size); - ASSERT(size != 0); - FX_STATICSTORECHUNK* pChunk = FindChunk(size); - ASSERT(pChunk->iFreeSize >= size); - uint8_t* p = (uint8_t*)pChunk; - p += sizeof(FX_STATICSTORECHUNK) + pChunk->iChunkSize - pChunk->iFreeSize; - pChunk->iFreeSize -= size; - m_iAllocatedSize += size; - return p; -} - -#ifndef MEMORY_TOOL_REPLACES_ALLOCATOR - -CFX_FixedStore::CFX_FixedStore(size_t iBlockSize, size_t iBlockNumsInChunk) - : m_iBlockSize(FX_4BYTEALIGN(iBlockSize)), - m_iDefChunkSize(FX_4BYTEALIGN(iBlockNumsInChunk)), - m_pChunk(nullptr) { - ASSERT(m_iBlockSize != 0 && m_iDefChunkSize != 0); -} - -CFX_FixedStore::~CFX_FixedStore() { - FX_FIXEDSTORECHUNK* pChunk = m_pChunk; - while (pChunk) { - FX_FIXEDSTORECHUNK* pNext = pChunk->pNextChunk; - FX_Free(pChunk); - pChunk = pNext; - } -} - -FX_FIXEDSTORECHUNK* CFX_FixedStore::AllocChunk() { - int32_t iTotalSize = sizeof(FX_FIXEDSTORECHUNK) + m_iDefChunkSize + - m_iBlockSize * m_iDefChunkSize; - FX_FIXEDSTORECHUNK* pChunk = - (FX_FIXEDSTORECHUNK*)FX_Alloc(uint8_t, iTotalSize); - if (!pChunk) - return nullptr; - - FXSYS_memset(pChunk->FirstFlag(), 0, m_iDefChunkSize); - pChunk->pNextChunk = m_pChunk; - pChunk->iChunkSize = m_iDefChunkSize; - pChunk->iFreeNum = m_iDefChunkSize; - m_pChunk = pChunk; - return pChunk; -} - -void* CFX_FixedStore::Alloc(size_t size) { - if (size > m_iBlockSize) { - return nullptr; - } - FX_FIXEDSTORECHUNK* pChunk = m_pChunk; - while (pChunk) { - if (pChunk->iFreeNum > 0) { - break; - } - pChunk = pChunk->pNextChunk; - } - if (!pChunk) { - pChunk = AllocChunk(); - } - uint8_t* pFlags = pChunk->FirstFlag(); - size_t i = 0; - for (; i < pChunk->iChunkSize; i++) - if (pFlags[i] == 0) { - break; - } - ASSERT(i < pChunk->iChunkSize); - pFlags[i] = 1; - pChunk->iFreeNum--; - return pChunk->FirstBlock() + i * m_iBlockSize; -} - -void CFX_FixedStore::Free(void* pBlock) { - FX_FIXEDSTORECHUNK* pPrior = nullptr; - FX_FIXEDSTORECHUNK* pChunk = m_pChunk; - uint8_t* pStart = nullptr; - uint8_t* pEnd; - while (pChunk) { - pStart = pChunk->FirstBlock(); - if (pBlock >= pStart) { - pEnd = pStart + m_iBlockSize * pChunk->iChunkSize; - if (pBlock < pEnd) { - break; - } - } - pPrior = pChunk, pChunk = pChunk->pNextChunk; - } - ASSERT(pChunk); - size_t iPos = ((uint8_t*)pBlock - pStart) / m_iBlockSize; - ASSERT(iPos < pChunk->iChunkSize); - uint8_t* pFlags = pChunk->FirstFlag(); - if (pFlags[iPos] == 0) { - return; - } - pFlags[iPos] = 0; - pChunk->iFreeNum++; - if (pChunk->iFreeNum == pChunk->iChunkSize) { - if (!pPrior) { - m_pChunk = pChunk->pNextChunk; - } else { - pPrior->pNextChunk = pChunk->pNextChunk; - } - FX_Free(pChunk); - } -} - -#endif // MEMORY_TOOL_REPLACES_ALLOCATOR diff --git a/xfa/fgas/crt/fgas_memory.h b/xfa/fgas/crt/fgas_memory.h deleted file mode 100644 index 4e4e33f7fc..0000000000 --- a/xfa/fgas/crt/fgas_memory.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FGAS_CRT_FGAS_MEMORY_H_ -#define XFA_FGAS_CRT_FGAS_MEMORY_H_ - -#include - -#include "core/fxcrt/fx_memory.h" -#include "core/fxcrt/fx_system.h" - -enum FX_ALLOCTYPE { - FX_ALLOCTYPE_Static, - FX_ALLOCTYPE_Fixed, -}; - -class IFX_MemoryAllocator { - public: - virtual ~IFX_MemoryAllocator() {} - virtual void* Alloc(size_t size) = 0; - virtual void Free(void* pBlock) = 0; - - static std::unique_ptr Create(FX_ALLOCTYPE eType, - size_t chunkSize, - size_t blockSize); -}; - -class CFX_Target { - public: - virtual ~CFX_Target() {} - void* operator new(size_t size) { return FX_Alloc(uint8_t, size); } - void operator delete(void* p) { FX_Free(p); } - void* operator new(size_t size, IFX_MemoryAllocator* pAllocator) { - return pAllocator->Alloc(size); - } - void operator delete(void* p, IFX_MemoryAllocator* pAllocator) { - pAllocator->Free(p); - } - void* operator new(size_t size, void* place) { return place; } - void operator delete(void* p, void* place) {} -}; - -#define FXTARGET_NewWith(__allocator__) new (__allocator__) -#define FXTARGET_DeleteWith(__class__, __allocator__, pointer) \ - { \ - (pointer)->~__class__(); \ - (pointer)->operator delete((pointer), (__allocator__)); \ - } - -#endif // XFA_FGAS_CRT_FGAS_MEMORY_H_ diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp index 0cdbf77d31..1e86c6c16a 100644 --- a/xfa/fgas/crt/fgas_utils.cpp +++ b/xfa/fgas/crt/fgas_utils.cpp @@ -10,10 +10,10 @@ #include "core/fxcrt/fx_basic.h" -class FX_BASEARRAYDATA : public CFX_Target { +class FX_BASEARRAYDATA { public: FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize); - ~FX_BASEARRAYDATA() override; + ~FX_BASEARRAYDATA(); int32_t iGrowSize; int32_t iBlockSize; diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h index c7bc45f73d..465601149b 100644 --- a/xfa/fgas/crt/fgas_utils.h +++ b/xfa/fgas/crt/fgas_utils.h @@ -8,14 +8,13 @@ #define XFA_FGAS_CRT_FGAS_UTILS_H_ #include "core/fxcrt/fx_coordinates.h" -#include "xfa/fgas/crt/fgas_memory.h" class FX_BASEARRAYDATA; -class CFX_BaseArray : public CFX_Target { +class CFX_BaseArray { protected: CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize); - ~CFX_BaseArray() override; + ~CFX_BaseArray(); int32_t GetSize() const; int32_t GetBlockSize() const; @@ -77,10 +76,10 @@ class CFX_BaseArrayTemplate : public CFX_BaseArray { void RemoveAll(bool bLeaveMemory) { CFX_BaseArray::RemoveAll(bLeaveMemory); } }; -class CFX_BaseMassArrayImp : public CFX_Target { +class CFX_BaseMassArrayImp { public: CFX_BaseMassArrayImp(int32_t iChunkSize, int32_t iBlockSize); - ~CFX_BaseMassArrayImp() override; + ~CFX_BaseMassArrayImp(); uint8_t* AddSpace() { return AddSpaceTo(m_iBlockCount); } uint8_t* AddSpaceTo(int32_t index); @@ -105,10 +104,10 @@ class CFX_BaseMassArrayImp : public CFX_Target { int32_t iSrcCount); }; -class CFX_BaseMassArray : public CFX_Target { +class CFX_BaseMassArray { protected: CFX_BaseMassArray(int32_t iChunkSize, int32_t iBlockSize); - ~CFX_BaseMassArray() override; + ~CFX_BaseMassArray(); int32_t GetSize() const; uint8_t* AddSpaceTo(int32_t index); @@ -251,10 +250,10 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray { } }; -class CFX_BaseDiscreteArray : public CFX_Target { +class CFX_BaseDiscreteArray { protected: CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize); - ~CFX_BaseDiscreteArray() override; + ~CFX_BaseDiscreteArray(); uint8_t* AddSpaceTo(int32_t index); uint8_t* GetAt(int32_t index) const; @@ -281,10 +280,10 @@ class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray { void RemoveAll() { CFX_BaseDiscreteArray::RemoveAll(); } }; -class CFX_BaseStack : public CFX_Target { +class CFX_BaseStack { protected: CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize); - ~CFX_BaseStack() override; + ~CFX_BaseStack(); uint8_t* Push(); void Pop(); diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 5e03af031f..1dadfd347e 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -21,7 +21,6 @@ #include "xfa/fgas/crt/fgas_stream.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_utils.h" #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index c281192553..6edd860354 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -11,7 +11,6 @@ #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_ucd.h" -#include "xfa/fgas/crt/fgas_memory.h" #include "xfa/fgas/crt/fgas_utils.h" #include "xfa/fgas/layout/fgas_textbreak.h" #include "xfa/fgas/layout/fgas_unicode.h" @@ -83,10 +82,10 @@ struct FX_RTFTEXTOBJ { int32_t iVerticalScale; }; -class CFX_RTFPiece : public CFX_Target { +class CFX_RTFPiece { public: CFX_RTFPiece(); - ~CFX_RTFPiece() override; + ~CFX_RTFPiece(); void AppendChar(const CFX_RTFChar& tc) { ASSERT(m_pChars); diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index 36602749c7..7359600c14 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -105,7 +105,7 @@ struct FX_TXTRUN { bool bSkipSpace; }; -class CFX_TxtPiece : public CFX_Target { +class CFX_TxtPiece { public: CFX_TxtPiece(); diff --git a/xfa/fxfa/app/cxfa_linkuserdata.cpp b/xfa/fxfa/app/cxfa_linkuserdata.cpp index 62a2938d95..f1e15f406d 100644 --- a/xfa/fxfa/app/cxfa_linkuserdata.cpp +++ b/xfa/fxfa/app/cxfa_linkuserdata.cpp @@ -6,9 +6,8 @@ #include "xfa/fxfa/app/cxfa_linkuserdata.h" -CXFA_LinkUserData::CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, - FX_WCHAR* pszText) - : m_pAllocator(pAllocator), m_dwRefCount(1), m_wsURLContent(pszText) {} +CXFA_LinkUserData::CXFA_LinkUserData(FX_WCHAR* pszText) + : m_dwRefCount(1), m_wsURLContent(pszText) {} CXFA_LinkUserData::~CXFA_LinkUserData() {} @@ -19,7 +18,7 @@ uint32_t CXFA_LinkUserData::Retain() { uint32_t CXFA_LinkUserData::Release() { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount <= 0) - FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this); + delete this; return dwRefCount; } diff --git a/xfa/fxfa/app/cxfa_linkuserdata.h b/xfa/fxfa/app/cxfa_linkuserdata.h index d5ec14e17e..621398ecb3 100644 --- a/xfa/fxfa/app/cxfa_linkuserdata.h +++ b/xfa/fxfa/app/cxfa_linkuserdata.h @@ -10,13 +10,10 @@ #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" -#include "xfa/fgas/crt/fgas_memory.h" -class IFX_MemoryAllocator; - -class CXFA_LinkUserData : public IFX_Retainable, public CFX_Target { +class CXFA_LinkUserData : public IFX_Retainable { public: - CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText); + explicit CXFA_LinkUserData(FX_WCHAR* pszText); ~CXFA_LinkUserData() override; // IFX_Retainable: @@ -26,7 +23,6 @@ class CXFA_LinkUserData : public IFX_Retainable, public CFX_Target { const FX_WCHAR* GetLinkURL(); protected: - IFX_MemoryAllocator* m_pAllocator; uint32_t m_dwRefCount; CFX_WideString m_wsURLContent; }; diff --git a/xfa/fxfa/app/cxfa_pieceline.h b/xfa/fxfa/app/cxfa_pieceline.h index 88642d38bc..48dfdae04d 100644 --- a/xfa/fxfa/app/cxfa_pieceline.h +++ b/xfa/fxfa/app/cxfa_pieceline.h @@ -8,14 +8,13 @@ #define XFA_FXFA_APP_CXFA_PIECELINE_H_ #include "core/fxcrt/fx_basic.h" -#include "xfa/fgas/crt/fgas_memory.h" class XFA_TextPiece; -class CXFA_PieceLine : public CFX_Target { +class CXFA_PieceLine { public: CXFA_PieceLine(); - ~CXFA_PieceLine() override; + ~CXFA_PieceLine(); CFX_ArrayTemplate m_textPieces; CFX_ArrayTemplate m_charCounts; diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index c4c2712386..c123668993 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -50,18 +50,17 @@ void CXFA_TextLayout::Unload() { for (int32_t i = 0; i < pLine->m_textPieces.GetSize(); i++) { XFA_TextPiece* pPiece = pLine->m_textPieces.GetAt(i); // Release text and widths in a text piece. - m_pAllocator->Free(pPiece->pszText); - m_pAllocator->Free(pPiece->pWidths); + delete pPiece->pszText; + delete pPiece->pWidths; // Release text piece. - FXTARGET_DeleteWith(XFA_TextPiece, m_pAllocator.get(), pPiece); + delete pPiece; } pLine->m_textPieces.RemoveAll(); // Release line. - FXTARGET_DeleteWith(CXFA_PieceLine, m_pAllocator.get(), pLine); + delete pLine; } m_pieceLines.RemoveAll(); m_pBreak.reset(); - m_pAllocator.reset(); } const CFX_ArrayTemplate* CXFA_TextLayout::GetPieceLines() { @@ -669,9 +668,6 @@ void CXFA_TextLayout::UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom) { bool CXFA_TextLayout::Loader(const CFX_SizeF& szText, FX_FLOAT& fLinePos, bool bSavePieces) { - if (!m_pAllocator) - m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 256, 0); - GetTextDataNode(); if (!m_pTextDataNode) return true; @@ -794,8 +790,7 @@ bool CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, ASSERT(pElement); pElement->GetString(L"href", wsLinkContent); if (!wsLinkContent.IsEmpty()) { - pLinkData = FXTARGET_NewWith(m_pAllocator.get()) CXFA_LinkUserData( - m_pAllocator.get(), + pLinkData = new CXFA_LinkUserData( wsLinkContent.GetBuffer(wsLinkContent.GetLength())); wsLinkContent.ReleaseBuffer(wsLinkContent.GetLength()); } @@ -852,10 +847,8 @@ bool CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, if (pLinkData) pLinkData->Retain(); - CXFA_TextUserData* pUserData = FXTARGET_NewWith(m_pAllocator.get()) - CXFA_TextUserData(m_pAllocator.get(), - bContentNode ? pParentStyle : pStyle, - pLinkData); + CXFA_TextUserData* pUserData = new CXFA_TextUserData( + bContentNode ? pParentStyle : pStyle, pLinkData); m_pBreak->SetUserData(pUserData); } @@ -1073,8 +1066,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, IFDE_CSSComputedStyle* pStyle = nullptr; if (bSavePieces) { - CXFA_PieceLine* pPieceLine = - FXTARGET_NewWith(m_pAllocator.get()) CXFA_PieceLine; + CXFA_PieceLine* pPieceLine = new CXFA_PieceLine; m_pieceLines.Add(pPieceLine); if (m_pTabstopContext) m_pTabstopContext->Reset(); @@ -1088,11 +1080,11 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus, pStyle = pUserData->m_pStyle; FX_FLOAT fVerScale = pPiece->m_iVerticalScale / 100.0f; - XFA_TextPiece* pTP = FXTARGET_NewWith(m_pAllocator.get()) XFA_TextPiece(); + XFA_TextPiece* pTP = new XFA_TextPiece(); pTP->pszText = - (FX_WCHAR*)m_pAllocator->Alloc(pPiece->m_iChars * sizeof(FX_WCHAR)); + (FX_WCHAR*)FX_Alloc(uint8_t, pPiece->m_iChars * sizeof(FX_WCHAR)); pTP->pWidths = - (int32_t*)m_pAllocator->Alloc(pPiece->m_iChars * sizeof(int32_t)); + (int32_t*)FX_Alloc(uint8_t, pPiece->m_iChars * sizeof(int32_t)); pTP->iChars = pPiece->m_iChars; pPiece->GetString(pTP->pszText); pPiece->GetWidths(pTP->pWidths); diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h index e21a5de424..e73005afb5 100644 --- a/xfa/fxfa/app/cxfa_textlayout.h +++ b/xfa/fxfa/app/cxfa_textlayout.h @@ -28,7 +28,6 @@ class CXFA_PieceLine; class CXFA_TextProvider; class CXFA_TextTabstopsContext; class IFDE_CSSComputedStyle; -class IFX_MemoryAllocator; class XFA_TextPiece; class CXFA_TextLayout { @@ -121,7 +120,6 @@ class CXFA_TextLayout { CXFA_TextProvider* m_pTextProvider; CXFA_Node* m_pTextDataNode; bool m_bRichText; - std::unique_ptr m_pAllocator; std::unique_ptr m_pBreak; std::unique_ptr m_pLoader; int32_t m_iLines; diff --git a/xfa/fxfa/app/cxfa_textparsecontext.h b/xfa/fxfa/app/cxfa_textparsecontext.h index 2eafacc8fe..94265fb0db 100644 --- a/xfa/fxfa/app/cxfa_textparsecontext.h +++ b/xfa/fxfa/app/cxfa_textparsecontext.h @@ -8,15 +8,14 @@ #define XFA_FXFA_APP_CXFA_TEXTPARSECONTEXT_H_ #include "xfa/fde/css/fde_css.h" -#include "xfa/fgas/crt/fgas_memory.h" class CFDE_CSSDeclaration; class IFDE_CSSComputedStyle; -class CXFA_TextParseContext : public CFX_Target { +class CXFA_TextParseContext { public: CXFA_TextParseContext(); - ~CXFA_TextParseContext() override; + ~CXFA_TextParseContext(); void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; } FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; } diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index b865e5e576..50f6cbaea2 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -36,29 +36,25 @@ enum class TabStopStatus { } // namespace -CXFA_TextParser::CXFA_TextParser() : m_pUASheet(nullptr) {} +CXFA_TextParser::CXFA_TextParser() : m_pUASheet(nullptr), m_bParsed(false) {} CXFA_TextParser::~CXFA_TextParser() { if (m_pUASheet) m_pUASheet->Release(); for (auto& pair : m_mapXMLNodeToParseContext) { - if (pair.second) { - FXTARGET_DeleteWith(CXFA_TextParseContext, m_pAllocator.get(), - pair.second); - } + if (pair.second) + delete pair.second; } } void CXFA_TextParser::Reset() { for (auto& pair : m_mapXMLNodeToParseContext) { - if (pair.second) { - FXTARGET_DeleteWith(CXFA_TextParseContext, m_pAllocator.get(), - pair.second); - } + if (pair.second) + delete pair.second; } m_mapXMLNodeToParseContext.clear(); - m_pAllocator.reset(); + m_bParsed = false; } void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { if (!pTextProvider) @@ -220,11 +216,10 @@ IFDE_CSSComputedStyle* CXFA_TextParser::ComputeStyle( void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider) { - if (!pXMLContainer || !pTextProvider || m_pAllocator) + if (!pXMLContainer || !pTextProvider || m_bParsed) return; - m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, 32, - sizeof(CXFA_CSSTagProvider)); + m_bParsed = true; InitCSSData(pTextProvider); IFDE_CSSComputedStyle* pRootStyle = CreateRootStyle(pTextProvider); ParseRichText(pXMLContainer, pRootStyle); @@ -244,8 +239,7 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pNewStyle = nullptr; if ((tagProvider.GetTagName() != FX_WSTRC(L"body")) || (tagProvider.GetTagName() != FX_WSTRC(L"html"))) { - CXFA_TextParseContext* pTextContext = - FXTARGET_NewWith(m_pAllocator.get()) CXFA_TextParseContext; + CXFA_TextParseContext* pTextContext = new CXFA_TextParseContext; FDE_CSSDISPLAY eDisplay = FDE_CSSDISPLAY_Inline; if (!tagProvider.m_bContent) { pNewStyle = CreateStyle(pParentStyle); diff --git a/xfa/fxfa/app/cxfa_textparser.h b/xfa/fxfa/app/cxfa_textparser.h index e793c0c9fe..923c07001a 100644 --- a/xfa/fxfa/app/cxfa_textparser.h +++ b/xfa/fxfa/app/cxfa_textparser.h @@ -24,7 +24,6 @@ class CXFA_TextProvider; class CXFA_TextTabstopsContext; class IFDE_CSSComputedStyle; class IFDE_CSSStyleSheet; -class IFX_MemoryAllocator; class CXFA_TextParser { public: @@ -38,7 +37,7 @@ class CXFA_TextParser { IFDE_CSSComputedStyle* ComputeStyle(CFDE_XMLNode* pXMLNode, IFDE_CSSComputedStyle* pParentStyle); - bool IsParsed() const { return !!m_pAllocator; } + bool IsParsed() const { return m_bParsed; } int32_t GetVAlign(CXFA_TextProvider* pTextProvider) const; @@ -92,10 +91,10 @@ class CXFA_TextParser { IFDE_CSSStyleSheet* LoadDefaultSheetStyle(); IFDE_CSSComputedStyle* CreateStyle(IFDE_CSSComputedStyle* pParentStyle); - std::unique_ptr m_pAllocator; std::unique_ptr m_pSelector; IFDE_CSSStyleSheet* m_pUASheet; std::map m_mapXMLNodeToParseContext; + bool m_bParsed; }; #endif // XFA_FXFA_APP_CXFA_TEXTPARSER_H_ diff --git a/xfa/fxfa/app/cxfa_textuserdata.cpp b/xfa/fxfa/app/cxfa_textuserdata.cpp index 209e4f2c21..62566deeac 100644 --- a/xfa/fxfa/app/cxfa_textuserdata.cpp +++ b/xfa/fxfa/app/cxfa_textuserdata.cpp @@ -9,25 +9,15 @@ #include "xfa/fde/css/fde_css.h" #include "xfa/fxfa/app/cxfa_linkuserdata.h" -CXFA_TextUserData::CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, - IFDE_CSSComputedStyle* pStyle) - : m_pStyle(pStyle), - m_pLinkData(nullptr), - m_pAllocator(pAllocator), - m_dwRefCount(0) { - ASSERT(m_pAllocator); +CXFA_TextUserData::CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle) + : m_pStyle(pStyle), m_pLinkData(nullptr), m_dwRefCount(0) { if (m_pStyle) m_pStyle->Retain(); } -CXFA_TextUserData::CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, - IFDE_CSSComputedStyle* pStyle, +CXFA_TextUserData::CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle, CXFA_LinkUserData* pLinkData) - : m_pStyle(pStyle), - m_pLinkData(pLinkData), - m_pAllocator(pAllocator), - m_dwRefCount(0) { - ASSERT(m_pAllocator); + : m_pStyle(pStyle), m_pLinkData(pLinkData), m_dwRefCount(0) { if (m_pStyle) m_pStyle->Retain(); } @@ -46,6 +36,6 @@ uint32_t CXFA_TextUserData::Retain() { uint32_t CXFA_TextUserData::Release() { uint32_t dwRefCount = --m_dwRefCount; if (dwRefCount == 0) - FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this); + delete this; return dwRefCount; } diff --git a/xfa/fxfa/app/cxfa_textuserdata.h b/xfa/fxfa/app/cxfa_textuserdata.h index f9e76f94d8..308475b0dd 100644 --- a/xfa/fxfa/app/cxfa_textuserdata.h +++ b/xfa/fxfa/app/cxfa_textuserdata.h @@ -8,18 +8,14 @@ #define XFA_FXFA_APP_CXFA_TEXTUSERDATA_H_ #include "core/fxcrt/fx_basic.h" -#include "xfa/fgas/crt/fgas_memory.h" class CXFA_LinkUserData; class IFDE_CSSComputedStyle; -class IFX_MemoryAllocator; -class CXFA_TextUserData : public IFX_Retainable, public CFX_Target { +class CXFA_TextUserData : public IFX_Retainable { public: - CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, - IFDE_CSSComputedStyle* pStyle); - CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, - IFDE_CSSComputedStyle* pStyle, + explicit CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle); + CXFA_TextUserData(IFDE_CSSComputedStyle* pStyle, CXFA_LinkUserData* pLinkData); ~CXFA_TextUserData() override; @@ -31,7 +27,6 @@ class CXFA_TextUserData : public IFX_Retainable, public CFX_Target { CXFA_LinkUserData* m_pLinkData; protected: - IFX_MemoryAllocator* m_pAllocator; uint32_t m_dwRefCount; }; diff --git a/xfa/fxfa/app/xfa_textpiece.h b/xfa/fxfa/app/xfa_textpiece.h index 4047cd2d7f..2b74155afd 100644 --- a/xfa/fxfa/app/xfa_textpiece.h +++ b/xfa/fxfa/app/xfa_textpiece.h @@ -15,10 +15,10 @@ class CXFA_LinkUserData; -class XFA_TextPiece : public CFX_Target { +class XFA_TextPiece { public: XFA_TextPiece(); - ~XFA_TextPiece() override; + ~XFA_TextPiece(); FX_WCHAR* pszText; int32_t iChars; -- cgit v1.2.3