Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: xfa/fde/css/fde_cssstyleselector.h

Issue 1928763002: Cleanup IFDE_CSS interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fde/css/fde_cssdeclaration.h ('k') | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "core/fxcrt/include/fx_ext.h" 12 #include "core/fxcrt/include/fx_ext.h"
13 #include "xfa/fde/css/fde_css.h" 13 #include "xfa/fde/css/fde_css.h"
14 #include "xfa/fde/css/fde_csscache.h" 14 #include "xfa/fde/css/fde_csscache.h"
15 #include "xfa/fde/css/fde_cssdeclaration.h" 15 #include "xfa/fde/css/fde_cssdeclaration.h"
16 #include "xfa/fgas/crt/fgas_memory.h" 16 #include "xfa/fgas/crt/fgas_memory.h"
17 #include "xfa/fgas/crt/fgas_system.h" 17 #include "xfa/fgas/crt/fgas_system.h"
18 18
19 class CFDE_CSSAccelerator; 19 class CFDE_CSSAccelerator;
20 class CFDE_CSSComputedStyle; 20 class CFDE_CSSComputedStyle;
21 class CXFA_CSSTagProvider; 21 class CXFA_CSSTagProvider;
22 22
23 class FDE_CSSRuleData : public CFX_Target { 23 class FDE_CSSRuleData : public CFX_Target {
24 public: 24 public:
25 FDE_CSSRuleData(IFDE_CSSSelector* pSel, 25 FDE_CSSRuleData(CFDE_CSSSelector* pSel,
26 IFDE_CSSDeclaration* pDecl, 26 CFDE_CSSDeclaration* pDecl,
27 uint32_t dwPos); 27 uint32_t dwPos);
28 28
29 IFDE_CSSSelector* pSelector; 29 CFDE_CSSSelector* pSelector;
30 IFDE_CSSDeclaration* pDeclaration; 30 CFDE_CSSDeclaration* pDeclaration;
31 uint32_t dwPriority; 31 uint32_t dwPriority;
32 FDE_CSSRuleData* pNext; 32 FDE_CSSRuleData* pNext;
33 }; 33 };
34 34
35 class CFDE_CSSRuleCollection : public CFX_Target { 35 class CFDE_CSSRuleCollection : public CFX_Target {
36 public: 36 public:
37 CFDE_CSSRuleCollection() 37 CFDE_CSSRuleCollection()
38 : m_pStaticStore(nullptr), 38 : m_pStaticStore(nullptr),
39 m_pUniversalRules(nullptr), 39 m_pUniversalRules(nullptr),
40 m_pPersudoRules(nullptr), 40 m_pPersudoRules(nullptr),
(...skipping 29 matching lines...) Expand all
70 70
71 IFX_MEMAllocator* m_pStaticStore; 71 IFX_MEMAllocator* 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 IFDE_CSSSelector* pSel, 80 CFDE_CSSSelector* pSel,
81 IFDE_CSSDeclaration* pDecl); 81 CFDE_CSSDeclaration* pDecl);
82 FX_BOOL AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData); 82 FX_BOOL AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData);
83 FDE_CSSRuleData* NewRuleData(IFDE_CSSSelector* pSel, 83 FDE_CSSRuleData* NewRuleData(CFDE_CSSSelector* pSel,
84 IFDE_CSSDeclaration* pDecl); 84 CFDE_CSSDeclaration* pDecl);
85 CFX_MapPtrToPtr m_IDRules; 85 CFX_MapPtrToPtr m_IDRules;
86 CFX_MapPtrToPtr m_TagRules; 86 CFX_MapPtrToPtr m_TagRules;
87 CFX_MapPtrToPtr m_ClassRules; 87 CFX_MapPtrToPtr m_ClassRules;
88 FDE_CSSRuleData* m_pUniversalRules; 88 FDE_CSSRuleData* m_pUniversalRules;
89 FDE_CSSRuleData* m_pPersudoRules; 89 FDE_CSSRuleData* m_pPersudoRules;
90 int32_t m_iSelectors; 90 int32_t m_iSelectors;
91 }; 91 };
92 92
93 class CFDE_CSSStyleSelector : public IFDE_CSSStyleSelector, public CFX_Target { 93 class CFDE_CSSStyleSelector : public CFX_Target {
94 public: 94 public:
95 CFDE_CSSStyleSelector(); 95 CFDE_CSSStyleSelector();
96 ~CFDE_CSSStyleSelector(); 96 ~CFDE_CSSStyleSelector();
97 virtual void Release() { delete this; }
98 97
99 virtual void SetFontMgr(IFX_FontMgr* pFontMgr); 98 void Release() { delete this; }
100 virtual void SetDefFontSize(FX_FLOAT fFontSize);
101 99
102 virtual FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, 100 void SetFontMgr(IFX_FontMgr* pFontMgr);
103 IFDE_CSSStyleSheet* pSheet); 101 void SetDefFontSize(FX_FLOAT fFontSize);
104 virtual FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, 102
105 const CFDE_CSSStyleSheetArray* pArray); 103 FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType,
106 virtual void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, 104 IFDE_CSSStyleSheet* pSheet);
107 FDE_CSSSTYLESHEETPRIORITY ePriority); 105 FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType,
108 virtual void UpdateStyleIndex(uint32_t dwMediaList); 106 const CFDE_CSSStyleSheetArray* pArray);
109 virtual CFDE_CSSAccelerator* InitAccelerator(); 107 void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType,
110 virtual IFDE_CSSComputedStyle* CreateComputedStyle( 108 FDE_CSSSTYLESHEETPRIORITY ePriority);
109 void UpdateStyleIndex(uint32_t dwMediaList);
110 CFDE_CSSAccelerator* InitAccelerator();
111 IFDE_CSSComputedStyle* CreateComputedStyle(
111 IFDE_CSSComputedStyle* pParentStyle); 112 IFDE_CSSComputedStyle* pParentStyle);
112 virtual int32_t MatchDeclarations( 113 int32_t MatchDeclarations(CXFA_CSSTagProvider* pTag,
113 CXFA_CSSTagProvider* pTag, 114 CFDE_CSSDeclarationArray& matchedDecls,
114 CFDE_CSSDeclarationArray& matchedDecls, 115 FDE_CSSPERSUDO ePersudoType = FDE_CSSPERSUDO_NONE);
115 FDE_CSSPERSUDO ePersudoType = FDE_CSSPERSUDO_NONE); 116 void ComputeStyle(CXFA_CSSTagProvider* pTag,
116 virtual void ComputeStyle(CXFA_CSSTagProvider* pTag, 117 const CFDE_CSSDeclaration** ppDeclArray,
117 const IFDE_CSSDeclaration** ppDeclArray, 118 int32_t iDeclCount,
118 int32_t iDeclCount, 119 IFDE_CSSComputedStyle* pDestStyle);
119 IFDE_CSSComputedStyle* pDestStyle);
120 120
121 protected: 121 protected:
122 void Reset(); 122 void Reset();
123 void MatchRules(FDE_CSSTagCache* pCache, 123 void MatchRules(FDE_CSSTagCache* pCache,
124 FDE_CSSRuleData* pList, 124 FDE_CSSRuleData* pList,
125 FDE_CSSPERSUDO ePersudoType); 125 FDE_CSSPERSUDO ePersudoType);
126 FX_BOOL MatchSelector(FDE_CSSTagCache* pCache, 126 FX_BOOL MatchSelector(FDE_CSSTagCache* pCache,
127 IFDE_CSSSelector* pSel, 127 CFDE_CSSSelector* pSel,
128 FDE_CSSPERSUDO ePersudoType); 128 FDE_CSSPERSUDO ePersudoType);
129 void AppendInlineStyle(CFDE_CSSDeclaration* pDecl, 129 void AppendInlineStyle(CFDE_CSSDeclaration* pDecl,
130 const FX_WCHAR* psz, 130 const FX_WCHAR* psz,
131 int32_t iLen); 131 int32_t iLen);
132 void ApplyDeclarations(FX_BOOL bPriority, 132 void ApplyDeclarations(FX_BOOL bPriority,
133 const IFDE_CSSDeclaration** ppDeclArray, 133 const CFDE_CSSDeclaration** ppDeclArray,
134 int32_t iDeclCount, 134 int32_t iDeclCount,
135 IFDE_CSSComputedStyle* pDestStyle); 135 IFDE_CSSComputedStyle* pDestStyle);
136 void ApplyProperty(FDE_CSSPROPERTY eProperty, 136 void ApplyProperty(FDE_CSSPROPERTY eProperty,
137 IFDE_CSSValue* pValue, 137 IFDE_CSSValue* pValue,
138 CFDE_CSSComputedStyle* pComputedStyle); 138 CFDE_CSSComputedStyle* pComputedStyle);
139 139
140 FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, 140 FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit,
141 FX_FLOAT fValue, 141 FX_FLOAT fValue,
142 FX_FLOAT fPercentBase); 142 FX_FLOAT fPercentBase);
143 FX_BOOL SetLengthWithPercent(FDE_CSSLENGTH& width, 143 FX_BOOL SetLengthWithPercent(FDE_CSSLENGTH& width,
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 582 }
583 583
584 uint32_t m_dwRefCount; 584 uint32_t m_dwRefCount;
585 IFX_MEMAllocator* m_pAllocator; 585 IFX_MEMAllocator* m_pAllocator;
586 CFDE_CSSInheritedData m_InheritedData; 586 CFDE_CSSInheritedData m_InheritedData;
587 CFDE_CSSNonInheritedData m_NonInheritedData; 587 CFDE_CSSNonInheritedData m_NonInheritedData;
588 CFX_WideStringArray m_CustomProperties; 588 CFX_WideStringArray m_CustomProperties;
589 }; 589 };
590 590
591 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ 591 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssdeclaration.h ('k') | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698