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(); |
19 | 19 |
20 IFDE_CSSStyleSheet* pStylesheet; | 20 IFDE_CSSStyleSheet* pStylesheet; |
21 FX_DWORD dwActivity; | 21 uint32_t dwActivity; |
22 }; | 22 }; |
23 | 23 |
24 class CFDE_CSSStyleSheetCache : public IFDE_CSSStyleSheetCache, | 24 class CFDE_CSSStyleSheetCache : public IFDE_CSSStyleSheetCache, |
25 public CFX_Target { | 25 public CFX_Target { |
26 public: | 26 public: |
27 CFDE_CSSStyleSheetCache(); | 27 CFDE_CSSStyleSheetCache(); |
28 ~CFDE_CSSStyleSheetCache(); | 28 ~CFDE_CSSStyleSheetCache(); |
29 virtual void Release() { delete this; } | 29 virtual void Release() { delete this; } |
30 | 30 |
31 virtual void SetMaxItems(int32_t iMaxCount = 5) { | 31 virtual void SetMaxItems(int32_t iMaxCount = 5) { |
(...skipping 12 matching lines...) Expand all Loading... |
44 IFX_MEMAllocator* m_pFixedStore; | 44 IFX_MEMAllocator* m_pFixedStore; |
45 int32_t m_iMaxItems; | 45 int32_t m_iMaxItems; |
46 }; | 46 }; |
47 | 47 |
48 class FDE_CSSTagCache : public CFX_Target { | 48 class FDE_CSSTagCache : public CFX_Target { |
49 public: | 49 public: |
50 FDE_CSSTagCache(FDE_CSSTagCache* parent, IFDE_CSSTagProvider* tag); | 50 FDE_CSSTagCache(FDE_CSSTagCache* parent, IFDE_CSSTagProvider* tag); |
51 FDE_CSSTagCache(const FDE_CSSTagCache& it); | 51 FDE_CSSTagCache(const FDE_CSSTagCache& it); |
52 FDE_CSSTagCache* GetParent() const { return pParent; } | 52 FDE_CSSTagCache* GetParent() const { return pParent; } |
53 IFDE_CSSTagProvider* GetTag() const { return pTag; } | 53 IFDE_CSSTagProvider* GetTag() const { return pTag; } |
54 FX_DWORD HashID() const { return dwIDHash; } | 54 uint32_t HashID() const { return dwIDHash; } |
55 FX_DWORD HashTag() const { return dwTagHash; } | 55 uint32_t HashTag() const { return dwTagHash; } |
56 int32_t CountHashClass() const { return dwClassHashs.GetSize(); } | 56 int32_t CountHashClass() const { return dwClassHashs.GetSize(); } |
57 void SetClassIndex(int32_t index) { iClassIndex = index; } | 57 void SetClassIndex(int32_t index) { iClassIndex = index; } |
58 FX_DWORD HashClass() const { | 58 uint32_t HashClass() const { |
59 return iClassIndex < dwClassHashs.GetSize() | 59 return iClassIndex < dwClassHashs.GetSize() |
60 ? dwClassHashs.GetAt(iClassIndex) | 60 ? dwClassHashs.GetAt(iClassIndex) |
61 : 0; | 61 : 0; |
62 } | 62 } |
63 | 63 |
64 protected: | 64 protected: |
65 IFDE_CSSTagProvider* pTag; | 65 IFDE_CSSTagProvider* pTag; |
66 FDE_CSSTagCache* pParent; | 66 FDE_CSSTagCache* pParent; |
67 FX_DWORD dwIDHash; | 67 uint32_t dwIDHash; |
68 FX_DWORD dwTagHash; | 68 uint32_t dwTagHash; |
69 int32_t iClassIndex; | 69 int32_t iClassIndex; |
70 CFDE_DWordArray dwClassHashs; | 70 CFDE_DWordArray dwClassHashs; |
71 }; | 71 }; |
72 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack; | 72 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack; |
73 | 73 |
74 class CFDE_CSSAccelerator : public IFDE_CSSAccelerator, public CFX_Target { | 74 class CFDE_CSSAccelerator : public IFDE_CSSAccelerator, public CFX_Target { |
75 public: | 75 public: |
76 virtual void OnEnterTag(IFDE_CSSTagProvider* pTag); | 76 virtual void OnEnterTag(IFDE_CSSTagProvider* pTag); |
77 virtual void OnLeaveTag(IFDE_CSSTagProvider* pTag); | 77 virtual void OnLeaveTag(IFDE_CSSTagProvider* pTag); |
78 void Clear() { m_Stack.RemoveAll(); } | 78 void Clear() { m_Stack.RemoveAll(); } |
79 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } | 79 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } |
80 | 80 |
81 protected: | 81 protected: |
82 CFDE_CSSTagStack m_Stack; | 82 CFDE_CSSTagStack m_Stack; |
83 }; | 83 }; |
84 | 84 |
85 #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ | 85 #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ |
OLD | NEW |