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_CSSSTYLESHEET_H_ 8 #define CORE_FXCRT_CSS_CFX_CSSSTYLESHEET_H_ 9 10 #include <memory> 11 #include <vector> 12 13 #include "core/fxcrt/css/cfx_csssyntaxparser.h" 14 #include "core/fxcrt/widestring.h" 15 16 class CFX_CSSStyleRule; 17 18 class CFX_CSSStyleSheet { 19 public: 20 CFX_CSSStyleSheet(); 21 ~CFX_CSSStyleSheet(); 22 23 bool LoadBuffer(WideStringView buffer); 24 size_t CountRules() const; 25 CFX_CSSStyleRule* GetRule(size_t index) const; 26 27 private: 28 CFX_CSSSyntaxParser::Status LoadStyleRule(CFX_CSSSyntaxParser* pSyntax); 29 void SkipRuleSet(CFX_CSSSyntaxParser* pSyntax); 30 31 std::vector<std::unique_ptr<CFX_CSSStyleRule>> m_RuleArray; 32 }; 33 34 #endif // CORE_FXCRT_CSS_CFX_CSSSTYLESHEET_H_ 35