| 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 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, IFDE_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 |
| 28 FDE_CSSTagCache* GetParent() const { return pParent; } | 29 FDE_CSSTagCache* GetParent() const { return pParent; } |
| 29 IFDE_CSSTagProvider* GetTag() const { return pTag; } | 30 CXFA_CSSTagProvider* GetTag() const { return pTag; } |
| 31 |
| 30 uint32_t HashID() const { return dwIDHash; } | 32 uint32_t HashID() const { return dwIDHash; } |
| 31 uint32_t HashTag() const { return dwTagHash; } | 33 uint32_t HashTag() const { return dwTagHash; } |
| 32 int32_t CountHashClass() const { return dwClassHashs.GetSize(); } | 34 int32_t CountHashClass() const { return dwClassHashs.GetSize(); } |
| 35 |
| 33 void SetClassIndex(int32_t index) { iClassIndex = index; } | 36 void SetClassIndex(int32_t index) { iClassIndex = index; } |
| 34 uint32_t HashClass() const { | 37 uint32_t HashClass() const { |
| 35 return iClassIndex < dwClassHashs.GetSize() | 38 return iClassIndex < dwClassHashs.GetSize() |
| 36 ? dwClassHashs.GetAt(iClassIndex) | 39 ? dwClassHashs.GetAt(iClassIndex) |
| 37 : 0; | 40 : 0; |
| 38 } | 41 } |
| 39 | 42 |
| 40 protected: | 43 protected: |
| 41 IFDE_CSSTagProvider* pTag; | 44 CXFA_CSSTagProvider* pTag; |
| 42 FDE_CSSTagCache* pParent; | 45 FDE_CSSTagCache* pParent; |
| 43 uint32_t dwIDHash; | 46 uint32_t dwIDHash; |
| 44 uint32_t dwTagHash; | 47 uint32_t dwTagHash; |
| 45 int32_t iClassIndex; | 48 int32_t iClassIndex; |
| 46 CFDE_DWordArray dwClassHashs; | 49 CFDE_DWordArray dwClassHashs; |
| 47 }; | 50 }; |
| 48 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack; | 51 typedef CFX_ObjectStackTemplate<FDE_CSSTagCache> CFDE_CSSTagStack; |
| 49 | 52 |
| 50 class CFDE_CSSAccelerator : public CFX_Target { | 53 class CFDE_CSSAccelerator : public CFX_Target { |
| 51 public: | 54 public: |
| 52 void OnEnterTag(IFDE_CSSTagProvider* pTag); | 55 void OnEnterTag(CXFA_CSSTagProvider* pTag); |
| 53 void OnLeaveTag(IFDE_CSSTagProvider* pTag); | 56 void OnLeaveTag(CXFA_CSSTagProvider* pTag); |
| 54 | 57 |
| 55 void Clear() { m_Stack.RemoveAll(); } | 58 void Clear() { m_Stack.RemoveAll(); } |
| 56 | 59 |
| 57 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } | 60 FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } |
| 58 | 61 |
| 59 protected: | 62 protected: |
| 60 CFDE_CSSTagStack m_Stack; | 63 CFDE_CSSTagStack m_Stack; |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ | 66 #endif // XFA_FDE_CSS_FDE_CSSCACHE_H_ |
| OLD | NEW |