OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ |
8 #define XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ | 8 #define XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_ext.h" | 10 #include "core/fxcrt/include/fx_ext.h" |
11 #include "xfa/fde/css/fde_cssdeclaration.h" | 11 #include "xfa/fde/css/fde_cssdeclaration.h" |
12 | 12 |
13 class CFDE_CSSSelector : public IFDE_CSSSelector, public CFX_Target { | 13 class CFDE_CSSSelector : public IFDE_CSSSelector, public CFX_Target { |
14 public: | 14 public: |
15 CFDE_CSSSelector(FDE_CSSSELECTORTYPE eType, | 15 CFDE_CSSSelector(FDE_CSSSELECTORTYPE eType, |
16 const FX_WCHAR* psz, | 16 const FX_WCHAR* psz, |
17 int32_t iLen, | 17 int32_t iLen, |
18 FX_BOOL bIgnoreCase) | 18 bool bIgnoreCase) |
19 : m_eType(eType), | 19 : m_eType(eType), |
20 m_dwHash(FX_HashCode_String_GetW(psz, iLen, bIgnoreCase)), | 20 m_dwHash(FX_HashCode_GetW(CFX_WideStringC(psz, iLen), bIgnoreCase)), |
21 m_pNext(NULL) {} | 21 m_pNext(nullptr) {} |
22 virtual FDE_CSSSELECTORTYPE GetType() const { return m_eType; } | 22 virtual FDE_CSSSELECTORTYPE GetType() const { return m_eType; } |
23 | 23 |
24 virtual uint32_t GetNameHash() const { return m_dwHash; } | 24 virtual uint32_t GetNameHash() const { return m_dwHash; } |
25 | 25 |
26 virtual IFDE_CSSSelector* GetNextSelector() const { return m_pNext; } | 26 virtual IFDE_CSSSelector* GetNextSelector() const { return m_pNext; } |
27 static IFDE_CSSSelector* FromString(IFX_MEMAllocator* pStaticStore, | 27 static IFDE_CSSSelector* FromString(IFX_MEMAllocator* pStaticStore, |
28 const FX_WCHAR* psz, | 28 const FX_WCHAR* psz, |
29 int32_t iLen); | 29 int32_t iLen); |
30 void SetNext(IFDE_CSSSelector* pNext) { m_pNext = pNext; } | 30 void SetNext(IFDE_CSSSelector* pNext) { m_pNext = pNext; } |
31 | 31 |
32 protected: | 32 protected: |
33 static CFDE_CSSSelector* ParseSelector(IFX_MEMAllocator* pStaticStore, | 33 static CFDE_CSSSelector* ParseSelector(IFX_MEMAllocator* pStaticStore, |
34 const FX_WCHAR* psz, | 34 const FX_WCHAR* psz, |
35 int32_t& iOff, | 35 int32_t& iOff, |
36 int32_t iLen, | 36 int32_t iLen, |
37 FDE_CSSSELECTORTYPE eType); | 37 FDE_CSSSELECTORTYPE eType); |
38 void SetType(FDE_CSSSELECTORTYPE eType) { m_eType = eType; } | 38 void SetType(FDE_CSSSELECTORTYPE eType) { m_eType = eType; } |
39 FDE_CSSSELECTORTYPE m_eType; | 39 FDE_CSSSELECTORTYPE m_eType; |
40 uint32_t m_dwHash; | 40 uint32_t m_dwHash; |
41 IFDE_CSSSelector* m_pNext; | 41 IFDE_CSSSelector* m_pNext; |
42 }; | 42 }; |
43 typedef CFX_ArrayTemplate<IFDE_CSSSelector*> CFDE_CSSSelectorArray; | 43 typedef CFX_ArrayTemplate<IFDE_CSSSelector*> CFDE_CSSSelectorArray; |
| 44 |
44 class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { | 45 class CFDE_CSSStyleRule : public IFDE_CSSStyleRule, public CFX_Target { |
45 public: | 46 public: |
46 CFDE_CSSStyleRule() : m_ppSelector(NULL), m_iSelectors(0) {} | 47 CFDE_CSSStyleRule() : m_ppSelector(NULL), m_iSelectors(0) {} |
47 virtual int32_t CountSelectorLists() const { return m_iSelectors; } | 48 virtual int32_t CountSelectorLists() const { return m_iSelectors; } |
48 virtual IFDE_CSSSelector* GetSelectorList(int32_t index) const { | 49 virtual IFDE_CSSSelector* GetSelectorList(int32_t index) const { |
49 return m_ppSelector[index]; | 50 return m_ppSelector[index]; |
50 } | 51 } |
51 | 52 |
52 virtual IFDE_CSSDeclaration* GetDeclaration() const { | 53 virtual IFDE_CSSDeclaration* GetDeclaration() const { |
53 return (IFDE_CSSDeclaration*)&m_Declaration; | 54 return (IFDE_CSSDeclaration*)&m_Declaration; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 uint16_t m_wRefCount; | 133 uint16_t m_wRefCount; |
133 uint32_t m_dwMediaList; | 134 uint32_t m_dwMediaList; |
134 IFX_MEMAllocator* m_pAllocator; | 135 IFX_MEMAllocator* m_pAllocator; |
135 CFDE_CSSRuleArray m_RuleArray; | 136 CFDE_CSSRuleArray m_RuleArray; |
136 CFX_WideString m_szUrl; | 137 CFX_WideString m_szUrl; |
137 CFDE_CSSSelectorArray m_Selectors; | 138 CFDE_CSSSelectorArray m_Selectors; |
138 CFX_MapPtrToPtr m_StringCache; | 139 CFX_MapPtrToPtr m_StringCache; |
139 }; | 140 }; |
140 | 141 |
141 #endif // XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ | 142 #endif // XFA_FDE_CSS_FDE_CSSSTYLESHEET_H_ |
OLD | NEW |