summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_cssrulecollection.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-23 15:39:01 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-24 14:47:55 +0000
commitaee2d80f628ba02d0561c921b7bb1939b3480fca (patch)
tree15e3c3060fe9f7ef069ce901d371051212a0e4ab /xfa/fde/css/cfde_cssrulecollection.h
parent1339133720c3b8bce77e970b479ec179160f30b5 (diff)
downloadpdfium-aee2d80f628ba02d0561c921b7bb1939b3480fca.tar.xz
Cleanup memory in CFDE_CSSRuleCollection
This Cl cleans up the memory for the CFDE_CSSRuleCollection::Data parameter. Change-Id: I449ffdeebdc6463bf68b991fffecdc6cf0b25362 Reviewed-on: https://pdfium-review.googlesource.com/2296 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssrulecollection.h')
-rw-r--r--xfa/fde/css/cfde_cssrulecollection.h22
1 files changed, 7 insertions, 15 deletions
diff --git a/xfa/fde/css/cfde_cssrulecollection.h b/xfa/fde/css/cfde_cssrulecollection.h
index 47e7696c34..d9bbeb3736 100644
--- a/xfa/fde/css/cfde_cssrulecollection.h
+++ b/xfa/fde/css/cfde_cssrulecollection.h
@@ -8,6 +8,8 @@
#define XFA_FDE_CSS_CFDE_CSSRULECOLLECTION_H_
#include <map>
+#include <memory>
+#include <vector>
#include "core/fxcrt/fx_basic.h"
@@ -21,12 +23,10 @@ class CFDE_CSSRuleCollection {
public:
class Data {
public:
- Data(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl, uint32_t dwPos);
+ Data(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl);
CFDE_CSSSelector* const pSelector;
CFDE_CSSDeclaration* const pDeclaration;
- uint32_t dwPriority;
- Data* pNext;
};
CFDE_CSSRuleCollection();
@@ -36,23 +36,15 @@ class CFDE_CSSRuleCollection {
void Clear();
int32_t CountSelectors() const { return m_iSelectors; }
- Data* GetTagRuleData(uint32_t dwTagHash) {
- auto it = m_TagRules.find(dwTagHash);
- return it != m_TagRules.end() ? it->second : nullptr;
- }
+ const std::vector<std::unique_ptr<Data>>* GetTagRuleData(
+ uint32_t dwTagHash) const;
private:
void AddRulesFrom(const CFDE_CSSStyleSheet* pStyleSheet,
CFDE_CSSStyleRule* pRule,
CFGAS_FontMgr* pFontMgr);
- void AddRuleTo(std::map<uint32_t, Data*>* pMap,
- uint32_t dwKey,
- CFDE_CSSSelector* pSel,
- CFDE_CSSDeclaration* pDecl);
- bool AddRuleTo(Data** pList, Data* pData);
- Data* NewRuleData(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl);
-
- std::map<uint32_t, Data*> m_TagRules;
+
+ std::map<uint32_t, std::vector<std::unique_ptr<Data>>> m_TagRules;
int32_t m_iSelectors;
};