diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-26 09:45:57 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-26 15:05:05 +0000 |
commit | 35ee5bb4a2e51fd42f07c23a4008bfb97e390b25 (patch) | |
tree | c15fd938e4ab87136dc97ef7bdd4e576d1378703 /xfa/fde/css/cfde_cssstyleselector.h | |
parent | cff5618d4e847b9f13e1f051d56e09ee00cfb089 (diff) | |
download | pdfium-35ee5bb4a2e51fd42f07c23a4008bfb97e390b25.tar.xz |
Cleanup memory in CFDE_CSSStyleSelector
This CL fixes up the bare new calls in CFDE_CSSStyleSelector and replaces
them with unique_ptrs. Code massaged to work correclty with new types.
Change-Id: I90fce1ed7486da97fe7b5e597e9d423748c069c0
Reviewed-on: https://pdfium-review.googlesource.com/2353
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssstyleselector.h')
-rw-r--r-- | xfa/fde/css/cfde_cssstyleselector.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/xfa/fde/css/cfde_cssstyleselector.h b/xfa/fde/css/cfde_cssstyleselector.h index c2262d7aa7..15bce93334 100644 --- a/xfa/fde/css/cfde_cssstyleselector.h +++ b/xfa/fde/css/cfde_cssstyleselector.h @@ -17,7 +17,9 @@ class CFDE_CSSAccelerator; class CFDE_CSSComputedStyle; +class CFDE_CSSCustomProperty; class CFDE_CSSDeclaration; +class CFDE_CSSPropertyHolder; class CFDE_CSSSelector; class CFDE_CSSStyleSheet; class CFDE_CSSTagCache; @@ -31,38 +33,38 @@ class CFDE_CSSStyleSelector { explicit CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr); ~CFDE_CSSStyleSelector(); - void SetDefFontSize(FX_FLOAT fFontSize); + CFDE_CSSAccelerator* InitAccelerator(); + void SetDefFontSize(FX_FLOAT fFontSize); void SetUAStyleSheet(std::unique_ptr<CFDE_CSSStyleSheet> pSheet); - void UpdateStyleIndex(); - CFDE_CSSAccelerator* InitAccelerator(); + CFX_RetainPtr<CFDE_CSSComputedStyle> CreateComputedStyle( CFDE_CSSComputedStyle* pParentStyle); - int32_t MatchDeclarations( - CXFA_CSSTagProvider* pTag, - CFX_ArrayTemplate<CFDE_CSSDeclaration*>& matchedDecls); void ComputeStyle(CXFA_CSSTagProvider* pTag, - const CFDE_CSSDeclaration** ppDeclArray, - int32_t iDeclCount, + const std::vector<const CFDE_CSSDeclaration*>& declArray, CFDE_CSSComputedStyle* pDestStyle); + std::vector<const CFDE_CSSDeclaration*> MatchDeclarations( + CXFA_CSSTagProvider* pTag); + private: - void MatchRules( - std::vector<CFDE_CSSRuleCollection::Data*>* matchedRules, - CFDE_CSSTagCache* pCache, - const std::vector<std::unique_ptr<CFDE_CSSRuleCollection::Data>>* pList); bool MatchSelector(CFDE_CSSTagCache* pCache, CFDE_CSSSelector* pSel); + void AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen); - void ApplyDeclarations(bool bPriority, - const CFDE_CSSDeclaration** ppDeclArray, - int32_t iDeclCount, - CFDE_CSSComputedStyle* pDestStyle); + void ApplyDeclarations( + const std::vector<const CFDE_CSSDeclaration*>& declArray, + const CFDE_CSSDeclaration* extraDecl, + CFDE_CSSComputedStyle* pDestStyle); void ApplyProperty(FDE_CSSProperty eProperty, CFDE_CSSValue* pValue, CFDE_CSSComputedStyle* pComputedStyle); + void ExtractValues(const CFDE_CSSDeclaration* decl, + std::vector<const CFDE_CSSPropertyHolder*>* importants, + std::vector<const CFDE_CSSPropertyHolder*>* normals, + std::vector<const CFDE_CSSCustomProperty*>* custom); bool SetLengthWithPercent(FDE_CSSLength& width, FDE_CSSPrimitiveType eType, |