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_CSSSTYLESELECTOR_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
8 #define XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 8 #define XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 FDE_CSSRuleData* GetClassRuleData(uint32_t dwIDHash) { | 62 FDE_CSSRuleData* GetClassRuleData(uint32_t dwIDHash) { |
63 void* pData; | 63 void* pData; |
64 return m_ClassRules.Lookup((void*)(uintptr_t)dwIDHash, pData) | 64 return m_ClassRules.Lookup((void*)(uintptr_t)dwIDHash, pData) |
65 ? (FDE_CSSRuleData*)pData | 65 ? (FDE_CSSRuleData*)pData |
66 : NULL; | 66 : NULL; |
67 } | 67 } |
68 FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; } | 68 FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; } |
69 FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; } | 69 FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; } |
70 | 70 |
71 IFX_MEMAllocator* m_pStaticStore; | 71 IFX_MemoryAllocator* m_pStaticStore; |
72 | 72 |
73 protected: | 73 protected: |
74 void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, | 74 void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, |
75 IFDE_CSSRule* pRule, | 75 IFDE_CSSRule* pRule, |
76 uint32_t dwMediaList, | 76 uint32_t dwMediaList, |
77 IFX_FontMgr* pFontMgr); | 77 IFX_FontMgr* pFontMgr); |
78 void AddRuleTo(CFX_MapPtrToPtr& map, | 78 void AddRuleTo(CFX_MapPtrToPtr& map, |
79 uint32_t dwKey, | 79 uint32_t dwKey, |
80 CFDE_CSSSelector* pSel, | 80 CFDE_CSSSelector* pSel, |
81 CFDE_CSSDeclaration* pDecl); | 81 CFDE_CSSDeclaration* pDecl); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); | 175 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); |
176 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); | 176 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); |
177 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); | 177 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); |
178 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); | 178 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); |
179 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); | 179 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); |
180 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); | 180 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); |
181 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); | 181 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); |
182 | 182 |
183 IFX_FontMgr* m_pFontMgr; | 183 IFX_FontMgr* m_pFontMgr; |
184 FX_FLOAT m_fDefFontSize; | 184 FX_FLOAT m_fDefFontSize; |
185 IFX_MEMAllocator* m_pRuleDataStore; | 185 IFX_MemoryAllocator* m_pRuleDataStore; |
186 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; | 186 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; |
187 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; | 187 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; |
188 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; | 188 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; |
189 IFX_MEMAllocator* m_pInlineStyleStore; | 189 IFX_MemoryAllocator* m_pInlineStyleStore; |
190 IFX_MEMAllocator* m_pFixedStyleStore; | 190 IFX_MemoryAllocator* m_pFixedStyleStore; |
191 CFDE_CSSAccelerator* m_pAccelerator; | 191 CFDE_CSSAccelerator* m_pAccelerator; |
192 std::vector<FDE_CSSRuleData*> m_MatchedRules; | 192 std::vector<FDE_CSSRuleData*> m_MatchedRules; |
193 }; | 193 }; |
194 | 194 |
195 struct FDE_CSSCOUNTERDATA { | 195 struct FDE_CSSCOUNTERDATA { |
196 public: | 196 public: |
197 FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } | 197 FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } |
198 FX_BOOL GetCounterIncrement(int32_t& iValue) { | 198 FX_BOOL GetCounterIncrement(int32_t& iValue) { |
199 iValue = m_iIncVal; | 199 iValue = m_iIncVal; |
200 return m_bIncrement; | 200 return m_bIncrement; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 uint32_t m_bHasTextCombineNumber : 1; | 380 uint32_t m_bHasTextCombineNumber : 1; |
381 }; | 381 }; |
382 | 382 |
383 class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, | 383 class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, |
384 public IFDE_CSSBoundaryStyle, | 384 public IFDE_CSSBoundaryStyle, |
385 public IFDE_CSSFontStyle, | 385 public IFDE_CSSFontStyle, |
386 public IFDE_CSSPositionStyle, | 386 public IFDE_CSSPositionStyle, |
387 public IFDE_CSSParagraphStyle, | 387 public IFDE_CSSParagraphStyle, |
388 public CFX_Target { | 388 public CFX_Target { |
389 public: | 389 public: |
390 CFDE_CSSComputedStyle(IFX_MEMAllocator* pAlloc) | 390 CFDE_CSSComputedStyle(IFX_MemoryAllocator* pAlloc) |
391 : m_dwRefCount(1), m_pAllocator(pAlloc) {} | 391 : m_dwRefCount(1), m_pAllocator(pAlloc) {} |
392 | 392 |
393 ~CFDE_CSSComputedStyle() {} | 393 ~CFDE_CSSComputedStyle() {} |
394 | 394 |
395 // IFX_Unknown: | 395 // IFX_Unknown: |
396 uint32_t AddRef() override { return ++m_dwRefCount; } | 396 uint32_t AddRef() override { return ++m_dwRefCount; } |
397 | 397 |
398 uint32_t Release() override { | 398 uint32_t Release() override { |
399 uint32_t dwRefCount = --m_dwRefCount; | 399 uint32_t dwRefCount = --m_dwRefCount; |
400 if (dwRefCount == 0) { | 400 if (dwRefCount == 0) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 m_InheritedData.m_LetterSpacing = letterSpacing; | 573 m_InheritedData.m_LetterSpacing = letterSpacing; |
574 } | 574 } |
575 | 575 |
576 void AddCustomStyle(const CFX_WideString& wsName, | 576 void AddCustomStyle(const CFX_WideString& wsName, |
577 const CFX_WideString& wsValue) { | 577 const CFX_WideString& wsValue) { |
578 m_CustomProperties.Add(wsName); | 578 m_CustomProperties.Add(wsName); |
579 m_CustomProperties.Add(wsValue); | 579 m_CustomProperties.Add(wsValue); |
580 } | 580 } |
581 | 581 |
582 uint32_t m_dwRefCount; | 582 uint32_t m_dwRefCount; |
583 IFX_MEMAllocator* m_pAllocator; | 583 IFX_MemoryAllocator* m_pAllocator; |
584 CFDE_CSSInheritedData m_InheritedData; | 584 CFDE_CSSInheritedData m_InheritedData; |
585 CFDE_CSSNonInheritedData m_NonInheritedData; | 585 CFDE_CSSNonInheritedData m_NonInheritedData; |
586 CFX_WideStringArray m_CustomProperties; | 586 CFX_WideStringArray m_CustomProperties; |
587 }; | 587 }; |
588 | 588 |
589 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 589 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
OLD | NEW |