diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-08 10:05:05 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-09 15:55:20 +0000 |
commit | 21e954b59fcef1b84fdcdb9ae337e2d4c060b19e (patch) | |
tree | 2053cd0a8b0d4c1bb6903db3aa6f753a23afedcf /xfa/fde/css/cfde_cssdeclaration.h | |
parent | 1b08df18300bbc67dabd12fb35ab6ce1732a1024 (diff) | |
download | pdfium-21e954b59fcef1b84fdcdb9ae337e2d4c060b19e.tar.xz |
Remove CopyToLocal from CFDE_CSSDeclaration
This CL removes the CopyToLocal method and creates CFX_WideString's directly.
This fixes several memory leaks as the CopyToLocal strings were not cleaned
up correctly.
Change-Id: Ie5ba4cdc4d713cd0b8e3fb85e02f27dc09f38af1
Reviewed-on: https://pdfium-review.googlesource.com/2553
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssdeclaration.h')
-rw-r--r-- | xfa/fde/css/cfde_cssdeclaration.h | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/xfa/fde/css/cfde_cssdeclaration.h b/xfa/fde/css/cfde_cssdeclaration.h index 777864efea..7d61675bea 100644 --- a/xfa/fde/css/cfde_cssdeclaration.h +++ b/xfa/fde/css/cfde_cssdeclaration.h @@ -8,17 +8,11 @@ #define XFA_FDE_CSS_CFDE_CSSDECLARATION_H_ #include <memory> -#include <unordered_map> #include <utility> #include <vector> #include "xfa/fde/css/fde_cssdatatable.h" -struct FDE_CSSPropertyArgs { - std::unordered_map<uint32_t, FX_WCHAR*>* pStringCache; - const FDE_CSSPropertyTable* pProperty; -}; - class CFDE_CSSPropertyHolder; class CFDE_CSSCustomProperty; @@ -52,14 +46,9 @@ class CFDE_CSSDeclaration { bool empty() const { return properties_.empty(); } - void AddProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen); - void AddProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszName, - int32_t iNameLen, - const FX_WCHAR* pszValue, - int32_t iValueLen); + void AddProperty(const FDE_CSSPropertyTable* pTable, + const CFX_WideStringC& value); + void AddProperty(const CFX_WideString& prop, const CFX_WideString& value); size_t PropertyCountForTesting() const; @@ -68,14 +57,13 @@ class CFDE_CSSDeclaration { FX_ARGB* dwColor) const; private: - void ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, + void ParseFontProperty(const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); bool ParseBorderProperty(const FX_WCHAR* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const; - void ParseValueListProperty(const FDE_CSSPropertyArgs* pArgs, + void ParseValueListProperty(const FDE_CSSPropertyTable* pTable, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); @@ -85,21 +73,14 @@ class CFDE_CSSDeclaration { FDE_CSSProperty eTop, FDE_CSSProperty eRight, FDE_CSSProperty eBottom); - CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const FX_WCHAR* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const FX_WCHAR* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseColor(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseColor(const FX_WCHAR* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseString(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseString(const FX_WCHAR* pszValue, int32_t iValueLen); - const FX_WCHAR* CopyToLocal(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen); void AddPropertyHolder(FDE_CSSProperty eProperty, CFX_RetainPtr<CFDE_CSSValue> pValue, bool bImportant); |