| 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 <memory> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "core/fxcrt/include/fx_ext.h" | 13 #include "core/fxcrt/include/fx_ext.h" |
| 13 #include "xfa/fde/css/fde_css.h" | 14 #include "xfa/fde/css/fde_css.h" |
| 14 #include "xfa/fde/css/fde_csscache.h" | 15 #include "xfa/fde/css/fde_csscache.h" |
| 15 #include "xfa/fde/css/fde_cssdeclaration.h" | 16 #include "xfa/fde/css/fde_cssdeclaration.h" |
| 16 #include "xfa/fgas/crt/fgas_memory.h" | 17 #include "xfa/fgas/crt/fgas_memory.h" |
| 17 #include "xfa/fgas/crt/fgas_system.h" | 18 #include "xfa/fgas/crt/fgas_system.h" |
| 18 | 19 |
| 19 class CFDE_CSSAccelerator; | 20 class CFDE_CSSAccelerator; |
| 20 class CFDE_CSSComputedStyle; | 21 class CFDE_CSSComputedStyle; |
| 21 class CXFA_CSSTagProvider; | 22 class CXFA_CSSTagProvider; |
| 22 | 23 |
| 23 class FDE_CSSRuleData : public CFX_Target { | 24 class FDE_CSSRuleData : public CFX_Target { |
| 24 public: | 25 public: |
| 25 FDE_CSSRuleData(CFDE_CSSSelector* pSel, | 26 FDE_CSSRuleData(CFDE_CSSSelector* pSel, |
| 26 CFDE_CSSDeclaration* pDecl, | 27 CFDE_CSSDeclaration* pDecl, |
| 27 uint32_t dwPos); | 28 uint32_t dwPos); |
| 28 | 29 |
| 29 CFDE_CSSSelector* pSelector; | 30 CFDE_CSSSelector* const pSelector; |
| 30 CFDE_CSSDeclaration* pDeclaration; | 31 CFDE_CSSDeclaration* const pDeclaration; |
| 31 uint32_t dwPriority; | 32 uint32_t dwPriority; |
| 32 FDE_CSSRuleData* pNext; | 33 FDE_CSSRuleData* pNext; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 class CFDE_CSSRuleCollection : public CFX_Target { | 36 class CFDE_CSSRuleCollection : public CFX_Target { |
| 36 public: | 37 public: |
| 37 CFDE_CSSRuleCollection(); | 38 CFDE_CSSRuleCollection(); |
| 38 ~CFDE_CSSRuleCollection() override; | 39 ~CFDE_CSSRuleCollection() override; |
| 39 | 40 |
| 40 void AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, | 41 void AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 CFX_MapPtrToPtr m_IDRules; | 82 CFX_MapPtrToPtr m_IDRules; |
| 82 CFX_MapPtrToPtr m_TagRules; | 83 CFX_MapPtrToPtr m_TagRules; |
| 83 CFX_MapPtrToPtr m_ClassRules; | 84 CFX_MapPtrToPtr m_ClassRules; |
| 84 FDE_CSSRuleData* m_pUniversalRules; | 85 FDE_CSSRuleData* m_pUniversalRules; |
| 85 FDE_CSSRuleData* m_pPersudoRules; | 86 FDE_CSSRuleData* m_pPersudoRules; |
| 86 int32_t m_iSelectors; | 87 int32_t m_iSelectors; |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 class CFDE_CSSStyleSelector : public CFX_Target { | 90 class CFDE_CSSStyleSelector : public CFX_Target { |
| 90 public: | 91 public: |
| 91 CFDE_CSSStyleSelector(); | 92 explicit CFDE_CSSStyleSelector(IFGAS_FontMgr* pFontMgr); |
| 92 ~CFDE_CSSStyleSelector() override; | 93 ~CFDE_CSSStyleSelector() override; |
| 93 | 94 |
| 94 void SetFontMgr(IFGAS_FontMgr* pFontMgr); | |
| 95 void SetDefFontSize(FX_FLOAT fFontSize); | 95 void SetDefFontSize(FX_FLOAT fFontSize); |
| 96 | 96 |
| 97 FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, | 97 FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, |
| 98 IFDE_CSSStyleSheet* pSheet); | 98 IFDE_CSSStyleSheet* pSheet); |
| 99 FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, | 99 FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, |
| 100 const CFDE_CSSStyleSheetArray* pArray); | 100 const CFDE_CSSStyleSheetArray* pArray); |
| 101 void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, | 101 void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, |
| 102 FDE_CSSSTYLESHEETPRIORITY ePriority); | 102 FDE_CSSSTYLESHEETPRIORITY ePriority); |
| 103 void UpdateStyleIndex(uint32_t dwMediaList); | 103 void UpdateStyleIndex(uint32_t dwMediaList); |
| 104 CFDE_CSSAccelerator* InitAccelerator(); | 104 CFDE_CSSAccelerator* InitAccelerator(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); | 167 FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); |
| 168 FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); | 168 FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); |
| 169 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); | 169 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); |
| 170 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); | 170 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); |
| 171 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); | 171 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); |
| 172 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); | 172 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); |
| 173 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); | 173 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); |
| 174 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); | 174 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); |
| 175 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); | 175 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); |
| 176 | 176 |
| 177 IFGAS_FontMgr* m_pFontMgr; | 177 IFGAS_FontMgr* const m_pFontMgr; |
| 178 FX_FLOAT m_fDefFontSize; | 178 FX_FLOAT m_fDefFontSize; |
| 179 IFX_MemoryAllocator* m_pRuleDataStore; | 179 std::unique_ptr<IFX_MemoryAllocator> m_pRuleDataStore; |
| 180 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; | 180 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; |
| 181 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; | 181 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; |
| 182 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; | 182 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; |
| 183 IFX_MemoryAllocator* m_pInlineStyleStore; | 183 std::unique_ptr<IFX_MemoryAllocator> m_pInlineStyleStore; |
| 184 IFX_MemoryAllocator* m_pFixedStyleStore; | 184 std::unique_ptr<IFX_MemoryAllocator> m_pFixedStyleStore; |
| 185 CFDE_CSSAccelerator* m_pAccelerator; | 185 std::unique_ptr<CFDE_CSSAccelerator> m_pAccelerator; |
| 186 std::vector<FDE_CSSRuleData*> m_MatchedRules; | 186 std::vector<FDE_CSSRuleData*> m_MatchedRules; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 struct FDE_CSSCOUNTERDATA { | 189 struct FDE_CSSCOUNTERDATA { |
| 190 public: | 190 public: |
| 191 FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } | 191 FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } |
| 192 FX_BOOL GetCounterIncrement(int32_t& iValue) { | 192 FX_BOOL GetCounterIncrement(int32_t& iValue) { |
| 193 iValue = m_iIncVal; | 193 iValue = m_iIncVal; |
| 194 return m_bIncrement; | 194 return m_bIncrement; |
| 195 } | 195 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 void SetLineHeight(FX_FLOAT fLineHeight) override; | 406 void SetLineHeight(FX_FLOAT fLineHeight) override; |
| 407 void SetTextIndent(const FDE_CSSLENGTH& textIndent) override; | 407 void SetTextIndent(const FDE_CSSLENGTH& textIndent) override; |
| 408 void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) override; | 408 void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) override; |
| 409 void SetNumberVerticalAlign(FX_FLOAT fAlign) override; | 409 void SetNumberVerticalAlign(FX_FLOAT fAlign) override; |
| 410 void SetTextDecoration(uint32_t dwTextDecoration) override; | 410 void SetTextDecoration(uint32_t dwTextDecoration) override; |
| 411 void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override; | 411 void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override; |
| 412 void AddCustomStyle(const CFX_WideString& wsName, | 412 void AddCustomStyle(const CFX_WideString& wsName, |
| 413 const CFX_WideString& wsValue); | 413 const CFX_WideString& wsValue); |
| 414 | 414 |
| 415 uint32_t m_dwRefCount; | 415 uint32_t m_dwRefCount; |
| 416 IFX_MemoryAllocator* m_pAllocator; | 416 IFX_MemoryAllocator* const m_pAllocator; |
| 417 CFDE_CSSInheritedData m_InheritedData; | 417 CFDE_CSSInheritedData m_InheritedData; |
| 418 CFDE_CSSNonInheritedData m_NonInheritedData; | 418 CFDE_CSSNonInheritedData m_NonInheritedData; |
| 419 CFX_WideStringArray m_CustomProperties; | 419 CFX_WideStringArray m_CustomProperties; |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 422 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
| OLD | NEW |