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_CSSCACHE_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSSCACHE_H_ |
8 #define XFA_FDE_CSS_FDE_CSSCACHE_H_ | 8 #define XFA_FDE_CSS_FDE_CSSCACHE_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "xfa/fde/css/fde_css.h" | 12 #include "xfa/fde/css/fde_css.h" |
13 #include "xfa/fgas/crt/fgas_memory.h" | 13 #include "xfa/fgas/crt/fgas_memory.h" |
14 | 14 |
15 class FDE_CSSCacheItem : public CFX_Target { | 15 class FDE_CSSCacheItem : public CFX_Target { |
16 public: | 16 public: |
17 explicit FDE_CSSCacheItem(IFDE_CSSStyleSheet* p); | 17 explicit FDE_CSSCacheItem(IFDE_CSSStyleSheet* p); |
18 ~FDE_CSSCacheItem(); | 18 ~FDE_CSSCacheItem() override; |
19 | 19 |
20 IFDE_CSSStyleSheet* pStylesheet; | 20 IFDE_CSSStyleSheet* pStylesheet; |
21 uint32_t dwActivity; | 21 uint32_t dwActivity; |
22 }; | 22 }; |
23 | 23 |
24 class FDE_CSSTagCache : public CFX_Target { | 24 class FDE_CSSTagCache : public CFX_Target { |
25 public: | 25 public: |
26 FDE_CSSTagCache(FDE_CSSTagCache* parent, CXFA_CSSTagProvider* tag); | 26 FDE_CSSTagCache(FDE_CSSTagCache* parent, CXFA_CSSTagProvider* tag); |
27 FDE_CSSTagCache(const FDE_CSSTagCache& it); | 27 FDE_CSSTagCache(const FDE_CSSTagCache& it); |
| 28 ~FDE_CSSTagCache() override; |
28 | 29 |
29 FDE_CSSTagCache* GetParent() const { return pParent; } | 30 FDE_CSSTagCache* GetParent() const { return pParent; } |
30 CXFA_CSSTagProvider* GetTag() const { return pTag; } | 31 CXFA_CSSTagProvider* GetTag() const { return pTag; } |
31 | 32 |
32 uint32_t HashID() const { return dwIDHash; } | 33 uint32_t HashID() const { return dwIDHash; } |
33 uint32_t HashTag() const { return dwTagHash; } | 34 uint32_t HashTag() const { return dwTagHash; } |
34 int32_t CountHashClass() const { return dwClassHashs.GetSize(); } | 35 int32_t CountHashClass() const { return dwClassHashs.GetSize(); } |
35 | 36 |
36 void SetClassIndex(int32_t index) { iClassIndex = index; } | 37 void SetClassIndex(int32_t index) { iClassIndex = index; } |
37 uint32_t HashClass() const { | 38 uint32_t HashClass() const { |
38 return iClassIndex < dwClassHashs.GetSize() | 39 return iClassIndex < dwClassHashs.GetSize() |
39 ? dwClassHashs.GetAt(iClassIndex) | 40 ? dwClassHashs.GetAt(iClassIndex) |
40 : 0; | 41 : 0; |
41 } | 42 } |
42 | 43 |
43 protected: | 44 protected: |
44 CXFA_CSSTagProvider* pTag; | 45 CXFA_CSSTagProvider* pTag; |
45 FDE_CSSTagCache* pParent; | 46 FDE_CSSTagCache* pParent; |
46 uint32_t dwIDHash; | 47 uint32_t dwIDHash; |
47 uint32_t dwTagHash; | 48 uint32_t dwTagHash; |
48 int32_t iClassIndex; | 49 int32_t iClassIndex; |
49 CFX_BaseArrayTemplate<uint32_t> dwClassHashs; | 50 CFX_BaseArrayTemplate<uint32_t> dwClassHashs; |
50 }; | 51 }; |
51 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack; | 52 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack; |
52 | 53 |
53 class CFDE_CSSAccelerator : public CFX_Target { | 54 class CFDE_CSSAccelerator : public CFX_Target { |
54 public: | 55 public: |
| 56 CFDE_CSSAccelerator(); |
| 57 ~CFDE_CSSAccelerator() override; |
| 58 |
55 void OnEnterTag(CXFA_CSSTagProvider* pTag); | 59 void OnEnterTag(CXFA_CSSTagProvider* pTag); |
56 void OnLeaveTag(CXFA_CSSTagProvider* pTag); | 60 void OnLeaveTag(CXFA_CSSTagProvider* pTag); |
57 | 61 |
58 void Clear() { m_Stack.RemoveAll(); } | 62 void Clear() { m_Stack.RemoveAll(); } |
59 | 63 |
60 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } | 64 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } |
61 | 65 |
62 protected: | 66 protected: |
63 CFDE_CSSTagStack m_Stack; | 67 CFDE_CSSTagStack m_Stack; |
64 }; | 68 }; |
65 | 69 |
66 #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ | 70 #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ |
OLD | NEW |