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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); | 168 FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); |
168 FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); | 169 FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); |
169 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); | 170 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); |
170 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); | 171 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); |
171 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); | 172 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); |
172 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); | 173 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); |
173 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); | 174 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); |
174 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); | 175 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); |
175 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); | 176 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); |
176 | 177 |
177 IFGAS_FontMgr* m_pFontMgr; | 178 IFGAS_FontMgr* m_pFontMgr; // not owned. |
178 FX_FLOAT m_fDefFontSize; | 179 FX_FLOAT m_fDefFontSize; |
179 IFX_MemoryAllocator* m_pRuleDataStore; | 180 std::unique_ptr<IFX_MemoryAllocator> m_pRuleDataStore; |
180 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; | 181 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; |
181 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; | 182 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; |
182 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; | 183 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; |
183 IFX_MemoryAllocator* m_pInlineStyleStore; | 184 std::unique_ptr<IFX_MemoryAllocator> m_pInlineStyleStore; |
184 IFX_MemoryAllocator* m_pFixedStyleStore; | 185 std::unique_ptr<IFX_MemoryAllocator> m_pFixedStyleStore; |
185 CFDE_CSSAccelerator* m_pAccelerator; | 186 std::unique_ptr<CFDE_CSSAccelerator> m_pAccelerator; |
186 std::vector<FDE_CSSRuleData*> m_MatchedRules; | 187 std::vector<FDE_CSSRuleData*> m_MatchedRules; |
187 }; | 188 }; |
188 | 189 |
189 struct FDE_CSSCOUNTERDATA { | 190 struct FDE_CSSCOUNTERDATA { |
190 public: | 191 public: |
191 FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } | 192 FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } |
192 FX_BOOL GetCounterIncrement(int32_t& iValue) { | 193 FX_BOOL GetCounterIncrement(int32_t& iValue) { |
193 iValue = m_iIncVal; | 194 iValue = m_iIncVal; |
194 return m_bIncrement; | 195 return m_bIncrement; |
195 } | 196 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 void SetLineHeight(FX_FLOAT fLineHeight) override; | 407 void SetLineHeight(FX_FLOAT fLineHeight) override; |
407 void SetTextIndent(const FDE_CSSLENGTH& textIndent) override; | 408 void SetTextIndent(const FDE_CSSLENGTH& textIndent) override; |
408 void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) override; | 409 void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) override; |
409 void SetNumberVerticalAlign(FX_FLOAT fAlign) override; | 410 void SetNumberVerticalAlign(FX_FLOAT fAlign) override; |
410 void SetTextDecoration(uint32_t dwTextDecoration) override; | 411 void SetTextDecoration(uint32_t dwTextDecoration) override; |
411 void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override; | 412 void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override; |
412 void AddCustomStyle(const CFX_WideString& wsName, | 413 void AddCustomStyle(const CFX_WideString& wsName, |
413 const CFX_WideString& wsValue); | 414 const CFX_WideString& wsValue); |
414 | 415 |
415 uint32_t m_dwRefCount; | 416 uint32_t m_dwRefCount; |
416 IFX_MemoryAllocator* m_pAllocator; | 417 IFX_MemoryAllocator* const m_pAllocator; |
417 CFDE_CSSInheritedData m_InheritedData; | 418 CFDE_CSSInheritedData m_InheritedData; |
418 CFDE_CSSNonInheritedData m_NonInheritedData; | 419 CFDE_CSSNonInheritedData m_NonInheritedData; |
419 CFX_WideStringArray m_CustomProperties; | 420 CFX_WideStringArray m_CustomProperties; |
420 }; | 421 }; |
421 | 422 |
422 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 423 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
OLD | NEW |