1 // Copyright 2017 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FXCRT_CSS_CFX_CSSRULECOLLECTION_H_ 8 #define CORE_FXCRT_CSS_CFX_CSSRULECOLLECTION_H_ 9 10 #include <map> 11 #include <memory> 12 #include <vector> 13 14 #include "core/fxcrt/widestring.h" 15 16 class CFX_CSSDeclaration; 17 class CFX_CSSSelector; 18 class CFX_CSSStyleRule; 19 class CFX_CSSStyleSheet; 20 21 class CFX_CSSRuleCollection { 22 public: 23 class Data { 24 public: 25 Data(CFX_CSSSelector* pSel, CFX_CSSDeclaration* pDecl); 26 27 CFX_CSSSelector* const pSelector; 28 CFX_CSSDeclaration* const pDeclaration; 29 }; 30 31 CFX_CSSRuleCollection(); 32 ~CFX_CSSRuleCollection(); 33 34 void SetRulesFromSheet(const CFX_CSSStyleSheet* sheet); 35 36 const std::vector<std::unique_ptr<Data>>* GetTagRuleData( 37 const WideString& tagname) const; 38 39 private: 40 void AddRule(CFX_CSSStyleRule* pRule); 41 42 std::map<uint32_t, std::vector<std::unique_ptr<Data>>> m_TagRules; 43 }; 44 45 #endif // CORE_FXCRT_CSS_CFX_CSSRULECOLLECTION_H_ 46