Chromium Code Reviews| 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 uint16_t m_eFontVariant : 1; |
|
dsinclair
2016/03/21 21:33:12
uint32_t and a uint8_t ? looks like there are 33 b
Tom Sepez
2016/03/21 21:59:48
Argh, bitfields. One of those places where I like
| |
| 279 FX_WORD m_eFontStyle : 1; | 279 uint16_t m_eFontStyle : 1; |
| 280 FX_WORD m_bTextEmphasisColorCurrent : 1; | 280 uint16_t m_bTextEmphasisColorCurrent : 1; |
| 281 FX_WORD m_eTextAligh : 2; | 281 uint16_t m_eTextAligh : 2; |
| 282 FX_WORD m_eVisibility : 2; | 282 uint16_t m_eVisibility : 2; |
| 283 FX_WORD m_eWhiteSpace : 3; | 283 uint16_t m_eWhiteSpace : 3; |
| 284 FX_WORD m_eTextTransform : 2; | 284 uint16_t m_eTextTransform : 2; |
| 285 FX_WORD m_eWritingMode : 2; | 285 uint16_t m_eWritingMode : 2; |
| 286 FX_WORD m_eWordBreak : 2; | 286 uint16_t m_eWordBreak : 2; |
| 287 FX_WORD m_eLineBreak : 2; | 287 uint16_t m_eLineBreak : 2; |
| 288 FX_WORD m_eTextEmphasisFill : 1; | 288 uint16_t m_eTextEmphasisFill : 1; |
| 289 FX_WORD m_eTextEmphasisMark : 3; | 289 uint16_t m_eTextEmphasisMark : 3; |
| 290 FX_WORD m_eCaptionSide : 3; | 290 uint16_t m_eCaptionSide : 3; |
| 291 | 291 |
| 292 FX_WORD m_eRubyAlign : 4; | 292 uint16_t m_eRubyAlign : 4; |
| 293 FX_WORD m_eRubyOverhang : 2; | 293 uint16_t m_eRubyOverhang : 2; |
| 294 FX_WORD m_eRubyPosition : 2; | 294 uint16_t m_eRubyPosition : 2; |
| 295 }; | 295 }; |
| 296 class CFDE_CSSNonInheritedData { | 296 class CFDE_CSSNonInheritedData { |
| 297 public: | 297 public: |
| 298 void Reset() { | 298 void Reset() { |
| 299 FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); | 299 FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); |
| 300 m_MarginWidth = m_BorderWidth = | 300 m_MarginWidth = m_BorderWidth = |
| 301 m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); | 301 m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); |
| 302 m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); | 302 m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); |
| 303 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); | 303 m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); |
| 304 m_eDisplay = FDE_CSSDISPLAY_Inline; | 304 m_eDisplay = FDE_CSSDISPLAY_Inline; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 virtual int32_t CountFontFamilies() const { | 533 virtual int32_t CountFontFamilies() const { |
| 534 return m_InheritedData.m_pFontFamily | 534 return m_InheritedData.m_pFontFamily |
| 535 ? m_InheritedData.m_pFontFamily->CountValues() | 535 ? m_InheritedData.m_pFontFamily->CountValues() |
| 536 : 0; | 536 : 0; |
| 537 } | 537 } |
| 538 virtual const FX_WCHAR* GetFontFamily(int32_t index) const { | 538 virtual const FX_WCHAR* GetFontFamily(int32_t index) const { |
| 539 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pFontFamily->GetValue( | 539 return ((IFDE_CSSPrimitiveValue*)(m_InheritedData.m_pFontFamily->GetValue( |
| 540 index))) | 540 index))) |
| 541 ->GetString(index); | 541 ->GetString(index); |
| 542 } | 542 } |
| 543 virtual FX_WORD GetFontWeight() const { | 543 virtual uint16_t GetFontWeight() const { |
| 544 return m_InheritedData.m_wFontWeight; | 544 return m_InheritedData.m_wFontWeight; |
| 545 } | 545 } |
| 546 virtual FDE_CSSFONTVARIANT GetFontVariant() const { | 546 virtual FDE_CSSFONTVARIANT GetFontVariant() const { |
| 547 return (FDE_CSSFONTVARIANT)m_InheritedData.m_eFontVariant; | 547 return (FDE_CSSFONTVARIANT)m_InheritedData.m_eFontVariant; |
| 548 } | 548 } |
| 549 virtual FDE_CSSFONTSTYLE GetFontStyle() const { | 549 virtual FDE_CSSFONTSTYLE GetFontStyle() const { |
| 550 return (FDE_CSSFONTSTYLE)m_InheritedData.m_eFontStyle; | 550 return (FDE_CSSFONTSTYLE)m_InheritedData.m_eFontStyle; |
| 551 } | 551 } |
| 552 virtual FX_FLOAT GetFontSize() const { return m_InheritedData.m_fFontSize; } | 552 virtual FX_FLOAT GetFontSize() const { return m_InheritedData.m_fFontSize; } |
| 553 virtual FX_ARGB GetColor() const { return m_InheritedData.m_dwFontColor; } | 553 virtual FX_ARGB GetColor() const { return m_InheritedData.m_dwFontColor; } |
| 554 virtual void SetFontWeight(FX_WORD wFontWeight) { | 554 virtual void SetFontWeight(uint16_t wFontWeight) { |
| 555 m_InheritedData.m_wFontWeight = wFontWeight; | 555 m_InheritedData.m_wFontWeight = wFontWeight; |
| 556 } | 556 } |
| 557 virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { | 557 virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { |
| 558 m_InheritedData.m_eFontVariant = eFontVariant; | 558 m_InheritedData.m_eFontVariant = eFontVariant; |
| 559 } | 559 } |
| 560 virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { | 560 virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { |
| 561 m_InheritedData.m_eFontStyle = eFontStyle; | 561 m_InheritedData.m_eFontStyle = eFontStyle; |
| 562 } | 562 } |
| 563 virtual void SetFontSize(FX_FLOAT fFontSize) { | 563 virtual void SetFontSize(FX_FLOAT fFontSize) { |
| 564 m_InheritedData.m_fFontSize = fFontSize; | 564 m_InheritedData.m_fFontSize = fFontSize; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 892 m_CustomProperties.Add(wsValue); | 892 m_CustomProperties.Add(wsValue); |
| 893 } | 893 } |
| 894 FX_DWORD m_dwRefCount; | 894 FX_DWORD m_dwRefCount; |
| 895 IFX_MEMAllocator* m_pAllocator; | 895 IFX_MEMAllocator* m_pAllocator; |
| 896 CFDE_CSSInheritedData m_InheritedData; | 896 CFDE_CSSInheritedData m_InheritedData; |
| 897 CFDE_CSSNonInheritedData m_NonInheritedData; | 897 CFDE_CSSNonInheritedData m_NonInheritedData; |
| 898 CFX_WideStringArray m_CustomProperties; | 898 CFX_WideStringArray m_CustomProperties; |
| 899 }; | 899 }; |
| 900 | 900 |
| 901 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ | 901 #endif // XFA_FDE_CSS_FDE_CSSSTYLESELECTOR_H_ |
| OLD | NEW |