| 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> |
| 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 #define FDE_CSSUNIVERSALHASH ('*') | 19 class CFDE_CSSAccelerator; |
| 20 class CFDE_CSSComputedStyle; |
| 20 | 21 |
| 21 class FDE_CSSRuleData : public CFX_Target { | 22 class FDE_CSSRuleData : public CFX_Target { |
| 22 public: | 23 public: |
| 23 FDE_CSSRuleData(IFDE_CSSSelector* pSel, | 24 FDE_CSSRuleData(IFDE_CSSSelector* pSel, |
| 24 IFDE_CSSDeclaration* pDecl, | 25 IFDE_CSSDeclaration* pDecl, |
| 25 uint32_t dwPos); | 26 uint32_t dwPos); |
| 26 | 27 |
| 27 IFDE_CSSSelector* pSelector; | 28 IFDE_CSSSelector* pSelector; |
| 28 IFDE_CSSDeclaration* pDeclaration; | 29 IFDE_CSSDeclaration* pDeclaration; |
| 29 uint32_t dwPriority; | 30 uint32_t dwPriority; |
| 30 FDE_CSSRuleData* pNext; | 31 FDE_CSSRuleData* pNext; |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 class CFDE_CSSRuleCollection : public CFX_Target { | 34 class CFDE_CSSRuleCollection : public CFX_Target { |
| 34 public: | 35 public: |
| 35 CFDE_CSSRuleCollection() | 36 CFDE_CSSRuleCollection() |
| 36 : m_pStaticStore(nullptr), | 37 : m_pStaticStore(nullptr), |
| 37 m_pUniversalRules(nullptr), | 38 m_pUniversalRules(nullptr), |
| 38 m_pPersudoRules(nullptr), | 39 m_pPersudoRules(nullptr), |
| 39 m_iSelectors(0) {} | 40 m_iSelectors(0) {} |
| 40 ~CFDE_CSSRuleCollection() { Clear(); } | 41 ~CFDE_CSSRuleCollection() { Clear(); } |
| 42 |
| 41 void AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, | 43 void AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, |
| 42 uint32_t dwMediaList, | 44 uint32_t dwMediaList, |
| 43 IFX_FontMgr* pFontMgr); | 45 IFX_FontMgr* pFontMgr); |
| 44 void Clear(); | 46 void Clear(); |
| 45 | 47 |
| 46 int32_t CountSelectors() const { return m_iSelectors; } | 48 int32_t CountSelectors() const { return m_iSelectors; } |
| 47 FDE_CSSRuleData* GetIDRuleData(uint32_t dwIDHash) { | 49 FDE_CSSRuleData* GetIDRuleData(uint32_t dwIDHash) { |
| 48 void* pData; | 50 void* pData; |
| 49 return m_IDRules.Lookup((void*)(uintptr_t)dwIDHash, pData) | 51 return m_IDRules.Lookup((void*)(uintptr_t)dwIDHash, pData) |
| 50 ? (FDE_CSSRuleData*)pData | 52 ? (FDE_CSSRuleData*)pData |
| 51 : NULL; | 53 : NULL; |
| 52 } | 54 } |
| 53 FDE_CSSRuleData* GetTagRuleData(uint32_t dwTagHasn) { | 55 FDE_CSSRuleData* GetTagRuleData(uint32_t dwTagHasn) { |
| 54 void* pData; | 56 void* pData; |
| 55 return m_TagRules.Lookup((void*)(uintptr_t)dwTagHasn, pData) | 57 return m_TagRules.Lookup((void*)(uintptr_t)dwTagHasn, pData) |
| 56 ? (FDE_CSSRuleData*)pData | 58 ? (FDE_CSSRuleData*)pData |
| 57 : NULL; | 59 : NULL; |
| 58 } | 60 } |
| 59 FDE_CSSRuleData* GetClassRuleData(uint32_t dwIDHash) { | 61 FDE_CSSRuleData* GetClassRuleData(uint32_t dwIDHash) { |
| 60 void* pData; | 62 void* pData; |
| 61 return m_ClassRules.Lookup((void*)(uintptr_t)dwIDHash, pData) | 63 return m_ClassRules.Lookup((void*)(uintptr_t)dwIDHash, pData) |
| 62 ? (FDE_CSSRuleData*)pData | 64 ? (FDE_CSSRuleData*)pData |
| 63 : NULL; | 65 : NULL; |
| 64 } | 66 } |
| 65 FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; } | 67 FDE_CSSRuleData* GetUniversalRuleData() { return m_pUniversalRules; } |
| 66 FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; } | 68 FDE_CSSRuleData* GetPersudoRuleData() { return m_pPersudoRules; } |
| 69 |
| 67 IFX_MEMAllocator* m_pStaticStore; | 70 IFX_MEMAllocator* m_pStaticStore; |
| 68 | 71 |
| 69 protected: | 72 protected: |
| 70 void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, | 73 void AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, |
| 71 IFDE_CSSRule* pRule, | 74 IFDE_CSSRule* pRule, |
| 72 uint32_t dwMediaList, | 75 uint32_t dwMediaList, |
| 73 IFX_FontMgr* pFontMgr); | 76 IFX_FontMgr* pFontMgr); |
| 74 void AddRuleTo(CFX_MapPtrToPtr& map, | 77 void AddRuleTo(CFX_MapPtrToPtr& map, |
| 75 uint32_t dwKey, | 78 uint32_t dwKey, |
| 76 IFDE_CSSSelector* pSel, | 79 IFDE_CSSSelector* pSel, |
| 77 IFDE_CSSDeclaration* pDecl); | 80 IFDE_CSSDeclaration* pDecl); |
| 78 FX_BOOL AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData); | 81 FX_BOOL AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData); |
| 79 FDE_CSSRuleData* NewRuleData(IFDE_CSSSelector* pSel, | 82 FDE_CSSRuleData* NewRuleData(IFDE_CSSSelector* pSel, |
| 80 IFDE_CSSDeclaration* pDecl); | 83 IFDE_CSSDeclaration* pDecl); |
| 81 CFX_MapPtrToPtr m_IDRules; | 84 CFX_MapPtrToPtr m_IDRules; |
| 82 CFX_MapPtrToPtr m_TagRules; | 85 CFX_MapPtrToPtr m_TagRules; |
| 83 CFX_MapPtrToPtr m_ClassRules; | 86 CFX_MapPtrToPtr m_ClassRules; |
| 84 FDE_CSSRuleData* m_pUniversalRules; | 87 FDE_CSSRuleData* m_pUniversalRules; |
| 85 FDE_CSSRuleData* m_pPersudoRules; | 88 FDE_CSSRuleData* m_pPersudoRules; |
| 86 int32_t m_iSelectors; | 89 int32_t m_iSelectors; |
| 87 }; | 90 }; |
| 88 class CFDE_CSSAccelerator; | 91 |
| 89 class CFDE_CSSComputedStyle; | |
| 90 class CFDE_CSSStyleSelector : public IFDE_CSSStyleSelector, public CFX_Target { | 92 class CFDE_CSSStyleSelector : public IFDE_CSSStyleSelector, public CFX_Target { |
| 91 public: | 93 public: |
| 92 CFDE_CSSStyleSelector(); | 94 CFDE_CSSStyleSelector(); |
| 93 ~CFDE_CSSStyleSelector(); | 95 ~CFDE_CSSStyleSelector(); |
| 94 virtual void Release() { delete this; } | 96 virtual void Release() { delete this; } |
| 95 | 97 |
| 96 virtual void SetFontMgr(IFX_FontMgr* pFontMgr); | 98 virtual void SetFontMgr(IFX_FontMgr* pFontMgr); |
| 97 virtual void SetDefFontSize(FX_FLOAT fFontSize); | 99 virtual void SetDefFontSize(FX_FLOAT fFontSize); |
| 98 | 100 |
| 99 virtual FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, | 101 virtual FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, |
| 100 IFDE_CSSStyleSheet* pSheet); | 102 IFDE_CSSStyleSheet* pSheet); |
| 101 virtual FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, | 103 virtual FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, |
| 102 const CFDE_CSSStyleSheetArray* pArray); | 104 const CFDE_CSSStyleSheetArray* pArray); |
| 103 virtual void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, | 105 virtual void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, |
| 104 FDE_CSSSTYLESHEETPRIORITY ePriority); | 106 FDE_CSSSTYLESHEETPRIORITY ePriority); |
| 105 virtual void UpdateStyleIndex(uint32_t dwMediaList); | 107 virtual void UpdateStyleIndex(uint32_t dwMediaList); |
| 106 virtual IFDE_CSSAccelerator* InitAccelerator(); | 108 virtual CFDE_CSSAccelerator* InitAccelerator(); |
| 107 virtual IFDE_CSSComputedStyle* CreateComputedStyle( | 109 virtual IFDE_CSSComputedStyle* CreateComputedStyle( |
| 108 IFDE_CSSComputedStyle* pParentStyle); | 110 IFDE_CSSComputedStyle* pParentStyle); |
| 109 virtual int32_t MatchDeclarations( | 111 virtual int32_t MatchDeclarations( |
| 110 IFDE_CSSTagProvider* pTag, | 112 IFDE_CSSTagProvider* pTag, |
| 111 CFDE_CSSDeclarationArray& matchedDecls, | 113 CFDE_CSSDeclarationArray& matchedDecls, |
| 112 FDE_CSSPERSUDO ePersudoType = FDE_CSSPERSUDO_NONE); | 114 FDE_CSSPERSUDO ePersudoType = FDE_CSSPERSUDO_NONE); |
| 113 virtual void ComputeStyle(IFDE_CSSTagProvider* pTag, | 115 virtual void ComputeStyle(IFDE_CSSTagProvider* pTag, |
| 114 const IFDE_CSSDeclaration** ppDeclArray, | 116 const IFDE_CSSDeclaration** ppDeclArray, |
| 115 int32_t iDeclCount, | 117 int32_t iDeclCount, |
| 116 IFDE_CSSComputedStyle* pDestStyle); | 118 IFDE_CSSComputedStyle* pDestStyle); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 FDE_CSSTEXTEMPHASISFILL& eFill); | 171 FDE_CSSTEXTEMPHASISFILL& eFill); |
| 170 FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); | 172 FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); |
| 171 FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); | 173 FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); |
| 172 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); | 174 FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); |
| 173 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); | 175 FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); |
| 174 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); | 176 FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); |
| 175 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); | 177 FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); |
| 176 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); | 178 FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); |
| 177 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); | 179 FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); |
| 178 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); | 180 FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); |
| 181 |
| 179 IFX_FontMgr* m_pFontMgr; | 182 IFX_FontMgr* m_pFontMgr; |
| 180 FX_FLOAT m_fDefFontSize; | 183 FX_FLOAT m_fDefFontSize; |
| 181 IFX_MEMAllocator* m_pRuleDataStore; | 184 IFX_MEMAllocator* m_pRuleDataStore; |
| 182 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; | 185 CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; |
| 183 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; | 186 CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; |
| 184 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; | 187 FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; |
| 185 IFX_MEMAllocator* m_pInlineStyleStore; | 188 IFX_MEMAllocator* m_pInlineStyleStore; |
| 186 IFX_MEMAllocator* m_pFixedStyleStore; | 189 IFX_MEMAllocator* m_pFixedStyleStore; |
| 187 CFDE_CSSAccelerator* m_pAccelerator; | 190 CFDE_CSSAccelerator* m_pAccelerator; |
| 188 std::vector<FDE_CSSRuleData*> m_MatchedRules; | 191 std::vector<FDE_CSSRuleData*> m_MatchedRules; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 202 | 205 |
| 203 const FX_WCHAR* m_pszIdent; | 206 const FX_WCHAR* m_pszIdent; |
| 204 FX_BOOL m_bIncrement; | 207 FX_BOOL m_bIncrement; |
| 205 FX_BOOL m_bReset; | 208 FX_BOOL m_bReset; |
| 206 int32_t m_iIncVal; | 209 int32_t m_iIncVal; |
| 207 int32_t m_iResetVal; | 210 int32_t m_iResetVal; |
| 208 }; | 211 }; |
| 209 | 212 |
| 210 class CFDE_CSSCounterStyle { | 213 class CFDE_CSSCounterStyle { |
| 211 public: | 214 public: |
| 212 CFDE_CSSCounterStyle() : m_pCounterInc(NULL), m_pCounterReset(NULL) {} | 215 CFDE_CSSCounterStyle() : m_pCounterInc(nullptr), m_pCounterReset(nullptr) {} |
| 216 |
| 213 void SetCounterIncrementList(IFDE_CSSValueList* pList) { | 217 void SetCounterIncrementList(IFDE_CSSValueList* pList) { |
| 214 m_pCounterInc = pList; | 218 m_pCounterInc = pList; |
| 215 m_bIndexDirty = TRUE; | 219 m_bIndexDirty = TRUE; |
| 216 } | 220 } |
| 221 |
| 217 void SetCounterResetList(IFDE_CSSValueList* pList) { | 222 void SetCounterResetList(IFDE_CSSValueList* pList) { |
| 218 m_pCounterReset = pList; | 223 m_pCounterReset = pList; |
| 219 m_bIndexDirty = TRUE; | 224 m_bIndexDirty = TRUE; |
| 220 } | 225 } |
| 226 |
| 221 int32_t CountCounters() { | 227 int32_t CountCounters() { |
| 222 UpdateIndex(); | 228 UpdateIndex(); |
| 223 return m_arrCounterData.GetSize(); | 229 return m_arrCounterData.GetSize(); |
| 224 } | 230 } |
| 231 |
| 225 FX_BOOL GetCounterIncrement(int32_t index, int32_t& iValue) { | 232 FX_BOOL GetCounterIncrement(int32_t index, int32_t& iValue) { |
| 226 UpdateIndex(); | 233 UpdateIndex(); |
| 227 return m_arrCounterData.ElementAt(index).GetCounterIncrement(iValue); | 234 return m_arrCounterData.ElementAt(index).GetCounterIncrement(iValue); |
| 228 } | 235 } |
| 236 |
| 229 FX_BOOL GetCounterReset(int32_t index, int32_t& iValue) { | 237 FX_BOOL GetCounterReset(int32_t index, int32_t& iValue) { |
| 230 UpdateIndex(); | 238 UpdateIndex(); |
| 231 return m_arrCounterData.ElementAt(index).GetCounterReset(iValue); | 239 return m_arrCounterData.ElementAt(index).GetCounterReset(iValue); |
| 232 } | 240 } |
| 241 |
| 233 const FX_WCHAR* GetCounterIdentifier(int32_t index) { | 242 const FX_WCHAR* GetCounterIdentifier(int32_t index) { |
| 234 UpdateIndex(); | 243 UpdateIndex(); |
| 235 return m_arrCounterData.ElementAt(index).m_pszIdent; | 244 return m_arrCounterData.ElementAt(index).m_pszIdent; |
| 236 } | 245 } |
| 237 | 246 |
| 238 protected: | 247 protected: |
| 239 void UpdateIndex(); | 248 void UpdateIndex(); |
| 240 void DoUpdateIndex(IFDE_CSSValueList* pList); | 249 void DoUpdateIndex(IFDE_CSSValueList* pList); |
| 241 int32_t FindIndex(const FX_WCHAR* pszIdentifier); | 250 int32_t FindIndex(const FX_WCHAR* pszIdentifier); |
| 251 |
| 242 IFDE_CSSValueList* m_pCounterInc; | 252 IFDE_CSSValueList* m_pCounterInc; |
| 243 IFDE_CSSValueList* m_pCounterReset; | 253 IFDE_CSSValueList* m_pCounterReset; |
| 244 CFX_ArrayTemplate<FDE_CSSCOUNTERDATA> m_arrCounterData; | 254 CFX_ArrayTemplate<FDE_CSSCOUNTERDATA> m_arrCounterData; |
| 245 FX_BOOL m_bIndexDirty; | 255 FX_BOOL m_bIndexDirty; |
| 246 }; | 256 }; |
| 257 |
| 247 class CFDE_CSSInheritedData { | 258 class CFDE_CSSInheritedData { |
| 248 public: | 259 public: |
| 249 void Reset() { | 260 void Reset() { |
| 250 FXSYS_memset(this, 0, sizeof(CFDE_CSSInheritedData)); | 261 FXSYS_memset(this, 0, sizeof(CFDE_CSSInheritedData)); |
| 251 m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); | 262 m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); |
| 252 m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); | 263 m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); |
| 253 m_TextIndent.Set(FDE_CSSLENGTHUNIT_Point, 0); | 264 m_TextIndent.Set(FDE_CSSLENGTHUNIT_Point, 0); |
| 254 m_fFontSize = 12.0f; | 265 m_fFontSize = 12.0f; |
| 255 m_fLineHeight = 14.0f; | 266 m_fLineHeight = 14.0f; |
| 256 m_wFontWeight = 400; | 267 m_wFontWeight = 400; |
| 257 m_dwFontColor = 0xFF000000; | 268 m_dwFontColor = 0xFF000000; |
| 258 m_iWidows = 2; | 269 m_iWidows = 2; |
| 259 m_bTextEmphasisColorCurrent = TRUE; | 270 m_bTextEmphasisColorCurrent = TRUE; |
| 260 m_iOrphans = 2; | 271 m_iOrphans = 2; |
| 261 } | 272 } |
| 273 |
| 262 const FX_WCHAR* m_pszListStyleImage; | 274 const FX_WCHAR* m_pszListStyleImage; |
| 263 FDE_CSSLENGTH m_LetterSpacing; | 275 FDE_CSSLENGTH m_LetterSpacing; |
| 264 FDE_CSSLENGTH m_WordSpacing; | 276 FDE_CSSLENGTH m_WordSpacing; |
| 265 FDE_CSSLENGTH m_TextIndent; | 277 FDE_CSSLENGTH m_TextIndent; |
| 266 IFDE_CSSValueList* m_pFontFamily; | 278 IFDE_CSSValueList* m_pFontFamily; |
| 267 IFDE_CSSValueList* m_pQuotes; | 279 IFDE_CSSValueList* m_pQuotes; |
| 268 IFDE_CSSValueList* m_pCursorUris; | 280 IFDE_CSSValueList* m_pCursorUris; |
| 269 FDE_CSSCURSOR m_eCursor; | 281 FDE_CSSCURSOR m_eCursor; |
| 270 FX_FLOAT m_fFontSize; | 282 FX_FLOAT m_fFontSize; |
| 271 FX_FLOAT m_fLineHeight; | 283 FX_FLOAT m_fLineHeight; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 285 uint32_t m_eWritingMode : 2; | 297 uint32_t m_eWritingMode : 2; |
| 286 uint32_t m_eWordBreak : 2; | 298 uint32_t m_eWordBreak : 2; |
| 287 uint32_t m_eLineBreak : 2; | 299 uint32_t m_eLineBreak : 2; |
| 288 uint32_t m_eTextEmphasisFill : 1; | 300 uint32_t m_eTextEmphasisFill : 1; |
| 289 uint32_t m_eTextEmphasisMark : 3; | 301 uint32_t m_eTextEmphasisMark : 3; |
| 290 uint32_t m_eCaptionSide : 3; | 302 uint32_t m_eCaptionSide : 3; |
| 291 uint8_t m_eRubyAlign : 4; | 303 uint8_t m_eRubyAlign : 4; |
| 292 uint8_t m_eRubyOverhang : 2; | 304 uint8_t m_eRubyOverhang : 2; |
| 293 uint8_t m_eRubyPosition : 2; | 305 uint8_t m_eRubyPosition : 2; |
| 294 }; | 306 }; |
| 307 |
| 295 class CFDE_CSSNonInheritedData { | 308 class CFDE_CSSNonInheritedData { |
| 296 public: | 309 public: |
| 297 void Reset() { | 310 void Reset() { |
| 298 FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); | 311 FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); |
| 299 m_MarginWidth = m_BorderWidth = | 312 m_MarginWidth = m_BorderWidth = |
| 300 m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); | 313 m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); |
| 301 m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); | 314 m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); |
| 302 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); | 315 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); |
| 303 m_eDisplay = FDE_CSSDISPLAY_Inline; | 316 m_eDisplay = FDE_CSSDISPLAY_Inline; |
| 304 m_fVerticalAlign = 0.0f; | 317 m_fVerticalAlign = 0.0f; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 uint32_t m_eListStylePosition : 1; | 371 uint32_t m_eListStylePosition : 1; |
| 359 uint32_t m_eBKGAttachment : 1; | 372 uint32_t m_eBKGAttachment : 1; |
| 360 uint32_t m_bHasMargin : 1; | 373 uint32_t m_bHasMargin : 1; |
| 361 uint32_t m_bHasBorder : 1; | 374 uint32_t m_bHasBorder : 1; |
| 362 uint32_t m_bHasPadding : 1; | 375 uint32_t m_bHasPadding : 1; |
| 363 uint32_t m_dwTextDecoration : 5; | 376 uint32_t m_dwTextDecoration : 5; |
| 364 uint32_t m_eTextCombine : 1; | 377 uint32_t m_eTextCombine : 1; |
| 365 uint32_t m_bColumnRuleColorSame : 1; | 378 uint32_t m_bColumnRuleColorSame : 1; |
| 366 uint32_t m_bHasTextCombineNumber : 1; | 379 uint32_t m_bHasTextCombineNumber : 1; |
| 367 }; | 380 }; |
| 381 |
| 368 class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, | 382 class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, |
| 383 public IFDE_CSSBoundaryStyle, |
| 369 public IFDE_CSSFontStyle, | 384 public IFDE_CSSFontStyle, |
| 370 public IFDE_CSSBoundaryStyle, | |
| 371 public IFDE_CSSPositionStyle, | 385 public IFDE_CSSPositionStyle, |
| 372 public IFDE_CSSParagraphStyle, | 386 public IFDE_CSSParagraphStyle, |
| 373 public IFDE_CSSBackgroundStyle, | |
| 374 public IFDE_CSSVisualStyle, | |
| 375 public IFDE_CSSListStyle, | |
| 376 public IFDE_CSSMultiColumnStyle, | |
| 377 public IFDE_CSSGeneratedContentStyle, | |
| 378 public IFDE_CSSTableStyle, | |
| 379 public IFDE_CSSRubyStyle, | |
| 380 public CFX_Target { | 387 public CFX_Target { |
| 381 public: | 388 public: |
| 382 CFDE_CSSComputedStyle(IFX_MEMAllocator* pAlloc) | 389 CFDE_CSSComputedStyle(IFX_MEMAllocator* pAlloc) |
| 383 : m_dwRefCount(1), m_pAllocator(pAlloc) {} | 390 : m_dwRefCount(1), m_pAllocator(pAlloc) {} |
| 391 |
| 384 ~CFDE_CSSComputedStyle() {} | 392 ~CFDE_CSSComputedStyle() {} |
| 385 virtual uint32_t AddRef() { return ++m_dwRefCount; } | 393 |
| 386 virtual uint32_t Release() { | 394 // IFX_Unknown: |
| 395 uint32_t AddRef() override { return ++m_dwRefCount; } |
| 396 |
| 397 uint32_t Release() override { |
| 387 uint32_t dwRefCount = --m_dwRefCount; | 398 uint32_t dwRefCount = --m_dwRefCount; |
| 388 if (dwRefCount == 0) { | 399 if (dwRefCount == 0) { |
| 389 if (m_NonInheritedData.m_pCounterStyle != NULL) { | 400 if (m_NonInheritedData.m_pCounterStyle) |
| 390 delete m_NonInheritedData.m_pCounterStyle; | 401 delete m_NonInheritedData.m_pCounterStyle; |
| 391 } | 402 |
| 392 FXTARGET_DeleteWith(CFDE_CSSComputedStyle, m_pAllocator, this); | 403 FXTARGET_DeleteWith(CFDE_CSSComputedStyle, m_pAllocator, this); |
| 393 } | 404 } |
| 394 return dwRefCount; | 405 return dwRefCount; |
| 395 } | 406 } |
| 396 | 407 |
| 397 virtual void Reset() { | 408 // IFDE_CSSComputedStyle: |
| 409 void Reset() override { |
| 398 m_InheritedData.Reset(); | 410 m_InheritedData.Reset(); |
| 399 m_NonInheritedData.Reset(); | 411 m_NonInheritedData.Reset(); |
| 400 } | 412 } |
| 401 virtual IFDE_CSSFontStyle* GetFontStyles() const { | 413 |
| 402 return (IFDE_CSSFontStyle * const) this; | 414 IFDE_CSSFontStyle* GetFontStyles() override { |
| 415 return static_cast<IFDE_CSSFontStyle*>(this); |
| 403 } | 416 } |
| 404 virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() const { | 417 |
| 405 return (IFDE_CSSBoundaryStyle * const) this; | 418 IFDE_CSSBoundaryStyle* GetBoundaryStyles() override { |
| 419 return static_cast<IFDE_CSSBoundaryStyle*>(this); |
| 406 } | 420 } |
| 407 virtual IFDE_CSSPositionStyle* GetPositionStyles() const { | 421 |
| 408 return (IFDE_CSSPositionStyle * const) this; | 422 IFDE_CSSPositionStyle* GetPositionStyles() override { |
| 423 return static_cast<IFDE_CSSPositionStyle*>(this); |
| 409 } | 424 } |
| 410 virtual IFDE_CSSParagraphStyle* GetParagraphStyles() const { | 425 |
| 411 return (IFDE_CSSParagraphStyle * const) this; | 426 IFDE_CSSParagraphStyle* GetParagraphStyles() override { |
| 427 return static_cast<IFDE_CSSParagraphStyle*>(this); |
| 412 } | 428 } |
| 413 virtual IFDE_CSSBackgroundStyle* GetBackgroundStyles() const { | 429 |
| 414 return (IFDE_CSSBackgroundStyle * const) this; | 430 FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, |
| 415 } | 431 CFX_WideString& wsValue) const override { |
| 416 virtual IFDE_CSSVisualStyle* GetVisualStyles() const { | |
| 417 return (IFDE_CSSVisualStyle * const) this; | |
| 418 } | |
| 419 virtual IFDE_CSSListStyle* GetListStyles() const { | |
| 420 return (IFDE_CSSListStyle * const) this; | |
| 421 } | |
| 422 virtual IFDE_CSSTableStyle* GetTableStyle() const { | |
| 423 return (IFDE_CSSTableStyle * const) this; | |
| 424 } | |
| 425 virtual IFDE_CSSMultiColumnStyle* GetMultiColumnStyle() const { | |
| 426 return (IFDE_CSSMultiColumnStyle * const) this; | |
| 427 } | |
| 428 virtual IFDE_CSSGeneratedContentStyle* GetGeneratedContentStyle() const { | |
| 429 return (IFDE_CSSGeneratedContentStyle * const) this; | |
| 430 } | |
| 431 virtual IFDE_CSSRubyStyle* GetRubyStyle() const { | |
| 432 return (IFDE_CSSRubyStyle * const) this; | |
| 433 } | |
| 434 virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, | |
| 435 CFX_WideString& wsValue) const { | |
| 436 for (int32_t i = m_CustomProperties.GetSize() - 2; i > -1; i -= 2) { | 432 for (int32_t i = m_CustomProperties.GetSize() - 2; i > -1; i -= 2) { |
| 437 if (wsName == m_CustomProperties[i]) { | 433 if (wsName == m_CustomProperties[i]) { |
| 438 wsValue = m_CustomProperties[i + 1]; | 434 wsValue = m_CustomProperties[i + 1]; |
| 439 return TRUE; | 435 return TRUE; |
| 440 } | 436 } |
| 441 } | 437 } |
| 442 return FALSE; | 438 return FALSE; |
| 443 } | 439 } |
| 444 virtual FDE_CSSRUBYALIGN GetRubyAlign() const { | 440 |
| 445 return (FDE_CSSRUBYALIGN)m_InheritedData.m_eRubyAlign; | 441 // IFDE_CSSFontStyle: |
| 446 } | 442 int32_t CountFontFamilies() const override { |
| 447 virtual FDE_CSSRUBYPOSITION GetRubyPosition() const { | |
| 448 return (FDE_CSSRUBYPOSITION)m_InheritedData.m_eRubyPosition; | |
| 449 } | |
| 450 virtual FDE_CSSRUBYOVERHANG GetRubyOverhang() const { | |
| 451 return (FDE_CSSRUBYOVERHANG)m_InheritedData.m_eRubyOverhang; | |
| 452 } | |
| 453 virtual FDE_CSSRUBYSPAN GetRubySpanType() const { | |
| 454 return m_NonInheritedData.m_pRubySpan == NULL ? FDE_CSSRUBYSPAN_None | |
| 455 : FDE_CSSRUBYSPAN_Attr; | |
| 456 } | |
| 457 virtual IFDE_CSSValue* GetRubySpanAttr() const { | |
| 458 return m_NonInheritedData.m_pRubySpan; | |
| 459 } | |
| 460 virtual FDE_CSSCAPTIONSIDE GetCaptionSide() const { | |
| 461 return (FDE_CSSCAPTIONSIDE)m_InheritedData.m_eCaptionSide; | |
| 462 } | |
| 463 virtual int32_t CountCounters() { | |
| 464 return (m_NonInheritedData.m_pCounterStyle == NULL) | |
| 465 ? 0 | |
| 466 : m_NonInheritedData.m_pCounterStyle->CountCounters(); | |
| 467 } | |
| 468 virtual const FX_WCHAR* GetCounterIdentifier(int32_t index) { | |
| 469 return m_NonInheritedData.m_pCounterStyle->GetCounterIdentifier(index); | |
| 470 } | |
| 471 virtual FX_BOOL GetCounterReset(int32_t index, int32_t& iValue) { | |
| 472 return m_NonInheritedData.m_pCounterStyle->GetCounterReset(index, iValue); | |
| 473 } | |
| 474 virtual FX_BOOL GetCounterIncrement(int32_t index, int32_t& iValue) { | |
| 475 return m_NonInheritedData.m_pCounterStyle->GetCounterIncrement(index, | |
| 476 iValue); | |
| 477 } | |
| 478 virtual IFDE_CSSValueList* GetContent() const { | |
| 479 return m_NonInheritedData.m_pContentList; | |
| 480 } | |
| 481 virtual int32_t CountQuotes() const { | |
| 482 return m_InheritedData.m_pQuotes == NULL | |
| 483 ? 0 | |
| 484 : m_InheritedData.m_pQuotes->CountValues(); | |
| 485 } | |
| 486 virtual const FX_WCHAR* GetQuotes(int32_t index) const { | |
| 487 FXSYS_assert(m_InheritedData.m_pQuotes != NULL && | |
| 488 m_InheritedData.m_pQuotes->CountValues() > index); | |
| 489 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pQuotes->GetValue( | |
| 490 index))) | |
| 491 ->GetString(index); | |
| 492 } | |
| 493 virtual const FDE_CSSLENGTH& GetColumnCount() const { | |
| 494 return m_NonInheritedData.m_ColumnCount; | |
| 495 } | |
| 496 virtual const FDE_CSSLENGTH& GetColumnGap() const { | |
| 497 return m_NonInheritedData.m_ColumnGap; | |
| 498 } | |
| 499 virtual FX_ARGB GetColumnRuleColor() const { | |
| 500 return m_NonInheritedData.m_bColumnRuleColorSame | |
| 501 ? m_InheritedData.m_dwFontColor | |
| 502 : m_NonInheritedData.m_dwColumnRuleColor; | |
| 503 } | |
| 504 virtual FDE_CSSBORDERSTYLE GetColumnRuleStyle() const { | |
| 505 return (FDE_CSSBORDERSTYLE)m_NonInheritedData.m_eColumnRuleStyle; | |
| 506 } | |
| 507 virtual const FDE_CSSLENGTH& GetColumnRuleWidth() const { | |
| 508 return m_NonInheritedData.m_ColumnRuleWidth; | |
| 509 } | |
| 510 virtual const FDE_CSSLENGTH& GetColumnWidth() const { | |
| 511 return m_NonInheritedData.m_ColumnWidth; | |
| 512 } | |
| 513 virtual void SetColumnCount(const FDE_CSSLENGTH& columnCount) { | |
| 514 m_NonInheritedData.m_ColumnCount = columnCount; | |
| 515 } | |
| 516 virtual void SetColumnGap(const FDE_CSSLENGTH& columnGap) { | |
| 517 m_NonInheritedData.m_ColumnGap = columnGap; | |
| 518 } | |
| 519 virtual void SetColumnRuleColor(FX_ARGB dwColumnRuleColor) { | |
| 520 m_NonInheritedData.m_dwColumnRuleColor = dwColumnRuleColor, | |
| 521 m_NonInheritedData.m_bColumnRuleColorSame = FALSE; | |
| 522 } | |
| 523 virtual void SetColumnRuleStyle(FDE_CSSBORDERSTYLE eColumnRuleStyle) { | |
| 524 m_NonInheritedData.m_eColumnRuleStyle = eColumnRuleStyle; | |
| 525 } | |
| 526 virtual void SetColumnRuleWidth(const FDE_CSSLENGTH& columnRuleWidth) { | |
| 527 m_NonInheritedData.m_ColumnRuleWidth = columnRuleWidth; | |
| 528 } | |
| 529 virtual void SetColumnWidth(const FDE_CSSLENGTH& columnWidth) { | |
| 530 m_NonInheritedData.m_ColumnWidth = columnWidth; | |
| 531 } | |
| 532 virtual int32_t CountFontFamilies() const { | |
| 533 return m_InheritedData.m_pFontFamily | 443 return m_InheritedData.m_pFontFamily |
| 534 ? m_InheritedData.m_pFontFamily->CountValues() | 444 ? m_InheritedData.m_pFontFamily->CountValues() |
| 535 : 0; | 445 : 0; |
| 536 } | 446 } |
| 537 virtual const FX_WCHAR* GetFontFamily(int32_t index) const { | 447 |
| 538 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pFontFamily->GetValue( | 448 const FX_WCHAR* GetFontFamily(int32_t index) const override { |
| 539 index))) | 449 return (static_cast<IFDE_CSSPrimitiveValue*>( |
| 450 m_InheritedData.m_pFontFamily->GetValue(index))) |
| 540 ->GetString(index); | 451 ->GetString(index); |
| 541 } | 452 } |
| 542 virtual uint16_t GetFontWeight() const { | 453 |
| 454 uint16_t GetFontWeight() const override { |
| 543 return m_InheritedData.m_wFontWeight; | 455 return m_InheritedData.m_wFontWeight; |
| 544 } | 456 } |
| 545 virtual FDE_CSSFONTVARIANT GetFontVariant() const { | 457 |
| 546 return (FDE_CSSFONTVARIANT)m_InheritedData.m_eFontVariant; | 458 FDE_CSSFONTVARIANT GetFontVariant() const override { |
| 459 return static_cast<FDE_CSSFONTVARIANT>(m_InheritedData.m_eFontVariant); |
| 547 } | 460 } |
| 548 virtual FDE_CSSFONTSTYLE GetFontStyle() const { | 461 |
| 549 return (FDE_CSSFONTSTYLE)m_InheritedData.m_eFontStyle; | 462 FDE_CSSFONTSTYLE GetFontStyle() const override { |
| 463 return static_cast<FDE_CSSFONTSTYLE>(m_InheritedData.m_eFontStyle); |
| 550 } | 464 } |
| 551 virtual FX_FLOAT GetFontSize() const { return m_InheritedData.m_fFontSize; } | 465 |
| 552 virtual FX_ARGB GetColor() const { return m_InheritedData.m_dwFontColor; } | 466 FX_FLOAT GetFontSize() const override { return m_InheritedData.m_fFontSize; } |
| 553 virtual void SetFontWeight(uint16_t wFontWeight) { | 467 |
| 468 FX_ARGB GetColor() const override { return m_InheritedData.m_dwFontColor; } |
| 469 |
| 470 void SetFontWeight(uint16_t wFontWeight) override { |
| 554 m_InheritedData.m_wFontWeight = wFontWeight; | 471 m_InheritedData.m_wFontWeight = wFontWeight; |
| 555 } | 472 } |
| 556 virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { | 473 |
| 474 void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) override { |
| 557 m_InheritedData.m_eFontVariant = eFontVariant; | 475 m_InheritedData.m_eFontVariant = eFontVariant; |
| 558 } | 476 } |
| 559 virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { | 477 |
| 478 void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) override { |
| 560 m_InheritedData.m_eFontStyle = eFontStyle; | 479 m_InheritedData.m_eFontStyle = eFontStyle; |
| 561 } | 480 } |
| 562 virtual void SetFontSize(FX_FLOAT fFontSize) { | 481 |
| 482 void SetFontSize(FX_FLOAT fFontSize) override { |
| 563 m_InheritedData.m_fFontSize = fFontSize; | 483 m_InheritedData.m_fFontSize = fFontSize; |
| 564 } | 484 } |
| 565 virtual void SetColor(FX_ARGB dwFontColor) { | 485 |
| 486 void SetColor(FX_ARGB dwFontColor) override { |
| 566 m_InheritedData.m_dwFontColor = dwFontColor; | 487 m_InheritedData.m_dwFontColor = dwFontColor; |
| 567 } | 488 } |
| 568 virtual FX_ARGB GetBorderLeftColor() const { | 489 |
| 569 return m_NonInheritedData.m_dwBDRLeftColor; | 490 // IFDE_CSSBoundaryStyle: |
| 570 } | 491 const FDE_CSSRECT* GetBorderWidth() const override { |
| 571 virtual FX_ARGB GetBorderTopColor() const { | 492 return m_NonInheritedData.m_bHasBorder ? &(m_NonInheritedData.m_BorderWidth) |
| 572 return m_NonInheritedData.m_dwBDRTopColor; | 493 : nullptr; |
| 573 } | |
| 574 virtual FX_ARGB GetBorderRightColor() const { | |
| 575 return m_NonInheritedData.m_dwBDRRightColor; | |
| 576 } | |
| 577 virtual FX_ARGB GetBorderBottomColor() const { | |
| 578 return m_NonInheritedData.m_dwBDRBottomColor; | |
| 579 } | 494 } |
| 580 | 495 |
| 581 virtual FDE_CSSBORDERSTYLE GetBorderLeftStyle() const { | 496 const FDE_CSSRECT* GetMarginWidth() const override { |
| 582 return (FDE_CSSBORDERSTYLE)m_NonInheritedData.m_eBDRLeftStyle; | 497 return m_NonInheritedData.m_bHasMargin ? &(m_NonInheritedData.m_MarginWidth) |
| 583 } | 498 : nullptr; |
| 584 virtual FDE_CSSBORDERSTYLE GetBorderTopStyle() const { | |
| 585 return (FDE_CSSBORDERSTYLE)m_NonInheritedData.m_eBDRTopStyle; | |
| 586 } | |
| 587 virtual FDE_CSSBORDERSTYLE GetBorderRightStyle() const { | |
| 588 return (FDE_CSSBORDERSTYLE)m_NonInheritedData.m_eBDRRightStyle; | |
| 589 } | |
| 590 virtual FDE_CSSBORDERSTYLE GetBorderBottomStyle() const { | |
| 591 return (FDE_CSSBORDERSTYLE)m_NonInheritedData.m_eBDRBottomStyle; | |
| 592 } | 499 } |
| 593 | 500 |
| 594 virtual const FDE_CSSRECT* GetBorderWidth() const { | 501 const FDE_CSSRECT* GetPaddingWidth() const override { |
| 595 return m_NonInheritedData.m_bHasBorder ? &(m_NonInheritedData.m_BorderWidth) | |
| 596 : NULL; | |
| 597 } | |
| 598 virtual const FDE_CSSRECT* GetMarginWidth() const { | |
| 599 return m_NonInheritedData.m_bHasMargin ? &(m_NonInheritedData.m_MarginWidth) | |
| 600 : NULL; | |
| 601 } | |
| 602 virtual const FDE_CSSRECT* GetPaddingWidth() const { | |
| 603 return m_NonInheritedData.m_bHasPadding | 502 return m_NonInheritedData.m_bHasPadding |
| 604 ? &(m_NonInheritedData.m_PaddingWidth) | 503 ? &(m_NonInheritedData.m_PaddingWidth) |
| 605 : NULL; | 504 : nullptr; |
| 606 } | |
| 607 virtual void SetBorderLeftColor(FX_ARGB dwBorderColor) { | |
| 608 m_NonInheritedData.m_dwBDRLeftColor = dwBorderColor; | |
| 609 } | |
| 610 virtual void SetBorderTopColor(FX_ARGB dwBorderColor) { | |
| 611 m_NonInheritedData.m_dwBDRTopColor = dwBorderColor; | |
| 612 } | |
| 613 virtual void SetBorderRightColor(FX_ARGB dwBorderColor) { | |
| 614 m_NonInheritedData.m_dwBDRRightColor = dwBorderColor; | |
| 615 } | |
| 616 virtual void SetBorderBottomColor(FX_ARGB dwBorderColor) { | |
| 617 m_NonInheritedData.m_dwBDRBottomColor = dwBorderColor; | |
| 618 } | 505 } |
| 619 | 506 |
| 620 virtual void SetBorderLeftStyle(FDE_CSSBORDERSTYLE eBorderStyle) { | 507 void SetMarginWidth(const FDE_CSSRECT& rect) override { |
| 621 m_NonInheritedData.m_eBDRLeftStyle = eBorderStyle; | |
| 622 } | |
| 623 virtual void SetBorderTopStyle(FDE_CSSBORDERSTYLE eBorderStyle) { | |
| 624 m_NonInheritedData.m_eBDRTopStyle = eBorderStyle; | |
| 625 } | |
| 626 virtual void SetBorderRightStyle(FDE_CSSBORDERSTYLE eBorderStyle) { | |
| 627 m_NonInheritedData.m_eBDRRightStyle = eBorderStyle; | |
| 628 } | |
| 629 virtual void SetBorderBottomStyle(FDE_CSSBORDERSTYLE eBorderStyle) { | |
| 630 m_NonInheritedData.m_eBDRBottomStyle = eBorderStyle; | |
| 631 } | |
| 632 | |
| 633 virtual void SetBorderWidth(const FDE_CSSRECT& rect) { | |
| 634 m_NonInheritedData.m_BorderWidth = rect; | |
| 635 m_NonInheritedData.m_bHasBorder = TRUE; | |
| 636 } | |
| 637 virtual void SetMarginWidth(const FDE_CSSRECT& rect) { | |
| 638 m_NonInheritedData.m_MarginWidth = rect; | 508 m_NonInheritedData.m_MarginWidth = rect; |
| 639 m_NonInheritedData.m_bHasMargin = TRUE; | 509 m_NonInheritedData.m_bHasMargin = TRUE; |
| 640 } | 510 } |
| 641 virtual void SetPaddingWidth(const FDE_CSSRECT& rect) { | 511 |
| 512 void SetPaddingWidth(const FDE_CSSRECT& rect) override { |
| 642 m_NonInheritedData.m_PaddingWidth = rect; | 513 m_NonInheritedData.m_PaddingWidth = rect; |
| 643 m_NonInheritedData.m_bHasPadding = TRUE; | 514 m_NonInheritedData.m_bHasPadding = TRUE; |
| 644 } | 515 } |
| 645 virtual FDE_CSSDISPLAY GetDisplay() const { | 516 |
| 646 return (FDE_CSSDISPLAY)m_NonInheritedData.m_eDisplay; | 517 // IFDE_CSSPositionStyle: |
| 518 FDE_CSSDISPLAY GetDisplay() const override { |
| 519 return static_cast<FDE_CSSDISPLAY>(m_NonInheritedData.m_eDisplay); |
| 647 } | 520 } |
| 648 virtual const FDE_CSSSIZE& GetBoxSize() const { | |
| 649 return m_NonInheritedData.m_BoxSize; | |
| 650 } | |
| 651 virtual const FDE_CSSSIZE& GetMinBoxSize() const { | |
| 652 return m_NonInheritedData.m_MinBoxSize; | |
| 653 } | |
| 654 virtual const FDE_CSSSIZE& GetMaxBoxSize() const { | |
| 655 return m_NonInheritedData.m_MaxBoxSize; | |
| 656 } | |
| 657 virtual FDE_CSSFLOAT GetFloat() const { | |
| 658 return (FDE_CSSFLOAT)m_NonInheritedData.m_eFloat; | |
| 659 } | |
| 660 virtual FDE_CSSCLEAR GetClear() const { | |
| 661 return (FDE_CSSCLEAR)m_NonInheritedData.m_eClear; | |
| 662 } | |
| 663 virtual FDE_CSSPOSITION GetPosition() const { | |
| 664 return (FDE_CSSPOSITION)m_NonInheritedData.m_ePosition; | |
| 665 } | |
| 666 virtual FDE_CSSLENGTH GetTop() const { return m_NonInheritedData.m_Top; } | |
| 667 virtual FDE_CSSLENGTH GetBottom() const { | |
| 668 return m_NonInheritedData.m_Bottom; | |
| 669 } | |
| 670 virtual FDE_CSSLENGTH GetLeft() const { return m_NonInheritedData.m_Left; } | |
| 671 virtual FDE_CSSLENGTH GetRight() const { return m_NonInheritedData.m_Right; } | |
| 672 | 521 |
| 673 virtual void SetDisplay(FDE_CSSDISPLAY eDisplay) { | 522 // IFDE_CSSParagraphStyle: |
| 674 m_NonInheritedData.m_eDisplay = eDisplay; | 523 FX_FLOAT GetLineHeight() const override { |
| 675 } | |
| 676 virtual void SetBoxSize(const FDE_CSSSIZE& size) { | |
| 677 m_NonInheritedData.m_BoxSize = size; | |
| 678 } | |
| 679 virtual void SetMinBoxSize(const FDE_CSSSIZE& size) { | |
| 680 m_NonInheritedData.m_MinBoxSize = size; | |
| 681 } | |
| 682 virtual void SetMaxBoxSize(const FDE_CSSSIZE& size) { | |
| 683 m_NonInheritedData.m_MaxBoxSize = size; | |
| 684 } | |
| 685 virtual void SetFloat(FDE_CSSFLOAT eFloat) { | |
| 686 m_NonInheritedData.m_eFloat = eFloat; | |
| 687 } | |
| 688 virtual void SetClear(FDE_CSSCLEAR eClear) { | |
| 689 m_NonInheritedData.m_eClear = eClear; | |
| 690 } | |
| 691 virtual FX_FLOAT GetLineHeight() const { | |
| 692 return m_InheritedData.m_fLineHeight; | 524 return m_InheritedData.m_fLineHeight; |
| 693 } | 525 } |
| 694 virtual FDE_CSSWHITESPACE GetWhiteSpace() const { | 526 |
| 695 return (FDE_CSSWHITESPACE)m_InheritedData.m_eWhiteSpace; | 527 const FDE_CSSLENGTH& GetTextIndent() const override { |
| 696 } | |
| 697 virtual const FDE_CSSLENGTH& GetTextIndent() const { | |
| 698 return m_InheritedData.m_TextIndent; | 528 return m_InheritedData.m_TextIndent; |
| 699 } | 529 } |
| 700 virtual FDE_CSSTEXTALIGN GetTextAlign() const { | 530 |
| 701 return (FDE_CSSTEXTALIGN)m_InheritedData.m_eTextAligh; | 531 FDE_CSSTEXTALIGN GetTextAlign() const override { |
| 532 return static_cast<FDE_CSSTEXTALIGN>(m_InheritedData.m_eTextAligh); |
| 702 } | 533 } |
| 703 virtual FDE_CSSVERTICALALIGN GetVerticalAlign() const { | 534 |
| 704 return (FDE_CSSVERTICALALIGN)m_NonInheritedData.m_eVerticalAlign; | 535 FDE_CSSVERTICALALIGN GetVerticalAlign() const override { |
| 536 return static_cast<FDE_CSSVERTICALALIGN>( |
| 537 m_NonInheritedData.m_eVerticalAlign); |
| 705 } | 538 } |
| 706 virtual FX_FLOAT GetNumberVerticalAlign() const { | 539 |
| 540 FX_FLOAT GetNumberVerticalAlign() const override { |
| 707 return m_NonInheritedData.m_fVerticalAlign; | 541 return m_NonInheritedData.m_fVerticalAlign; |
| 708 } | 542 } |
| 709 virtual FDE_CSSTEXTTRANSFORM GetTextTransform() const { | 543 |
| 710 return (FDE_CSSTEXTTRANSFORM)m_InheritedData.m_eTextTransform; | 544 uint32_t GetTextDecoration() const override { |
| 711 } | |
| 712 virtual uint32_t GetTextDecoration() const { | |
| 713 return m_NonInheritedData.m_dwTextDecoration; | 545 return m_NonInheritedData.m_dwTextDecoration; |
| 714 } | 546 } |
| 715 virtual const FDE_CSSLENGTH& GetLetterSpacing() const { | 547 |
| 548 const FDE_CSSLENGTH& GetLetterSpacing() const override { |
| 716 return m_InheritedData.m_LetterSpacing; | 549 return m_InheritedData.m_LetterSpacing; |
| 717 } | 550 } |
| 718 virtual const FDE_CSSLENGTH& GetWordSpacing() const { | 551 |
| 719 return m_InheritedData.m_WordSpacing; | 552 void SetLineHeight(FX_FLOAT fLineHeight) override { |
| 720 } | |
| 721 virtual FDE_CSSWRITINGMODE GetWritingMode() const { | |
| 722 return (FDE_CSSWRITINGMODE)m_InheritedData.m_eWritingMode; | |
| 723 } | |
| 724 virtual FDE_CSSWORDBREAK GetWordBreak() const { | |
| 725 return (FDE_CSSWORDBREAK)m_InheritedData.m_eWordBreak; | |
| 726 } | |
| 727 virtual int32_t GetWidows() const { return m_InheritedData.m_iWidows; } | |
| 728 virtual FX_ARGB GetTextEmphasisColor() const { | |
| 729 return m_InheritedData.m_bTextEmphasisColorCurrent | |
| 730 ? m_InheritedData.m_dwFontColor | |
| 731 : m_InheritedData.m_dwTextEmphasisColor; | |
| 732 } | |
| 733 virtual FDE_CSSPAGEBREAK GetPageBreakBefore() const { | |
| 734 return (FDE_CSSPAGEBREAK)m_NonInheritedData.m_ePageBreakBefore; | |
| 735 } | |
| 736 virtual FDE_CSSPAGEBREAK GetPageBreakAfter() const { | |
| 737 return (FDE_CSSPAGEBREAK)m_NonInheritedData.m_ePageBreakAfter; | |
| 738 } | |
| 739 virtual FDE_CSSPAGEBREAK GetPageBreakInside() const { | |
| 740 return (FDE_CSSPAGEBREAK)m_NonInheritedData.m_ePageBreakInside; | |
| 741 } | |
| 742 virtual int32_t GetOrphans() const { return m_InheritedData.m_iOrphans; } | |
| 743 virtual FDE_CSSLINEBREAK GetLineBreak() const { | |
| 744 return (FDE_CSSLINEBREAK)m_InheritedData.m_eLineBreak; | |
| 745 } | |
| 746 virtual FDE_CSSTEXTEMPHASISMARK GetTextEmphasisMark() const; | |
| 747 virtual FDE_CSSTEXTEMPHASISFILL GetTextEmphasisFill() const { | |
| 748 return (FDE_CSSTEXTEMPHASISFILL)m_InheritedData.m_eTextEmphasisFill; | |
| 749 } | |
| 750 virtual const FX_WCHAR* GetTextEmphasisCustom() const { | |
| 751 FXSYS_assert(m_InheritedData.m_eTextEmphasisMark == | |
| 752 FDE_CSSTEXTEMPHASISMARK_Custom); | |
| 753 return m_InheritedData.m_pszTextEmphasisCustomMark; | |
| 754 } | |
| 755 virtual FDE_CSSTEXTCOMBINE GetTextCombineType() const { | |
| 756 return (FDE_CSSTEXTCOMBINE)m_NonInheritedData.m_eTextCombine; | |
| 757 } | |
| 758 virtual FX_BOOL HasTextCombineNumber() const { | |
| 759 return m_NonInheritedData.m_bHasTextCombineNumber; | |
| 760 } | |
| 761 virtual FX_FLOAT GetTextCombineNumber() const { | |
| 762 FXSYS_assert(m_NonInheritedData.m_eTextCombine == | |
| 763 FDE_CSSTEXTCOMBINE_Horizontal); | |
| 764 return m_NonInheritedData.m_fTextCombineNumber; | |
| 765 } | |
| 766 virtual void SetLineHeight(FX_FLOAT fLineHeight) { | |
| 767 m_InheritedData.m_fLineHeight = fLineHeight; | 553 m_InheritedData.m_fLineHeight = fLineHeight; |
| 768 } | 554 } |
| 769 virtual void SetWhiteSpace(FDE_CSSWHITESPACE eWhiteSpace) { | 555 |
| 770 m_InheritedData.m_eWhiteSpace = eWhiteSpace; | 556 void SetTextIndent(const FDE_CSSLENGTH& textIndent) override { |
| 771 } | |
| 772 virtual void SetTextIndent(const FDE_CSSLENGTH& textIndent) { | |
| 773 m_InheritedData.m_TextIndent = textIndent; | 557 m_InheritedData.m_TextIndent = textIndent; |
| 774 } | 558 } |
| 775 virtual void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) { | 559 |
| 560 void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) override { |
| 776 m_InheritedData.m_eTextAligh = eTextAlign; | 561 m_InheritedData.m_eTextAligh = eTextAlign; |
| 777 } | 562 } |
| 778 virtual void SetVerticalAlign(FDE_CSSVERTICALALIGN eVerticalAlign) { | 563 |
| 779 m_NonInheritedData.m_eVerticalAlign = eVerticalAlign; | 564 void SetNumberVerticalAlign(FX_FLOAT fAlign) override { |
| 780 } | |
| 781 virtual void SetNumberVerticalAlign(FX_FLOAT fAlign) { | |
| 782 m_NonInheritedData.m_eVerticalAlign = FDE_CSSVERTICALALIGN_Number, | 565 m_NonInheritedData.m_eVerticalAlign = FDE_CSSVERTICALALIGN_Number, |
| 783 m_NonInheritedData.m_fVerticalAlign = fAlign; | 566 m_NonInheritedData.m_fVerticalAlign = fAlign; |
| 784 } | 567 } |
| 785 virtual void SetTextTransform(FDE_CSSTEXTTRANSFORM eTextTransform) { | 568 |
| 786 m_InheritedData.m_eTextTransform = eTextTransform; | 569 void SetTextDecoration(uint32_t dwTextDecoration) override { |
| 787 } | |
| 788 virtual void SetTextDecoration(uint32_t dwTextDecoration) { | |
| 789 m_NonInheritedData.m_dwTextDecoration = dwTextDecoration; | 570 m_NonInheritedData.m_dwTextDecoration = dwTextDecoration; |
| 790 } | 571 } |
| 791 virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) { | 572 |
| 573 void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override { |
| 792 m_InheritedData.m_LetterSpacing = letterSpacing; | 574 m_InheritedData.m_LetterSpacing = letterSpacing; |
| 793 } | 575 } |
| 794 virtual void SetWordSpacing(const FDE_CSSLENGTH& wordSpacing) { | 576 |
| 795 m_InheritedData.m_WordSpacing = wordSpacing; | |
| 796 } | |
| 797 virtual void SetWritingMode(FDE_CSSWRITINGMODE eWritingMode) { | |
| 798 m_InheritedData.m_eWritingMode = eWritingMode; | |
| 799 } | |
| 800 virtual void SetWordBreak(FDE_CSSWORDBREAK eWordBreak) { | |
| 801 m_InheritedData.m_eWordBreak = eWordBreak; | |
| 802 } | |
| 803 virtual void SetWidows(int32_t iWidows) { | |
| 804 m_InheritedData.m_iWidows = iWidows; | |
| 805 } | |
| 806 virtual void SetTextEmphasisColor(FX_ARGB dwTextEmphasisColor) { | |
| 807 m_InheritedData.m_dwTextEmphasisColor = dwTextEmphasisColor, | |
| 808 m_InheritedData.m_bTextEmphasisColorCurrent = FALSE; | |
| 809 } | |
| 810 virtual void SetPageBreakBefore(FDE_CSSPAGEBREAK ePageBreakBefore) { | |
| 811 m_NonInheritedData.m_ePageBreakBefore = ePageBreakBefore; | |
| 812 } | |
| 813 virtual void SetPageBreakAfter(FDE_CSSPAGEBREAK ePageBreakAfter) { | |
| 814 m_NonInheritedData.m_ePageBreakAfter = ePageBreakAfter; | |
| 815 } | |
| 816 virtual void SetPageBreakInside(FDE_CSSPAGEBREAK ePageBreakInside) { | |
| 817 m_NonInheritedData.m_ePageBreakInside = ePageBreakInside; | |
| 818 } | |
| 819 virtual void SetOrphans(int32_t iOrphans) { | |
| 820 m_InheritedData.m_iOrphans = iOrphans; | |
| 821 } | |
| 822 virtual void SetLineBreak(FDE_CSSLINEBREAK eLineBreak) { | |
| 823 m_InheritedData.m_eLineBreak = eLineBreak; | |
| 824 } | |
| 825 virtual FX_ARGB GetBKGColor() const { | |
| 826 return m_NonInheritedData.m_dwBKGColor; | |
| 827 } | |
| 828 virtual const FX_WCHAR* GetBKGImage() const { | |
| 829 return m_NonInheritedData.m_pszBKGImage; | |
| 830 } | |
| 831 virtual const FDE_CSSPOINT& GetBKGPosition() const { | |
| 832 return m_NonInheritedData.m_BKGPosition; | |
| 833 } | |
| 834 virtual FDE_CSSBKGREPEAT GetBKGRepeat() const { | |
| 835 return (FDE_CSSBKGREPEAT)m_NonInheritedData.m_eBKGRepeat; | |
| 836 } | |
| 837 virtual FDE_CSSBKGATTACHMENT GetBKGAttachment() const { | |
| 838 return (FDE_CSSBKGATTACHMENT)m_NonInheritedData.m_eBKGAttachment; | |
| 839 } | |
| 840 virtual void SetBKGColor(FX_ARGB dwBKGColor) { | |
| 841 m_NonInheritedData.m_dwBKGColor = dwBKGColor; | |
| 842 } | |
| 843 virtual void SetBKGPosition(const FDE_CSSPOINT& bkgPosition) { | |
| 844 m_NonInheritedData.m_BKGPosition = bkgPosition; | |
| 845 } | |
| 846 virtual FDE_CSSVISIBILITY GetVisibility() const { | |
| 847 return (FDE_CSSVISIBILITY)m_InheritedData.m_eVisibility; | |
| 848 } | |
| 849 virtual FDE_CSSOVERFLOW GetOverflowX() const { | |
| 850 return (FDE_CSSOVERFLOW)m_NonInheritedData.m_eOverflowX; | |
| 851 } | |
| 852 virtual FDE_CSSOVERFLOW GetOverflowY() const { | |
| 853 return (FDE_CSSOVERFLOW)m_NonInheritedData.m_eOverflowY; | |
| 854 } | |
| 855 virtual int32_t CountCursorUrls() const { | |
| 856 return m_InheritedData.m_pCursorUris == NULL | |
| 857 ? 0 | |
| 858 : m_InheritedData.m_pCursorUris->CountValues(); | |
| 859 } | |
| 860 virtual const FX_WCHAR* GetCursorUrl(int32_t index) const { | |
| 861 FXSYS_assert(m_InheritedData.m_pCursorUris != NULL); | |
| 862 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pCursorUris->GetValue( | |
| 863 index))) | |
| 864 ->GetString(index); | |
| 865 } | |
| 866 virtual FDE_CSSCURSOR GetCursorType() const { | |
| 867 return m_InheritedData.m_eCursor; | |
| 868 } | |
| 869 virtual void SetVisibility(FDE_CSSVISIBILITY eVisibility) { | |
| 870 m_InheritedData.m_eVisibility = eVisibility; | |
| 871 } | |
| 872 virtual FDE_CSSLISTSTYLETYPE GetListStyleType() const { | |
| 873 return (FDE_CSSLISTSTYLETYPE)m_NonInheritedData.m_eListStyleType; | |
| 874 } | |
| 875 virtual FDE_CSSLISTSTYLEPOSITION GetListStylePosition() const { | |
| 876 return (FDE_CSSLISTSTYLEPOSITION)m_NonInheritedData.m_eListStylePosition; | |
| 877 } | |
| 878 virtual const FX_WCHAR* GetListStyleImage() const { | |
| 879 return m_InheritedData.m_pszListStyleImage; | |
| 880 } | |
| 881 virtual void SetListStyleType(FDE_CSSLISTSTYLETYPE eListStyleType) { | |
| 882 m_NonInheritedData.m_eListStyleType = eListStyleType; | |
| 883 } | |
| 884 virtual void SetListStylePosition( | |
| 885 FDE_CSSLISTSTYLEPOSITION eListStylePosition) { | |
| 886 m_NonInheritedData.m_eListStylePosition = eListStylePosition; | |
| 887 } | |
| 888 void AddCustomStyle(const CFX_WideString& wsName, | 577 void AddCustomStyle(const CFX_WideString& wsName, |
| 889 const CFX_WideString& wsValue) { | 578 const CFX_WideString& wsValue) { |
| 890 m_CustomProperties.Add(wsName); | 579 m_CustomProperties.Add(wsName); |
| 891 m_CustomProperties.Add(wsValue); | 580 m_CustomProperties.Add(wsValue); |
| 892 } | 581 } |
| 582 |
| 893 uint32_t m_dwRefCount; | 583 uint32_t m_dwRefCount; |
| 894 IFX_MEMAllocator* m_pAllocator; | 584 IFX_MEMAllocator* m_pAllocator; |
| 895 CFDE_CSSInheritedData m_InheritedData; | 585 CFDE_CSSInheritedData m_InheritedData; |
| 896 CFDE_CSSNonInheritedData m_NonInheritedData; | 586 CFDE_CSSNonInheritedData m_NonInheritedData; |
| 897 CFX_WideStringArray m_CustomProperties; | 587 CFX_WideStringArray m_CustomProperties; |
| 898 }; | 588 }; |
| 899 | 589 |
| 900 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 590 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
| OLD | NEW |