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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, | 137 FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, |
138 FX_FLOAT fValue, | 138 FX_FLOAT fValue, |
139 FX_FLOAT fPercentBase); | 139 FX_FLOAT fPercentBase); |
140 FX_BOOL SetLengthWithPercent(FDE_CSSLENGTH& width, | 140 FX_BOOL SetLengthWithPercent(FDE_CSSLENGTH& width, |
141 FDE_CSSPRIMITIVETYPE eType, | 141 FDE_CSSPRIMITIVETYPE eType, |
142 IFDE_CSSPrimitiveValue* pPrimitive, | 142 IFDE_CSSPrimitiveValue* pPrimitive, |
143 FX_FLOAT fFontSize); | 143 FX_FLOAT fFontSize); |
144 FX_FLOAT ToFontSize(FDE_CSSPROPERTYVALUE eValue, FX_FLOAT fCurFontSize); | 144 FX_FLOAT ToFontSize(FDE_CSSPROPERTYVALUE eValue, FX_FLOAT fCurFontSize); |
145 FDE_CSSDISPLAY ToDisplay(FDE_CSSPROPERTYVALUE eValue); | 145 FDE_CSSDISPLAY ToDisplay(FDE_CSSPROPERTYVALUE eValue); |
146 FDE_CSSTEXTALIGN ToTextAlign(FDE_CSSPROPERTYVALUE eValue); | 146 FDE_CSSTEXTALIGN ToTextAlign(FDE_CSSPROPERTYVALUE eValue); |
147 FX_WORD ToFontWeight(FDE_CSSPROPERTYVALUE eValue); | 147 uint16_t ToFontWeight(FDE_CSSPROPERTYVALUE eValue); |
148 FDE_CSSFONTSTYLE ToFontStyle(FDE_CSSPROPERTYVALUE eValue); | 148 FDE_CSSFONTSTYLE ToFontStyle(FDE_CSSPROPERTYVALUE eValue); |
149 FDE_CSSBORDERSTYLE ToBorderStyle(FDE_CSSPROPERTYVALUE eValue); | 149 FDE_CSSBORDERSTYLE ToBorderStyle(FDE_CSSPROPERTYVALUE eValue); |
150 FDE_CSSVERTICALALIGN ToVerticalAlign(FDE_CSSPROPERTYVALUE eValue); | 150 FDE_CSSVERTICALALIGN ToVerticalAlign(FDE_CSSPROPERTYVALUE eValue); |
151 FDE_CSSLISTSTYLETYPE ToListStyleType(FDE_CSSPROPERTYVALUE eValue); | 151 FDE_CSSLISTSTYLETYPE ToListStyleType(FDE_CSSPROPERTYVALUE eValue); |
152 FDE_CSSLISTSTYLEPOSITION ToListStylePosition(FDE_CSSPROPERTYVALUE eValue); | 152 FDE_CSSLISTSTYLEPOSITION ToListStylePosition(FDE_CSSPROPERTYVALUE eValue); |
153 FDE_CSSVISIBILITY ToVisibility(FDE_CSSPROPERTYVALUE eValue); | 153 FDE_CSSVISIBILITY ToVisibility(FDE_CSSPROPERTYVALUE eValue); |
154 FDE_CSSWHITESPACE ToWhiteSpace(FDE_CSSPROPERTYVALUE eValue); | 154 FDE_CSSWHITESPACE ToWhiteSpace(FDE_CSSPROPERTYVALUE eValue); |
155 FX_DWORD ToTextDecoration(IFDE_CSSValueList* pList); | 155 FX_DWORD ToTextDecoration(IFDE_CSSValueList* pList); |
156 FDE_CSSTEXTTRANSFORM ToTextTransform(FDE_CSSPROPERTYVALUE eValue); | 156 FDE_CSSTEXTTRANSFORM ToTextTransform(FDE_CSSPROPERTYVALUE eValue); |
157 FDE_CSSFONTVARIANT ToFontVariant(FDE_CSSPROPERTYVALUE eValue); | 157 FDE_CSSFONTVARIANT ToFontVariant(FDE_CSSPROPERTYVALUE eValue); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 FDE_CSSLENGTH m_WordSpacing; | 264 FDE_CSSLENGTH m_WordSpacing; |
265 FDE_CSSLENGTH m_TextIndent; | 265 FDE_CSSLENGTH m_TextIndent; |
266 IFDE_CSSValueList* m_pFontFamily; | 266 IFDE_CSSValueList* m_pFontFamily; |
267 IFDE_CSSValueList* m_pQuotes; | 267 IFDE_CSSValueList* m_pQuotes; |
268 IFDE_CSSValueList* m_pCursorUris; | 268 IFDE_CSSValueList* m_pCursorUris; |
269 FDE_CSSCURSOR m_eCursor; | 269 FDE_CSSCURSOR m_eCursor; |
270 FX_FLOAT m_fFontSize; | 270 FX_FLOAT m_fFontSize; |
271 FX_FLOAT m_fLineHeight; | 271 FX_FLOAT m_fLineHeight; |
272 FX_ARGB m_dwFontColor; | 272 FX_ARGB m_dwFontColor; |
273 FX_ARGB m_dwTextEmphasisColor; | 273 FX_ARGB m_dwTextEmphasisColor; |
274 FX_WORD m_wFontWeight; | 274 uint16_t m_wFontWeight; |
275 int32_t m_iWidows; | 275 int32_t m_iWidows; |
276 int32_t m_iOrphans; | 276 int32_t m_iOrphans; |
277 const FX_WCHAR* m_pszTextEmphasisCustomMark; | 277 const FX_WCHAR* m_pszTextEmphasisCustomMark; |
278 FX_WORD m_eFontVariant : 1; | 278 uint32_t m_eFontVariant : 1; |
279 FX_WORD m_eFontStyle : 1; | 279 uint32_t m_eFontStyle : 1; |
280 FX_WORD m_bTextEmphasisColorCurrent : 1; | 280 uint32_t m_bTextEmphasisColorCurrent : 1; |
281 FX_WORD m_eTextAligh : 2; | 281 uint32_t m_eTextAligh : 2; |
282 FX_WORD m_eVisibility : 2; | 282 uint32_t m_eVisibility : 2; |
283 FX_WORD m_eWhiteSpace : 3; | 283 uint32_t m_eWhiteSpace : 3; |
284 FX_WORD m_eTextTransform : 2; | 284 uint32_t m_eTextTransform : 2; |
285 FX_WORD m_eWritingMode : 2; | 285 uint32_t m_eWritingMode : 2; |
286 FX_WORD m_eWordBreak : 2; | 286 uint32_t m_eWordBreak : 2; |
287 FX_WORD m_eLineBreak : 2; | 287 uint32_t m_eLineBreak : 2; |
288 FX_WORD m_eTextEmphasisFill : 1; | 288 uint32_t m_eTextEmphasisFill : 1; |
289 FX_WORD m_eTextEmphasisMark : 3; | 289 uint32_t m_eTextEmphasisMark : 3; |
290 FX_WORD m_eCaptionSide : 3; | 290 uint32_t m_eCaptionSide : 3; |
291 | 291 uint8_t m_eRubyAlign : 4; |
292 FX_WORD m_eRubyAlign : 4; | 292 uint8_t m_eRubyOverhang : 2; |
293 FX_WORD m_eRubyOverhang : 2; | 293 uint8_t m_eRubyPosition : 2; |
294 FX_WORD m_eRubyPosition : 2; | |
295 }; | 294 }; |
296 class CFDE_CSSNonInheritedData { | 295 class CFDE_CSSNonInheritedData { |
297 public: | 296 public: |
298 void Reset() { | 297 void Reset() { |
299 FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); | 298 FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); |
300 m_MarginWidth = m_BorderWidth = | 299 m_MarginWidth = m_BorderWidth = |
301 m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); | 300 m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); |
302 m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); | 301 m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); |
303 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); | 302 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); |
304 m_eDisplay = FDE_CSSDISPLAY_Inline; | 303 m_eDisplay = FDE_CSSDISPLAY_Inline; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 virtual int32_t CountFontFamilies() const { | 532 virtual int32_t CountFontFamilies() const { |
534 return m_InheritedData.m_pFontFamily | 533 return m_InheritedData.m_pFontFamily |
535 ? m_InheritedData.m_pFontFamily->CountValues() | 534 ? m_InheritedData.m_pFontFamily->CountValues() |
536 : 0; | 535 : 0; |
537 } | 536 } |
538 virtual const FX_WCHAR* GetFontFamily(int32_t index) const { | 537 virtual const FX_WCHAR* GetFontFamily(int32_t index) const { |
539 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pFontFamily->GetValue( | 538 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pFontFamily->GetValue( |
540 index))) | 539 index))) |
541 ->GetString(index); | 540 ->GetString(index); |
542 } | 541 } |
543 virtual FX_WORD GetFontWeight() const { | 542 virtual uint16_t GetFontWeight() const { |
544 return m_InheritedData.m_wFontWeight; | 543 return m_InheritedData.m_wFontWeight; |
545 } | 544 } |
546 virtual FDE_CSSFONTVARIANT GetFontVariant() const { | 545 virtual FDE_CSSFONTVARIANT GetFontVariant() const { |
547 return (FDE_CSSFONTVARIANT)m_InheritedData.m_eFontVariant; | 546 return (FDE_CSSFONTVARIANT)m_InheritedData.m_eFontVariant; |
548 } | 547 } |
549 virtual FDE_CSSFONTSTYLE GetFontStyle() const { | 548 virtual FDE_CSSFONTSTYLE GetFontStyle() const { |
550 return (FDE_CSSFONTSTYLE)m_InheritedData.m_eFontStyle; | 549 return (FDE_CSSFONTSTYLE)m_InheritedData.m_eFontStyle; |
551 } | 550 } |
552 virtual FX_FLOAT GetFontSize() const { return m_InheritedData.m_fFontSize; } | 551 virtual FX_FLOAT GetFontSize() const { return m_InheritedData.m_fFontSize; } |
553 virtual FX_ARGB GetColor() const { return m_InheritedData.m_dwFontColor; } | 552 virtual FX_ARGB GetColor() const { return m_InheritedData.m_dwFontColor; } |
554 virtual void SetFontWeight(FX_WORD wFontWeight) { | 553 virtual void SetFontWeight(uint16_t wFontWeight) { |
555 m_InheritedData.m_wFontWeight = wFontWeight; | 554 m_InheritedData.m_wFontWeight = wFontWeight; |
556 } | 555 } |
557 virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { | 556 virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { |
558 m_InheritedData.m_eFontVariant = eFontVariant; | 557 m_InheritedData.m_eFontVariant = eFontVariant; |
559 } | 558 } |
560 virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { | 559 virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { |
561 m_InheritedData.m_eFontStyle = eFontStyle; | 560 m_InheritedData.m_eFontStyle = eFontStyle; |
562 } | 561 } |
563 virtual void SetFontSize(FX_FLOAT fFontSize) { | 562 virtual void SetFontSize(FX_FLOAT fFontSize) { |
564 m_InheritedData.m_fFontSize = fFontSize; | 563 m_InheritedData.m_fFontSize = fFontSize; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 m_CustomProperties.Add(wsValue); | 891 m_CustomProperties.Add(wsValue); |
893 } | 892 } |
894 FX_DWORD m_dwRefCount; | 893 FX_DWORD m_dwRefCount; |
895 IFX_MEMAllocator* m_pAllocator; | 894 IFX_MEMAllocator* m_pAllocator; |
896 CFDE_CSSInheritedData m_InheritedData; | 895 CFDE_CSSInheritedData m_InheritedData; |
897 CFDE_CSSNonInheritedData m_NonInheritedData; | 896 CFDE_CSSNonInheritedData m_NonInheritedData; |
898 CFX_WideStringArray m_CustomProperties; | 897 CFX_WideStringArray m_CustomProperties; |
899 }; | 898 }; |
900 | 899 |
901 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 900 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
OLD | NEW |