From 96f482c9cd3c99425fd3422251903b1218253c66 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 11 Jan 2017 16:31:27 -0500 Subject: Convert FDE CSS enums to enum classes. This CL updates the possible FDE CSS enums to enum classes and fixes up any instances of incorrect values being used. A few other cleanups and changes were needed to complete the conversion. Change-Id: Ibcca5229a9ca8de1f4beb6462535f61705fd4f8c Reviewed-on: https://pdfium-review.googlesource.com/2170 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fde/css/cfde_cssrulecollection.cpp | 21 +- xfa/fde/css/fde_css.cpp | 12 +- xfa/fde/css/fde_css.h | 1134 +++++++++------------- xfa/fde/css/fde_cssdatatable.cpp | 687 ++++++------- xfa/fde/css/fde_cssdatatable.h | 54 +- xfa/fde/css/fde_cssdeclaration.cpp | 585 ++++++------ xfa/fde/css/fde_cssdeclaration.h | 68 +- xfa/fde/css/fde_cssstyleselector.cpp | 1643 ++++++++------------------------ xfa/fde/css/fde_cssstyleselector.h | 231 +---- xfa/fde/css/fde_cssstylesheet.cpp | 148 +-- xfa/fde/css/fde_cssstylesheet.h | 27 +- xfa/fde/css/fde_csssyntax.cpp | 93 +- xfa/fde/css/fde_csssyntax.h | 4 +- 13 files changed, 1759 insertions(+), 2948 deletions(-) (limited to 'xfa/fde/css') diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index f96396e319..baa6eb465a 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -32,9 +32,10 @@ CFDE_CSSRuleCollection::~CFDE_CSSRuleCollection() { Clear(); } -void CFDE_CSSRuleCollection::AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, - uint32_t dwMediaList, - CFGAS_FontMgr* pFontMgr) { +void CFDE_CSSRuleCollection::AddRulesFrom( + const CFX_ArrayTemplate& sheets, + uint32_t dwMediaList, + CFGAS_FontMgr* pFontMgr) { int32_t iSheets = sheets.GetSize(); for (int32_t i = 0; i < iSheets; ++i) { IFDE_CSSStyleSheet* pSheet = sheets.GetAt(i); @@ -52,13 +53,13 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr) { switch (pRule->GetType()) { - case FDE_CSSRULETYPE_Style: { + case FDE_CSSRuleType::Style: { IFDE_CSSStyleRule* pStyleRule = static_cast(pRule); CFDE_CSSDeclaration* pDeclaration = pStyleRule->GetDeclaration(); int32_t iSelectors = pStyleRule->CountSelectorLists(); for (int32_t i = 0; i < iSelectors; ++i) { CFDE_CSSSelector* pSelector = pStyleRule->GetSelectorList(i); - if (pSelector->GetType() == FDE_CSSSELECTORTYPE_Pseudo) { + if (pSelector->GetType() == FDE_CSSSelectorType::Pseudo) { FDE_CSSRuleData* pData = NewRuleData(pSelector, pDeclaration); AddRuleTo(&m_pPseudoRules, pData); continue; @@ -75,16 +76,16 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, continue; } switch (pNext->GetType()) { - case FDE_CSSSELECTORTYPE_ID: + case FDE_CSSSelectorType::ID: AddRuleTo(&m_IDRules, pNext->GetNameHash(), pSelector, pDeclaration); break; - case FDE_CSSSELECTORTYPE_Class: + case FDE_CSSSelectorType::Class: AddRuleTo(&m_ClassRules, pNext->GetNameHash(), pSelector, pDeclaration); break; - case FDE_CSSSELECTORTYPE_Descendant: - case FDE_CSSSELECTORTYPE_Element: + case FDE_CSSSelectorType::Descendant: + case FDE_CSSSelectorType::Element: AddRuleTo(&m_pUniversalRules, NewRuleData(pSelector, pDeclaration)); break; default: @@ -93,7 +94,7 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, } } } break; - case FDE_CSSRULETYPE_Media: { + case FDE_CSSRuleType::Media: { IFDE_CSSMediaRule* pMediaRule = static_cast(pRule); if (pMediaRule->GetMediaList() & dwMediaList) { int32_t iRules = pMediaRule->CountRules(); diff --git a/xfa/fde/css/fde_css.cpp b/xfa/fde/css/fde_css.cpp index 053b2774e6..c9122b4bfd 100644 --- a/xfa/fde/css/fde_css.cpp +++ b/xfa/fde/css/fde_css.cpp @@ -14,14 +14,14 @@ FDE_CSSVALUETYPE IFDE_CSSValueList::GetType() const { return FDE_CSSVALUETYPE_List; } -FDE_CSSRULETYPE IFDE_CSSStyleRule::GetType() const { - return FDE_CSSRULETYPE_Style; +FDE_CSSRuleType IFDE_CSSStyleRule::GetType() const { + return FDE_CSSRuleType::Style; } -FDE_CSSRULETYPE IFDE_CSSMediaRule::GetType() const { - return FDE_CSSRULETYPE_Media; +FDE_CSSRuleType IFDE_CSSMediaRule::GetType() const { + return FDE_CSSRuleType::Media; } -FDE_CSSRULETYPE IFDE_CSSFontFaceRule::GetType() const { - return FDE_CSSRULETYPE_FontFace; +FDE_CSSRuleType IFDE_CSSFontFaceRule::GetType() const { + return FDE_CSSRuleType::FontFace; } diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 77656116a3..88b0fe2db4 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -36,651 +36,414 @@ class IFDE_CSSValueList; #define FDE_CSSMEDIATYPE_TV 0x80 #define FDE_CSSMEDIATYPE_ALL 0xFF -#define FDE_CSSUNITBITS (3) -#define FDE_CSSUNITMASK ((1 << FDE_CSSUNITBITS) - 1) - enum FDE_CSSVALUETYPE { - FDE_CSSVALUETYPE_Primitive = 1, - FDE_CSSVALUETYPE_List = 2, - FDE_CSSVALUETYPE_Shorthand, -}; - -enum FDE_CSSPRIMITIVETYPE { - FDE_CSSPRIMITIVETYPE_Unknown = 0, - FDE_CSSPRIMITIVETYPE_Number = 1, - FDE_CSSPRIMITIVETYPE_Percent = 2, - FDE_CSSPRIMITIVETYPE_EMS = 3, - FDE_CSSPRIMITIVETYPE_EXS = 4, - FDE_CSSPRIMITIVETYPE_PX = 5, - FDE_CSSPRIMITIVETYPE_CM = 6, - FDE_CSSPRIMITIVETYPE_MM = 7, - FDE_CSSPRIMITIVETYPE_IN = 8, - FDE_CSSPRIMITIVETYPE_PT = 9, - FDE_CSSPRIMITIVETYPE_PC = 10, - FDE_CSSPRIMITIVETYPE_String = 19, - FDE_CSSPRIMITIVETYPE_URI = 20, - FDE_CSSPRIMITIVETYPE_RGB = 25, - FDE_CSSPRIMITIVETYPE_Enum, - FDE_CSSPRIMITIVETYPE_Function, -}; - -enum FDE_CSSPROPERTYVALUE { - FDE_CSSPROPERTYVALUE_Bolder, - FDE_CSSPROPERTYVALUE_LowerLatin, - FDE_CSSPROPERTYVALUE_Lowercase, - FDE_CSSPROPERTYVALUE_LowerGreek, - FDE_CSSPROPERTYVALUE_Sesame, - FDE_CSSPROPERTYVALUE_None, - FDE_CSSPROPERTYVALUE_NwResize, - FDE_CSSPROPERTYVALUE_WResize, - FDE_CSSPROPERTYVALUE_Dot, - FDE_CSSPROPERTYVALUE_End, - FDE_CSSPROPERTYVALUE_Ltr, - FDE_CSSPROPERTYVALUE_Pre, - FDE_CSSPROPERTYVALUE_Rtl, - FDE_CSSPROPERTYVALUE_Sub, - FDE_CSSPROPERTYVALUE_Top, - FDE_CSSPROPERTYVALUE_Visible, - FDE_CSSPROPERTYVALUE_Filled, - FDE_CSSPROPERTYVALUE_SwResize, - FDE_CSSPROPERTYVALUE_NoRepeat, - FDE_CSSPROPERTYVALUE_Default, - FDE_CSSPROPERTYVALUE_Transparent, - FDE_CSSPROPERTYVALUE_Ridge, - FDE_CSSPROPERTYVALUE_Right, - FDE_CSSPROPERTYVALUE_HorizontalTb, - FDE_CSSPROPERTYVALUE_DistributeLetter, - FDE_CSSPROPERTYVALUE_DoubleCircle, - FDE_CSSPROPERTYVALUE_Ruby, - FDE_CSSPROPERTYVALUE_Collapse, - FDE_CSSPROPERTYVALUE_Normal, - FDE_CSSPROPERTYVALUE_Avoid, - FDE_CSSPROPERTYVALUE_UpperRoman, - FDE_CSSPROPERTYVALUE_Auto, - FDE_CSSPROPERTYVALUE_Text, - FDE_CSSPROPERTYVALUE_XSmall, - FDE_CSSPROPERTYVALUE_Thin, - FDE_CSSPROPERTYVALUE_Repeat, - FDE_CSSPROPERTYVALUE_Small, - FDE_CSSPROPERTYVALUE_NeResize, - FDE_CSSPROPERTYVALUE_NoContent, - FDE_CSSPROPERTYVALUE_Outside, - FDE_CSSPROPERTYVALUE_EResize, - FDE_CSSPROPERTYVALUE_TableRow, - FDE_CSSPROPERTYVALUE_Bottom, - FDE_CSSPROPERTYVALUE_Underline, - FDE_CSSPROPERTYVALUE_CjkIdeographic, - FDE_CSSPROPERTYVALUE_SeResize, - FDE_CSSPROPERTYVALUE_Fixed, - FDE_CSSPROPERTYVALUE_Double, - FDE_CSSPROPERTYVALUE_Solid, - FDE_CSSPROPERTYVALUE_RubyBaseGroup, - FDE_CSSPROPERTYVALUE_OpenQuote, - FDE_CSSPROPERTYVALUE_Lighter, - FDE_CSSPROPERTYVALUE_LowerRoman, - FDE_CSSPROPERTYVALUE_Strict, - FDE_CSSPROPERTYVALUE_TableCaption, - FDE_CSSPROPERTYVALUE_Oblique, - FDE_CSSPROPERTYVALUE_Decimal, - FDE_CSSPROPERTYVALUE_Loose, - FDE_CSSPROPERTYVALUE_Hebrew, - FDE_CSSPROPERTYVALUE_Hidden, - FDE_CSSPROPERTYVALUE_Dashed, - FDE_CSSPROPERTYVALUE_Embed, - FDE_CSSPROPERTYVALUE_TableRowGroup, - FDE_CSSPROPERTYVALUE_TableColumn, - FDE_CSSPROPERTYVALUE_Static, - FDE_CSSPROPERTYVALUE_Outset, - FDE_CSSPROPERTYVALUE_DecimalLeadingZero, - FDE_CSSPROPERTYVALUE_KeepWords, - FDE_CSSPROPERTYVALUE_KatakanaIroha, - FDE_CSSPROPERTYVALUE_Super, - FDE_CSSPROPERTYVALUE_Center, - FDE_CSSPROPERTYVALUE_TableHeaderGroup, - FDE_CSSPROPERTYVALUE_Inside, - FDE_CSSPROPERTYVALUE_XxLarge, - FDE_CSSPROPERTYVALUE_Triangle, - FDE_CSSPROPERTYVALUE_RubyTextGroup, - FDE_CSSPROPERTYVALUE_Circle, - FDE_CSSPROPERTYVALUE_Hiragana, - FDE_CSSPROPERTYVALUE_RepeatX, - FDE_CSSPROPERTYVALUE_RepeatY, - FDE_CSSPROPERTYVALUE_Move, - FDE_CSSPROPERTYVALUE_HiraganaIroha, - FDE_CSSPROPERTYVALUE_RubyBase, - FDE_CSSPROPERTYVALUE_Scroll, - FDE_CSSPROPERTYVALUE_Smaller, - FDE_CSSPROPERTYVALUE_TableFooterGroup, - FDE_CSSPROPERTYVALUE_Baseline, - FDE_CSSPROPERTYVALUE_Separate, - FDE_CSSPROPERTYVALUE_Armenian, - FDE_CSSPROPERTYVALUE_Open, - FDE_CSSPROPERTYVALUE_Relative, - FDE_CSSPROPERTYVALUE_Thick, - FDE_CSSPROPERTYVALUE_Justify, - FDE_CSSPROPERTYVALUE_Middle, - FDE_CSSPROPERTYVALUE_Always, - FDE_CSSPROPERTYVALUE_DistributeSpace, - FDE_CSSPROPERTYVALUE_LineEdge, - FDE_CSSPROPERTYVALUE_PreWrap, - FDE_CSSPROPERTYVALUE_Medium, - FDE_CSSPROPERTYVALUE_NResize, - FDE_CSSPROPERTYVALUE_ListItem, - FDE_CSSPROPERTYVALUE_Show, - FDE_CSSPROPERTYVALUE_Currentcolor, - FDE_CSSPROPERTYVALUE_NoCloseQuote, - FDE_CSSPROPERTYVALUE_VerticalLr, - FDE_CSSPROPERTYVALUE_VerticalRl, - FDE_CSSPROPERTYVALUE_Pointer, - FDE_CSSPROPERTYVALUE_XxSmall, - FDE_CSSPROPERTYVALUE_Bold, - FDE_CSSPROPERTYVALUE_Both, - FDE_CSSPROPERTYVALUE_SmallCaps, - FDE_CSSPROPERTYVALUE_Katakana, - FDE_CSSPROPERTYVALUE_After, - FDE_CSSPROPERTYVALUE_Horizontal, - FDE_CSSPROPERTYVALUE_Dotted, - FDE_CSSPROPERTYVALUE_Disc, - FDE_CSSPROPERTYVALUE_Georgian, - FDE_CSSPROPERTYVALUE_Inline, - FDE_CSSPROPERTYVALUE_Overline, - FDE_CSSPROPERTYVALUE_Wait, - FDE_CSSPROPERTYVALUE_BreakAll, - FDE_CSSPROPERTYVALUE_UpperAlpha, - FDE_CSSPROPERTYVALUE_Capitalize, - FDE_CSSPROPERTYVALUE_Nowrap, - FDE_CSSPROPERTYVALUE_TextBottom, - FDE_CSSPROPERTYVALUE_NoOpenQuote, - FDE_CSSPROPERTYVALUE_Groove, - FDE_CSSPROPERTYVALUE_Progress, - FDE_CSSPROPERTYVALUE_Larger, - FDE_CSSPROPERTYVALUE_CloseQuote, - FDE_CSSPROPERTYVALUE_TableCell, - FDE_CSSPROPERTYVALUE_PreLine, - FDE_CSSPROPERTYVALUE_Absolute, - FDE_CSSPROPERTYVALUE_InlineTable, - FDE_CSSPROPERTYVALUE_BidiOverride, - FDE_CSSPROPERTYVALUE_InlineBlock, - FDE_CSSPROPERTYVALUE_Inset, - FDE_CSSPROPERTYVALUE_Crosshair, - FDE_CSSPROPERTYVALUE_UpperLatin, - FDE_CSSPROPERTYVALUE_Help, - FDE_CSSPROPERTYVALUE_Hide, - FDE_CSSPROPERTYVALUE_Uppercase, - FDE_CSSPROPERTYVALUE_SResize, - FDE_CSSPROPERTYVALUE_Table, - FDE_CSSPROPERTYVALUE_Blink, - FDE_CSSPROPERTYVALUE_Block, - FDE_CSSPROPERTYVALUE_Start, - FDE_CSSPROPERTYVALUE_TableColumnGroup, - FDE_CSSPROPERTYVALUE_Italic, - FDE_CSSPROPERTYVALUE_LineThrough, - FDE_CSSPROPERTYVALUE_KeepAll, - FDE_CSSPROPERTYVALUE_LowerAlpha, - FDE_CSSPROPERTYVALUE_RunIn, - FDE_CSSPROPERTYVALUE_Square, - FDE_CSSPROPERTYVALUE_XLarge, - FDE_CSSPROPERTYVALUE_Large, - FDE_CSSPROPERTYVALUE_Before, - FDE_CSSPROPERTYVALUE_Left, - FDE_CSSPROPERTYVALUE_TextTop, - FDE_CSSPROPERTYVALUE_RubyText, - FDE_CSSPROPERTYVALUE_NoDisplay, - FDE_CSSPROPERTYVALUE_MAX -}; - -enum FDE_CSSPROPERTY { - FDE_CSSPROPERTY_WritingMode, - FDE_CSSPROPERTY_ColumnRuleWidth, - FDE_CSSPROPERTY_BorderLeft, - FDE_CSSPROPERTY_ColumnRule, - FDE_CSSPROPERTY_Height, - FDE_CSSPROPERTY_CounterReset, - FDE_CSSPROPERTY_Content, - FDE_CSSPROPERTY_RubyPosition, - FDE_CSSPROPERTY_BackgroundColor, - FDE_CSSPROPERTY_Width, - FDE_CSSPROPERTY_Src, - FDE_CSSPROPERTY_Top, - FDE_CSSPROPERTY_Margin, - FDE_CSSPROPERTY_BorderColor, - FDE_CSSPROPERTY_Widows, - FDE_CSSPROPERTY_BorderBottomColor, - FDE_CSSPROPERTY_TextIndent, - FDE_CSSPROPERTY_Right, - FDE_CSSPROPERTY_TextEmphasisStyle, - FDE_CSSPROPERTY_PaddingLeft, - FDE_CSSPROPERTY_ColumnWidth, - FDE_CSSPROPERTY_MarginLeft, - FDE_CSSPROPERTY_Border, - FDE_CSSPROPERTY_BorderTop, - FDE_CSSPROPERTY_RubyOverhang, - FDE_CSSPROPERTY_PageBreakBefore, - FDE_CSSPROPERTY_MaxHeight, - FDE_CSSPROPERTY_MinWidth, - FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_Bottom, - FDE_CSSPROPERTY_Quotes, - FDE_CSSPROPERTY_MaxWidth, - FDE_CSSPROPERTY_PaddingRight, - FDE_CSSPROPERTY_ListStyleImage, - FDE_CSSPROPERTY_WhiteSpace, - FDE_CSSPROPERTY_BorderBottom, - FDE_CSSPROPERTY_ListStyleType, - FDE_CSSPROPERTY_WordBreak, - FDE_CSSPROPERTY_OverflowX, - FDE_CSSPROPERTY_OverflowY, - FDE_CSSPROPERTY_BorderTopColor, - FDE_CSSPROPERTY_FontFamily, - FDE_CSSPROPERTY_Cursor, - FDE_CSSPROPERTY_RubyAlign, - FDE_CSSPROPERTY_ColumnRuleColor, - FDE_CSSPROPERTY_FontWeight, - FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_MinHeight, - FDE_CSSPROPERTY_Color, - FDE_CSSPROPERTY_LetterSpacing, - FDE_CSSPROPERTY_EmptyCells, - FDE_CSSPROPERTY_TextAlign, - FDE_CSSPROPERTY_RubySpan, - FDE_CSSPROPERTY_Position, - FDE_CSSPROPERTY_BorderStyle, - FDE_CSSPROPERTY_BorderBottomStyle, - FDE_CSSPROPERTY_BorderCollapse, - FDE_CSSPROPERTY_ColumnCount, - FDE_CSSPROPERTY_BorderRightWidth, - FDE_CSSPROPERTY_UnicodeBidi, - FDE_CSSPROPERTY_VerticalAlign, - FDE_CSSPROPERTY_PaddingTop, - FDE_CSSPROPERTY_Columns, - FDE_CSSPROPERTY_Overflow, - FDE_CSSPROPERTY_TableLayout, - FDE_CSSPROPERTY_FontVariant, - FDE_CSSPROPERTY_ListStyle, - FDE_CSSPROPERTY_BackgroundPosition, - FDE_CSSPROPERTY_BorderWidth, - FDE_CSSPROPERTY_TextEmphasisColor, - FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_PageBreakInside, - FDE_CSSPROPERTY_TextEmphasis, - FDE_CSSPROPERTY_BorderBottomWidth, - FDE_CSSPROPERTY_ColumnGap, - FDE_CSSPROPERTY_Orphans, - FDE_CSSPROPERTY_BorderRight, - FDE_CSSPROPERTY_FontSize, - FDE_CSSPROPERTY_PageBreakAfter, - FDE_CSSPROPERTY_CaptionSide, - FDE_CSSPROPERTY_BackgroundRepeat, - FDE_CSSPROPERTY_BorderTopStyle, - FDE_CSSPROPERTY_BorderSpacing, - FDE_CSSPROPERTY_TextTransform, - FDE_CSSPROPERTY_FontStyle, - FDE_CSSPROPERTY_Font, - FDE_CSSPROPERTY_LineHeight, - FDE_CSSPROPERTY_MarginRight, - FDE_CSSPROPERTY_Float, - FDE_CSSPROPERTY_BorderLeftWidth, - FDE_CSSPROPERTY_Display, - FDE_CSSPROPERTY_Clear, - FDE_CSSPROPERTY_ColumnRuleStyle, - FDE_CSSPROPERTY_TextCombine, - FDE_CSSPROPERTY_ListStylePosition, - FDE_CSSPROPERTY_Visibility, - FDE_CSSPROPERTY_PaddingBottom, - FDE_CSSPROPERTY_BackgroundAttachment, - FDE_CSSPROPERTY_BackgroundImage, - FDE_CSSPROPERTY_LineBreak, - FDE_CSSPROPERTY_Background, - FDE_CSSPROPERTY_BorderTopWidth, - FDE_CSSPROPERTY_WordSpacing, - FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_CounterIncrement, - FDE_CSSPROPERTY_Left, - FDE_CSSPROPERTY_TextDecoration, - FDE_CSSPROPERTY_Padding, - FDE_CSSPROPERTY_MarginBottom, - FDE_CSSPROPERTY_MarginTop, - FDE_CSSPROPERTY_Direction, - FDE_CSSPROPERTY_MAX -}; - -enum FDE_CSSPSEUDO { - FDE_CSSPSEUDO_After, - FDE_CSSPSEUDO_Before, - FDE_CSSPSEUDO_NONE -}; - -enum FDE_CSSSELECTORTYPE { - FDE_CSSSELECTORTYPE_Element, - FDE_CSSSELECTORTYPE_Descendant, - FDE_CSSSELECTORTYPE_Class, - FDE_CSSSELECTORTYPE_Pseudo, - FDE_CSSSELECTORTYPE_ID, -}; - -enum FDE_CSSRULETYPE { - FDE_CSSRULETYPE_Unknown = 0, - FDE_CSSRULETYPE_Style = 1, - FDE_CSSRULETYPE_Media = 4, - FDE_CSSRULETYPE_FontFace = 5, -}; - -enum FDE_CSSSYNTAXSTATUS { - FDE_CSSSYNTAXSTATUS_Error, - FDE_CSSSYNTAXSTATUS_EOS, - FDE_CSSSYNTAXSTATUS_None, - FDE_CSSSYNTAXSTATUS_Charset, - FDE_CSSSYNTAXSTATUS_ImportRule, - FDE_CSSSYNTAXSTATUS_ImportClose, - FDE_CSSSYNTAXSTATUS_PageRule, - FDE_CSSSYNTAXSTATUS_StyleRule, - FDE_CSSSYNTAXSTATUS_FontFaceRule, - FDE_CSSSYNTAXSTATUS_MediaRule, - FDE_CSSSYNTAXSTATUS_MediaType, - FDE_CSSSYNTAXSTATUS_URI, - FDE_CSSSYNTAXSTATUS_Selector, - FDE_CSSSYNTAXSTATUS_DeclOpen, - FDE_CSSSYNTAXSTATUS_DeclClose, - FDE_CSSSYNTAXSTATUS_PropertyName, - FDE_CSSSYNTAXSTATUS_PropertyValue, -}; - -enum FDE_CSSLENGTHUNIT { - FDE_CSSLENGTHUNIT_Auto, - FDE_CSSLENGTHUNIT_None, - FDE_CSSLENGTHUNIT_Normal, - FDE_CSSLENGTHUNIT_Point, - FDE_CSSLENGTHUNIT_Percent, -}; - -enum FDE_CSSBKGATTACHMENT { - FDE_CSSBKGATTACHMENT_Scroll, - FDE_CSSBKGATTACHMENT_Fixed, -}; - -enum FDE_CSSBKGREPEAT { - FDE_CSSBKGREPEAT_Repeat, - FDE_CSSBKGREPEAT_RepeatX, - FDE_CSSBKGREPEAT_RepeatY, - FDE_CSSBKGREPEAT_NoRepeat, -}; - -enum FDE_CSSBORDERSTYLE { - FDE_CSSBORDERSTYLE_None, - FDE_CSSBORDERSTYLE_Hidden, - FDE_CSSBORDERSTYLE_Dotted, - FDE_CSSBORDERSTYLE_Dashed, - FDE_CSSBORDERSTYLE_Solid, - FDE_CSSBORDERSTYLE_Double, - FDE_CSSBORDERSTYLE_Groove, - FDE_CSSBORDERSTYLE_Ridge, - FDE_CSSBORDERSTYLE_Inset, - FDE_CSSBORDERSTYLE_outset, -}; - -enum FDE_CSSCLEAR { - FDE_CSSCLEAR_None, - FDE_CSSCLEAR_Left, - FDE_CSSCLEAR_Right, - FDE_CSSCLEAR_Both, -}; - -enum FDE_CSSDISPLAY { - FDE_CSSDISPLAY_None, - FDE_CSSDISPLAY_ListItem, - FDE_CSSDISPLAY_RunIn, - FDE_CSSDISPLAY_Block, - FDE_CSSDISPLAY_Inline, - FDE_CSSDISPLAY_InlineBlock, - FDE_CSSDISPLAY_InlineTable, - FDE_CSSDISPLAY_Table, - FDE_CSSDISPLAY_TableRow, - FDE_CSSDISPLAY_TableCell, - FDE_CSSDISPLAY_TableCaption, - FDE_CSSDISPLAY_TableColumn, - FDE_CSSDISPLAY_TableRowGroup, - FDE_CSSDISPLAY_TableColumnGroup, - FDE_CSSDISPLAY_TableHeaderGroup, - FDE_CSSDISPLAY_TableFooterGroup, - FDE_CSSDISPLAY_Ruby, - FDE_CSSDISPLAY_RubyBase, - FDE_CSSDISPLAY_RubyText, - FDE_CSSDISPLSY_RubyBaseGroup, - FDE_CSSDISPLAY_RubyTextGroup, -}; - -enum FDE_CSSVISIBILITY { - FDE_CSSVISIBILITY_Visible, - FDE_CSSVISIBILITY_Hidden, - FDE_CSSVISIBILITY_Collapse, -}; - -enum FDE_CSSFONTSTYLE { - FDE_CSSFONTSTYLE_Normal, - FDE_CSSFONTSTYLE_Italic, -}; - -enum FDE_CSSFLOAT { - FDE_CSSFLOAT_None, - FDE_CSSFLOAT_Left, - FDE_CSSFLOAT_Right, -}; - -enum FDE_CSSWRITINGMODE { - FDE_CSSWRITINGMODE_HorizontalTb, - FDE_CSSWRITINGMODE_VerticalRl, - FDE_CSSWRITINGMODE_VerticalLr, -}; - -enum FDE_CSSWORDBREAK { - FDE_CSSWORDBREAK_Normal, - FDE_CSSWORDBREAK_KeepAll, - FDE_CSSWORDBREAK_BreakAll, - FDE_CSSWORDBREAK_KeepWords, -}; - -enum FDE_CSSPAGEBREAK { - FDE_CSSPAGEBREAK_Auto, - FDE_CSSPAGEBREAK_Always, - FDE_CSSPAGEBREAK_Avoid, - FDE_CSSPAGEBREAK_Left, - FDE_CSSPAGEBREAK_Right, -}; - -enum FDE_CSSOVERFLOW { - FDE_CSSOVERFLOW_Visible, - FDE_CSSOVERFLOW_Hidden, - FDE_CSSOVERFLOW_Scroll, - FDE_CSSOVERFLOW_Auto, - FDE_CSSOVERFLOW_NoDisplay, - FDE_CSSOVERFLOW_NoContent, -}; - -enum FDE_CSSLINEBREAK { - FDE_CSSLINEBREAK_Auto, - FDE_CSSLINEBREAK_Loose, - FDE_CSSLINEBREAK_Normal, - FDE_CSSLINEBREAK_Strict, -}; - -enum FDE_CSSTEXTEMPHASISFILL { - FDE_CSSTEXTEMPHASISFILL_Filled, - FDE_CSSTEXTEMPHASISFILL_Open, -}; - -enum FDE_CSSTEXTEMPHASISMARK { - FDE_CSSTEXTEMPHASISMARK_None, - FDE_CSSTEXTEMPHASISMARK_Auto, - FDE_CSSTEXTEMPHASISMARK_Dot, - FDE_CSSTEXTEMPHASISMARK_Circle, - FDE_CSSTEXTEMPHASISMARK_DoubleCircle, - FDE_CSSTEXTEMPHASISMARK_Triangle, - FDE_CSSTEXTEMPHASISMARK_Sesame, - FDE_CSSTEXTEMPHASISMARK_Custom, -}; - -enum FDE_CSSTEXTCOMBINE { - FDE_CSSTEXTCOMBINE_Horizontal, - FDE_CSSTEXTCOMBINE_None, -}; - -enum FDE_CSSCURSOR { - FDE_CSSCURSOR_Auto, - FDE_CSSCURSOR_Crosshair, - FDE_CSSCURSOR_Default, - FDE_CSSCURSOR_Pointer, - FDE_CSSCURSOR_Move, - FDE_CSSCURSOR_EResize, - FDE_CSSCURSOR_NeResize, - FDE_CSSCURSOR_NwResize, - FDE_CSSCURSOR_NResize, - FDE_CSSCURSOR_SeResize, - FDE_CSSCURSOR_SwResize, - FDE_CSSCURSOR_SResize, - FDE_CSSCURSOR_WResize, - FDE_CSSCURSOR_Text, - FDE_CSSCURSOR_Wait, - FDE_CSSCURSOR_Help, - FDE_CSSCURSOR_Progress, -}; - -enum FDE_CSSPOSITION { - FDE_CSSPOSITION_Static, - FDE_CSSPOSITION_Relative, - FDE_CSSPOSITION_Absolute, - FDE_CSSPOSITION_Fixed, -}; - -enum FDE_CSSCAPTIONSIDE { - FDE_CSSCAPTIONSIDE_Top, - FDE_CSSCAPTIONSIDE_Bottom, - FDE_CSSCAPTIONSIDE_Left, - FDE_CSSCAPTIONSIDE_Right, - FDE_CSSCAPTIONSIDE_Before, - FDE_CSSCAPTIONSIDE_After, -}; - -enum FDE_CSSRUBYALIGN { - FDE_CSSRUBYALIGN_Auto, - FDE_CSSRUBYALIGN_Start, - FDE_CSSRUBYALIGN_Left, - FDE_CSSRUBYALIGN_Center, - FDE_CSSRUBYALIGN_End, - FDE_CSSRUBYALIGN_Right, - FDE_CSSRUBYALIGN_DistributeLetter, - FDE_CSSRUBYALIGN_DistributeSpace, - FDE_CSSRUBYALIGN_LineEdge, -}; - -enum FDE_CSSRUBYOVERHANG { - FDE_CSSRUBYOVERHANG_Auto, - FDE_CSSRUBYOVERHANG_Start, - FDE_CSSRUBYOVERHANG_End, - FDE_CSSRUBYOVERHANG_None, -}; - -enum FDE_CSSRUBYPOSITION { - FDE_CSSRUBYPOSITION_Before, - FDE_CSSRUBYPOSITION_After, - FDE_CSSRUBYPOSITION_Right, - FDE_CSSRUBYPOSITION_Inline, -}; - -enum FDE_CSSRUBYSPAN { - FDE_CSSRUBYSPAN_None, - FDE_CSSRUBYSPAN_Attr, -}; - -enum FDE_CSSTEXTALIGN { - FDE_CSSTEXTALIGN_Left, - FDE_CSSTEXTALIGN_Right, - FDE_CSSTEXTALIGN_Center, - FDE_CSSTEXTALIGN_Justify, - FDE_CSSTEXTALIGN_JustifyAll, -}; - -enum FDE_CSSVERTICALALIGN { - FDE_CSSVERTICALALIGN_Baseline, - FDE_CSSVERTICALALIGN_Sub, - FDE_CSSVERTICALALIGN_Super, - FDE_CSSVERTICALALIGN_Top, - FDE_CSSVERTICALALIGN_TextTop, - FDE_CSSVERTICALALIGN_Middle, - FDE_CSSVERTICALALIGN_Bottom, - FDE_CSSVERTICALALIGN_TextBottom, - FDE_CSSVERTICALALIGN_Number, -}; - -enum FDE_CSSLISTSTYLETYPE { - FDE_CSSLISTSTYLETYPE_Disc, - FDE_CSSLISTSTYLETYPE_Circle, - FDE_CSSLISTSTYLETYPE_Square, - FDE_CSSLISTSTYLETYPE_Decimal, - FDE_CSSLISTSTYLETYPE_DecimalLeadingZero, - FDE_CSSLISTSTYLETYPE_LowerRoman, - FDE_CSSLISTSTYLETYPE_UpperRoman, - FDE_CSSLISTSTYLETYPE_LowerGreek, - FDE_CSSLISTSTYLETYPE_LowerLatin, - FDE_CSSLISTSTYLETYPE_UpperLatin, - FDE_CSSLISTSTYLETYPE_Armenian, - FDE_CSSLISTSTYLETYPE_Georgian, - FDE_CSSLISTSTYLETYPE_LowerAlpha, - FDE_CSSLISTSTYLETYPE_UpperAlpha, - FDE_CSSLISTSTYLETYPE_None, - FDE_CSSLISTSTYLETYPE_CjkIdeographic, - FDE_CSSLISTSTYLETYPE_Hebrew, - FDE_CSSLISTSTYLETYPE_Hiragana, - FDE_CSSLISTSTYLETYPE_HiraganaIroha, - FDE_CSSLISTSTYLETYPE_Katakana, - FDE_CSSLISTSTYLETYPE_KatakanaIroha, -}; - -enum FDE_CSSLISTSTYLEPOSITION { - FDE_CSSLISTSTYLEPOSITION_Outside, - FDE_CSSLISTSTYLEPOSITION_Inside, -}; - -enum FDE_CSSWHITESPACE { - FDE_CSSWHITESPACE_Normal, - FDE_CSSWHITESPACE_Pre, - FDE_CSSWHITESPACE_Nowrap, - FDE_CSSWHITESPACE_PreWrap, - FDE_CSSWHITESPACE_PreLine, -}; - -enum FDE_CSSFONTVARIANT { - FDE_CSSFONTVARIANT_Normal, - FDE_CSSFONTVARIANT_SmallCaps, -}; - -enum FDE_CSSTEXTTRANSFORM { - FDE_CSSTEXTTRANSFORM_None, - FDE_CSSTEXTTRANSFORM_Capitalize, - FDE_CSSTEXTTRANSFORM_UpperCase, - FDE_CSSTEXTTRANSFORM_LowerCase, + FDE_CSSVALUETYPE_Primitive = 1 << 0, + FDE_CSSVALUETYPE_List = 1 << 1, + FDE_CSSVALUETYPE_Shorthand = 1 << 2, + // Note the values below this comment must be > 0x0F so we can mask the above. + FDE_CSSVALUETYPE_MaybeNumber = 1 << 4, + FDE_CSSVALUETYPE_MaybeEnum = 1 << 5, + FDE_CSSVALUETYPE_MaybeURI = 1 << 6, + FDE_CSSVALUETYPE_MaybeString = 1 << 7, + FDE_CSSVALUETYPE_MaybeColor = 1 << 8, + FDE_CSSVALUETYPE_MaybeFunction = 1 << 9 +}; + +enum class FDE_CSSPrimitiveType : uint8_t { + Unknown = 0, + Number, + Percent, + EMS, + EXS, + Pixels, + CentiMeters, + MilliMeters, + Inches, + Points, + Picas, + String, + URI, + RGB, + Enum, + Function, +}; + +enum class FDE_CSSPropertyValue : uint8_t { + Bolder = 0, + LowerLatin, + Lowercase, + LowerGreek, + Sesame, + None, + NwResize, + WResize, + Dot, + End, + Ltr, + Pre, + Rtl, + Sub, + Top, + Visible, + Filled, + SwResize, + NoRepeat, + Default, + Transparent, + Ridge, + Right, + HorizontalTb, + DistributeLetter, + DoubleCircle, + Ruby, + Collapse, + Normal, + Avoid, + UpperRoman, + Auto, + Text, + XSmall, + Thin, + Repeat, + Small, + NeResize, + NoContent, + Outside, + EResize, + TableRow, + Bottom, + Underline, + CjkIdeographic, + SeResize, + Fixed, + Double, + Solid, + RubyBaseGroup, + OpenQuote, + Lighter, + LowerRoman, + Strict, + TableCaption, + Oblique, + Decimal, + Loose, + Hebrew, + Hidden, + Dashed, + Embed, + TableRowGroup, + TableColumn, + Static, + Outset, + DecimalLeadingZero, + KeepWords, + KatakanaIroha, + Super, + Center, + TableHeaderGroup, + Inside, + XxLarge, + Triangle, + RubyTextGroup, + Circle, + Hiragana, + RepeatX, + RepeatY, + Move, + HiraganaIroha, + RubyBase, + Scroll, + Smaller, + TableFooterGroup, + Baseline, + Separate, + Armenian, + Open, + Relative, + Thick, + Justify, + Middle, + Always, + DistributeSpace, + LineEdge, + PreWrap, + Medium, + NResize, + ListItem, + Show, + Currentcolor, + NoCloseQuote, + VerticalLr, + VerticalRl, + Pointer, + XxSmall, + Bold, + Both, + SmallCaps, + Katakana, + After, + Horizontal, + Dotted, + Disc, + Georgian, + Inline, + Overline, + Wait, + BreakAll, + UpperAlpha, + Capitalize, + Nowrap, + TextBottom, + NoOpenQuote, + Groove, + Progress, + Larger, + CloseQuote, + TableCell, + PreLine, + Absolute, + InlineTable, + BidiOverride, + InlineBlock, + Inset, + Crosshair, + UpperLatin, + Help, + Hide, + Uppercase, + SResize, + Table, + Blink, + Block, + Start, + TableColumnGroup, + Italic, + LineThrough, + KeepAll, + LowerAlpha, + RunIn, + Square, + XLarge, + Large, + Before, + Left, + TextTop, + RubyText, + NoDisplay +}; + +enum class FDE_CSSProperty : uint8_t { + WritingMode, + ColumnRuleWidth, + BorderLeft, + ColumnRule, + Height, + CounterReset, + Content, + RubyPosition, + BackgroundColor, + Width, + Src, + Top, + Margin, + BorderColor, + Widows, + BorderBottomColor, + TextIndent, + Right, + TextEmphasisStyle, + PaddingLeft, + ColumnWidth, + MarginLeft, + Border, + BorderTop, + RubyOverhang, + PageBreakBefore, + MaxHeight, + MinWidth, + BorderLeftColor, + Bottom, + Quotes, + MaxWidth, + PaddingRight, + ListStyleImage, + WhiteSpace, + BorderBottom, + ListStyleType, + WordBreak, + OverflowX, + OverflowY, + BorderTopColor, + FontFamily, + Cursor, + RubyAlign, + ColumnRuleColor, + FontWeight, + BorderRightStyle, + MinHeight, + Color, + LetterSpacing, + EmptyCells, + TextAlign, + RubySpan, + Position, + BorderStyle, + BorderBottomStyle, + BorderCollapse, + ColumnCount, + BorderRightWidth, + UnicodeBidi, + VerticalAlign, + PaddingTop, + Columns, + Overflow, + TableLayout, + FontVariant, + ListStyle, + BackgroundPosition, + BorderWidth, + TextEmphasisColor, + BorderLeftStyle, + PageBreakInside, + TextEmphasis, + BorderBottomWidth, + ColumnGap, + Orphans, + BorderRight, + FontSize, + PageBreakAfter, + CaptionSide, + BackgroundRepeat, + BorderTopStyle, + BorderSpacing, + TextTransform, + FontStyle, + Font, + LineHeight, + MarginRight, + Float, + BorderLeftWidth, + Display, + Clear, + ColumnRuleStyle, + TextCombine, + ListStylePosition, + Visibility, + PaddingBottom, + BackgroundAttachment, + BackgroundImage, + LineBreak, + Background, + BorderTopWidth, + WordSpacing, + BorderRightColor, + CounterIncrement, + Left, + TextDecoration, + Padding, + MarginBottom, + MarginTop, + Direction +}; + +enum class FDE_CSSPseudo : uint8_t { After, Before, NONE }; + +enum class FDE_CSSSelectorType : uint8_t { + Element = 0, + Descendant, + Class, + Pseudo, + ID, +}; + +enum class FDE_CSSRuleType : uint8_t { Style, Media, FontFace }; + +enum class FDE_CSSSyntaxStatus : uint8_t { + Error, + EOS, + None, + Charset, + ImportRule, + ImportClose, + PageRule, + StyleRule, + FontFaceRule, + MediaRule, + MediaType, + URI, + Selector, + DeclOpen, + DeclClose, + PropertyName, + PropertyValue, +}; + +enum class FDE_CSSLengthUnit : uint8_t { + Auto, + None, + Normal, + Point, + Percent, +}; + +enum class FDE_CSSDisplay : uint8_t { + None, + ListItem, + Block, + Inline, + InlineBlock, + InlineTable, +}; + +enum class FDE_CSSFontStyle : uint8_t { + Normal, + Italic, +}; + +enum class FDE_CSSTextAlign : uint8_t { + Left, + Right, + Center, + Justify, + JustifyAll, +}; + +enum class FDE_CSSVerticalAlign : uint8_t { + Baseline, + Sub, + Super, + Top, + TextTop, + Middle, + Bottom, + TextBottom, + Number, +}; + +enum class FDE_CSSFontVariant : uint8_t { + Normal, + SmallCaps, }; enum FDE_CSSTEXTDECORATION { FDE_CSSTEXTDECORATION_None = 0, - FDE_CSSTEXTDECORATION_Underline = 1, - FDE_CSSTEXTDECORATION_Overline = 2, - FDE_CSSTEXTDECORATION_LineThrough = 4, - FDE_CSSTEXTDECORATION_Blink = 8, - FDE_CSSTEXTDECORATION_Double = 16, + FDE_CSSTEXTDECORATION_Underline = 1 << 0, + FDE_CSSTEXTDECORATION_Overline = 1 << 1, + FDE_CSSTEXTDECORATION_LineThrough = 1 << 2, + FDE_CSSTEXTDECORATION_Blink = 1 << 3, + FDE_CSSTEXTDECORATION_Double = 1 << 4, }; -enum FDE_CSSSTYLESHEETGROUP { - FDE_CSSSTYLESHEETGROUP_UserAgent, - FDE_CSSSTYLESHEETGROUP_User, - FDE_CSSSTYLESHEETGROUP_Author, - FDE_CSSSTYLESHEETGROUP_MAX, +enum class FDE_CSSStyleSheetGroup : uint8_t { + UserAgent = 0, + User, + Author, }; -enum FDE_CSSSTYLESHEETPRIORITY { - FDE_CSSSTYLESHEETPRIORITY_High, - FDE_CSSSTYLESHEETPRIORITY_Mid, - FDE_CSSSTYLESHEETPRIORITY_Low, - FDE_CSSSTYLESHEETPRIORITY_MAX, +enum class FDE_CSSStyleSheetPriority : uint8_t { + High = 0, + Mid, + Low, }; class IFDE_CSSValue { @@ -694,11 +457,11 @@ class IFDE_CSSPrimitiveValue : public IFDE_CSSValue { // IFDE_CSSValue FDE_CSSVALUETYPE GetType() const override; - virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const = 0; + virtual FDE_CSSPrimitiveType GetPrimitiveType() const = 0; virtual FX_ARGB GetRGBColor() const = 0; virtual FX_FLOAT GetFloat() const = 0; virtual const FX_WCHAR* GetString(int32_t& iLength) const = 0; - virtual FDE_CSSPROPERTYVALUE GetEnum() const = 0; + virtual FDE_CSSPropertyValue GetEnum() const = 0; virtual const FX_WCHAR* GetFuncName() const = 0; virtual int32_t CountArgs() const = 0; virtual IFDE_CSSValue* GetArgs(int32_t index) const = 0; @@ -716,13 +479,13 @@ class IFDE_CSSValueList : public IFDE_CSSValue { class IFDE_CSSRule { public: virtual ~IFDE_CSSRule() {} - virtual FDE_CSSRULETYPE GetType() const = 0; + virtual FDE_CSSRuleType GetType() const = 0; }; class IFDE_CSSStyleRule : public IFDE_CSSRule { public: // IFDE_CSSValue - FDE_CSSRULETYPE GetType() const override; + FDE_CSSRuleType GetType() const override; virtual int32_t CountSelectorLists() const = 0; virtual CFDE_CSSSelector* GetSelectorList(int32_t index) const = 0; @@ -732,7 +495,7 @@ class IFDE_CSSStyleRule : public IFDE_CSSRule { class IFDE_CSSMediaRule : public IFDE_CSSRule { public: // IFDE_CSSValue - FDE_CSSRULETYPE GetType() const override; + FDE_CSSRuleType GetType() const override; virtual uint32_t GetMediaList() const = 0; virtual int32_t CountRules() const = 0; @@ -742,7 +505,7 @@ class IFDE_CSSMediaRule : public IFDE_CSSRule { class IFDE_CSSFontFaceRule : public IFDE_CSSRule { public: // IFDE_CSSValue - FDE_CSSRULETYPE GetType() const override; + FDE_CSSRuleType GetType() const override; virtual CFDE_CSSDeclaration* GetDeclaration() = 0; }; @@ -769,64 +532,52 @@ class IFDE_CSSStyleSheet : public IFX_Retainable { virtual IFDE_CSSRule* GetRule(int32_t index) = 0; }; -typedef CFX_ArrayTemplate CFDE_CSSStyleSheetArray; - struct FDE_CSSLENGTH { - FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit) { - m_iData = eUnit; - return *this; - } - FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { - m_iData = ((intptr_t)(fValue * 1024.0f) << FDE_CSSUNITBITS) | eUnit; - return *this; - } - FDE_CSSLENGTHUNIT GetUnit() const { - return (FDE_CSSLENGTHUNIT)(m_iData & FDE_CSSUNITMASK); - } - FX_FLOAT GetValue() const { return (m_iData >> FDE_CSSUNITBITS) / 1024.0f; } - bool NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } + FDE_CSSLENGTH() {} - private: - intptr_t m_iData; -}; + explicit FDE_CSSLENGTH(FDE_CSSLengthUnit eUnit) : m_unit(eUnit) {} -struct FDE_CSSPOINT { - FDE_CSSPOINT& Set(FDE_CSSLENGTHUNIT eUnit) { - x.Set(eUnit); - y.Set(eUnit); - return *this; - } - FDE_CSSPOINT& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { - x.Set(eUnit, fValue); - y.Set(eUnit, fValue); - return *this; - } - FDE_CSSLENGTH x, y; -}; + FDE_CSSLENGTH(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) + : m_unit(eUnit), m_fValue(fValue) {} -struct FDE_CSSSIZE { - FDE_CSSSIZE& Set(FDE_CSSLENGTHUNIT eUnit) { - cx.Set(eUnit); - cy.Set(eUnit); + FDE_CSSLENGTH& Set(FDE_CSSLengthUnit eUnit) { + m_unit = eUnit; return *this; } - FDE_CSSSIZE& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { - cx.Set(eUnit, fValue); - cy.Set(eUnit, fValue); + + FDE_CSSLENGTH& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { + m_unit = eUnit; + m_fValue = fValue; return *this; } - FDE_CSSLENGTH cx, cy; + + FDE_CSSLengthUnit GetUnit() const { return m_unit; } + + FX_FLOAT GetValue() const { return m_fValue; } + bool NonZero() const { return static_cast(m_fValue) != 0; } + + private: + FDE_CSSLengthUnit m_unit; + FX_FLOAT m_fValue; }; struct FDE_CSSRECT { - FDE_CSSRECT& Set(FDE_CSSLENGTHUNIT eUnit) { + FDE_CSSRECT() {} + + FDE_CSSRECT(FDE_CSSLengthUnit eUnit, FX_FLOAT val) + : left(eUnit, val), + top(eUnit, val), + right(eUnit, val), + bottom(eUnit, val) {} + + FDE_CSSRECT& Set(FDE_CSSLengthUnit eUnit) { left.Set(eUnit); top.Set(eUnit); right.Set(eUnit); bottom.Set(eUnit); return *this; } - FDE_CSSRECT& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { + FDE_CSSRECT& Set(FDE_CSSLengthUnit eUnit, FX_FLOAT fValue) { left.Set(eUnit, fValue); top.Set(eUnit, fValue); right.Set(eUnit, fValue); @@ -844,13 +595,13 @@ class IFDE_CSSFontStyle { virtual int32_t CountFontFamilies() const = 0; virtual const FX_WCHAR* GetFontFamily(int32_t index) const = 0; virtual uint16_t GetFontWeight() const = 0; - virtual FDE_CSSFONTVARIANT GetFontVariant() const = 0; - virtual FDE_CSSFONTSTYLE GetFontStyle() const = 0; + virtual FDE_CSSFontVariant GetFontVariant() const = 0; + virtual FDE_CSSFontStyle GetFontStyle() const = 0; virtual FX_FLOAT GetFontSize() const = 0; virtual FX_ARGB GetColor() const = 0; virtual void SetFontWeight(uint16_t wFontWeight) = 0; - virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) = 0; - virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) = 0; + virtual void SetFontVariant(FDE_CSSFontVariant eFontVariant) = 0; + virtual void SetFontStyle(FDE_CSSFontStyle eFontStyle) = 0; virtual void SetFontSize(FX_FLOAT fFontSize) = 0; virtual void SetColor(FX_ARGB dwFontColor) = 0; }; @@ -869,7 +620,7 @@ class IFDE_CSSBoundaryStyle { class IFDE_CSSPositionStyle { public: virtual ~IFDE_CSSPositionStyle() {} - virtual FDE_CSSDISPLAY GetDisplay() const = 0; + virtual FDE_CSSDisplay GetDisplay() const = 0; }; class IFDE_CSSParagraphStyle { @@ -878,14 +629,14 @@ class IFDE_CSSParagraphStyle { virtual FX_FLOAT GetLineHeight() const = 0; virtual const FDE_CSSLENGTH& GetTextIndent() const = 0; - virtual FDE_CSSTEXTALIGN GetTextAlign() const = 0; - virtual FDE_CSSVERTICALALIGN GetVerticalAlign() const = 0; + virtual FDE_CSSTextAlign GetTextAlign() const = 0; + virtual FDE_CSSVerticalAlign GetVerticalAlign() const = 0; virtual FX_FLOAT GetNumberVerticalAlign() const = 0; virtual uint32_t GetTextDecoration() const = 0; virtual const FDE_CSSLENGTH& GetLetterSpacing() const = 0; virtual void SetLineHeight(FX_FLOAT fLineHeight) = 0; virtual void SetTextIndent(const FDE_CSSLENGTH& textIndent) = 0; - virtual void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) = 0; + virtual void SetTextAlign(FDE_CSSTextAlign eTextAlign) = 0; virtual void SetNumberVerticalAlign(FX_FLOAT fAlign) = 0; virtual void SetTextDecoration(uint32_t dwTextDecoration) = 0; virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; @@ -893,7 +644,6 @@ class IFDE_CSSParagraphStyle { class IFDE_CSSComputedStyle : public IFX_Retainable { public: - virtual void Reset() = 0; virtual IFDE_CSSFontStyle* GetFontStyles() = 0; virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index b0e86c8a7e..910f7f4be0 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -21,10 +21,10 @@ bool FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, FX_FLOAT fPercentBase, FX_FLOAT& fResult) { switch (len.GetUnit()) { - case FDE_CSSLENGTHUNIT_Point: + case FDE_CSSLengthUnit::Point: fResult = len.GetValue(); return true; - case FDE_CSSLENGTHUNIT_Percent: + case FDE_CSSLengthUnit::Percent: fResult = len.GetValue() * fPercentBase; return true; default: @@ -94,7 +94,7 @@ CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle, } uint32_t FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) { uint32_t dwFontStyle = FX_FONTSTYLE_Normal; - if (pFontStyle->GetFontStyle() == FDE_CSSFONTSTYLE_Italic) { + if (pFontStyle->GetFontStyle() == FDE_CSSFontStyle::Italic) { dwFontStyle |= FX_FONTSTYLE_Italic; } if (pFontStyle->GetFontWeight() >= 700) { @@ -102,445 +102,459 @@ uint32_t FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) { } return dwFontStyle; } -static const FDE_CSSPROPERTYTABLE g_FDE_CSSProperties[] = { - {FDE_CSSPROPERTY_WritingMode, L"writing-mode", 0x01878076, + +static const FDE_CSSPropertyTable g_FDE_CSSProperties[] = { + {FDE_CSSProperty::WritingMode, L"writing-mode", 0x01878076, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_ColumnRuleWidth, L"column-rule-width", 0x0200FB00, + {FDE_CSSProperty::ColumnRuleWidth, L"column-rule-width", 0x0200FB00, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderLeft, L"border-left", 0x04080036, + {FDE_CSSProperty::BorderLeft, L"border-left", 0x04080036, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_ColumnRule, L"column-rule", 0x04C83DF3, + {FDE_CSSProperty::ColumnRule, L"column-rule", 0x04C83DF3, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_Height, L"height", 0x05A5C519, + {FDE_CSSProperty::Height, L"height", 0x05A5C519, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_CounterReset, L"counter-reset", 0x0894F9B0, + {FDE_CSSProperty::CounterReset, L"counter-reset", 0x0894F9B0, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_Content, L"content", 0x097BE91B, + {FDE_CSSProperty::Content, L"content", 0x097BE91B, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeURI | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_RubyPosition, L"ruby-position", 0x09ACD024, + {FDE_CSSProperty::RubyPosition, L"ruby-position", 0x09ACD024, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BackgroundColor, L"background-color", 0x09E8E8AC, + {FDE_CSSProperty::BackgroundColor, L"background-color", 0x09E8E8AC, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_Width, L"width", 0x0A8A8F80, + {FDE_CSSProperty::Width, L"width", 0x0A8A8F80, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Src, L"src", 0x0BD37048, + {FDE_CSSProperty::Src, L"src", 0x0BD37048, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeURI}, - {FDE_CSSPROPERTY_Top, L"top", 0x0BEDAF33, FDE_CSSVALUETYPE_Primitive | - FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Margin, L"margin", 0x0CB016BE, + {FDE_CSSProperty::Top, L"top", 0x0BEDAF33, + FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | + FDE_CSSVALUETYPE_MaybeNumber}, + {FDE_CSSProperty::Margin, L"margin", 0x0CB016BE, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderColor, L"border-color", 0x0CBB528A, + {FDE_CSSProperty::BorderColor, L"border-color", 0x0CBB528A, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_Widows, L"widows", 0x1026C59D, + {FDE_CSSProperty::Widows, L"widows", 0x1026C59D, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderBottomColor, L"border-bottom-color", 0x121E22EC, + {FDE_CSSProperty::BorderBottomColor, L"border-bottom-color", 0x121E22EC, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_TextIndent, L"text-indent", 0x169ADB74, + {FDE_CSSProperty::TextIndent, L"text-indent", 0x169ADB74, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Right, L"right", 0x193ADE3E, + {FDE_CSSProperty::Right, L"right", 0x193ADE3E, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_TextEmphasisStyle, L"text-emphasis-style", 0x20DBAF4A, + {FDE_CSSProperty::TextEmphasisStyle, L"text-emphasis-style", 0x20DBAF4A, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_PaddingLeft, L"padding-left", 0x228CF02F, + {FDE_CSSProperty::PaddingLeft, L"padding-left", 0x228CF02F, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_ColumnWidth, L"column-width", 0x24C9AC9B, + {FDE_CSSProperty::ColumnWidth, L"column-width", 0x24C9AC9B, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_MarginLeft, L"margin-left", 0x297C5656, + {FDE_CSSProperty::MarginLeft, L"margin-left", 0x297C5656, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Border, L"border", 0x2A23349E, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_BorderTop, L"border-top", 0x2B866ADE, + {FDE_CSSProperty::Border, L"border", 0x2A23349E, + FDE_CSSVALUETYPE_Shorthand}, + {FDE_CSSProperty::BorderTop, L"border-top", 0x2B866ADE, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_RubyOverhang, L"ruby-overhang", 0x2CCA0D89, + {FDE_CSSProperty::RubyOverhang, L"ruby-overhang", 0x2CCA0D89, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_PageBreakBefore, L"page-break-before", 0x3119B36F, + {FDE_CSSProperty::PageBreakBefore, L"page-break-before", 0x3119B36F, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_MaxHeight, L"max-height", 0x343597EC, + {FDE_CSSProperty::MaxHeight, L"max-height", 0x343597EC, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_MinWidth, L"min-width", 0x35832871, + {FDE_CSSProperty::MinWidth, L"min-width", 0x35832871, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderLeftColor, L"border-left-color", 0x35C64022, + {FDE_CSSProperty::BorderLeftColor, L"border-left-color", 0x35C64022, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_Bottom, L"bottom", 0x399F02B5, + {FDE_CSSProperty::Bottom, L"bottom", 0x399F02B5, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Quotes, L"quotes", 0x3D8C6A01, + {FDE_CSSProperty::Quotes, L"quotes", 0x3D8C6A01, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_MaxWidth, L"max-width", 0x3EA274F3, + {FDE_CSSProperty::MaxWidth, L"max-width", 0x3EA274F3, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_PaddingRight, L"padding-right", 0x3F616AC2, + {FDE_CSSProperty::PaddingRight, L"padding-right", 0x3F616AC2, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_ListStyleImage, L"list-style-image", 0x42A8A86A, + {FDE_CSSProperty::ListStyleImage, L"list-style-image", 0x42A8A86A, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeURI}, - {FDE_CSSPROPERTY_WhiteSpace, L"white-space", 0x42F0429A, + {FDE_CSSProperty::WhiteSpace, L"white-space", 0x42F0429A, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderBottom, L"border-bottom", 0x452CE780, + {FDE_CSSProperty::BorderBottom, L"border-bottom", 0x452CE780, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_ListStyleType, L"list-style-type", 0x48094789, + {FDE_CSSProperty::ListStyleType, L"list-style-type", 0x48094789, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_WordBreak, L"word-break", 0x4D74A3CE, + {FDE_CSSProperty::WordBreak, L"word-break", 0x4D74A3CE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_OverflowX, L"overflow-x", 0x4ECEBF99, + {FDE_CSSProperty::OverflowX, L"overflow-x", 0x4ECEBF99, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_OverflowY, L"overflow-y", 0x4ECEBF9A, + {FDE_CSSProperty::OverflowY, L"overflow-y", 0x4ECEBF9A, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderTopColor, L"border-top-color", 0x5109B8CA, + {FDE_CSSProperty::BorderTopColor, L"border-top-color", 0x5109B8CA, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_FontFamily, L"font-family", 0x574686E6, + {FDE_CSSProperty::FontFamily, L"font-family", 0x574686E6, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_Cursor, L"cursor", 0x59DFCA5E, + {FDE_CSSProperty::Cursor, L"cursor", 0x59DFCA5E, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_RubyAlign, L"ruby-align", 0x6077BDFA, + {FDE_CSSProperty::RubyAlign, L"ruby-align", 0x6077BDFA, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_ColumnRuleColor, L"column-rule-color", 0x65DDFD9F, + {FDE_CSSProperty::ColumnRuleColor, L"column-rule-color", 0x65DDFD9F, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_FontWeight, L"font-weight", 0x6692F60C, + {FDE_CSSProperty::FontWeight, L"font-weight", 0x6692F60C, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderRightStyle, L"border-right-style", 0x6920DDA7, + {FDE_CSSProperty::BorderRightStyle, L"border-right-style", 0x6920DDA7, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_MinHeight, L"min-height", 0x6AAE312A, + {FDE_CSSProperty::MinHeight, L"min-height", 0x6AAE312A, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Color, L"color", 0x6E67921F, + {FDE_CSSProperty::Color, L"color", 0x6E67921F, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_LetterSpacing, L"letter-spacing", 0x70536102, + {FDE_CSSProperty::LetterSpacing, L"letter-spacing", 0x70536102, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_EmptyCells, L"empty-cells", 0x7531528F, + {FDE_CSSProperty::EmptyCells, L"empty-cells", 0x7531528F, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_TextAlign, L"text-align", 0x7553F1BD, + {FDE_CSSProperty::TextAlign, L"text-align", 0x7553F1BD, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_RubySpan, L"ruby-span", 0x76FCFCE1, + {FDE_CSSProperty::RubySpan, L"ruby-span", 0x76FCFCE1, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeFunction}, - {FDE_CSSPROPERTY_Position, L"position", 0x814F82B5, + {FDE_CSSProperty::Position, L"position", 0x814F82B5, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderStyle, L"border-style", 0x82A4CD5C, + {FDE_CSSProperty::BorderStyle, L"border-style", 0x82A4CD5C, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderBottomStyle, L"border-bottom-style", 0x88079DBE, + {FDE_CSSProperty::BorderBottomStyle, L"border-bottom-style", 0x88079DBE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderCollapse, L"border-collapse", 0x8883C7FE, + {FDE_CSSProperty::BorderCollapse, L"border-collapse", 0x8883C7FE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_ColumnCount, L"column-count", 0x89936A64, + {FDE_CSSProperty::ColumnCount, L"column-count", 0x89936A64, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderRightWidth, L"border-right-width", 0x8F5A6036, + {FDE_CSSProperty::BorderRightWidth, L"border-right-width", 0x8F5A6036, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_UnicodeBidi, L"unicode-bidi", 0x91670F6C, + {FDE_CSSProperty::UnicodeBidi, L"unicode-bidi", 0x91670F6C, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_VerticalAlign, L"vertical-align", 0x934A87D2, + {FDE_CSSProperty::VerticalAlign, L"vertical-align", 0x934A87D2, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_PaddingTop, L"padding-top", 0x959D22B7, + {FDE_CSSProperty::PaddingTop, L"padding-top", 0x959D22B7, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Columns, L"columns", 0x96FA5D81, + {FDE_CSSProperty::Columns, L"columns", 0x96FA5D81, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_Overflow, L"overflow", 0x97B76B54, + {FDE_CSSProperty::Overflow, L"overflow", 0x97B76B54, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_TableLayout, L"table-layout", 0x9B1CB4B3, + {FDE_CSSProperty::TableLayout, L"table-layout", 0x9B1CB4B3, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_FontVariant, L"font-variant", 0x9C785779, + {FDE_CSSProperty::FontVariant, L"font-variant", 0x9C785779, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_ListStyle, L"list-style", 0x9E6C471A, + {FDE_CSSProperty::ListStyle, L"list-style", 0x9E6C471A, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_BackgroundPosition, L"background-position", 0xA8846D22, + {FDE_CSSProperty::BackgroundPosition, L"background-position", 0xA8846D22, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderWidth, L"border-width", 0xA8DE4FEB, + {FDE_CSSProperty::BorderWidth, L"border-width", 0xA8DE4FEB, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_TextEmphasisColor, L"text-emphasis-color", 0xAAF23478, + {FDE_CSSProperty::TextEmphasisColor, L"text-emphasis-color", 0xAAF23478, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_BorderLeftStyle, L"border-left-style", 0xABAFBAF4, + {FDE_CSSProperty::BorderLeftStyle, L"border-left-style", 0xABAFBAF4, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_PageBreakInside, L"page-break-inside", 0xACB695F8, + {FDE_CSSProperty::PageBreakInside, L"page-break-inside", 0xACB695F8, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_TextEmphasis, L"text-emphasis", 0xAD0E580C, + {FDE_CSSProperty::TextEmphasis, L"text-emphasis", 0xAD0E580C, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_BorderBottomWidth, L"border-bottom-width", 0xAE41204D, + {FDE_CSSProperty::BorderBottomWidth, L"border-bottom-width", 0xAE41204D, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_ColumnGap, L"column-gap", 0xB5C1BA73, + {FDE_CSSProperty::ColumnGap, L"column-gap", 0xB5C1BA73, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Orphans, L"orphans", 0xB716467B, + {FDE_CSSProperty::Orphans, L"orphans", 0xB716467B, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderRight, L"border-right", 0xB78E9EA9, + {FDE_CSSProperty::BorderRight, L"border-right", 0xB78E9EA9, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_FontSize, L"font-size", 0xB93956DF, + {FDE_CSSProperty::FontSize, L"font-size", 0xB93956DF, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_PageBreakAfter, L"page-break-after", 0xBC358AEE, + {FDE_CSSProperty::PageBreakAfter, L"page-break-after", 0xBC358AEE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_CaptionSide, L"caption-side", 0xC03F3560, + {FDE_CSSProperty::CaptionSide, L"caption-side", 0xC03F3560, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BackgroundRepeat, L"background-repeat", 0xC2C2FDCE, + {FDE_CSSProperty::BackgroundRepeat, L"background-repeat", 0xC2C2FDCE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderTopStyle, L"border-top-style", 0xC6F3339C, + {FDE_CSSProperty::BorderTopStyle, L"border-top-style", 0xC6F3339C, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderSpacing, L"border-spacing", 0xC72030F0, + {FDE_CSSProperty::BorderSpacing, L"border-spacing", 0xC72030F0, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_TextTransform, L"text-transform", 0xC88EEA6E, + {FDE_CSSProperty::TextTransform, L"text-transform", 0xC88EEA6E, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_FontStyle, L"font-style", 0xCB1950F5, + {FDE_CSSProperty::FontStyle, L"font-style", 0xCB1950F5, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Font, L"font", 0xCD308B77, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_LineHeight, L"line-height", 0xCFCACE2E, + {FDE_CSSProperty::Font, L"font", 0xCD308B77, FDE_CSSVALUETYPE_Shorthand}, + {FDE_CSSProperty::LineHeight, L"line-height", 0xCFCACE2E, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_MarginRight, L"margin-right", 0xD13C58C9, + {FDE_CSSProperty::MarginRight, L"margin-right", 0xD13C58C9, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Float, L"float", 0xD1532876, + {FDE_CSSProperty::Float, L"float", 0xD1532876, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BorderLeftWidth, L"border-left-width", 0xD1E93D83, + {FDE_CSSProperty::BorderLeftWidth, L"border-left-width", 0xD1E93D83, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_Display, L"display", 0xD4224C36, + {FDE_CSSProperty::Display, L"display", 0xD4224C36, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Clear, L"clear", 0xD8ED1467, + {FDE_CSSProperty::Clear, L"clear", 0xD8ED1467, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_ColumnRuleStyle, L"column-rule-style", 0xDBC77871, + {FDE_CSSProperty::ColumnRuleStyle, L"column-rule-style", 0xDBC77871, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_TextCombine, L"text-combine", 0xDC5207CF, + {FDE_CSSProperty::TextCombine, L"text-combine", 0xDC5207CF, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_ListStylePosition, L"list-style-position", 0xE1A1DE3C, + {FDE_CSSProperty::ListStylePosition, L"list-style-position", 0xE1A1DE3C, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Visibility, L"visibility", 0xE29F5168, + {FDE_CSSProperty::Visibility, L"visibility", 0xE29F5168, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_PaddingBottom, L"padding-bottom", 0xE555B3B9, + {FDE_CSSProperty::PaddingBottom, L"padding-bottom", 0xE555B3B9, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BackgroundAttachment, L"background-attachment", 0xE77981F6, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_BackgroundImage, L"background-image", 0xE9AEB710, + {FDE_CSSProperty::BackgroundAttachment, L"background-attachment", + 0xE77981F6, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, + {FDE_CSSProperty::BackgroundImage, L"background-image", 0xE9AEB710, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeURI}, - {FDE_CSSPROPERTY_LineBreak, L"line-break", 0xEA2D1D9A, + {FDE_CSSProperty::LineBreak, L"line-break", 0xEA2D1D9A, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Background, L"background", 0xEB49DD40, + {FDE_CSSProperty::Background, L"background", 0xEB49DD40, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSPROPERTY_BorderTopWidth, L"border-top-width", 0xED2CB62B, + {FDE_CSSProperty::BorderTopWidth, L"border-top-width", 0xED2CB62B, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_WordSpacing, L"word-spacing", 0xEDA63BAE, + {FDE_CSSProperty::WordSpacing, L"word-spacing", 0xEDA63BAE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_BorderRightColor, L"border-right-color", 0xF33762D5, + {FDE_CSSProperty::BorderRightColor, L"border-right-color", 0xF33762D5, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSPROPERTY_CounterIncrement, L"counter-increment", 0xF4CFB1B2, + {FDE_CSSProperty::CounterIncrement, L"counter-increment", 0xF4CFB1B2, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSPROPERTY_Left, L"left", 0xF5AD782B, + {FDE_CSSProperty::Left, L"left", 0xF5AD782B, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_TextDecoration, L"text-decoration", 0xF7C634BA, + {FDE_CSSProperty::TextDecoration, L"text-decoration", 0xF7C634BA, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Padding, L"padding", 0xF8C373F7, + {FDE_CSSProperty::Padding, L"padding", 0xF8C373F7, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSPROPERTY_MarginBottom, L"margin-bottom", 0xF93485A0, + {FDE_CSSProperty::MarginBottom, L"margin-bottom", 0xF93485A0, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_MarginTop, L"margin-top", 0xFE51DCFE, + {FDE_CSSProperty::MarginTop, L"margin-top", 0xFE51DCFE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSPROPERTY_Direction, L"direction", 0xFE746E61, + {FDE_CSSProperty::Direction, L"direction", 0xFE746E61, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, }; -static const FDE_CSSPROPERTYVALUETABLE g_FDE_CSSPropertyValues[] = { - {FDE_CSSPROPERTYVALUE_Bolder, L"bolder", 0x009F1058}, - {FDE_CSSPROPERTYVALUE_LowerLatin, L"lower-latin", 0x016014CE}, - {FDE_CSSPROPERTYVALUE_Lowercase, L"lowercase", 0x02ACB805}, - {FDE_CSSPROPERTYVALUE_LowerGreek, L"lower-greek", 0x03D81D64}, - {FDE_CSSPROPERTYVALUE_Sesame, L"sesame", 0x0432ECDE}, - {FDE_CSSPROPERTYVALUE_None, L"none", 0x048B6670}, - {FDE_CSSPROPERTYVALUE_NwResize, L"nw-resize", 0x054B4BE4}, - {FDE_CSSPROPERTYVALUE_WResize, L"w-resize", 0x0A2F8D76}, - {FDE_CSSPROPERTYVALUE_Dot, L"dot", 0x0A48CB27}, - {FDE_CSSPROPERTYVALUE_End, L"end", 0x0A631437}, - {FDE_CSSPROPERTYVALUE_Ltr, L"ltr", 0x0B1B56D2}, - {FDE_CSSPROPERTYVALUE_Pre, L"pre", 0x0B848587}, - {FDE_CSSPROPERTYVALUE_Rtl, L"rtl", 0x0BB92C52}, - {FDE_CSSPROPERTYVALUE_Sub, L"sub", 0x0BD37FAA}, - {FDE_CSSPROPERTYVALUE_Top, L"top", 0x0BEDAF33}, - {FDE_CSSPROPERTYVALUE_Visible, L"visible", 0x0F55D7EE}, - {FDE_CSSPROPERTYVALUE_Filled, L"filled", 0x10827DD0}, - {FDE_CSSPROPERTYVALUE_SwResize, L"sw-resize", 0x10B548E9}, - {FDE_CSSPROPERTYVALUE_NoRepeat, L"no-repeat", 0x1235C18B}, - {FDE_CSSPROPERTYVALUE_Default, L"default", 0x14DA2125}, - {FDE_CSSPROPERTYVALUE_Transparent, L"transparent", 0x17B64DB2}, - {FDE_CSSPROPERTYVALUE_Ridge, L"ridge", 0x18EBEE4B}, - {FDE_CSSPROPERTYVALUE_Right, L"right", 0x193ADE3E}, - {FDE_CSSPROPERTYVALUE_HorizontalTb, L"horizontal-tb", 0x1A66A86D}, - {FDE_CSSPROPERTYVALUE_DistributeLetter, L"distribute-letter", 0x1EDBD75C}, - {FDE_CSSPROPERTYVALUE_DoubleCircle, L"double-circle", 0x1FF082BA}, - {FDE_CSSPROPERTYVALUE_Ruby, L"ruby", 0x20D66C02}, - {FDE_CSSPROPERTYVALUE_Collapse, L"collapse", 0x2128D673}, - {FDE_CSSPROPERTYVALUE_Normal, L"normal", 0x247CF3E9}, - {FDE_CSSPROPERTYVALUE_Avoid, L"avoid", 0x24E684B3}, - {FDE_CSSPROPERTYVALUE_UpperRoman, L"upper-roman", 0x28BAC2B6}, - {FDE_CSSPROPERTYVALUE_Auto, L"auto", 0x2B35B6D9}, - {FDE_CSSPROPERTYVALUE_Text, L"text", 0x2D08AF85}, - {FDE_CSSPROPERTYVALUE_XSmall, L"x-small", 0x2D2FCAFE}, - {FDE_CSSPROPERTYVALUE_Thin, L"thin", 0x2D574D53}, - {FDE_CSSPROPERTYVALUE_Repeat, L"repeat", 0x306614A1}, - {FDE_CSSPROPERTYVALUE_Small, L"small", 0x316A3739}, - {FDE_CSSPROPERTYVALUE_NeResize, L"ne-resize", 0x31FD5E12}, - {FDE_CSSPROPERTYVALUE_NoContent, L"no-content", 0x33A1C545}, - {FDE_CSSPROPERTYVALUE_Outside, L"outside", 0x36DF693D}, - {FDE_CSSPROPERTYVALUE_EResize, L"e-resize", 0x36E19FA4}, - {FDE_CSSPROPERTYVALUE_TableRow, L"table-row", 0x3912A02D}, - {FDE_CSSPROPERTYVALUE_Bottom, L"bottom", 0x399F02B5}, - {FDE_CSSPROPERTYVALUE_Underline, L"underline", 0x3A0273A6}, - {FDE_CSSPROPERTYVALUE_CjkIdeographic, L"cjk-ideographic", 0x3A641CC4}, - {FDE_CSSPROPERTYVALUE_SeResize, L"se-resize", 0x3D675B17}, - {FDE_CSSPROPERTYVALUE_Fixed, L"fixed", 0x3D7DEB10}, - {FDE_CSSPROPERTYVALUE_Double, L"double", 0x3D98515B}, - {FDE_CSSPROPERTYVALUE_Solid, L"solid", 0x40623B5B}, - {FDE_CSSPROPERTYVALUE_RubyBaseGroup, L"ruby-base-group", 0x41014E84}, - {FDE_CSSPROPERTYVALUE_OpenQuote, L"open-quote", 0x44A41E8D}, - {FDE_CSSPROPERTYVALUE_Lighter, L"lighter", 0x45BEB7AF}, - {FDE_CSSPROPERTYVALUE_LowerRoman, L"lower-roman", 0x5044D253}, - {FDE_CSSPROPERTYVALUE_Strict, L"strict", 0x52F4EBD9}, - {FDE_CSSPROPERTYVALUE_TableCaption, L"table-caption", 0x5325CD63}, - {FDE_CSSPROPERTYVALUE_Oblique, L"oblique", 0x53EBDDB1}, - {FDE_CSSPROPERTYVALUE_Decimal, L"decimal", 0x54034C2F}, - {FDE_CSSPROPERTYVALUE_Loose, L"loose", 0x54D3A1E2}, - {FDE_CSSPROPERTYVALUE_Hebrew, L"hebrew", 0x565792DD}, - {FDE_CSSPROPERTYVALUE_Hidden, L"hidden", 0x573CB40C}, - {FDE_CSSPROPERTYVALUE_Dashed, L"dashed", 0x58A3DD29}, - {FDE_CSSPROPERTYVALUE_Embed, L"embed", 0x59C8F27D}, - {FDE_CSSPROPERTYVALUE_TableRowGroup, L"table-row-group", 0x5A43BD07}, - {FDE_CSSPROPERTYVALUE_TableColumn, L"table-column", 0x5E705DA3}, - {FDE_CSSPROPERTYVALUE_Static, L"static", 0x5E7555E8}, - {FDE_CSSPROPERTYVALUE_Outset, L"outset", 0x61236164}, - {FDE_CSSPROPERTYVALUE_DecimalLeadingZero, L"decimal-leading-zero", +const int32_t g_iCSSPropertyCount = + sizeof(g_FDE_CSSProperties) / sizeof(FDE_CSSPropertyTable); + +static const FDE_CSSPropertyValueTable g_FDE_CSSPropertyValues[] = { + {FDE_CSSPropertyValue::Bolder, L"bolder", 0x009F1058}, + {FDE_CSSPropertyValue::LowerLatin, L"lower-latin", 0x016014CE}, + {FDE_CSSPropertyValue::Lowercase, L"lowercase", 0x02ACB805}, + {FDE_CSSPropertyValue::LowerGreek, L"lower-greek", 0x03D81D64}, + {FDE_CSSPropertyValue::Sesame, L"sesame", 0x0432ECDE}, + {FDE_CSSPropertyValue::None, L"none", 0x048B6670}, + {FDE_CSSPropertyValue::NwResize, L"nw-resize", 0x054B4BE4}, + {FDE_CSSPropertyValue::WResize, L"w-resize", 0x0A2F8D76}, + {FDE_CSSPropertyValue::Dot, L"dot", 0x0A48CB27}, + {FDE_CSSPropertyValue::End, L"end", 0x0A631437}, + {FDE_CSSPropertyValue::Ltr, L"ltr", 0x0B1B56D2}, + {FDE_CSSPropertyValue::Pre, L"pre", 0x0B848587}, + {FDE_CSSPropertyValue::Rtl, L"rtl", 0x0BB92C52}, + {FDE_CSSPropertyValue::Sub, L"sub", 0x0BD37FAA}, + {FDE_CSSPropertyValue::Top, L"top", 0x0BEDAF33}, + {FDE_CSSPropertyValue::Visible, L"visible", 0x0F55D7EE}, + {FDE_CSSPropertyValue::Filled, L"filled", 0x10827DD0}, + {FDE_CSSPropertyValue::SwResize, L"sw-resize", 0x10B548E9}, + {FDE_CSSPropertyValue::NoRepeat, L"no-repeat", 0x1235C18B}, + {FDE_CSSPropertyValue::Default, L"default", 0x14DA2125}, + {FDE_CSSPropertyValue::Transparent, L"transparent", 0x17B64DB2}, + {FDE_CSSPropertyValue::Ridge, L"ridge", 0x18EBEE4B}, + {FDE_CSSPropertyValue::Right, L"right", 0x193ADE3E}, + {FDE_CSSPropertyValue::HorizontalTb, L"horizontal-tb", 0x1A66A86D}, + {FDE_CSSPropertyValue::DistributeLetter, L"distribute-letter", 0x1EDBD75C}, + {FDE_CSSPropertyValue::DoubleCircle, L"double-circle", 0x1FF082BA}, + {FDE_CSSPropertyValue::Ruby, L"ruby", 0x20D66C02}, + {FDE_CSSPropertyValue::Collapse, L"collapse", 0x2128D673}, + {FDE_CSSPropertyValue::Normal, L"normal", 0x247CF3E9}, + {FDE_CSSPropertyValue::Avoid, L"avoid", 0x24E684B3}, + {FDE_CSSPropertyValue::UpperRoman, L"upper-roman", 0x28BAC2B6}, + {FDE_CSSPropertyValue::Auto, L"auto", 0x2B35B6D9}, + {FDE_CSSPropertyValue::Text, L"text", 0x2D08AF85}, + {FDE_CSSPropertyValue::XSmall, L"x-small", 0x2D2FCAFE}, + {FDE_CSSPropertyValue::Thin, L"thin", 0x2D574D53}, + {FDE_CSSPropertyValue::Repeat, L"repeat", 0x306614A1}, + {FDE_CSSPropertyValue::Small, L"small", 0x316A3739}, + {FDE_CSSPropertyValue::NeResize, L"ne-resize", 0x31FD5E12}, + {FDE_CSSPropertyValue::NoContent, L"no-content", 0x33A1C545}, + {FDE_CSSPropertyValue::Outside, L"outside", 0x36DF693D}, + {FDE_CSSPropertyValue::EResize, L"e-resize", 0x36E19FA4}, + {FDE_CSSPropertyValue::TableRow, L"table-row", 0x3912A02D}, + {FDE_CSSPropertyValue::Bottom, L"bottom", 0x399F02B5}, + {FDE_CSSPropertyValue::Underline, L"underline", 0x3A0273A6}, + {FDE_CSSPropertyValue::CjkIdeographic, L"cjk-ideographic", 0x3A641CC4}, + {FDE_CSSPropertyValue::SeResize, L"se-resize", 0x3D675B17}, + {FDE_CSSPropertyValue::Fixed, L"fixed", 0x3D7DEB10}, + {FDE_CSSPropertyValue::Double, L"double", 0x3D98515B}, + {FDE_CSSPropertyValue::Solid, L"solid", 0x40623B5B}, + {FDE_CSSPropertyValue::RubyBaseGroup, L"ruby-base-group", 0x41014E84}, + {FDE_CSSPropertyValue::OpenQuote, L"open-quote", 0x44A41E8D}, + {FDE_CSSPropertyValue::Lighter, L"lighter", 0x45BEB7AF}, + {FDE_CSSPropertyValue::LowerRoman, L"lower-roman", 0x5044D253}, + {FDE_CSSPropertyValue::Strict, L"strict", 0x52F4EBD9}, + {FDE_CSSPropertyValue::TableCaption, L"table-caption", 0x5325CD63}, + {FDE_CSSPropertyValue::Oblique, L"oblique", 0x53EBDDB1}, + {FDE_CSSPropertyValue::Decimal, L"decimal", 0x54034C2F}, + {FDE_CSSPropertyValue::Loose, L"loose", 0x54D3A1E2}, + {FDE_CSSPropertyValue::Hebrew, L"hebrew", 0x565792DD}, + {FDE_CSSPropertyValue::Hidden, L"hidden", 0x573CB40C}, + {FDE_CSSPropertyValue::Dashed, L"dashed", 0x58A3DD29}, + {FDE_CSSPropertyValue::Embed, L"embed", 0x59C8F27D}, + {FDE_CSSPropertyValue::TableRowGroup, L"table-row-group", 0x5A43BD07}, + {FDE_CSSPropertyValue::TableColumn, L"table-column", 0x5E705DA3}, + {FDE_CSSPropertyValue::Static, L"static", 0x5E7555E8}, + {FDE_CSSPropertyValue::Outset, L"outset", 0x61236164}, + {FDE_CSSPropertyValue::DecimalLeadingZero, L"decimal-leading-zero", 0x61DFC55D}, - {FDE_CSSPROPERTYVALUE_KeepWords, L"keep-words", 0x63964801}, - {FDE_CSSPROPERTYVALUE_KatakanaIroha, L"katakana-iroha", 0x65D7C91C}, - {FDE_CSSPROPERTYVALUE_Super, L"super", 0x6A4F842F}, - {FDE_CSSPROPERTYVALUE_Center, L"center", 0x6C51AFC1}, - {FDE_CSSPROPERTYVALUE_TableHeaderGroup, L"table-header-group", 0x706103D8}, - {FDE_CSSPROPERTYVALUE_Inside, L"inside", 0x709CB0FC}, - {FDE_CSSPROPERTYVALUE_XxLarge, L"xx-large", 0x70BB1508}, - {FDE_CSSPROPERTYVALUE_Triangle, L"triangle", 0x7524EDF6}, - {FDE_CSSPROPERTYVALUE_RubyTextGroup, L"ruby-text-group", 0x78C2B98E}, - {FDE_CSSPROPERTYVALUE_Circle, L"circle", 0x7ABEC0D2}, - {FDE_CSSPROPERTYVALUE_Hiragana, L"hiragana", 0x7BF5E25B}, - {FDE_CSSPROPERTYVALUE_RepeatX, L"repeat-x", 0x7C8F3226}, - {FDE_CSSPROPERTYVALUE_RepeatY, L"repeat-y", 0x7C8F3227}, - {FDE_CSSPROPERTYVALUE_Move, L"move", 0x7DA03417}, - {FDE_CSSPROPERTYVALUE_HiraganaIroha, L"hiragana-iroha", 0x7EE863FB}, - {FDE_CSSPROPERTYVALUE_RubyBase, L"ruby-base", 0x7FD1B1EA}, - {FDE_CSSPROPERTYVALUE_Scroll, L"scroll", 0x84787AEF}, - {FDE_CSSPROPERTYVALUE_Smaller, L"smaller", 0x849769F0}, - {FDE_CSSPROPERTYVALUE_TableFooterGroup, L"table-footer-group", 0x85BDD97E}, - {FDE_CSSPROPERTYVALUE_Baseline, L"baseline", 0x87436BA3}, - {FDE_CSSPROPERTYVALUE_Separate, L"separate", 0x877C66B5}, - {FDE_CSSPROPERTYVALUE_Armenian, L"armenian", 0x889BE4EB}, - {FDE_CSSPROPERTYVALUE_Open, L"open", 0x8B90E1F2}, - {FDE_CSSPROPERTYVALUE_Relative, L"relative", 0x8C995B5C}, - {FDE_CSSPROPERTYVALUE_Thick, L"thick", 0x8CC35EB3}, - {FDE_CSSPROPERTYVALUE_Justify, L"justify", 0x8D269CAE}, - {FDE_CSSPROPERTYVALUE_Middle, L"middle", 0x947FA00F}, - {FDE_CSSPROPERTYVALUE_Always, L"always", 0x959AB231}, - {FDE_CSSPROPERTYVALUE_DistributeSpace, L"distribute-space", 0x97A20E58}, - {FDE_CSSPROPERTYVALUE_LineEdge, L"line-edge", 0x9A845D2A}, - {FDE_CSSPROPERTYVALUE_PreWrap, L"pre-wrap", 0x9D59588E}, - {FDE_CSSPROPERTYVALUE_Medium, L"medium", 0xA084A381}, - {FDE_CSSPROPERTYVALUE_NResize, L"n-resize", 0xA088968D}, - {FDE_CSSPROPERTYVALUE_ListItem, L"list-item", 0xA32382B8}, - {FDE_CSSPROPERTYVALUE_Show, L"show", 0xA66C10C1}, - {FDE_CSSPROPERTYVALUE_Currentcolor, L"currentColor", 0xA7883922}, - {FDE_CSSPROPERTYVALUE_NoCloseQuote, L"no-close-quote", 0xA79CBFFB}, - {FDE_CSSPROPERTYVALUE_VerticalLr, L"vertical-lr", 0xA8673F65}, - {FDE_CSSPROPERTYVALUE_VerticalRl, L"vertical-rl", 0xA8675E25}, - {FDE_CSSPROPERTYVALUE_Pointer, L"pointer", 0xA90929C1}, - {FDE_CSSPROPERTYVALUE_XxSmall, L"xx-small", 0xADE1FC76}, - {FDE_CSSPROPERTYVALUE_Bold, L"bold", 0xB18313A1}, - {FDE_CSSPROPERTYVALUE_Both, L"both", 0xB1833CAD}, - {FDE_CSSPROPERTYVALUE_SmallCaps, L"small-caps", 0xB299428D}, - {FDE_CSSPROPERTYVALUE_Katakana, L"katakana", 0xB421A4BC}, - {FDE_CSSPROPERTYVALUE_After, L"after", 0xB6B44172}, - {FDE_CSSPROPERTYVALUE_Horizontal, L"horizontal", 0xB7732DEA}, - {FDE_CSSPROPERTYVALUE_Dotted, L"dotted", 0xB88652A4}, - {FDE_CSSPROPERTYVALUE_Disc, L"disc", 0xBEBC18C3}, - {FDE_CSSPROPERTYVALUE_Georgian, L"georgian", 0xBEF99E8C}, - {FDE_CSSPROPERTYVALUE_Inline, L"inline", 0xC02D649F}, - {FDE_CSSPROPERTYVALUE_Overline, L"overline", 0xC0EC9FA4}, - {FDE_CSSPROPERTYVALUE_Wait, L"wait", 0xC1613BB5}, - {FDE_CSSPROPERTYVALUE_BreakAll, L"break-all", 0xC3145BAB}, - {FDE_CSSPROPERTYVALUE_UpperAlpha, L"upper-alpha", 0xC52D4A9F}, - {FDE_CSSPROPERTYVALUE_Capitalize, L"capitalize", 0xC5321D46}, - {FDE_CSSPROPERTYVALUE_Nowrap, L"nowrap", 0xC7994417}, - {FDE_CSSPROPERTYVALUE_TextBottom, L"text-bottom", 0xC7D08D87}, - {FDE_CSSPROPERTYVALUE_NoOpenQuote, L"no-open-quote", 0xC8CD7877}, - {FDE_CSSPROPERTYVALUE_Groove, L"groove", 0xCB24A412}, - {FDE_CSSPROPERTYVALUE_Progress, L"progress", 0xCD1D9835}, - {FDE_CSSPROPERTYVALUE_Larger, L"larger", 0xCD3C409D}, - {FDE_CSSPROPERTYVALUE_CloseQuote, L"close-quote", 0xCF8696D1}, - {FDE_CSSPROPERTYVALUE_TableCell, L"table-cell", 0xCFB5E595}, - {FDE_CSSPROPERTYVALUE_PreLine, L"pre-line", 0xD04FEDBC}, - {FDE_CSSPROPERTYVALUE_Absolute, L"absolute", 0xD0B2D55F}, - {FDE_CSSPROPERTYVALUE_InlineTable, L"inline-table", 0xD131F494}, - {FDE_CSSPROPERTYVALUE_BidiOverride, L"bidi-override", 0xD161FDE5}, - {FDE_CSSPROPERTYVALUE_InlineBlock, L"inline-block", 0xD26A8BD7}, - {FDE_CSSPROPERTYVALUE_Inset, L"inset", 0xD6F23243}, - {FDE_CSSPROPERTYVALUE_Crosshair, L"crosshair", 0xD6F8018E}, - {FDE_CSSPROPERTYVALUE_UpperLatin, L"upper-latin", 0xD9D60531}, - {FDE_CSSPROPERTYVALUE_Help, L"help", 0xDA002969}, - {FDE_CSSPROPERTYVALUE_Hide, L"hide", 0xDA69395A}, - {FDE_CSSPROPERTYVALUE_Uppercase, L"uppercase", 0xDAD595A8}, - {FDE_CSSPROPERTYVALUE_SResize, L"s-resize", 0xDB3AADF2}, - {FDE_CSSPROPERTYVALUE_Table, L"table", 0xDB9BE968}, - {FDE_CSSPROPERTYVALUE_Blink, L"blink", 0xDC36E390}, - {FDE_CSSPROPERTYVALUE_Block, L"block", 0xDCD480AB}, - {FDE_CSSPROPERTYVALUE_Start, L"start", 0xE1D9D5AE}, - {FDE_CSSPROPERTYVALUE_TableColumnGroup, L"table-column-group", 0xE2258EFD}, - {FDE_CSSPROPERTYVALUE_Italic, L"italic", 0xE31D5396}, - {FDE_CSSPROPERTYVALUE_LineThrough, L"line-through", 0xE4C5A276}, - {FDE_CSSPROPERTYVALUE_KeepAll, L"keep-all", 0xE704A72B}, - {FDE_CSSPROPERTYVALUE_LowerAlpha, L"lower-alpha", 0xECB75A3C}, - {FDE_CSSPROPERTYVALUE_RunIn, L"run-in", 0xEEC930B9}, - {FDE_CSSPROPERTYVALUE_Square, L"square", 0xEF85D351}, - {FDE_CSSPROPERTYVALUE_XLarge, L"x-large", 0xF008E390}, - {FDE_CSSPROPERTYVALUE_Large, L"large", 0xF4434FCB}, - {FDE_CSSPROPERTYVALUE_Before, L"before", 0xF4FFCE73}, - {FDE_CSSPROPERTYVALUE_Left, L"left", 0xF5AD782B}, - {FDE_CSSPROPERTYVALUE_TextTop, L"text-top", 0xFCB58D45}, - {FDE_CSSPROPERTYVALUE_RubyText, L"ruby-text", 0xFCC77174}, - {FDE_CSSPROPERTYVALUE_NoDisplay, L"no-display", 0xFE482860}, + {FDE_CSSPropertyValue::KeepWords, L"keep-words", 0x63964801}, + {FDE_CSSPropertyValue::KatakanaIroha, L"katakana-iroha", 0x65D7C91C}, + {FDE_CSSPropertyValue::Super, L"super", 0x6A4F842F}, + {FDE_CSSPropertyValue::Center, L"center", 0x6C51AFC1}, + {FDE_CSSPropertyValue::TableHeaderGroup, L"table-header-group", 0x706103D8}, + {FDE_CSSPropertyValue::Inside, L"inside", 0x709CB0FC}, + {FDE_CSSPropertyValue::XxLarge, L"xx-large", 0x70BB1508}, + {FDE_CSSPropertyValue::Triangle, L"triangle", 0x7524EDF6}, + {FDE_CSSPropertyValue::RubyTextGroup, L"ruby-text-group", 0x78C2B98E}, + {FDE_CSSPropertyValue::Circle, L"circle", 0x7ABEC0D2}, + {FDE_CSSPropertyValue::Hiragana, L"hiragana", 0x7BF5E25B}, + {FDE_CSSPropertyValue::RepeatX, L"repeat-x", 0x7C8F3226}, + {FDE_CSSPropertyValue::RepeatY, L"repeat-y", 0x7C8F3227}, + {FDE_CSSPropertyValue::Move, L"move", 0x7DA03417}, + {FDE_CSSPropertyValue::HiraganaIroha, L"hiragana-iroha", 0x7EE863FB}, + {FDE_CSSPropertyValue::RubyBase, L"ruby-base", 0x7FD1B1EA}, + {FDE_CSSPropertyValue::Scroll, L"scroll", 0x84787AEF}, + {FDE_CSSPropertyValue::Smaller, L"smaller", 0x849769F0}, + {FDE_CSSPropertyValue::TableFooterGroup, L"table-footer-group", 0x85BDD97E}, + {FDE_CSSPropertyValue::Baseline, L"baseline", 0x87436BA3}, + {FDE_CSSPropertyValue::Separate, L"separate", 0x877C66B5}, + {FDE_CSSPropertyValue::Armenian, L"armenian", 0x889BE4EB}, + {FDE_CSSPropertyValue::Open, L"open", 0x8B90E1F2}, + {FDE_CSSPropertyValue::Relative, L"relative", 0x8C995B5C}, + {FDE_CSSPropertyValue::Thick, L"thick", 0x8CC35EB3}, + {FDE_CSSPropertyValue::Justify, L"justify", 0x8D269CAE}, + {FDE_CSSPropertyValue::Middle, L"middle", 0x947FA00F}, + {FDE_CSSPropertyValue::Always, L"always", 0x959AB231}, + {FDE_CSSPropertyValue::DistributeSpace, L"distribute-space", 0x97A20E58}, + {FDE_CSSPropertyValue::LineEdge, L"line-edge", 0x9A845D2A}, + {FDE_CSSPropertyValue::PreWrap, L"pre-wrap", 0x9D59588E}, + {FDE_CSSPropertyValue::Medium, L"medium", 0xA084A381}, + {FDE_CSSPropertyValue::NResize, L"n-resize", 0xA088968D}, + {FDE_CSSPropertyValue::ListItem, L"list-item", 0xA32382B8}, + {FDE_CSSPropertyValue::Show, L"show", 0xA66C10C1}, + {FDE_CSSPropertyValue::Currentcolor, L"currentColor", 0xA7883922}, + {FDE_CSSPropertyValue::NoCloseQuote, L"no-close-quote", 0xA79CBFFB}, + {FDE_CSSPropertyValue::VerticalLr, L"vertical-lr", 0xA8673F65}, + {FDE_CSSPropertyValue::VerticalRl, L"vertical-rl", 0xA8675E25}, + {FDE_CSSPropertyValue::Pointer, L"pointer", 0xA90929C1}, + {FDE_CSSPropertyValue::XxSmall, L"xx-small", 0xADE1FC76}, + {FDE_CSSPropertyValue::Bold, L"bold", 0xB18313A1}, + {FDE_CSSPropertyValue::Both, L"both", 0xB1833CAD}, + {FDE_CSSPropertyValue::SmallCaps, L"small-caps", 0xB299428D}, + {FDE_CSSPropertyValue::Katakana, L"katakana", 0xB421A4BC}, + {FDE_CSSPropertyValue::After, L"after", 0xB6B44172}, + {FDE_CSSPropertyValue::Horizontal, L"horizontal", 0xB7732DEA}, + {FDE_CSSPropertyValue::Dotted, L"dotted", 0xB88652A4}, + {FDE_CSSPropertyValue::Disc, L"disc", 0xBEBC18C3}, + {FDE_CSSPropertyValue::Georgian, L"georgian", 0xBEF99E8C}, + {FDE_CSSPropertyValue::Inline, L"inline", 0xC02D649F}, + {FDE_CSSPropertyValue::Overline, L"overline", 0xC0EC9FA4}, + {FDE_CSSPropertyValue::Wait, L"wait", 0xC1613BB5}, + {FDE_CSSPropertyValue::BreakAll, L"break-all", 0xC3145BAB}, + {FDE_CSSPropertyValue::UpperAlpha, L"upper-alpha", 0xC52D4A9F}, + {FDE_CSSPropertyValue::Capitalize, L"capitalize", 0xC5321D46}, + {FDE_CSSPropertyValue::Nowrap, L"nowrap", 0xC7994417}, + {FDE_CSSPropertyValue::TextBottom, L"text-bottom", 0xC7D08D87}, + {FDE_CSSPropertyValue::NoOpenQuote, L"no-open-quote", 0xC8CD7877}, + {FDE_CSSPropertyValue::Groove, L"groove", 0xCB24A412}, + {FDE_CSSPropertyValue::Progress, L"progress", 0xCD1D9835}, + {FDE_CSSPropertyValue::Larger, L"larger", 0xCD3C409D}, + {FDE_CSSPropertyValue::CloseQuote, L"close-quote", 0xCF8696D1}, + {FDE_CSSPropertyValue::TableCell, L"table-cell", 0xCFB5E595}, + {FDE_CSSPropertyValue::PreLine, L"pre-line", 0xD04FEDBC}, + {FDE_CSSPropertyValue::Absolute, L"absolute", 0xD0B2D55F}, + {FDE_CSSPropertyValue::InlineTable, L"inline-table", 0xD131F494}, + {FDE_CSSPropertyValue::BidiOverride, L"bidi-override", 0xD161FDE5}, + {FDE_CSSPropertyValue::InlineBlock, L"inline-block", 0xD26A8BD7}, + {FDE_CSSPropertyValue::Inset, L"inset", 0xD6F23243}, + {FDE_CSSPropertyValue::Crosshair, L"crosshair", 0xD6F8018E}, + {FDE_CSSPropertyValue::UpperLatin, L"upper-latin", 0xD9D60531}, + {FDE_CSSPropertyValue::Help, L"help", 0xDA002969}, + {FDE_CSSPropertyValue::Hide, L"hide", 0xDA69395A}, + {FDE_CSSPropertyValue::Uppercase, L"uppercase", 0xDAD595A8}, + {FDE_CSSPropertyValue::SResize, L"s-resize", 0xDB3AADF2}, + {FDE_CSSPropertyValue::Table, L"table", 0xDB9BE968}, + {FDE_CSSPropertyValue::Blink, L"blink", 0xDC36E390}, + {FDE_CSSPropertyValue::Block, L"block", 0xDCD480AB}, + {FDE_CSSPropertyValue::Start, L"start", 0xE1D9D5AE}, + {FDE_CSSPropertyValue::TableColumnGroup, L"table-column-group", 0xE2258EFD}, + {FDE_CSSPropertyValue::Italic, L"italic", 0xE31D5396}, + {FDE_CSSPropertyValue::LineThrough, L"line-through", 0xE4C5A276}, + {FDE_CSSPropertyValue::KeepAll, L"keep-all", 0xE704A72B}, + {FDE_CSSPropertyValue::LowerAlpha, L"lower-alpha", 0xECB75A3C}, + {FDE_CSSPropertyValue::RunIn, L"run-in", 0xEEC930B9}, + {FDE_CSSPropertyValue::Square, L"square", 0xEF85D351}, + {FDE_CSSPropertyValue::XLarge, L"x-large", 0xF008E390}, + {FDE_CSSPropertyValue::Large, L"large", 0xF4434FCB}, + {FDE_CSSPropertyValue::Before, L"before", 0xF4FFCE73}, + {FDE_CSSPropertyValue::Left, L"left", 0xF5AD782B}, + {FDE_CSSPropertyValue::TextTop, L"text-top", 0xFCB58D45}, + {FDE_CSSPropertyValue::RubyText, L"ruby-text", 0xFCC77174}, + {FDE_CSSPropertyValue::NoDisplay, L"no-display", 0xFE482860}, }; +const int32_t g_iCSSPropertyValueCount = + sizeof(g_FDE_CSSPropertyValues) / sizeof(FDE_CSSPropertyValueTable); + static const FDE_CSSMEDIATYPETABLE g_FDE_CSSMediaTypes[] = { {0xF09, 0x02}, {0x4880, 0x20}, {0x536A, 0x80}, {0x741D, 0x10}, {0x76ED, 0x08}, {0x7CFB, 0x01}, {0x9578, 0x04}, {0xC8E1, 0x40}, {0xD0F9, 0xFF}, }; -static const FDE_CSSLENGTHUNITTABLE g_FDE_CSSLengthUnits[] = { - {0x0672, 3}, {0x067D, 4}, {0x1AF7, 8}, {0x2F7A, 7}, - {0x3ED3, 10}, {0x3EE4, 9}, {0x3EE8, 5}, {0xFC30, 6}, +static const FDE_CSSLengthUnitTable g_FDE_CSSLengthUnits[] = { + {0x0672, FDE_CSSPrimitiveType::EMS}, + {0x067D, FDE_CSSPrimitiveType::EXS}, + {0x1AF7, FDE_CSSPrimitiveType::Inches}, + {0x2F7A, FDE_CSSPrimitiveType::MilliMeters}, + {0x3ED3, FDE_CSSPrimitiveType::Picas}, + {0x3EE4, FDE_CSSPrimitiveType::Points}, + {0x3EE8, FDE_CSSPrimitiveType::Pixels}, + {0xFC30, FDE_CSSPrimitiveType::CentiMeters}, }; static const FDE_CSSCOLORTABLE g_FDE_CSSColors[] = { {0x031B47FE, 0xff000080}, {0x0BB8DF5B, 0xffff0000}, @@ -553,18 +567,21 @@ static const FDE_CSSCOLORTABLE g_FDE_CSSColors[] = { {0xDB64391D, 0xff000000}, {0xF616D507, 0xff00ff00}, {0xF6EFFF31, 0xff008000}, }; -static const FDE_CSSPSEUDOTABLE g_FDE_CSSPseudoType[] = { - {FDE_CSSPSEUDO_After, L":after", 0x16EE1FEC}, - {FDE_CSSPSEUDO_Before, L":before", 0x7DCDDE2D}, + +static const FDE_CSSPseudoTable g_FDE_CSSPseudoType[] = { + {FDE_CSSPseudo::After, L":after", 0x16EE1FEC}, + {FDE_CSSPseudo::Before, L":before", 0x7DCDDE2D}, }; -const FDE_CSSPSEUDOTABLE* FDE_GetCSSPseudoByEnum(FDE_CSSPSEUDO ePseudo) { - return ePseudo < FDE_CSSPSEUDO_NONE ? g_FDE_CSSPseudoType + ePseudo : nullptr; + +const FDE_CSSPseudoTable* FDE_GetCSSPseudoByEnum(FDE_CSSPseudo ePseudo) { + return g_FDE_CSSPseudoType + static_cast(ePseudo); } -const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByName( + +const FDE_CSSPropertyTable* FDE_GetCSSPropertyByName( const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); uint32_t dwHash = FX_HashCode_GetW(wsName, true); - int32_t iEnd = FDE_CSSPROPERTY_MAX - 1; + int32_t iEnd = g_iCSSPropertyCount; int32_t iMid, iStart = 0; uint32_t dwMid; do { @@ -580,15 +597,16 @@ const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByName( } while (iStart <= iEnd); return nullptr; } -const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName) { - return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName) - : nullptr; + +const FDE_CSSPropertyTable* FDE_GetCSSPropertyByEnum(FDE_CSSProperty eName) { + return g_FDE_CSSProperties + static_cast(eName); } -const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByName( + +const FDE_CSSPropertyValueTable* FDE_GetCSSPropertyValueByName( const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); uint32_t dwHash = FX_HashCode_GetW(wsName, true); - int32_t iEnd = FDE_CSSPROPERTYVALUE_MAX - 1; + int32_t iEnd = g_iCSSPropertyValueCount; int32_t iMid, iStart = 0; uint32_t dwMid; do { @@ -604,11 +622,12 @@ const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByName( } while (iStart <= iEnd); return nullptr; } -const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByEnum( - FDE_CSSPROPERTYVALUE eName) { - return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName) - : nullptr; + +const FDE_CSSPropertyValueTable* FDE_GetCSSPropertyValueByEnum( + FDE_CSSPropertyValue eName) { + return g_FDE_CSSPropertyValues + static_cast(eName); } + const FDE_CSSMEDIATYPETABLE* FDE_GetCSSMediaTypeByName( const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); @@ -631,12 +650,12 @@ const FDE_CSSMEDIATYPETABLE* FDE_GetCSSMediaTypeByName( return nullptr; } -const FDE_CSSLENGTHUNITTABLE* FDE_GetCSSLengthUnitByName( +const FDE_CSSLengthUnitTable* FDE_GetCSSLengthUnitByName( const CFX_WideStringC& wsName) { ASSERT(!wsName.IsEmpty()); uint16_t wHash = FX_HashCode_GetW(wsName, true); int32_t iEnd = - sizeof(g_FDE_CSSLengthUnits) / sizeof(FDE_CSSLENGTHUNITTABLE) - 1; + sizeof(g_FDE_CSSLengthUnits) / sizeof(FDE_CSSLengthUnitTable) - 1; int32_t iMid, iStart = 0; uint16_t wMid; do { @@ -676,7 +695,7 @@ const FDE_CSSCOLORTABLE* FDE_GetCSSColorByName(const CFX_WideStringC& wsName) { bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, int32_t iValueLen, FX_FLOAT& fValue, - FDE_CSSPRIMITIVETYPE& eUnit) { + FDE_CSSPrimitiveType& eUnit) { ASSERT(pszValue && iValueLen > 0); int32_t iUsedLen = 0; fValue = FXSYS_wcstof(pszValue, iValueLen, &iUsedLen); @@ -685,14 +704,14 @@ bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, iValueLen -= iUsedLen; pszValue += iUsedLen; - eUnit = FDE_CSSPRIMITIVETYPE_Number; + eUnit = FDE_CSSPrimitiveType::Number; if (iValueLen >= 1 && *pszValue == '%') { - eUnit = FDE_CSSPRIMITIVETYPE_Percent; + eUnit = FDE_CSSPrimitiveType::Percent; } else if (iValueLen == 2) { - const FDE_CSSLENGTHUNITTABLE* pUnit = + const FDE_CSSLengthUnitTable* pUnit = FDE_GetCSSLengthUnitByName(CFX_WideStringC(pszValue, 2)); if (pUnit) - eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; + eUnit = pUnit->wValue; } return true; } @@ -761,17 +780,17 @@ bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, uint8_t rgb[3] = {0}; FX_FLOAT fValue; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; CFDE_CSSValueListParser list(pszValue + 4, iValueLen - 5, ','); for (int32_t i = 0; i < 3; ++i) { if (!list.NextValue(eType, pszValue, iValueLen)) return false; - if (eType != FDE_CSSPRIMITIVETYPE_Number) + if (eType != FDE_CSSPrimitiveType::Number) return false; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) return false; - rgb[i] = eType == FDE_CSSPRIMITIVETYPE_Percent + rgb[i] = eType == FDE_CSSPrimitiveType::Percent ? FXSYS_round(fValue * 2.55f) : FXSYS_round(fValue); } @@ -802,7 +821,7 @@ int32_t CFDE_CSSValueList::CountValues() const { IFDE_CSSValue* CFDE_CSSValueList::GetValue(int32_t index) const { return m_ppList[index]; } -bool CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, +bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, const FX_WCHAR*& pStart, int32_t& iLength) { while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) { @@ -811,14 +830,14 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, if (m_pCur >= m_pEnd) { return false; } - eType = FDE_CSSPRIMITIVETYPE_Unknown; + eType = FDE_CSSPrimitiveType::Unknown; pStart = m_pCur; iLength = 0; FX_WCHAR wch = *m_pCur; if (wch == '#') { iLength = SkipTo(' '); if (iLength == 4 || iLength == 7) { - eType = FDE_CSSPRIMITIVETYPE_RGB; + eType = FDE_CSSPrimitiveType::RGB; } } else if ((wch >= '0' && wch <= '9') || wch == '.' || wch == '-' || wch == '+') { @@ -827,13 +846,13 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, } iLength = m_pCur - pStart; if (iLength > 0) { - eType = FDE_CSSPRIMITIVETYPE_Number; + eType = FDE_CSSPrimitiveType::Number; } } else if (wch == '\"' || wch == '\'') { pStart++; iLength = SkipTo(wch) - 1; m_pCur++; - eType = FDE_CSSPRIMITIVETYPE_String; + eType = FDE_CSSPrimitiveType::String; } else if (m_pEnd - m_pCur > 5 && m_pCur[3] == '(') { if (FXSYS_wcsnicmp(L"url", m_pCur, 3) == 0) { wch = m_pCur[4]; @@ -846,15 +865,15 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, iLength = SkipTo(')') - 4; m_pCur++; } - eType = FDE_CSSPRIMITIVETYPE_URI; + eType = FDE_CSSPrimitiveType::URI; } else if (FXSYS_wcsnicmp(L"rgb", m_pCur, 3) == 0) { iLength = SkipTo(')') + 1; m_pCur++; - eType = FDE_CSSPRIMITIVETYPE_RGB; + eType = FDE_CSSPrimitiveType::RGB; } } else { iLength = SkipTo(m_Separator, true, true); - eType = FDE_CSSPRIMITIVETYPE_String; + eType = FDE_CSSPrimitiveType::String; } return m_pCur <= m_pEnd && iLength > 0; } @@ -908,62 +927,62 @@ CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue( const CFDE_CSSPrimitiveValue& src) = default; CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FX_ARGB color) - : m_eType(FDE_CSSPRIMITIVETYPE_RGB), m_dwColor(color) {} + : m_eType(FDE_CSSPrimitiveType::RGB), m_dwColor(color) {} -CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue) - : m_eType(FDE_CSSPRIMITIVETYPE_Enum), m_eEnum(eValue) {} +CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPropertyValue eValue) + : m_eType(FDE_CSSPrimitiveType::Enum), m_eEnum(eValue) {} -CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, +CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType eType, FX_FLOAT fValue) : m_eType(eType), m_fNumber(fValue) {} -CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, +CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType eType, const FX_WCHAR* pValue) : m_eType(eType), m_pString(pValue) { ASSERT(m_pString); } CFDE_CSSPrimitiveValue::CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction) - : m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {} + : m_eType(FDE_CSSPrimitiveType::Function), m_pFunction(pFunction) {} -FDE_CSSPRIMITIVETYPE CFDE_CSSPrimitiveValue::GetPrimitiveType() const { +FDE_CSSPrimitiveType CFDE_CSSPrimitiveValue::GetPrimitiveType() const { return m_eType; } FX_ARGB CFDE_CSSPrimitiveValue::GetRGBColor() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_RGB); + ASSERT(m_eType == FDE_CSSPrimitiveType::RGB); return m_dwColor; } FX_FLOAT CFDE_CSSPrimitiveValue::GetFloat() const { - ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_Number && - m_eType <= FDE_CSSPRIMITIVETYPE_PC); + ASSERT(m_eType >= FDE_CSSPrimitiveType::Number && + m_eType <= FDE_CSSPrimitiveType::Picas); return m_fNumber; } const FX_WCHAR* CFDE_CSSPrimitiveValue::GetString(int32_t& iLength) const { - ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_String && - m_eType <= FDE_CSSPRIMITIVETYPE_URI); + ASSERT(m_eType >= FDE_CSSPrimitiveType::String && + m_eType <= FDE_CSSPrimitiveType::URI); iLength = FXSYS_wcslen(m_pString); return m_pString; } -FDE_CSSPROPERTYVALUE CFDE_CSSPrimitiveValue::GetEnum() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Enum); +FDE_CSSPropertyValue CFDE_CSSPrimitiveValue::GetEnum() const { + ASSERT(m_eType == FDE_CSSPrimitiveType::Enum); return m_eEnum; } const FX_WCHAR* CFDE_CSSPrimitiveValue::GetFuncName() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); + ASSERT(m_eType == FDE_CSSPrimitiveType::Function); return m_pFunction->GetFuncName(); } int32_t CFDE_CSSPrimitiveValue::CountArgs() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); + ASSERT(m_eType == FDE_CSSPrimitiveType::Function); return m_pFunction->CountArgs(); } IFDE_CSSValue* CFDE_CSSPrimitiveValue::GetArgs(int32_t index) const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); + ASSERT(m_eType == FDE_CSSPrimitiveType::Function); return m_pFunction->GetArgs(index); } diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index 2790188318..f11cae2eac 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -30,28 +30,28 @@ class CFDE_CSSFunction { class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue { public: explicit CFDE_CSSPrimitiveValue(FX_ARGB color); - explicit CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue); + explicit CFDE_CSSPrimitiveValue(FDE_CSSPropertyValue eValue); explicit CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction); - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue); - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue); + CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType eType, FX_FLOAT fValue); + CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType eType, const FX_WCHAR* pValue); CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src); // IFDE_CSSPrimitiveValue - FDE_CSSPRIMITIVETYPE GetPrimitiveType() const override; + FDE_CSSPrimitiveType GetPrimitiveType() const override; FX_ARGB GetRGBColor() const override; FX_FLOAT GetFloat() const override; const FX_WCHAR* GetString(int32_t& iLength) const override; - FDE_CSSPROPERTYVALUE GetEnum() const override; + FDE_CSSPropertyValue GetEnum() const override; const FX_WCHAR* GetFuncName() const override; int32_t CountArgs() const override; IFDE_CSSValue* GetArgs(int32_t index) const override; - FDE_CSSPRIMITIVETYPE m_eType; + FDE_CSSPrimitiveType m_eType; union { FX_ARGB m_dwColor; FX_FLOAT m_fNumber; const FX_WCHAR* m_pString; - FDE_CSSPROPERTYVALUE m_eEnum; + FDE_CSSPropertyValue m_eEnum; CFDE_CSSFunction* m_pFunction; }; }; @@ -78,7 +78,7 @@ class CFDE_CSSValueListParser { : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { ASSERT(psz && iLen > 0); } - bool NextValue(FDE_CSSPRIMITIVETYPE& eType, + bool NextValue(FDE_CSSPrimitiveType& eType, const FX_WCHAR*& pStart, int32_t& iLength); FX_WCHAR m_Separator; @@ -92,36 +92,30 @@ class CFDE_CSSValueListParser { const FX_WCHAR* m_pEnd; }; -#define FDE_CSSVALUETYPE_MaybeNumber 0x0100 -#define FDE_CSSVALUETYPE_MaybeEnum 0x0200 -#define FDE_CSSVALUETYPE_MaybeURI 0x0400 -#define FDE_CSSVALUETYPE_MaybeString 0x0800 -#define FDE_CSSVALUETYPE_MaybeColor 0x1000 -#define FDE_CSSVALUETYPE_MaybeFunction 0x2000 #define FDE_IsOnlyValue(type, enum) \ (((type) & ~(enum)) == FDE_CSSVALUETYPE_Primitive) -struct FDE_CSSPROPERTYTABLE { - FDE_CSSPROPERTY eName; +struct FDE_CSSPropertyTable { + FDE_CSSProperty eName; const FX_WCHAR* pszName; uint32_t dwHash; uint32_t dwType; }; -const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByName( +const FDE_CSSPropertyTable* FDE_GetCSSPropertyByName( const CFX_WideStringC& wsName); -const FDE_CSSPROPERTYTABLE* FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName); +const FDE_CSSPropertyTable* FDE_GetCSSPropertyByEnum(FDE_CSSProperty eName); -struct FDE_CSSPROPERTYVALUETABLE { - FDE_CSSPROPERTYVALUE eName; +struct FDE_CSSPropertyValueTable { + FDE_CSSPropertyValue eName; const FX_WCHAR* pszName; uint32_t dwHash; }; -const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByName( +const FDE_CSSPropertyValueTable* FDE_GetCSSPropertyValueByName( const CFX_WideStringC& wsName); -const FDE_CSSPROPERTYVALUETABLE* FDE_GetCSSPropertyValueByEnum( - FDE_CSSPROPERTYVALUE eName); +const FDE_CSSPropertyValueTable* FDE_GetCSSPropertyValueByEnum( + FDE_CSSPropertyValue eName); struct FDE_CSSMEDIATYPETABLE { uint16_t wHash; @@ -131,12 +125,12 @@ struct FDE_CSSMEDIATYPETABLE { const FDE_CSSMEDIATYPETABLE* FDE_GetCSSMediaTypeByName( const CFX_WideStringC& wsName); -struct FDE_CSSLENGTHUNITTABLE { +struct FDE_CSSLengthUnitTable { uint16_t wHash; - uint16_t wValue; + FDE_CSSPrimitiveType wValue; }; -const FDE_CSSLENGTHUNITTABLE* FDE_GetCSSLengthUnitByName( +const FDE_CSSLengthUnitTable* FDE_GetCSSLengthUnitByName( const CFX_WideStringC& wsName); struct FDE_CSSCOLORTABLE { @@ -146,18 +140,18 @@ struct FDE_CSSCOLORTABLE { const FDE_CSSCOLORTABLE* FDE_GetCSSColorByName(const CFX_WideStringC& wsName); -struct FDE_CSSPSEUDOTABLE { - FDE_CSSPSEUDO eName; +struct FDE_CSSPseudoTable { + FDE_CSSPseudo eName; const FX_WCHAR* pszName; uint32_t dwHash; }; -const FDE_CSSPSEUDOTABLE* FDE_GetCSSPseudoByEnum(FDE_CSSPSEUDO ePseudo); +const FDE_CSSPseudoTable* FDE_GetCSSPseudoByEnum(FDE_CSSPseudo ePseudo); bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, int32_t iValueLen, FX_FLOAT& fValue, - FDE_CSSPRIMITIVETYPE& eUnit); + FDE_CSSPrimitiveType& eUnit); bool FDE_ParseCSSString(const FX_WCHAR* pszValue, int32_t iValueLen, int32_t* iOffset, diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index a5385af0db..e723ee6801 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -8,7 +8,7 @@ #include "core/fxcrt/fx_ext.h" -IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty, +IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSProperty eProperty, bool& bImportant) const { for (const FDE_CSSPropertyHolder* pHolder = m_pFirstProperty; pHolder; pHolder = pHolder->pNext) { @@ -23,12 +23,12 @@ FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const { return (FX_POSITION)m_pFirstProperty; } void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos, - FDE_CSSPROPERTY& eProperty, + FDE_CSSProperty& eProperty, IFDE_CSSValue*& pValue, bool& bImportant) const { const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos; bImportant = pHolder->bImportant; - eProperty = (FDE_CSSPROPERTY)pHolder->eProperty; + eProperty = pHolder->eProperty; pValue = pHolder->pValue; pos = (FX_POSITION)pHolder->pNext; } @@ -47,7 +47,7 @@ void CFDE_CSSDeclaration::GetNextCustom(FX_POSITION& pos, pos = (FX_POSITION)pProperty->pNext; } const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { ASSERT(iValueLen > 0); @@ -68,19 +68,19 @@ const FX_WCHAR* CFDE_CSSDeclaration::CopyToLocal( return psz; } IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewNumberValue( - FDE_CSSPRIMITIVETYPE eUnit, + FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue) const { - static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); - if (eUnit == FDE_CSSPRIMITIVETYPE_Number && FXSYS_fabs(fValue) < 0.001f) { + static CFDE_CSSPrimitiveValue s_ZeroValue(FDE_CSSPrimitiveType::Number, 0.0f); + if (eUnit == FDE_CSSPrimitiveType::Number && FXSYS_fabs(fValue) < 0.001f) { return &s_ZeroValue; } return new CFDE_CSSPrimitiveValue(eUnit, fValue); } inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( - FDE_CSSPROPERTYVALUE eValue) const { + FDE_CSSPropertyValue eValue) const { return new CFDE_CSSPrimitiveValue(eValue); } -void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSPROPERTY eProperty, +void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, bool bImportant) { FDE_CSSPropertyHolder* pHolder = new FDE_CSSPropertyHolder; @@ -94,7 +94,7 @@ void CFDE_CSSDeclaration::AddPropertyHolder(FDE_CSSPROPERTY eProperty, m_pFirstProperty = pHolder; m_pLastProperty = pHolder; } -bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { ASSERT(iValueLen > 0); @@ -156,78 +156,78 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, case FDE_CSSVALUETYPE_Shorthand: { IFDE_CSSValue *pColor, *pStyle, *pWidth; switch (pArgs->pProperty->eName) { - case FDE_CSSPROPERTY_Font: + case FDE_CSSProperty::Font: return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_Background: + case FDE_CSSProperty::Background: return ParseBackgroundProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_ListStyle: + case FDE_CSSProperty::ListStyle: return ParseListStyleProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_Border: + case FDE_CSSProperty::Border: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_BorderLeftWidth); + FDE_CSSProperty::BorderLeftColor, + FDE_CSSProperty::BorderLeftStyle, + FDE_CSSProperty::BorderLeftWidth); AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderTopColor, - FDE_CSSPROPERTY_BorderTopStyle, - FDE_CSSPROPERTY_BorderTopWidth); + FDE_CSSProperty::BorderTopColor, + FDE_CSSProperty::BorderTopStyle, + FDE_CSSProperty::BorderTopWidth); AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_BorderRightWidth); + FDE_CSSProperty::BorderRightColor, + FDE_CSSProperty::BorderRightStyle, + FDE_CSSProperty::BorderRightWidth); AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderBottomColor, - FDE_CSSPROPERTY_BorderBottomStyle, - FDE_CSSPROPERTY_BorderBottomWidth); + FDE_CSSProperty::BorderBottomColor, + FDE_CSSProperty::BorderBottomStyle, + FDE_CSSProperty::BorderBottomWidth); return true; } break; - case FDE_CSSPROPERTY_BorderLeft: + case FDE_CSSProperty::BorderLeft: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_BorderLeftWidth); + FDE_CSSProperty::BorderLeftColor, + FDE_CSSProperty::BorderLeftStyle, + FDE_CSSProperty::BorderLeftWidth); return true; } break; - case FDE_CSSPROPERTY_BorderTop: + case FDE_CSSProperty::BorderTop: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderTopColor, - FDE_CSSPROPERTY_BorderTopStyle, - FDE_CSSPROPERTY_BorderTopWidth); + FDE_CSSProperty::BorderTopColor, + FDE_CSSProperty::BorderTopStyle, + FDE_CSSProperty::BorderTopWidth); return true; } break; - case FDE_CSSPROPERTY_BorderRight: + case FDE_CSSProperty::BorderRight: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_BorderRightWidth); + FDE_CSSProperty::BorderRightColor, + FDE_CSSProperty::BorderRightStyle, + FDE_CSSProperty::BorderRightWidth); return true; } break; - case FDE_CSSPROPERTY_BorderBottom: + case FDE_CSSProperty::BorderBottom: if (ParseBorderPropoerty(pszValue, iValueLen, pColor, pStyle, pWidth)) { AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSPROPERTY_BorderBottomColor, - FDE_CSSPROPERTY_BorderBottomStyle, - FDE_CSSPROPERTY_BorderBottomWidth); + FDE_CSSProperty::BorderBottomColor, + FDE_CSSProperty::BorderBottomStyle, + FDE_CSSProperty::BorderBottomWidth); return true; } break; - case FDE_CSSPROPERTY_Overflow: + case FDE_CSSProperty::Overflow: return ParseOverflowProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_ColumnRule: + case FDE_CSSProperty::ColumnRule: return ParseColumnRuleProperty(pArgs, pszValue, iValueLen, bImportant); default: @@ -236,10 +236,10 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } break; case FDE_CSSVALUETYPE_List: switch (pArgs->pProperty->eName) { - case FDE_CSSPROPERTY_CounterIncrement: - case FDE_CSSPROPERTY_CounterReset: + case FDE_CSSProperty::CounterIncrement: + case FDE_CSSProperty::CounterReset: return ParseCounterProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSPROPERTY_Content: + case FDE_CSSProperty::Content: return ParseContentProperty(pArgs, pszValue, iValueLen, bImportant); default: return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); @@ -250,7 +250,7 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, } return false; } -bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszName, int32_t iNameLen, const FX_WCHAR* pszValue, @@ -267,24 +267,24 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, return true; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { FX_FLOAT fValue; - FDE_CSSPRIMITIVETYPE eUnit; + FDE_CSSPrimitiveType eUnit; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eUnit)) { return nullptr; } return NewNumberValue(eUnit, fValue); } -IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, +IFDE_CSSValue* CFDE_CSSDeclaration::ParseEnum(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { - const FDE_CSSPROPERTYVALUETABLE* pValue = + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); return pValue ? NewEnumValue(pValue->eName) : nullptr; } -IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, +IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { FX_ARGB dwColor; @@ -294,7 +294,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseColor(const FDE_CSSPROPERTYARGS* pArgs, return new CFDE_CSSPrimitiveValue(dwColor); } -IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, +IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { int32_t iOffset; @@ -306,12 +306,12 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseURI(const FDE_CSSPROPERTYARGS* pArgs, pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); return pszValue - ? new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_URI, pszValue) + ? new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::URI, pszValue) : nullptr; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { int32_t iOffset; @@ -322,12 +322,12 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseString( return nullptr; pszValue = CopyToLocal(pArgs, pszValue + iOffset, iValueLen); - return pszValue - ? new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue) - : nullptr; + return pszValue ? new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, + pszValue) + : nullptr; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen) { if (pszValue[iValueLen - 1] != ')') { @@ -349,11 +349,11 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( iValueLen -= (iStartBracket + 2); CFDE_CSSValueArray argumentArr; CFDE_CSSValueListParser parser(pszValue, iValueLen, ','); - FDE_CSSPRIMITIVETYPE ePrimitiveType; + FDE_CSSPrimitiveType ePrimitiveType; while (parser.NextValue(ePrimitiveType, pszValue, iValueLen)) { switch (ePrimitiveType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pPropertyValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pPropertyValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pPropertyValue) { argumentArr.Add(NewEnumValue(pPropertyValue->eName)); @@ -366,10 +366,10 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( continue; } argumentArr.Add(new CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, + FDE_CSSPrimitiveType::String, CopyToLocal(pArgs, pszValue, iValueLen))); } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, ePrimitiveType)) { argumentArr.Add(NewNumberValue(ePrimitiveType, fValue)); @@ -377,7 +377,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( } break; default: argumentArr.Add(new CFDE_CSSPrimitiveValue( - FDE_CSSPRIMITIVETYPE_String, + FDE_CSSPrimitiveType::String, CopyToLocal(pArgs, pszValue, iValueLen))); break; } @@ -387,38 +387,38 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( new CFDE_CSSFunction(pszFuncName, pArgumentList); return new CFDE_CSSPrimitiveValue(pFunction); } -bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; CFDE_CSSValueArray list; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_URI: + case FDE_CSSPrimitiveType::URI: list.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); break; - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: return false; - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_Normal: - case FDE_CSSPROPERTYVALUE_None: { + case FDE_CSSPropertyValue::Normal: + case FDE_CSSPropertyValue::None: { if (list.GetSize() == 0) { list.Add(NewEnumValue(pValue->eName)); } else { return false; } } break; - case FDE_CSSPROPERTYVALUE_OpenQuote: - case FDE_CSSPROPERTYVALUE_CloseQuote: - case FDE_CSSPROPERTYVALUE_NoOpenQuote: - case FDE_CSSPROPERTYVALUE_NoCloseQuote: + case FDE_CSSPropertyValue::OpenQuote: + case FDE_CSSPropertyValue::CloseQuote: + case FDE_CSSPropertyValue::NoOpenQuote: + case FDE_CSSPropertyValue::NoCloseQuote: list.Add(NewEnumValue(pValue->eName)); break; default: @@ -434,7 +434,7 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, list.Add(new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen))); } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: return false; default: break; @@ -447,17 +447,17 @@ bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, bImportant); return true; } -bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray list; CFDE_CSSValueArray listFull; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { if (list.GetSize() == 1) { @@ -469,16 +469,16 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, } } } break; - case FDE_CSSPRIMITIVETYPE_String: { + case FDE_CSSPrimitiveType::String: { if (list.GetSize() == 0) { pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } else { listFull.Add(new CFDE_CSSValueList(list)); list.RemoveAll(); pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } } break; @@ -497,19 +497,19 @@ bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, return true; } bool CFDE_CSSDeclaration::ParseValueListProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { FX_WCHAR separator = - (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; + (pArgs->pProperty->eName == FDE_CSSProperty::FontFamily) ? ',' : ' '; CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); const uint32_t dwType = pArgs->pProperty->dwType; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; CFDE_CSSValueArray list; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { @@ -517,7 +517,7 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } } break; - case FDE_CSSPRIMITIVETYPE_String: + case FDE_CSSPrimitiveType::String: if (dwType & FDE_CSSVALUETYPE_MaybeColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -526,7 +526,7 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } } if (dwType & FDE_CSSVALUETYPE_MaybeEnum) { - const FDE_CSSPROPERTYVALUETABLE* pValue = + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName( CFX_WideStringC(pszValue, iValueLen)); if (pValue) { @@ -536,11 +536,11 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } if (dwType & FDE_CSSVALUETYPE_MaybeString) { pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, + list.Add(new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: if (dwType & FDE_CSSVALUETYPE_MaybeColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -556,31 +556,31 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( return false; } switch (pArgs->pProperty->eName) { - case FDE_CSSPROPERTY_BorderColor: + case FDE_CSSProperty::BorderColor: return Add4ValuesProperty( - list, bImportant, FDE_CSSPROPERTY_BorderLeftColor, - FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderRightColor, - FDE_CSSPROPERTY_BorderBottomColor); - case FDE_CSSPROPERTY_BorderStyle: + list, bImportant, FDE_CSSProperty::BorderLeftColor, + FDE_CSSProperty::BorderTopColor, FDE_CSSProperty::BorderRightColor, + FDE_CSSProperty::BorderBottomColor); + case FDE_CSSProperty::BorderStyle: return Add4ValuesProperty( - list, bImportant, FDE_CSSPROPERTY_BorderLeftStyle, - FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderRightStyle, - FDE_CSSPROPERTY_BorderBottomStyle); - case FDE_CSSPROPERTY_BorderWidth: + list, bImportant, FDE_CSSProperty::BorderLeftStyle, + FDE_CSSProperty::BorderTopStyle, FDE_CSSProperty::BorderRightStyle, + FDE_CSSProperty::BorderBottomStyle); + case FDE_CSSProperty::BorderWidth: return Add4ValuesProperty( - list, bImportant, FDE_CSSPROPERTY_BorderLeftWidth, - FDE_CSSPROPERTY_BorderTopWidth, FDE_CSSPROPERTY_BorderRightWidth, - FDE_CSSPROPERTY_BorderBottomWidth); - case FDE_CSSPROPERTY_Margin: - return Add4ValuesProperty(list, bImportant, FDE_CSSPROPERTY_MarginLeft, - FDE_CSSPROPERTY_MarginTop, - FDE_CSSPROPERTY_MarginRight, - FDE_CSSPROPERTY_MarginBottom); - case FDE_CSSPROPERTY_Padding: - return Add4ValuesProperty(list, bImportant, FDE_CSSPROPERTY_PaddingLeft, - FDE_CSSPROPERTY_PaddingTop, - FDE_CSSPROPERTY_PaddingRight, - FDE_CSSPROPERTY_PaddingBottom); + list, bImportant, FDE_CSSProperty::BorderLeftWidth, + FDE_CSSProperty::BorderTopWidth, FDE_CSSProperty::BorderRightWidth, + FDE_CSSProperty::BorderBottomWidth); + case FDE_CSSProperty::Margin: + return Add4ValuesProperty(list, bImportant, FDE_CSSProperty::MarginLeft, + FDE_CSSProperty::MarginTop, + FDE_CSSProperty::MarginRight, + FDE_CSSProperty::MarginBottom); + case FDE_CSSProperty::Padding: + return Add4ValuesProperty(list, bImportant, FDE_CSSProperty::PaddingLeft, + FDE_CSSProperty::PaddingTop, + FDE_CSSProperty::PaddingRight, + FDE_CSSProperty::PaddingBottom); default: { CFDE_CSSValueList* pList = new CFDE_CSSValueList(list); AddPropertyHolder(pArgs->pProperty->eName, pList, bImportant); @@ -589,12 +589,13 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( } return false; } + bool CFDE_CSSDeclaration::Add4ValuesProperty(const CFDE_CSSValueArray& list, bool bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom) { + FDE_CSSProperty eLeft, + FDE_CSSProperty eTop, + FDE_CSSProperty eRight, + FDE_CSSProperty eBottom) { switch (list.GetSize()) { case 1: AddPropertyHolder(eLeft, list[0], bImportant); @@ -633,10 +634,10 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( IFDE_CSSValue*& pWidth) const { pColor = pStyle = pWidth = nullptr; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: if (!pWidth) { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { @@ -644,7 +645,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: if (!pColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -652,7 +653,7 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } } break; - case FDE_CSSPRIMITIVETYPE_String: { + case FDE_CSSPrimitiveType::String: { const FDE_CSSCOLORTABLE* pColorItem = FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (pColorItem) { @@ -661,33 +662,33 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( } continue; } - const FDE_CSSPROPERTYVALUETABLE* pValue = + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (!pValue) continue; switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_Transparent: + case FDE_CSSPropertyValue::Transparent: if (!pColor) { pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } break; - case FDE_CSSPROPERTYVALUE_Thin: - case FDE_CSSPROPERTYVALUE_Thick: - case FDE_CSSPROPERTYVALUE_Medium: + case FDE_CSSPropertyValue::Thin: + case FDE_CSSPropertyValue::Thick: + case FDE_CSSPropertyValue::Medium: if (!pWidth) pWidth = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_None: - case FDE_CSSPROPERTYVALUE_Hidden: - case FDE_CSSPROPERTYVALUE_Dotted: - case FDE_CSSPROPERTYVALUE_Dashed: - case FDE_CSSPROPERTYVALUE_Solid: - case FDE_CSSPROPERTYVALUE_Double: - case FDE_CSSPROPERTYVALUE_Groove: - case FDE_CSSPROPERTYVALUE_Ridge: - case FDE_CSSPROPERTYVALUE_Inset: - case FDE_CSSPROPERTYVALUE_Outset: + case FDE_CSSPropertyValue::None: + case FDE_CSSPropertyValue::Hidden: + case FDE_CSSPropertyValue::Dotted: + case FDE_CSSPropertyValue::Dashed: + case FDE_CSSPropertyValue::Solid: + case FDE_CSSPropertyValue::Double: + case FDE_CSSPropertyValue::Groove: + case FDE_CSSPropertyValue::Ridge: + case FDE_CSSPropertyValue::Inset: + case FDE_CSSPropertyValue::Outset: if (!pStyle) pStyle = NewEnumValue(pValue->eName); break; @@ -702,24 +703,24 @@ bool CFDE_CSSDeclaration::ParseBorderPropoerty( if (!pColor) pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); if (!pStyle) - pStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pStyle = NewEnumValue(FDE_CSSPropertyValue::None); if (!pWidth) - pWidth = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pWidth = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); return true; } void CFDE_CSSDeclaration::AddBorderProperty(IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, bool bImportant, - FDE_CSSPROPERTY eColor, - FDE_CSSPROPERTY eStyle, - FDE_CSSPROPERTY eWidth) { + FDE_CSSProperty eColor, + FDE_CSSProperty eStyle, + FDE_CSSProperty eWidth) { AddPropertyHolder(eStyle, pStyle, bImportant); AddPropertyHolder(eWidth, pWidth, bImportant); AddPropertyHolder(eColor, pColor, bImportant); } bool CFDE_CSSDeclaration::ParseListStyleProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -727,47 +728,47 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( IFDE_CSSPrimitiveValue* pType = nullptr; IFDE_CSSPrimitiveValue* pImage = nullptr; IFDE_CSSPrimitiveValue* pPosition = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_URI: + case FDE_CSSPrimitiveType::URI: if (!pImage) { pImage = new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen)); } break; - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (!pValue) break; switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_None: + case FDE_CSSPropertyValue::None: if (!pImage) pImage = NewEnumValue(pValue->eName); else if (!pType) pImage = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Inside: - case FDE_CSSPROPERTYVALUE_Outside: + case FDE_CSSPropertyValue::Inside: + case FDE_CSSPropertyValue::Outside: if (!pPosition) pPosition = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Disc: - case FDE_CSSPROPERTYVALUE_Circle: - case FDE_CSSPROPERTYVALUE_Square: - case FDE_CSSPROPERTYVALUE_Decimal: - case FDE_CSSPROPERTYVALUE_DecimalLeadingZero: - case FDE_CSSPROPERTYVALUE_LowerRoman: - case FDE_CSSPROPERTYVALUE_UpperRoman: - case FDE_CSSPROPERTYVALUE_LowerGreek: - case FDE_CSSPROPERTYVALUE_LowerLatin: - case FDE_CSSPROPERTYVALUE_UpperLatin: - case FDE_CSSPROPERTYVALUE_Armenian: - case FDE_CSSPROPERTYVALUE_Georgian: - case FDE_CSSPROPERTYVALUE_LowerAlpha: - case FDE_CSSPROPERTYVALUE_UpperAlpha: + case FDE_CSSPropertyValue::Disc: + case FDE_CSSPropertyValue::Circle: + case FDE_CSSPropertyValue::Square: + case FDE_CSSPropertyValue::Decimal: + case FDE_CSSPropertyValue::DecimalLeadingZero: + case FDE_CSSPropertyValue::LowerRoman: + case FDE_CSSPropertyValue::UpperRoman: + case FDE_CSSPropertyValue::LowerGreek: + case FDE_CSSPropertyValue::LowerLatin: + case FDE_CSSPropertyValue::UpperLatin: + case FDE_CSSPropertyValue::Armenian: + case FDE_CSSPropertyValue::Georgian: + case FDE_CSSPropertyValue::LowerAlpha: + case FDE_CSSPropertyValue::UpperAlpha: if (!pType) pType = NewEnumValue(pValue->eName); break; @@ -780,18 +781,18 @@ bool CFDE_CSSDeclaration::ParseListStyleProperty( } } if (!pPosition) - pPosition = NewEnumValue(FDE_CSSPROPERTYVALUE_Outside); + pPosition = NewEnumValue(FDE_CSSPropertyValue::Outside); if (!pImage) - pImage = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pImage = NewEnumValue(FDE_CSSPropertyValue::None); if (!pType) - pType = NewEnumValue(FDE_CSSPROPERTYVALUE_None); - AddPropertyHolder(FDE_CSSPROPERTY_ListStylePosition, pPosition, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ListStyleImage, pImage, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ListStyleType, pType, bImportant); + pType = NewEnumValue(FDE_CSSPropertyValue::None); + AddPropertyHolder(FDE_CSSProperty::ListStylePosition, pPosition, bImportant); + AddPropertyHolder(FDE_CSSProperty::ListStyleImage, pImage, bImportant); + AddPropertyHolder(FDE_CSSProperty::ListStyleType, pType, bImportant); return true; } bool CFDE_CSSDeclaration::ParseBackgroundProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -802,16 +803,16 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( IFDE_CSSPrimitiveValue* pPosX = nullptr; IFDE_CSSPrimitiveValue* pPosY = nullptr; IFDE_CSSPrimitiveValue* pAttachment = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_URI: + case FDE_CSSPrimitiveType::URI: if (!pImage) { pImage = new CFDE_CSSPrimitiveValue( eType, CopyToLocal(pArgs, pszValue, iValueLen)); } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { break; @@ -821,43 +822,43 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( else if (!pPosY) pPosY = NewNumberValue(eType, fValue); } break; - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_None: + case FDE_CSSPropertyValue::None: if (!pImage) pImage = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Transparent: + case FDE_CSSPropertyValue::Transparent: if (!pColor) { pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } break; - case FDE_CSSPROPERTYVALUE_Fixed: - case FDE_CSSPROPERTYVALUE_Scroll: + case FDE_CSSPropertyValue::Fixed: + case FDE_CSSPropertyValue::Scroll: if (!pAttachment) pAttachment = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Repeat: - case FDE_CSSPROPERTYVALUE_RepeatX: - case FDE_CSSPROPERTYVALUE_RepeatY: - case FDE_CSSPROPERTYVALUE_NoRepeat: + case FDE_CSSPropertyValue::Repeat: + case FDE_CSSPropertyValue::RepeatX: + case FDE_CSSPropertyValue::RepeatY: + case FDE_CSSPropertyValue::NoRepeat: if (!pRepeat) pRepeat = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Left: - case FDE_CSSPROPERTYVALUE_Right: + case FDE_CSSPropertyValue::Left: + case FDE_CSSPropertyValue::Right: if (!pPosX) pPosX = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Top: - case FDE_CSSPROPERTYVALUE_Bottom: + case FDE_CSSPropertyValue::Top: + case FDE_CSSPropertyValue::Bottom: if (!pPosY) pPosX = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Center: + case FDE_CSSPropertyValue::Center: if (!pPosX) pPosX = NewEnumValue(pValue->eName); else if (!pPosY) @@ -876,7 +877,7 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( } } } break; - case FDE_CSSPRIMITIVETYPE_RGB: + case FDE_CSSPrimitiveType::RGB: if (!pColor) { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -892,33 +893,33 @@ bool CFDE_CSSDeclaration::ParseBackgroundProperty( pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } if (!pImage) - pImage = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pImage = NewEnumValue(FDE_CSSPropertyValue::None); if (!pRepeat) - pRepeat = NewEnumValue(FDE_CSSPROPERTYVALUE_Repeat); + pRepeat = NewEnumValue(FDE_CSSPropertyValue::Repeat); if (!pAttachment) - pAttachment = NewEnumValue(FDE_CSSPROPERTYVALUE_Scroll); + pAttachment = NewEnumValue(FDE_CSSPropertyValue::Scroll); if (!pPosX) { - pPosX = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); - pPosY = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosX = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); + pPosY = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); } else if (!pPosY) { - pPosY = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, 0.0f); + pPosY = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); } CFDE_CSSValueArray position; position.Add(pPosX); position.Add(pPosY); CFDE_CSSValueList* pPosList = new CFDE_CSSValueList(position); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundColor, pColor, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundImage, pImage, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundRepeat, pRepeat, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundPosition, pPosList, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_BackgroundAttachment, pAttachment, + AddPropertyHolder(FDE_CSSProperty::BackgroundColor, pColor, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundImage, pImage, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundRepeat, pRepeat, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundPosition, pPosList, bImportant); + AddPropertyHolder(FDE_CSSProperty::BackgroundAttachment, pAttachment, bImportant); return true; } -bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -929,42 +930,42 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, IFDE_CSSPrimitiveValue* pFontSize = nullptr; IFDE_CSSPrimitiveValue* pLineHeight = nullptr; CFDE_CSSValueArray familyList; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_XxSmall: - case FDE_CSSPROPERTYVALUE_XSmall: - case FDE_CSSPROPERTYVALUE_Small: - case FDE_CSSPROPERTYVALUE_Medium: - case FDE_CSSPROPERTYVALUE_Large: - case FDE_CSSPROPERTYVALUE_XLarge: - case FDE_CSSPROPERTYVALUE_XxLarge: - case FDE_CSSPROPERTYVALUE_Smaller: - case FDE_CSSPROPERTYVALUE_Larger: + case FDE_CSSPropertyValue::XxSmall: + case FDE_CSSPropertyValue::XSmall: + case FDE_CSSPropertyValue::Small: + case FDE_CSSPropertyValue::Medium: + case FDE_CSSPropertyValue::Large: + case FDE_CSSPropertyValue::XLarge: + case FDE_CSSPropertyValue::XxLarge: + case FDE_CSSPropertyValue::Smaller: + case FDE_CSSPropertyValue::Larger: if (!pFontSize) pFontSize = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_Bold: - case FDE_CSSPROPERTYVALUE_Bolder: - case FDE_CSSPROPERTYVALUE_Lighter: + case FDE_CSSPropertyValue::Bold: + case FDE_CSSPropertyValue::Bolder: + case FDE_CSSPropertyValue::Lighter: if (!pWeight) pWeight = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_Italic: - case FDE_CSSPROPERTYVALUE_Oblique: + case FDE_CSSPropertyValue::Italic: + case FDE_CSSPropertyValue::Oblique: if (!pStyle) pStyle = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_SmallCaps: + case FDE_CSSPropertyValue::SmallCaps: if (!pVariant) pVariant = NewEnumValue(pValue->eName); continue; - case FDE_CSSPROPERTYVALUE_Normal: + case FDE_CSSPropertyValue::Normal: if (!pStyle) pStyle = NewEnumValue(pValue->eName); else if (!pVariant) @@ -986,12 +987,12 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, } parser.m_Separator = ','; } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { break; } - if (eType == FDE_CSSPRIMITIVETYPE_Number) { + if (eType == FDE_CSSPrimitiveType::Number) { switch ((int32_t)fValue) { case 100: case 200: @@ -1003,7 +1004,7 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, case 800: case 900: if (!pWeight) { - pWeight = NewNumberValue(FDE_CSSPRIMITIVETYPE_Number, fValue); + pWeight = NewNumberValue(FDE_CSSPrimitiveType::Number, fValue); } continue; } @@ -1018,29 +1019,29 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, } } if (!pStyle) - pStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pStyle = NewEnumValue(FDE_CSSPropertyValue::Normal); if (!pVariant) - pVariant = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pVariant = NewEnumValue(FDE_CSSPropertyValue::Normal); if (!pWeight) - pWeight = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pWeight = NewEnumValue(FDE_CSSPropertyValue::Normal); if (!pFontSize) - pFontSize = NewEnumValue(FDE_CSSPROPERTYVALUE_Medium); + pFontSize = NewEnumValue(FDE_CSSPropertyValue::Medium); if (!pLineHeight) - pLineHeight = NewEnumValue(FDE_CSSPROPERTYVALUE_Normal); + pLineHeight = NewEnumValue(FDE_CSSPropertyValue::Normal); - AddPropertyHolder(FDE_CSSPROPERTY_FontStyle, pStyle, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_FontVariant, pVariant, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_FontWeight, pWeight, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_FontSize, pFontSize, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_LineHeight, pLineHeight, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontStyle, pStyle, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontVariant, pVariant, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontWeight, pWeight, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontSize, pFontSize, bImportant); + AddPropertyHolder(FDE_CSSProperty::LineHeight, pLineHeight, bImportant); if (familyList.GetSize() > 0) { CFDE_CSSValueList* pList = new CFDE_CSSValueList(familyList); - AddPropertyHolder(FDE_CSSPROPERTY_FontFamily, pList, bImportant); + AddPropertyHolder(FDE_CSSProperty::FontFamily, pList, bImportant); } return true; } bool CFDE_CSSDeclaration::ParseColumnRuleProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { @@ -1048,34 +1049,34 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr; IFDE_CSSPrimitiveValue* pColumnRuleColor = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSPROPERTYVALUE_None: - case FDE_CSSPROPERTYVALUE_Hidden: - case FDE_CSSPROPERTYVALUE_Dotted: - case FDE_CSSPROPERTYVALUE_Dashed: - case FDE_CSSPROPERTYVALUE_Solid: - case FDE_CSSPROPERTYVALUE_Double: - case FDE_CSSPROPERTYVALUE_Groove: - case FDE_CSSPROPERTYVALUE_Ridge: - case FDE_CSSPROPERTYVALUE_Inset: - case FDE_CSSPROPERTYVALUE_Outset: + case FDE_CSSPropertyValue::None: + case FDE_CSSPropertyValue::Hidden: + case FDE_CSSPropertyValue::Dotted: + case FDE_CSSPropertyValue::Dashed: + case FDE_CSSPropertyValue::Solid: + case FDE_CSSPropertyValue::Double: + case FDE_CSSPropertyValue::Groove: + case FDE_CSSPropertyValue::Ridge: + case FDE_CSSPropertyValue::Inset: + case FDE_CSSPropertyValue::Outset: if (!pColumnRuleStyle) pColumnRuleStyle = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Transparent: + case FDE_CSSPropertyValue::Transparent: if (!pColumnRuleColor) pColumnRuleColor = NewEnumValue(pValue->eName); break; - case FDE_CSSPROPERTYVALUE_Thin: - case FDE_CSSPROPERTYVALUE_Medium: - case FDE_CSSPROPERTYVALUE_Thick: + case FDE_CSSPropertyValue::Thin: + case FDE_CSSPropertyValue::Medium: + case FDE_CSSPropertyValue::Thick: if (!pColumnRuleWidth) pColumnRuleWidth = NewEnumValue(pValue->eName); break; @@ -1091,14 +1092,14 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( continue; } } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType) && !pColumnRuleWidth) { pColumnRuleWidth = NewNumberValue(eType, fValue); } } break; - case FDE_CSSPRIMITIVETYPE_RGB: { + case FDE_CSSPrimitiveType::RGB: { FX_ARGB dwColor; if (!pColumnRuleColor && FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { @@ -1113,32 +1114,32 @@ bool CFDE_CSSDeclaration::ParseColumnRuleProperty( return false; if (!pColumnRuleStyle) - pColumnRuleStyle = NewEnumValue(FDE_CSSPROPERTYVALUE_None); + pColumnRuleStyle = NewEnumValue(FDE_CSSPropertyValue::None); if (!pColumnRuleWidth) - pColumnRuleWidth = NewEnumValue(FDE_CSSPROPERTYVALUE_Medium); + pColumnRuleWidth = NewEnumValue(FDE_CSSPropertyValue::Medium); if (!pColumnRuleColor) { pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); } - AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleStyle, pColumnRuleStyle, + AddPropertyHolder(FDE_CSSProperty::ColumnRuleStyle, pColumnRuleStyle, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleWidth, pColumnRuleWidth, + AddPropertyHolder(FDE_CSSProperty::ColumnRuleWidth, pColumnRuleWidth, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnRuleColor, pColumnRuleColor, + AddPropertyHolder(FDE_CSSProperty::ColumnRuleColor, pColumnRuleColor, bImportant); return true; } -bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray arrEmphasisStyle; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; IFDE_CSSPrimitiveValue* pEmphasisColor = nullptr; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { arrEmphasisStyle.Add(NewEnumValue(pValue->eName)); @@ -1151,9 +1152,9 @@ bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, } pszValue = CopyToLocal(pArgs, pszValue, iValueLen); arrEmphasisStyle.Add( - new CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE_String, pszValue)); + new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); } break; - case FDE_CSSPRIMITIVETYPE_RGB: { + case FDE_CSSPrimitiveType::RGB: { FX_ARGB dwColor; if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { pEmphasisColor = new CFDE_CSSPrimitiveValue(dwColor); @@ -1164,37 +1165,37 @@ bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, } } if (arrEmphasisStyle.GetSize() != 0) { - AddPropertyHolder(FDE_CSSPROPERTY_TextEmphasisStyle, + AddPropertyHolder(FDE_CSSProperty::TextEmphasisStyle, new CFDE_CSSValueList(arrEmphasisStyle), bImportant); } if (pEmphasisColor) { - AddPropertyHolder(FDE_CSSPROPERTY_TextEmphasisColor, pEmphasisColor, + AddPropertyHolder(FDE_CSSProperty::TextEmphasisColor, pEmphasisColor, bImportant); } return true; } -bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, +bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnWidth = nullptr; IFDE_CSSPrimitiveValue* pColumnCount = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_String: { - const FDE_CSSPROPERTYVALUETABLE* pValue = + case FDE_CSSPrimitiveType::String: { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (!pValue && pValue->eName == FDE_CSSPROPERTYVALUE_Auto) { + if (!pValue && pValue->eName == FDE_CSSPropertyValue::Auto) { pColumnWidth = NewEnumValue(pValue->eName); } } break; - case FDE_CSSPRIMITIVETYPE_Number: { + case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { switch (eType) { - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Number: if (!pColumnCount) pColumnCount = NewNumberValue(eType, fValue); break; @@ -1213,35 +1214,35 @@ bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, return false; if (!pColumnWidth) - pColumnWidth = NewEnumValue(FDE_CSSPROPERTYVALUE_Auto); + pColumnWidth = NewEnumValue(FDE_CSSPropertyValue::Auto); else if (!pColumnCount) - pColumnCount = NewEnumValue(FDE_CSSPROPERTYVALUE_Auto); + pColumnCount = NewEnumValue(FDE_CSSPropertyValue::Auto); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnWidth, pColumnWidth, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_ColumnCount, pColumnCount, bImportant); + AddPropertyHolder(FDE_CSSProperty::ColumnWidth, pColumnWidth, bImportant); + AddPropertyHolder(FDE_CSSProperty::ColumnCount, pColumnCount, bImportant); return true; } bool CFDE_CSSDeclaration::ParseOverflowProperty( - const FDE_CSSPROPERTYARGS* pArgs, + const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pOverflowX = nullptr; IFDE_CSSPrimitiveValue* pOverflowY = nullptr; - FDE_CSSPRIMITIVETYPE eType; + FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { - if (eType == FDE_CSSPRIMITIVETYPE_String) { - const FDE_CSSPROPERTYVALUETABLE* pValue = + if (eType == FDE_CSSPrimitiveType::String) { + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (pValue) { switch (pValue->eName) { - case FDE_CSSOVERFLOW_Visible: - case FDE_CSSOVERFLOW_Hidden: - case FDE_CSSOVERFLOW_Scroll: - case FDE_CSSOVERFLOW_Auto: - case FDE_CSSOVERFLOW_NoDisplay: - case FDE_CSSOVERFLOW_NoContent: + case FDE_CSSPropertyValue::Visible: + case FDE_CSSPropertyValue::Hidden: + case FDE_CSSPropertyValue::Scroll: + case FDE_CSSPropertyValue::Auto: + case FDE_CSSPropertyValue::NoDisplay: + case FDE_CSSPropertyValue::NoContent: if (pOverflowX && pOverflowY) return false; if (!pOverflowX) { @@ -1262,7 +1263,7 @@ bool CFDE_CSSDeclaration::ParseOverflowProperty( if (!pOverflowY) pOverflowY = NewEnumValue(pOverflowX->GetEnum()); - AddPropertyHolder(FDE_CSSPROPERTY_OverflowX, pOverflowX, bImportant); - AddPropertyHolder(FDE_CSSPROPERTY_OverflowY, pOverflowY, bImportant); + AddPropertyHolder(FDE_CSSProperty::OverflowX, pOverflowX, bImportant); + AddPropertyHolder(FDE_CSSProperty::OverflowY, pOverflowY, bImportant); return true; } diff --git a/xfa/fde/css/fde_cssdeclaration.h b/xfa/fde/css/fde_cssdeclaration.h index 38b1626566..d6f405e842 100644 --- a/xfa/fde/css/fde_cssdeclaration.h +++ b/xfa/fde/css/fde_cssdeclaration.h @@ -13,7 +13,7 @@ class FDE_CSSPropertyHolder { public: - int16_t eProperty; + FDE_CSSProperty eProperty; bool bImportant; IFDE_CSSValue* pValue; FDE_CSSPropertyHolder* pNext; @@ -26,9 +26,9 @@ class FDE_CSSCustomProperty { FDE_CSSCustomProperty* pNext; }; -struct FDE_CSSPROPERTYARGS { +struct FDE_CSSPropertyArgs { std::unordered_map* pStringCache; - const FDE_CSSPROPERTYTABLE* pProperty; + const FDE_CSSPropertyTable* pProperty; }; class CFDE_CSSDeclaration { @@ -39,51 +39,51 @@ class CFDE_CSSDeclaration { m_pFirstCustom(nullptr), m_pLastCustom(nullptr) {} - IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, bool& bImportant) const; + IFDE_CSSValue* GetProperty(FDE_CSSProperty eProperty, bool& bImportant) const; FX_POSITION GetStartPosition() const; void GetNextProperty(FX_POSITION& pos, - FDE_CSSPROPERTY& eProperty, + FDE_CSSProperty& eProperty, IFDE_CSSValue*& pValue, bool& bImportant) const; FX_POSITION GetStartCustom() const; void GetNextCustom(FX_POSITION& pos, CFX_WideString& wsName, CFX_WideString& wsValue) const; - bool AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool AddProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - bool AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool AddProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszName, int32_t iNameLen, const FX_WCHAR* pszValue, int32_t iValueLen); protected: - bool ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, + bool ParseTextEmphasisProperty(FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseColumnsProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseColumnRuleProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseColumnRuleProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseOverflowProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseOverflowProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseBackgroundProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseBackgroundProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseListStyleProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseListStyleProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); @@ -96,54 +96,54 @@ class CFDE_CSSDeclaration { IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, bool bImportant, - FDE_CSSPROPERTY eColor, - FDE_CSSPROPERTY eStyle, - FDE_CSSPROPERTY eWidth); - bool ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, + FDE_CSSProperty eColor, + FDE_CSSProperty eStyle, + FDE_CSSProperty eWidth); + bool ParseContentProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseCounterProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseValueListProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseValueListProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); bool Add4ValuesProperty(const CFDE_CSSValueArray& list, bool bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom); - IFDE_CSSValue* ParseNumber(const FDE_CSSPROPERTYARGS* pArgs, + FDE_CSSProperty eLeft, + FDE_CSSProperty eTop, + FDE_CSSProperty eRight, + FDE_CSSProperty eBottom); + IFDE_CSSValue* ParseNumber(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - IFDE_CSSValue* ParseEnum(const FDE_CSSPROPERTYARGS* pArgs, + IFDE_CSSValue* ParseEnum(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - IFDE_CSSValue* ParseColor(const FDE_CSSPROPERTYARGS* pArgs, + IFDE_CSSValue* ParseColor(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - IFDE_CSSValue* ParseURI(const FDE_CSSPROPERTYARGS* pArgs, + IFDE_CSSValue* ParseURI(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - IFDE_CSSValue* ParseString(const FDE_CSSPROPERTYARGS* pArgs, + IFDE_CSSValue* ParseString(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - IFDE_CSSValue* ParseFunction(const FDE_CSSPROPERTYARGS* pArgs, + IFDE_CSSValue* ParseFunction(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - const FX_WCHAR* CopyToLocal(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* CopyToLocal(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); - void AddPropertyHolder(FDE_CSSPROPERTY eProperty, + void AddPropertyHolder(FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, bool bImportant); - IFDE_CSSPrimitiveValue* NewNumberValue(FDE_CSSPRIMITIVETYPE eUnit, + IFDE_CSSPrimitiveValue* NewNumberValue(FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue) const; - IFDE_CSSPrimitiveValue* NewEnumValue(FDE_CSSPROPERTYVALUE eValue) const; + IFDE_CSSPrimitiveValue* NewEnumValue(FDE_CSSPropertyValue eValue) const; FDE_CSSPropertyHolder* m_pFirstProperty; FDE_CSSPropertyHolder* m_pLastProperty; diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index d10cbf1d49..6808bab48a 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -19,80 +19,6 @@ #define FDE_CSSUNIVERSALHASH ('*') -int32_t CFDE_CSSCounterStyle::FindIndex(const FX_WCHAR* pszIdentifier) { - int32_t iCount = m_arrCounterData.GetSize(); - for (int32_t i = 0; i < iCount; i++) { - if (FXSYS_wcscmp(pszIdentifier, m_arrCounterData.ElementAt(i).m_pszIdent) == - 0) { - return i; - } - } - return -1; -} - -void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { - if (!pList) - return; - - int32_t iCount = pList->CountValues(); - FX_FLOAT fDefValue = 1.0; - bool bDefIncrement = true; - if (pList == m_pCounterReset) { - fDefValue = 0.0; - bDefIncrement = false; - } - for (int32_t i = 0; i < iCount; i++) { - IFDE_CSSValueList* pCounter = - static_cast(pList->GetValue(i)); - int32_t iLen; - const FX_WCHAR* pszIdentifier = - static_cast(pCounter->GetValue(0)) - ->GetString(iLen); - FX_FLOAT fValue = fDefValue; - if (pCounter->CountValues() > 1) { - fValue = static_cast(pCounter->GetValue(1)) - ->GetFloat(); - } - int32_t iIndex = FindIndex(pszIdentifier); - if (iIndex == -1) { - FDE_CSSCOUNTERDATA data; - data.m_pszIdent = pszIdentifier; - if (bDefIncrement) { - data.m_bIncrement = true; - data.m_iIncVal = (int32_t)fValue; - } else { - data.m_iResetVal = (int32_t)fValue; - data.m_bReset = true; - } - m_arrCounterData.Add(data); - } else { - FDE_CSSCOUNTERDATA& data = m_arrCounterData.ElementAt(iIndex); - if (bDefIncrement) { - data.m_bIncrement = true; - data.m_iIncVal += (int32_t)fValue; - } else { - data.m_bReset = true; - data.m_iResetVal = (int32_t)fValue; - } - } - } -} - -CFDE_CSSCounterStyle::CFDE_CSSCounterStyle() - : m_pCounterInc(nullptr), m_pCounterReset(nullptr), m_bIndexDirty(false) {} - -CFDE_CSSCounterStyle::~CFDE_CSSCounterStyle() {} - -void CFDE_CSSCounterStyle::UpdateIndex() { - if (!m_bIndexDirty) { - return; - } - m_arrCounterData.RemoveAll(); - DoUpdateIndex(m_pCounterInc); - DoUpdateIndex(m_pCounterReset); - m_bIndexDirty = false; -} - FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl, uint32_t dwPos) @@ -100,20 +26,22 @@ FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel, static const uint32_t s_Specific[5] = {0x00010000, 0x00010000, 0x00100000, 0x00100000, 0x01000000}; for (; pSel; pSel = pSel->GetNextSelector()) { - FDE_CSSSELECTORTYPE eType = pSel->GetType(); - if (eType > FDE_CSSSELECTORTYPE_Descendant || + FDE_CSSSelectorType eType = pSel->GetType(); + if (eType > FDE_CSSSelectorType::Descendant || pSel->GetNameHash() != FDE_CSSUNIVERSALHASH) { - dwPriority += s_Specific[eType]; + dwPriority += s_Specific[static_cast(eType)]; } } } CFDE_CSSStyleSelector::CFDE_CSSStyleSelector(CFGAS_FontMgr* pFontMgr) : m_pFontMgr(pFontMgr), m_fDefFontSize(12.0f) { - m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_High] = FDE_CSSSTYLESHEETGROUP_Author; - m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_Mid] = FDE_CSSSTYLESHEETGROUP_User; - m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_Low] = - FDE_CSSSTYLESHEETGROUP_UserAgent; + m_ePriorities[static_cast(FDE_CSSStyleSheetPriority::High)] = + FDE_CSSStyleSheetGroup::Author; + m_ePriorities[static_cast(FDE_CSSStyleSheetPriority::Mid)] = + FDE_CSSStyleSheetGroup::User; + m_ePriorities[static_cast(FDE_CSSStyleSheetPriority::Low)] = + FDE_CSSStyleSheetGroup::UserAgent; } CFDE_CSSStyleSelector::~CFDE_CSSStyleSelector() { @@ -138,17 +66,14 @@ IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( if (pParentStyle) { pStyle->m_InheritedData = static_cast(pParentStyle)->m_InheritedData; - } else { - pStyle->m_InheritedData.Reset(); } - pStyle->m_NonInheritedData.Reset(); return pStyle; } -bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, +bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSStyleSheetGroup eType, IFDE_CSSStyleSheet* pSheet) { - ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); - CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType]; + CFX_ArrayTemplate& dest = + m_SheetGroups[static_cast(eType)]; dest.RemoveAt(0, dest.GetSize()); if (pSheet) dest.Add(pSheet); @@ -156,10 +81,10 @@ bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, } bool CFDE_CSSStyleSelector::SetStyleSheets( - FDE_CSSSTYLESHEETGROUP eType, - const CFDE_CSSStyleSheetArray* pArray) { - ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); - CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType]; + FDE_CSSStyleSheetGroup eType, + const CFX_ArrayTemplate* pArray) { + CFX_ArrayTemplate& dest = + m_SheetGroups[static_cast(eType)]; if (pArray) dest.Copy(*pArray); else @@ -168,22 +93,24 @@ bool CFDE_CSSStyleSelector::SetStyleSheets( } void CFDE_CSSStyleSelector::SetStylePriority( - FDE_CSSSTYLESHEETGROUP eType, - FDE_CSSSTYLESHEETPRIORITY ePriority) { - m_ePriorities[ePriority] = eType; + FDE_CSSStyleSheetGroup eType, + FDE_CSSStyleSheetPriority ePriority) { + m_ePriorities[static_cast(ePriority)] = eType; } void CFDE_CSSStyleSelector::UpdateStyleIndex(uint32_t dwMediaList) { Reset(); - for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { + // TODO(dsinclair): Hard coded size bad. This should probably just be a map. + for (int32_t iGroup = 0; iGroup < 3; ++iGroup) { CFDE_CSSRuleCollection& rules = m_RuleCollection[iGroup]; rules.AddRulesFrom(m_SheetGroups[iGroup], dwMediaList, m_pFontMgr); } } void CFDE_CSSStyleSelector::Reset() { - for (int32_t iGroup = 0; iGroup < FDE_CSSSTYLESHEETGROUP_MAX; ++iGroup) { + // TODO(dsinclair): Hard coded size bad. This should probably just be a map. + for (int32_t iGroup = 0; iGroup < 3; ++iGroup) { m_RuleCollection[iGroup].Clear(); } } @@ -191,20 +118,21 @@ void CFDE_CSSStyleSelector::Reset() { int32_t CFDE_CSSStyleSelector::MatchDeclarations( CXFA_CSSTagProvider* pTag, CFDE_CSSDeclarationArray& matchedDecls, - FDE_CSSPSEUDO ePseudoType) { + FDE_CSSPseudo ePseudoType) { ASSERT(pTag); FDE_CSSTagCache* pCache = m_pAccelerator->GetTopElement(); ASSERT(pCache && pCache->GetTag() == pTag); matchedDecls.RemoveAt(0, matchedDecls.GetSize()); - for (int32_t ePriority = FDE_CSSSTYLESHEETPRIORITY_MAX - 1; ePriority >= 0; - --ePriority) { - FDE_CSSSTYLESHEETGROUP eGroup = m_ePriorities[ePriority]; - CFDE_CSSRuleCollection& rules = m_RuleCollection[eGroup]; + // TODO(dsinclair): Hard coded size bad ... + for (int32_t ePriority = 2; ePriority >= 0; --ePriority) { + FDE_CSSStyleSheetGroup eGroup = m_ePriorities[ePriority]; + CFDE_CSSRuleCollection& rules = + m_RuleCollection[static_cast(eGroup)]; if (rules.CountSelectors() == 0) continue; - if (ePseudoType == FDE_CSSPSEUDO_NONE) { + if (ePseudoType == FDE_CSSPseudo::NONE) { MatchRules(pCache, rules.GetUniversalRuleData(), ePseudoType); if (pCache->HashTag()) { MatchRules(pCache, rules.GetTagRuleData(pCache->HashTag()), @@ -233,7 +161,7 @@ int32_t CFDE_CSSStyleSelector::MatchDeclarations( void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, - FDE_CSSPSEUDO ePseudoType) { + FDE_CSSPseudo ePseudoType) { while (pList) { if (MatchSelector(pCache, pList->pSelector, ePseudoType)) m_MatchedRules.push_back(pList); @@ -243,11 +171,11 @@ void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, CFDE_CSSSelector* pSel, - FDE_CSSPSEUDO ePseudoType) { + FDE_CSSPseudo ePseudoType) { uint32_t dwHash; while (pSel && pCache) { switch (pSel->GetType()) { - case FDE_CSSSELECTORTYPE_Descendant: + case FDE_CSSSelectorType::Descendant: dwHash = pSel->GetNameHash(); while ((pCache = pCache->GetParent()) != nullptr) { if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { @@ -258,25 +186,25 @@ bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, } } return false; - case FDE_CSSSELECTORTYPE_ID: + case FDE_CSSSelectorType::ID: dwHash = pCache->HashID(); if (dwHash != pSel->GetNameHash()) { return false; } break; - case FDE_CSSSELECTORTYPE_Class: + case FDE_CSSSelectorType::Class: dwHash = pCache->HashClass(); if (dwHash != pSel->GetNameHash()) { return false; } break; - case FDE_CSSSELECTORTYPE_Element: + case FDE_CSSSelectorType::Element: dwHash = pSel->GetNameHash(); if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { return false; } break; - case FDE_CSSSELECTORTYPE_Pseudo: + case FDE_CSSSelectorType::Pseudo: dwHash = FDE_GetCSSPseudoByEnum(ePseudoType)->dwHash; if (dwHash != pSel->GetNameHash()) { return false; @@ -317,9 +245,9 @@ void CFDE_CSSStyleSelector::ComputeStyle( if (!pDecl) pDecl = new CFDE_CSSDeclaration; - FDE_CSSPROPERTYARGS args; + FDE_CSSPropertyArgs args; args.pStringCache = nullptr; - args.pProperty = FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY_TextAlign); + args.pProperty = FDE_GetCSSPropertyByEnum(FDE_CSSProperty::TextAlign); pDecl->AddProperty(&args, wsValue.c_str(), wsValue.GetLength()); } } @@ -362,7 +290,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( IFDE_CSSValue* pLastest = nullptr; IFDE_CSSValue* pImportant = nullptr; for (i = 0; i < iDeclCount; ++i) { - pVal = ppDeclArray[i]->GetProperty(FDE_CSSPROPERTY_FontSize, bImportant); + pVal = ppDeclArray[i]->GetProperty(FDE_CSSProperty::FontSize, bImportant); if (!pVal) continue; @@ -372,21 +300,21 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( pLastest = pVal; } if (pImportant) { - ApplyProperty(FDE_CSSPROPERTY_FontSize, pImportant, pComputedStyle); + ApplyProperty(FDE_CSSProperty::FontSize, pImportant, pComputedStyle); } else if (pLastest) { - ApplyProperty(FDE_CSSPROPERTY_FontSize, pLastest, pComputedStyle); + ApplyProperty(FDE_CSSProperty::FontSize, pLastest, pComputedStyle); } } else { CFDE_CSSDeclarationArray importants; const CFDE_CSSDeclaration* pDecl = nullptr; - FDE_CSSPROPERTY eProp; + FDE_CSSProperty eProp; FX_POSITION pos; for (i = 0; i < iDeclCount; ++i) { pDecl = ppDeclArray[i]; pos = pDecl->GetStartPosition(); while (pos) { pDecl->GetNextProperty(pos, eProp, pVal, bImportant); - if (eProp == FDE_CSSPROPERTY_FontSize) { + if (eProp == FDE_CSSProperty::FontSize) { continue; } else if (!bImportant) { ApplyProperty(eProp, pVal, pComputedStyle); @@ -402,7 +330,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( pos = pDecl->GetStartPosition(); while (pos) { pDecl->GetNextProperty(pos, eProp, pVal, bImportant); - if (bImportant && eProp != FDE_CSSPROPERTY_FontSize) { + if (bImportant && eProp != FDE_CSSProperty::FontSize) { ApplyProperty(eProp, pVal, pComputedStyle); } } @@ -420,24 +348,24 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen) { ASSERT(pDecl && psz && iLen > 0); - std::unique_ptr pSyntax(new CFDE_CSSSyntaxParser); + auto pSyntax = pdfium::MakeUnique(); if (!pSyntax->Init(psz, iLen, 32, true)) return; int32_t iLen2 = 0; const FX_WCHAR* psz2; - FDE_CSSPROPERTYARGS args; + FDE_CSSPropertyArgs args; args.pStringCache = nullptr; args.pProperty = nullptr; CFX_WideString wsName; while (1) { - FDE_CSSSYNTAXSTATUS eStatus = pSyntax->DoSyntaxParse(); - if (eStatus == FDE_CSSSYNTAXSTATUS_PropertyName) { + FDE_CSSSyntaxStatus eStatus = pSyntax->DoSyntaxParse(); + if (eStatus == FDE_CSSSyntaxStatus::PropertyName) { psz2 = pSyntax->GetCurrentString(iLen2); args.pProperty = FDE_GetCSSPropertyByName(CFX_WideStringC(psz2, iLen2)); if (!args.pProperty) wsName = CFX_WideStringC(psz2, iLen2); - } else if (eStatus == FDE_CSSSYNTAXSTATUS_PropertyValue) { + } else if (eStatus == FDE_CSSSyntaxStatus::PropertyValue) { if (args.pProperty) { psz2 = pSyntax->GetCurrentString(iLen2); if (iLen2 > 0) @@ -455,458 +383,274 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, } } -#define FDE_CSSNONINHERITS (pComputedStyle->m_NonInheritedData) -#define FDE_CSSINHERITS (pComputedStyle->m_InheritedData) -#define FDE_CSSFONTSIZE (FDE_CSSINHERITS.m_fFontSize) void CFDE_CSSStyleSelector::ApplyProperty( - FDE_CSSPROPERTY eProperty, + FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, CFDE_CSSComputedStyle* pComputedStyle) { if (pValue->GetType() == FDE_CSSVALUETYPE_Primitive) { IFDE_CSSPrimitiveValue* pPrimitive = static_cast(pValue); - FDE_CSSPRIMITIVETYPE eType = pPrimitive->GetPrimitiveType(); + FDE_CSSPrimitiveType eType = pPrimitive->GetPrimitiveType(); switch (eProperty) { - case FDE_CSSPROPERTY_Display: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eDisplay = ToDisplay(pPrimitive->GetEnum()); + case FDE_CSSProperty::Display: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_NonInheritedData.m_eDisplay = + ToDisplay(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_FontSize: { - FX_FLOAT& fFontSize = FDE_CSSFONTSIZE; - if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { + case FDE_CSSProperty::FontSize: { + FX_FLOAT& fFontSize = pComputedStyle->m_InheritedData.m_fFontSize; + if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { fFontSize = ApplyNumber(eType, pPrimitive->GetFloat(), fFontSize); - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { + } else if (eType == FDE_CSSPrimitiveType::Enum) { fFontSize = ToFontSize(pPrimitive->GetEnum(), fFontSize); } } break; - case FDE_CSSPROPERTY_LineHeight: - if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSINHERITS.m_fLineHeight = - pPrimitive->GetFloat() * FDE_CSSFONTSIZE; - } else if (eType > FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - FDE_CSSINHERITS.m_fLineHeight = - ApplyNumber(eType, pPrimitive->GetFloat(), FDE_CSSFONTSIZE); + case FDE_CSSProperty::LineHeight: + if (eType == FDE_CSSPrimitiveType::Number) { + pComputedStyle->m_InheritedData.m_fLineHeight = + pPrimitive->GetFloat() * + pComputedStyle->m_InheritedData.m_fFontSize; + } else if (eType > FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + pComputedStyle->m_InheritedData.m_fLineHeight = + ApplyNumber(eType, pPrimitive->GetFloat(), + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_TextAlign: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eTextAligh = ToTextAlign(pPrimitive->GetEnum()); + case FDE_CSSProperty::TextAlign: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_eTextAlign = + ToTextAlign(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_TextIndent: - SetLengthWithPercent(FDE_CSSINHERITS.m_TextIndent, eType, pPrimitive, - FDE_CSSFONTSIZE); + case FDE_CSSProperty::TextIndent: + SetLengthWithPercent(pComputedStyle->m_InheritedData.m_TextIndent, + eType, pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); break; - case FDE_CSSPROPERTY_FontWeight: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_wFontWeight = ToFontWeight(pPrimitive->GetEnum()); - } else if (eType == FDE_CSSPRIMITIVETYPE_Number) { + case FDE_CSSProperty::FontWeight: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_wFontWeight = + ToFontWeight(pPrimitive->GetEnum()); + } else if (eType == FDE_CSSPrimitiveType::Number) { int32_t iValue = (int32_t)pPrimitive->GetFloat() / 100; if (iValue >= 1 && iValue <= 9) { - FDE_CSSINHERITS.m_wFontWeight = iValue * 100; + pComputedStyle->m_InheritedData.m_wFontWeight = iValue * 100; } } break; - case FDE_CSSPROPERTY_FontStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eFontStyle = ToFontStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::FontStyle: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_eFontStyle = + ToFontStyle(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_Color: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSINHERITS.m_dwFontColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::Color: + if (eType == FDE_CSSPrimitiveType::RGB) { + pComputedStyle->m_InheritedData.m_dwFontColor = + pPrimitive->GetRGBColor(); } break; - case FDE_CSSPROPERTY_MarginLeft: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.left, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MarginTop: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.top, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MarginRight: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.right, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MarginBottom: - FDE_CSSNONINHERITS.m_bHasMargin |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MarginWidth.bottom, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingLeft: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.left, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingTop: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.top, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingRight: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.right, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_PaddingBottom: - FDE_CSSNONINHERITS.m_bHasPadding |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_PaddingWidth.bottom, - eType, pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderLeftWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.left, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderTopWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.top, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderRightWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.right, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderBottomWidth: - FDE_CSSNONINHERITS.m_bHasBorder |= - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BorderWidth.bottom, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BorderLeftStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRLeftStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginLeft: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.left, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderTopStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRTopStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginTop: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.top, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderRightStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRRightStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginRight: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.right, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderBottomStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBDRBottomStyle = - ToBorderStyle(pPrimitive->GetEnum()); + case FDE_CSSProperty::MarginBottom: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_MarginWidth.bottom, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasMargin = true; } break; - case FDE_CSSPROPERTY_BorderLeftColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRLeftColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingLeft: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.left, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_BorderTopColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRTopColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingTop: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.top, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_BorderRightColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRRightColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingRight: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.right, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_BorderBottomColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBDRBottomColor = pPrimitive->GetRGBColor(); + case FDE_CSSProperty::PaddingBottom: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_PaddingWidth.bottom, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasPadding = true; } break; - case FDE_CSSPROPERTY_ListStyleType: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eListStyleType = - ToListStyleType(pPrimitive->GetEnum()); + case FDE_CSSProperty::BorderLeftWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.left, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_ListStylePosition: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eListStylePosition = - ToListStylePosition(pPrimitive->GetEnum()); + case FDE_CSSProperty::BorderTopWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.top, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_BackgroundColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwBKGColor = pPrimitive->GetRGBColor(); - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_dwBKGColor = 0; + case FDE_CSSProperty::BorderRightWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.right, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_Visibility: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eVisibility = ToVisibility(pPrimitive->GetEnum()); + case FDE_CSSProperty::BorderBottomWidth: + if (SetLengthWithPercent( + pComputedStyle->m_NonInheritedData.m_BorderWidth.bottom, eType, + pPrimitive, pComputedStyle->m_InheritedData.m_fFontSize)) { + pComputedStyle->m_NonInheritedData.m_bHasBorder = true; } break; - case FDE_CSSPROPERTY_Width: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BoxSize.cx, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Height: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_BoxSize.cy, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MinWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MinBoxSize.cx, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MinHeight: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MinBoxSize.cy, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MaxWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MaxBoxSize.cx, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_MaxHeight: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_MaxBoxSize.cy, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_VerticalAlign: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eVerticalAlign = + case FDE_CSSProperty::VerticalAlign: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_NonInheritedData.m_eVerticalAlign = ToVerticalAlign(pPrimitive->GetEnum()); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - FDE_CSSNONINHERITS.m_eVerticalAlign = FDE_CSSVERTICALALIGN_Number; - FDE_CSSNONINHERITS.m_fVerticalAlign = - ApplyNumber(eType, pPrimitive->GetFloat(), FDE_CSSFONTSIZE); + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + pComputedStyle->m_NonInheritedData.m_eVerticalAlign = + FDE_CSSVerticalAlign::Number; + pComputedStyle->m_NonInheritedData.m_fVerticalAlign = + ApplyNumber(eType, pPrimitive->GetFloat(), + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_WhiteSpace: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eWhiteSpace = ToWhiteSpace(pPrimitive->GetEnum()); + case FDE_CSSProperty::FontVariant: + if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_eFontVariant = + ToFontVariant(pPrimitive->GetEnum()); } break; - case FDE_CSSPROPERTY_TextTransform: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eTextTransform = - ToTextTransform(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_FontVariant: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eFontVariant = ToFontVariant(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_LetterSpacing: - if (eType == FDE_CSSPRIMITIVETYPE_Percent) { + case FDE_CSSProperty::LetterSpacing: + if (eType == FDE_CSSPrimitiveType::Percent) { break; - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - SetLengthWithPercent(FDE_CSSINHERITS.m_LetterSpacing, eType, - pPrimitive, FDE_CSSFONTSIZE); + } else if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_LetterSpacing.Set( + FDE_CSSLengthUnit::Normal); + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + SetLengthWithPercent(pComputedStyle->m_InheritedData.m_LetterSpacing, + eType, pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_WordSpacing: - if (eType == FDE_CSSPRIMITIVETYPE_Percent) { + case FDE_CSSProperty::WordSpacing: + if (eType == FDE_CSSPrimitiveType::Percent) { break; - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { - SetLengthWithPercent(FDE_CSSINHERITS.m_WordSpacing, eType, pPrimitive, - FDE_CSSFONTSIZE); - } - break; - case FDE_CSSPROPERTY_Float: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eFloat = ToFloat(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_Clear: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eClear = ToClear(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_WritingMode: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eWritingMode = ToWritingMode(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_WordBreak: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eWordBreak = ToWordBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_Widows: - if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSINHERITS.m_iWidows = (int32_t)pPrimitive->GetFloat(); - } - break; - case FDE_CSSPROPERTY_Orphans: - if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSINHERITS.m_iOrphans = (int32_t)pPrimitive->GetFloat(); - } - break; - case FDE_CSSPROPERTY_TextEmphasisColor: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - switch (pPrimitive->GetEnum()) { - case FDE_CSSPROPERTYVALUE_Transparent: - FDE_CSSINHERITS.m_dwTextEmphasisColor = 0; - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; - break; - case FDE_CSSPROPERTYVALUE_Currentcolor: - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = true; - break; - default: - break; - } - } else if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSINHERITS.m_dwTextEmphasisColor = pPrimitive->GetRGBColor(); - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; - } - break; - case FDE_CSSPROPERTY_PageBreakBefore: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePageBreakBefore = - ToPageBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_PageBreakAfter: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePageBreakAfter = - ToPageBreak(pPrimitive->GetEnum()); + } else if (eType == FDE_CSSPrimitiveType::Enum) { + pComputedStyle->m_InheritedData.m_WordSpacing.Set( + FDE_CSSLengthUnit::Normal); + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { + SetLengthWithPercent(pComputedStyle->m_InheritedData.m_WordSpacing, + eType, pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); } break; - case FDE_CSSPROPERTY_PageBreakInside: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePageBreakInside = - ToPageBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_OverflowX: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eOverflowX = ToOverflow(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_OverflowY: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eOverflowY = ToOverflow(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_LineBreak: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eLineBreak = ToLineBreak(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_ColumnCount: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); - } else if (eType == FDE_CSSPRIMITIVETYPE_Number) { - FDE_CSSNONINHERITS.m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Point, - pPrimitive->GetFloat()); - } - break; - case FDE_CSSPROPERTY_ColumnGap: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_ColumnGap, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_ColumnRuleColor: - if (eType == FDE_CSSPRIMITIVETYPE_RGB) { - FDE_CSSNONINHERITS.m_dwColumnRuleColor = pPrimitive->GetRGBColor(); - FDE_CSSNONINHERITS.m_bColumnRuleColorSame = false; - } - break; - case FDE_CSSPROPERTY_ColumnRuleStyle: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eColumnRuleStyle = - ToBorderStyle(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_ColumnRuleWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_ColumnRuleWidth, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_ColumnWidth: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_ColumnWidth, eType, - pPrimitive, FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_BackgroundImage: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_pszBKGImage = nullptr; - } else if (eType == FDE_CSSPRIMITIVETYPE_URI) { - int32_t iLength; - FDE_CSSNONINHERITS.m_pszBKGImage = pPrimitive->GetString(iLength); - } - break; - case FDE_CSSPROPERTY_Position: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_ePosition = ToPosition(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_Top: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Top, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Bottom: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Bottom, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Left: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Left, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_Right: - SetLengthWithPercent(FDE_CSSNONINHERITS.m_Right, eType, pPrimitive, - FDE_CSSFONTSIZE); - break; - case FDE_CSSPROPERTY_ListStyleImage: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_pszListStyleImage = nullptr; - } else if (eType == FDE_CSSPRIMITIVETYPE_URI) { - int32_t iLength; - FDE_CSSINHERITS.m_pszListStyleImage = pPrimitive->GetString(iLength); - } - break; - case FDE_CSSPROPERTY_CaptionSide: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eCaptionSide = ToCaptionSide(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_BackgroundRepeat: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBKGRepeat = ToBKGRepeat(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_BackgroundAttachment: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSNONINHERITS.m_eBKGAttachment = - ToBKGAttachment(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubyAlign: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eRubyAlign = ToRubyAlign(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubyOverhang: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eRubyOverhang = - ToRubyOverhang(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubyPosition: - if (eType == FDE_CSSPRIMITIVETYPE_Enum) { - FDE_CSSINHERITS.m_eRubyPosition = - ToRubyPosition(pPrimitive->GetEnum()); - } - break; - case FDE_CSSPROPERTY_RubySpan: - FDE_CSSNONINHERITS.m_pRubySpan = pPrimitive; - break; + case FDE_CSSProperty::Top: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Top, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::Bottom: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Bottom, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::Left: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Left, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::Right: + SetLengthWithPercent(pComputedStyle->m_NonInheritedData.m_Right, eType, + pPrimitive, + pComputedStyle->m_InheritedData.m_fFontSize); + break; + case FDE_CSSProperty::BorderLeftStyle: + case FDE_CSSProperty::BorderTopStyle: + case FDE_CSSProperty::BorderRightStyle: + case FDE_CSSProperty::BorderBottomStyle: + case FDE_CSSProperty::BorderLeftColor: + case FDE_CSSProperty::BorderTopColor: + case FDE_CSSProperty::BorderRightColor: + case FDE_CSSProperty::BorderBottomColor: + case FDE_CSSProperty::ListStyleType: + case FDE_CSSProperty::ListStylePosition: + case FDE_CSSProperty::BackgroundColor: + case FDE_CSSProperty::Visibility: + case FDE_CSSProperty::Width: + case FDE_CSSProperty::Height: + case FDE_CSSProperty::MinWidth: + case FDE_CSSProperty::MinHeight: + case FDE_CSSProperty::MaxWidth: + case FDE_CSSProperty::MaxHeight: + case FDE_CSSProperty::WhiteSpace: + case FDE_CSSProperty::TextTransform: + case FDE_CSSProperty::Float: + case FDE_CSSProperty::Clear: + case FDE_CSSProperty::WritingMode: + case FDE_CSSProperty::WordBreak: + case FDE_CSSProperty::Widows: + case FDE_CSSProperty::Orphans: + case FDE_CSSProperty::TextEmphasisColor: + case FDE_CSSProperty::PageBreakBefore: + case FDE_CSSProperty::PageBreakAfter: + case FDE_CSSProperty::PageBreakInside: + case FDE_CSSProperty::OverflowX: + case FDE_CSSProperty::OverflowY: + case FDE_CSSProperty::LineBreak: + case FDE_CSSProperty::ColumnCount: + case FDE_CSSProperty::ColumnGap: + case FDE_CSSProperty::ColumnRuleColor: + case FDE_CSSProperty::ColumnRuleStyle: + case FDE_CSSProperty::ColumnRuleWidth: + case FDE_CSSProperty::ColumnWidth: + case FDE_CSSProperty::BackgroundImage: + case FDE_CSSProperty::Position: + case FDE_CSSProperty::ListStyleImage: + case FDE_CSSProperty::CaptionSide: + case FDE_CSSProperty::BackgroundRepeat: + case FDE_CSSProperty::BackgroundAttachment: + case FDE_CSSProperty::RubyAlign: + case FDE_CSSProperty::RubyOverhang: + case FDE_CSSProperty::RubyPosition: + case FDE_CSSProperty::RubySpan: default: break; } @@ -915,83 +659,19 @@ void CFDE_CSSStyleSelector::ApplyProperty( int32_t iCount = pList->CountValues(); if (iCount > 0) { switch (eProperty) { - case FDE_CSSPROPERTY_FontFamily: - FDE_CSSINHERITS.m_pFontFamily = pList; + case FDE_CSSProperty::FontFamily: + pComputedStyle->m_InheritedData.m_pFontFamily = pList; break; - case FDE_CSSPROPERTY_TextDecoration: - FDE_CSSNONINHERITS.m_dwTextDecoration = ToTextDecoration(pList); + case FDE_CSSProperty::TextDecoration: + pComputedStyle->m_NonInheritedData.m_dwTextDecoration = + ToTextDecoration(pList); break; - case FDE_CSSPROPERTY_CounterIncrement: { - if (!FDE_CSSNONINHERITS.m_pCounterStyle) - FDE_CSSNONINHERITS.m_pCounterStyle = new CFDE_CSSCounterStyle; - FDE_CSSNONINHERITS.m_pCounterStyle->SetCounterIncrementList(pList); - } break; - case FDE_CSSPROPERTY_CounterReset: { - if (!FDE_CSSNONINHERITS.m_pCounterStyle) - FDE_CSSNONINHERITS.m_pCounterStyle = new CFDE_CSSCounterStyle; - FDE_CSSNONINHERITS.m_pCounterStyle->SetCounterResetList(pList); - } break; - case FDE_CSSPROPERTY_Content: - FDE_CSSNONINHERITS.m_pContentList = pList; - break; - case FDE_CSSPROPERTY_Quotes: - FDE_CSSINHERITS.m_pQuotes = pList; - break; - case FDE_CSSPROPERTY_TextCombine: { - for (int32_t i = 0; i < pList->CountValues(); i++) { - IFDE_CSSPrimitiveValue* pVal = - static_cast(pList->GetValue(i)); - switch (pVal->GetPrimitiveType()) { - case FDE_CSSPRIMITIVETYPE_Enum: { - switch (pVal->GetEnum()) { - case FDE_CSSPROPERTYVALUE_None: { - FDE_CSSNONINHERITS.m_eTextCombine = FDE_CSSTEXTCOMBINE_None; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; - } break; - case FDE_CSSPROPERTYVALUE_Horizontal: { - FDE_CSSNONINHERITS.m_eTextCombine = - FDE_CSSTEXTCOMBINE_Horizontal; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; - } break; - default: - break; - } - } break; - case FDE_CSSPRIMITIVETYPE_Number: - FDE_CSSNONINHERITS.m_fTextCombineNumber = pVal->GetFloat(); - break; - default: - break; - } - } - } break; - case FDE_CSSPROPERTY_TextEmphasisStyle: { - FDE_CSSTEXTEMPHASISFILL eFill; - FDE_CSSTEXTEMPHASISMARK eMark; - for (int32_t i = 0; i < pList->CountValues(); i++) { - IFDE_CSSPrimitiveValue* pVal = - static_cast(pList->GetValue(i)); - switch (pVal->GetPrimitiveType()) { - case FDE_CSSPRIMITIVETYPE_Enum: { - if (ToTextEmphasisFill(pVal->GetEnum(), eFill)) { - FDE_CSSINHERITS.m_eTextEmphasisFill = eFill; - continue; - } else if (ToTextEmphasisMark(pVal->GetEnum(), eMark)) { - FDE_CSSINHERITS.m_eTextEmphasisMark = eMark; - } - } break; - case FDE_CSSPRIMITIVETYPE_String: { - FDE_CSSINHERITS.m_eTextEmphasisMark = - FDE_CSSTEXTEMPHASISMARK_Custom; - int32_t iLen; - FDE_CSSINHERITS.m_pszTextEmphasisCustomMark = - pVal->GetString(iLen); - } break; - default: - break; - } - } - } break; + case FDE_CSSProperty::CounterIncrement: + case FDE_CSSProperty::CounterReset: + case FDE_CSSProperty::Content: + case FDE_CSSProperty::Quotes: + case FDE_CSSProperty::TextCombine: + case FDE_CSSProperty::TextEmphasisStyle: default: break; } @@ -1001,500 +681,119 @@ void CFDE_CSSStyleSelector::ApplyProperty( } } -FX_FLOAT CFDE_CSSStyleSelector::ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, +FX_FLOAT CFDE_CSSStyleSelector::ApplyNumber(FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue, FX_FLOAT fPercentBase) { switch (eUnit) { - case FDE_CSSPRIMITIVETYPE_PX: - case FDE_CSSPRIMITIVETYPE_Number: + case FDE_CSSPrimitiveType::Pixels: + case FDE_CSSPrimitiveType::Number: return fValue * 72 / 96; - case FDE_CSSPRIMITIVETYPE_PT: - return fValue; - case FDE_CSSPRIMITIVETYPE_EMS: - case FDE_CSSPRIMITIVETYPE_EXS: + case FDE_CSSPrimitiveType::EMS: + case FDE_CSSPrimitiveType::EXS: return fValue * fPercentBase; - case FDE_CSSPRIMITIVETYPE_Percent: + case FDE_CSSPrimitiveType::Percent: return fValue * fPercentBase / 100.0f; - case FDE_CSSPRIMITIVETYPE_CM: + case FDE_CSSPrimitiveType::CentiMeters: return fValue * 28.3464f; - case FDE_CSSPRIMITIVETYPE_MM: + case FDE_CSSPrimitiveType::MilliMeters: return fValue * 2.8346f; - case FDE_CSSPRIMITIVETYPE_IN: + case FDE_CSSPrimitiveType::Inches: return fValue * 72.0f; - case FDE_CSSPRIMITIVETYPE_PC: + case FDE_CSSPrimitiveType::Picas: return fValue / 12.0f; + case FDE_CSSPrimitiveType::Points: default: return fValue; } } -FDE_CSSRUBYSPAN CFDE_CSSStyleSelector::ToRubySpan(FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSDisplay CFDE_CSSStyleSelector::ToDisplay(FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: + case FDE_CSSPropertyValue::Block: + return FDE_CSSDisplay::Block; + case FDE_CSSPropertyValue::None: + return FDE_CSSDisplay::None; + case FDE_CSSPropertyValue::ListItem: + return FDE_CSSDisplay::ListItem; + case FDE_CSSPropertyValue::InlineTable: + return FDE_CSSDisplay::InlineTable; + case FDE_CSSPropertyValue::InlineBlock: + return FDE_CSSDisplay::InlineBlock; + case FDE_CSSPropertyValue::Inline: default: - return FDE_CSSRUBYSPAN_None; + return FDE_CSSDisplay::Inline; } } -FDE_CSSRUBYPOSITION CFDE_CSSStyleSelector::ToRubyPosition( - FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSTextAlign CFDE_CSSStyleSelector::ToTextAlign( + FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Before: - return FDE_CSSRUBYPOSITION_Before; - case FDE_CSSPROPERTYVALUE_After: - return FDE_CSSRUBYPOSITION_After; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSRUBYPOSITION_Right; - case FDE_CSSPROPERTYVALUE_Inline: - return FDE_CSSRUBYPOSITION_Inline; + case FDE_CSSPropertyValue::Center: + return FDE_CSSTextAlign::Center; + case FDE_CSSPropertyValue::Right: + return FDE_CSSTextAlign::Right; + case FDE_CSSPropertyValue::Justify: + return FDE_CSSTextAlign::Justify; + case FDE_CSSPropertyValue::Left: default: - return FDE_CSSRUBYPOSITION_Before; + return FDE_CSSTextAlign::Left; } } -FDE_CSSRUBYOVERHANG CFDE_CSSStyleSelector::ToRubyOverhang( - FDE_CSSPROPERTYVALUE eValue) { +uint16_t CFDE_CSSStyleSelector::ToFontWeight(FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSRUBYOVERHANG_Auto; - case FDE_CSSPROPERTYVALUE_Start: - return FDE_CSSRUBYOVERHANG_Start; - case FDE_CSSPROPERTYVALUE_End: - return FDE_CSSRUBYOVERHANG_End; - case FDE_CSSPROPERTYVALUE_None: - default: - return FDE_CSSRUBYOVERHANG_None; - } -} - -FDE_CSSRUBYALIGN CFDE_CSSStyleSelector::ToRubyAlign( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSRUBYALIGN_Auto; - case FDE_CSSPROPERTYVALUE_Start: - return FDE_CSSRUBYALIGN_Start; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSRUBYALIGN_End; - case FDE_CSSPROPERTYVALUE_Center: - return FDE_CSSRUBYALIGN_Center; - case FDE_CSSPROPERTYVALUE_End: - return FDE_CSSRUBYALIGN_End; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSRUBYALIGN_Right; - case FDE_CSSPROPERTYVALUE_DistributeLetter: - return FDE_CSSRUBYALIGN_DistributeLetter; - case FDE_CSSPROPERTYVALUE_DistributeSpace: - return FDE_CSSRUBYALIGN_DistributeSpace; - case FDE_CSSPROPERTYVALUE_LineEdge: - return FDE_CSSRUBYALIGN_LineEdge; - default: - return FDE_CSSRUBYALIGN_Auto; - } -} - -bool CFDE_CSSStyleSelector::ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - eMark = FDE_CSSTEXTEMPHASISMARK_None; - return true; - case FDE_CSSPROPERTYVALUE_Dot: - eMark = FDE_CSSTEXTEMPHASISMARK_Dot; - return true; - case FDE_CSSPROPERTYVALUE_Circle: - eMark = FDE_CSSTEXTEMPHASISMARK_Circle; - return true; - case FDE_CSSPROPERTYVALUE_DoubleCircle: - eMark = FDE_CSSTEXTEMPHASISMARK_DoubleCircle; - return true; - case FDE_CSSPROPERTYVALUE_Triangle: - eMark = FDE_CSSTEXTEMPHASISMARK_Triangle; - return true; - case FDE_CSSPROPERTYVALUE_Sesame: - eMark = FDE_CSSTEXTEMPHASISMARK_Sesame; - return true; - default: - return false; - } -} - -bool CFDE_CSSStyleSelector::ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Filled: - eFill = FDE_CSSTEXTEMPHASISFILL_Filled; - return true; - case FDE_CSSPROPERTYVALUE_Open: - eFill = FDE_CSSTEXTEMPHASISFILL_Open; - return true; - default: - return false; - } -} - -FDE_CSSBKGATTACHMENT CFDE_CSSStyleSelector::ToBKGAttachment( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Fixed: - return FDE_CSSBKGATTACHMENT_Fixed; - case FDE_CSSPROPERTYVALUE_Scroll: - return FDE_CSSBKGATTACHMENT_Scroll; - default: - return FDE_CSSBKGATTACHMENT_Fixed; - } -} - -FDE_CSSCAPTIONSIDE CFDE_CSSStyleSelector::ToCaptionSide( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Top: - return FDE_CSSCAPTIONSIDE_Top; - case FDE_CSSPROPERTYVALUE_Bottom: - return FDE_CSSCAPTIONSIDE_Bottom; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSCAPTIONSIDE_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSCAPTIONSIDE_Right; - case FDE_CSSPROPERTYVALUE_Before: - return FDE_CSSCAPTIONSIDE_Before; - case FDE_CSSPROPERTYVALUE_After: - return FDE_CSSCAPTIONSIDE_After; - default: - return FDE_CSSCAPTIONSIDE_Top; - } -} - -FDE_CSSPOSITION CFDE_CSSStyleSelector::ToPosition(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Static: - return FDE_CSSPOSITION_Static; - case FDE_CSSPROPERTYVALUE_Relative: - return FDE_CSSPOSITION_Relative; - case FDE_CSSPROPERTYVALUE_Fixed: - return FDE_CSSPOSITION_Fixed; - case FDE_CSSPROPERTYVALUE_Absolute: - return FDE_CSSPOSITION_Absolute; - default: - return FDE_CSSPOSITION_Static; - } -} - -FDE_CSSCURSOR CFDE_CSSStyleSelector::ToCursor(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSCURSOR_Auto; - case FDE_CSSPROPERTYVALUE_Crosshair: - return FDE_CSSCURSOR_Crosshair; - case FDE_CSSPROPERTYVALUE_Default: - return FDE_CSSCURSOR_Default; - case FDE_CSSPROPERTYVALUE_Pointer: - return FDE_CSSCURSOR_Pointer; - case FDE_CSSPROPERTYVALUE_Move: - return FDE_CSSCURSOR_Move; - case FDE_CSSPROPERTYVALUE_EResize: - return FDE_CSSCURSOR_EResize; - case FDE_CSSPROPERTYVALUE_NeResize: - return FDE_CSSCURSOR_NeResize; - case FDE_CSSPROPERTYVALUE_NwResize: - return FDE_CSSCURSOR_NwResize; - case FDE_CSSPROPERTYVALUE_NResize: - return FDE_CSSCURSOR_NResize; - case FDE_CSSPROPERTYVALUE_SeResize: - return FDE_CSSCURSOR_SeResize; - case FDE_CSSPROPERTYVALUE_SwResize: - return FDE_CSSCURSOR_SwResize; - default: - return FDE_CSSCURSOR_Auto; - } -} - -FDE_CSSBKGREPEAT CFDE_CSSStyleSelector::ToBKGRepeat( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Repeat: - return FDE_CSSBKGREPEAT_Repeat; - case FDE_CSSPROPERTYVALUE_RepeatX: - return FDE_CSSBKGREPEAT_RepeatX; - case FDE_CSSPROPERTYVALUE_RepeatY: - return FDE_CSSBKGREPEAT_RepeatY; - case FDE_CSSPROPERTYVALUE_NoRepeat: - return FDE_CSSBKGREPEAT_NoRepeat; - default: - return FDE_CSSBKGREPEAT_Repeat; - } -} - -FDE_CSSTEXTCOMBINE CFDE_CSSStyleSelector::ToTextCombine( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Horizontal: - return FDE_CSSTEXTCOMBINE_Horizontal; - case FDE_CSSPROPERTYVALUE_None: - default: - return FDE_CSSTEXTCOMBINE_None; - } -} - -FDE_CSSLINEBREAK CFDE_CSSStyleSelector::ToLineBreak( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSLINEBREAK_Auto; - case FDE_CSSPROPERTYVALUE_Loose: - return FDE_CSSLINEBREAK_Loose; - case FDE_CSSPROPERTYVALUE_Normal: - return FDE_CSSLINEBREAK_Normal; - case FDE_CSSPROPERTYVALUE_Strict: - return FDE_CSSLINEBREAK_Strict; - default: - return FDE_CSSLINEBREAK_Auto; - } -} - -FDE_CSSOVERFLOW CFDE_CSSStyleSelector::ToOverflow(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Visible: - return FDE_CSSOVERFLOW_Visible; - case FDE_CSSPROPERTYVALUE_Hidden: - return FDE_CSSOVERFLOW_Hidden; - case FDE_CSSPROPERTYVALUE_Scroll: - return FDE_CSSOVERFLOW_Scroll; - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSOVERFLOW_Auto; - case FDE_CSSPROPERTYVALUE_NoDisplay: - return FDE_CSSOVERFLOW_NoDisplay; - case FDE_CSSPROPERTYVALUE_NoContent: - return FDE_CSSOVERFLOW_NoContent; - default: - return FDE_CSSOVERFLOW_Visible; - } -} - -FDE_CSSWRITINGMODE CFDE_CSSStyleSelector::ToWritingMode( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_HorizontalTb: - return FDE_CSSWRITINGMODE_HorizontalTb; - case FDE_CSSPROPERTYVALUE_VerticalRl: - return FDE_CSSWRITINGMODE_VerticalRl; - case FDE_CSSPROPERTYVALUE_VerticalLr: - return FDE_CSSWRITINGMODE_VerticalLr; - default: - return FDE_CSSWRITINGMODE_HorizontalTb; - } -} - -FDE_CSSWORDBREAK CFDE_CSSStyleSelector::ToWordBreak( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Normal: - return FDE_CSSWORDBREAK_Normal; - case FDE_CSSPROPERTYVALUE_KeepAll: - return FDE_CSSWORDBREAK_KeepAll; - case FDE_CSSPROPERTYVALUE_BreakAll: - return FDE_CSSWORDBREAK_BreakAll; - case FDE_CSSPROPERTYVALUE_KeepWords: - return FDE_CSSWORDBREAK_KeepWords; - default: - return FDE_CSSWORDBREAK_Normal; - } -} - -FDE_CSSFLOAT CFDE_CSSStyleSelector::ToFloat(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSFLOAT_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSFLOAT_Right; - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSFLOAT_None; - default: - return FDE_CSSFLOAT_None; - } -} - -FDE_CSSCLEAR CFDE_CSSStyleSelector::ToClear(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSCLEAR_None; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSCLEAR_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSCLEAR_Right; - case FDE_CSSPROPERTYVALUE_Both: - return FDE_CSSCLEAR_Both; - default: - return FDE_CSSCLEAR_None; - } -} - -FDE_CSSPAGEBREAK CFDE_CSSStyleSelector::ToPageBreak( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Avoid: - return FDE_CSSPAGEBREAK_Avoid; - case FDE_CSSPROPERTYVALUE_Auto: - return FDE_CSSPAGEBREAK_Auto; - case FDE_CSSPROPERTYVALUE_Always: - return FDE_CSSPAGEBREAK_Always; - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSPAGEBREAK_Left; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSPAGEBREAK_Right; - default: - return FDE_CSSPAGEBREAK_Auto; - } -} - -FDE_CSSDISPLAY CFDE_CSSStyleSelector::ToDisplay(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Inline: - return FDE_CSSDISPLAY_Inline; - case FDE_CSSPROPERTYVALUE_Block: - return FDE_CSSDISPLAY_Block; - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSDISPLAY_None; - case FDE_CSSPROPERTYVALUE_ListItem: - return FDE_CSSDISPLAY_ListItem; - case FDE_CSSPROPERTYVALUE_TableCell: - return FDE_CSSDISPLAY_TableCell; - case FDE_CSSPROPERTYVALUE_TableRow: - return FDE_CSSDISPLAY_TableRow; - case FDE_CSSPROPERTYVALUE_Table: - return FDE_CSSDISPLAY_Table; - case FDE_CSSPROPERTYVALUE_TableCaption: - return FDE_CSSDISPLAY_TableCaption; - case FDE_CSSPROPERTYVALUE_TableRowGroup: - return FDE_CSSDISPLAY_TableRowGroup; - case FDE_CSSPROPERTYVALUE_TableHeaderGroup: - return FDE_CSSDISPLAY_TableHeaderGroup; - case FDE_CSSPROPERTYVALUE_TableFooterGroup: - return FDE_CSSDISPLAY_TableFooterGroup; - case FDE_CSSPROPERTYVALUE_TableColumnGroup: - return FDE_CSSDISPLAY_TableColumnGroup; - case FDE_CSSPROPERTYVALUE_TableColumn: - return FDE_CSSDISPLAY_TableColumn; - case FDE_CSSPROPERTYVALUE_InlineTable: - return FDE_CSSDISPLAY_InlineTable; - case FDE_CSSPROPERTYVALUE_InlineBlock: - return FDE_CSSDISPLAY_InlineBlock; - case FDE_CSSPROPERTYVALUE_RunIn: - return FDE_CSSDISPLAY_RunIn; - case FDE_CSSPROPERTYVALUE_Ruby: - return FDE_CSSDISPLAY_Ruby; - case FDE_CSSPROPERTYVALUE_RubyBase: - return FDE_CSSDISPLAY_RubyBase; - case FDE_CSSPROPERTYVALUE_RubyText: - return FDE_CSSDISPLAY_RubyText; - case FDE_CSSPROPERTYVALUE_RubyBaseGroup: - return FDE_CSSDISPLSY_RubyBaseGroup; - case FDE_CSSPROPERTYVALUE_RubyTextGroup: - return FDE_CSSDISPLAY_RubyTextGroup; - default: - return FDE_CSSDISPLAY_Inline; - } -} - -FDE_CSSTEXTALIGN CFDE_CSSStyleSelector::ToTextAlign( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Left: - return FDE_CSSTEXTALIGN_Left; - case FDE_CSSPROPERTYVALUE_Center: - return FDE_CSSTEXTALIGN_Center; - case FDE_CSSPROPERTYVALUE_Right: - return FDE_CSSTEXTALIGN_Right; - case FDE_CSSPROPERTYVALUE_Justify: - return FDE_CSSTEXTALIGN_Justify; - default: - return FDE_CSSTEXTALIGN_Left; - } -} - -uint16_t CFDE_CSSStyleSelector::ToFontWeight(FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Normal: - return 400; - case FDE_CSSPROPERTYVALUE_Bold: + case FDE_CSSPropertyValue::Bold: return 700; - case FDE_CSSPROPERTYVALUE_Bolder: + case FDE_CSSPropertyValue::Bolder: return 900; - case FDE_CSSPROPERTYVALUE_Lighter: + case FDE_CSSPropertyValue::Lighter: return 200; + case FDE_CSSPropertyValue::Normal: default: return 400; } } -FDE_CSSFONTSTYLE CFDE_CSSStyleSelector::ToFontStyle( - FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSFontStyle CFDE_CSSStyleSelector::ToFontStyle( + FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Italic: - case FDE_CSSPROPERTYVALUE_Oblique: - return FDE_CSSFONTSTYLE_Italic; + case FDE_CSSPropertyValue::Italic: + case FDE_CSSPropertyValue::Oblique: + return FDE_CSSFontStyle::Italic; default: - return FDE_CSSFONTSTYLE_Normal; - } -} - -FDE_CSSBORDERSTYLE CFDE_CSSStyleSelector::ToBorderStyle( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSBORDERSTYLE_None; - case FDE_CSSPROPERTYVALUE_Solid: - return FDE_CSSBORDERSTYLE_Solid; - case FDE_CSSPROPERTYVALUE_Hidden: - return FDE_CSSBORDERSTYLE_Hidden; - case FDE_CSSPROPERTYVALUE_Dotted: - return FDE_CSSBORDERSTYLE_Dotted; - case FDE_CSSPROPERTYVALUE_Dashed: - return FDE_CSSBORDERSTYLE_Dashed; - case FDE_CSSPROPERTYVALUE_Double: - return FDE_CSSBORDERSTYLE_Double; - case FDE_CSSPROPERTYVALUE_Groove: - return FDE_CSSBORDERSTYLE_Groove; - case FDE_CSSPROPERTYVALUE_Ridge: - return FDE_CSSBORDERSTYLE_Ridge; - case FDE_CSSPROPERTYVALUE_Inset: - return FDE_CSSBORDERSTYLE_Inset; - case FDE_CSSPROPERTYVALUE_Outset: - return FDE_CSSBORDERSTYLE_outset; - default: - return FDE_CSSBORDERSTYLE_None; + return FDE_CSSFontStyle::Normal; } } bool CFDE_CSSStyleSelector::SetLengthWithPercent( FDE_CSSLENGTH& width, - FDE_CSSPRIMITIVETYPE eType, + FDE_CSSPrimitiveType eType, IFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize) { - if (eType == FDE_CSSPRIMITIVETYPE_Percent) { - width.Set(FDE_CSSLENGTHUNIT_Percent, pPrimitive->GetFloat() / 100.0f); + if (eType == FDE_CSSPrimitiveType::Percent) { + width.Set(FDE_CSSLengthUnit::Percent, pPrimitive->GetFloat() / 100.0f); return width.NonZero(); - } else if (eType >= FDE_CSSPRIMITIVETYPE_Number && - eType <= FDE_CSSPRIMITIVETYPE_PC) { + } else if (eType >= FDE_CSSPrimitiveType::Number && + eType <= FDE_CSSPrimitiveType::Picas) { FX_FLOAT fValue = ApplyNumber(eType, pPrimitive->GetFloat(), fFontSize); - width.Set(FDE_CSSLENGTHUNIT_Point, fValue); + width.Set(FDE_CSSLengthUnit::Point, fValue); return width.NonZero(); - } else if (eType == FDE_CSSPRIMITIVETYPE_Enum) { + } else if (eType == FDE_CSSPrimitiveType::Enum) { switch (pPrimitive->GetEnum()) { - case FDE_CSSPROPERTYVALUE_Auto: - width.Set(FDE_CSSLENGTHUNIT_Auto); + case FDE_CSSPropertyValue::Auto: + width.Set(FDE_CSSLengthUnit::Auto); return true; - case FDE_CSSPROPERTYVALUE_None: - width.Set(FDE_CSSLENGTHUNIT_None); + case FDE_CSSPropertyValue::None: + width.Set(FDE_CSSLengthUnit::None); return true; - case FDE_CSSPROPERTYVALUE_Thin: - width.Set(FDE_CSSLENGTHUNIT_Point, 2); + case FDE_CSSPropertyValue::Thin: + width.Set(FDE_CSSLengthUnit::Point, 2); return true; - case FDE_CSSPROPERTYVALUE_Medium: - width.Set(FDE_CSSLENGTHUNIT_Point, 3); + case FDE_CSSPropertyValue::Medium: + width.Set(FDE_CSSLengthUnit::Point, 3); return true; - case FDE_CSSPROPERTYVALUE_Thick: - width.Set(FDE_CSSLENGTHUNIT_Point, 4); + case FDE_CSSPropertyValue::Thick: + width.Set(FDE_CSSLengthUnit::Point, 4); return true; default: return false; @@ -1503,142 +802,52 @@ bool CFDE_CSSStyleSelector::SetLengthWithPercent( return false; } -FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPROPERTYVALUE eValue, +FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPropertyValue eValue, FX_FLOAT fCurFontSize) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_XxSmall: + case FDE_CSSPropertyValue::XxSmall: return m_fDefFontSize / 1.2f / 1.2f / 1.2f; - case FDE_CSSPROPERTYVALUE_XSmall: + case FDE_CSSPropertyValue::XSmall: return m_fDefFontSize / 1.2f / 1.2f; - case FDE_CSSPROPERTYVALUE_Small: + case FDE_CSSPropertyValue::Small: return m_fDefFontSize / 1.2f; - case FDE_CSSPROPERTYVALUE_Medium: + case FDE_CSSPropertyValue::Medium: return m_fDefFontSize; - case FDE_CSSPROPERTYVALUE_Large: + case FDE_CSSPropertyValue::Large: return m_fDefFontSize * 1.2f; - case FDE_CSSPROPERTYVALUE_XLarge: + case FDE_CSSPropertyValue::XLarge: return m_fDefFontSize * 1.2f * 1.2f; - case FDE_CSSPROPERTYVALUE_XxLarge: + case FDE_CSSPropertyValue::XxLarge: return m_fDefFontSize * 1.2f * 1.2f * 1.2f; - case FDE_CSSPROPERTYVALUE_Larger: + case FDE_CSSPropertyValue::Larger: return fCurFontSize * 1.2f; - case FDE_CSSPROPERTYVALUE_Smaller: + case FDE_CSSPropertyValue::Smaller: return fCurFontSize / 1.2f; default: return fCurFontSize; } } -FDE_CSSVERTICALALIGN CFDE_CSSStyleSelector::ToVerticalAlign( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Baseline: - return FDE_CSSVERTICALALIGN_Baseline; - case FDE_CSSPROPERTYVALUE_Middle: - return FDE_CSSVERTICALALIGN_Middle; - case FDE_CSSPROPERTYVALUE_Bottom: - return FDE_CSSVERTICALALIGN_Bottom; - case FDE_CSSPROPERTYVALUE_Super: - return FDE_CSSVERTICALALIGN_Super; - case FDE_CSSPROPERTYVALUE_Sub: - return FDE_CSSVERTICALALIGN_Sub; - case FDE_CSSPROPERTYVALUE_Top: - return FDE_CSSVERTICALALIGN_Top; - case FDE_CSSPROPERTYVALUE_TextTop: - return FDE_CSSVERTICALALIGN_TextTop; - case FDE_CSSPROPERTYVALUE_TextBottom: - return FDE_CSSVERTICALALIGN_TextBottom; - default: - return FDE_CSSVERTICALALIGN_Baseline; - } -} - -FDE_CSSLISTSTYLETYPE CFDE_CSSStyleSelector::ToListStyleType( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSLISTSTYLETYPE_None; - case FDE_CSSPROPERTYVALUE_Disc: - return FDE_CSSLISTSTYLETYPE_Disc; - case FDE_CSSPROPERTYVALUE_Circle: - return FDE_CSSLISTSTYLETYPE_Circle; - case FDE_CSSPROPERTYVALUE_Square: - return FDE_CSSLISTSTYLETYPE_Square; - case FDE_CSSPROPERTYVALUE_Decimal: - return FDE_CSSLISTSTYLETYPE_Decimal; - case FDE_CSSPROPERTYVALUE_DecimalLeadingZero: - return FDE_CSSLISTSTYLETYPE_DecimalLeadingZero; - case FDE_CSSPROPERTYVALUE_LowerRoman: - return FDE_CSSLISTSTYLETYPE_LowerRoman; - case FDE_CSSPROPERTYVALUE_UpperRoman: - return FDE_CSSLISTSTYLETYPE_UpperRoman; - case FDE_CSSPROPERTYVALUE_LowerGreek: - return FDE_CSSLISTSTYLETYPE_LowerGreek; - case FDE_CSSPROPERTYVALUE_LowerLatin: - return FDE_CSSLISTSTYLETYPE_LowerLatin; - case FDE_CSSPROPERTYVALUE_UpperLatin: - return FDE_CSSLISTSTYLETYPE_UpperLatin; - case FDE_CSSPROPERTYVALUE_Armenian: - return FDE_CSSLISTSTYLETYPE_Armenian; - case FDE_CSSPROPERTYVALUE_Georgian: - return FDE_CSSLISTSTYLETYPE_Georgian; - case FDE_CSSPROPERTYVALUE_LowerAlpha: - return FDE_CSSLISTSTYLETYPE_LowerAlpha; - case FDE_CSSPROPERTYVALUE_UpperAlpha: - return FDE_CSSLISTSTYLETYPE_UpperAlpha; - case FDE_CSSPROPERTYVALUE_CjkIdeographic: - return FDE_CSSLISTSTYLETYPE_CjkIdeographic; - case FDE_CSSPROPERTYVALUE_Hebrew: - return FDE_CSSLISTSTYLETYPE_Hebrew; - case FDE_CSSLISTSTYLETYPE_Hiragana: - return FDE_CSSLISTSTYLETYPE_Hiragana; - case FDE_CSSLISTSTYLETYPE_HiraganaIroha: - return FDE_CSSLISTSTYLETYPE_HiraganaIroha; - case FDE_CSSLISTSTYLETYPE_Katakana: - return FDE_CSSLISTSTYLETYPE_Katakana; - case FDE_CSSLISTSTYLETYPE_KatakanaIroha: - return FDE_CSSLISTSTYLETYPE_KatakanaIroha; - default: - return FDE_CSSLISTSTYLETYPE_Disc; - } -} - -FDE_CSSLISTSTYLEPOSITION CFDE_CSSStyleSelector::ToListStylePosition( - FDE_CSSPROPERTYVALUE eValue) { - return eValue == FDE_CSSPROPERTYVALUE_Inside - ? FDE_CSSLISTSTYLEPOSITION_Inside - : FDE_CSSLISTSTYLEPOSITION_Outside; -} - -FDE_CSSVISIBILITY CFDE_CSSStyleSelector::ToVisibility( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_Visible: - return FDE_CSSVISIBILITY_Visible; - case FDE_CSSPROPERTYVALUE_Hidden: - return FDE_CSSVISIBILITY_Hidden; - case FDE_CSSPROPERTYVALUE_Collapse: - return FDE_CSSVISIBILITY_Collapse; - default: - return FDE_CSSVISIBILITY_Visible; - } -} - -FDE_CSSWHITESPACE CFDE_CSSStyleSelector::ToWhiteSpace( - FDE_CSSPROPERTYVALUE eValue) { +FDE_CSSVerticalAlign CFDE_CSSStyleSelector::ToVerticalAlign( + FDE_CSSPropertyValue eValue) { switch (eValue) { - case FDE_CSSPROPERTYVALUE_Normal: - return FDE_CSSWHITESPACE_Normal; - case FDE_CSSPROPERTYVALUE_Pre: - return FDE_CSSWHITESPACE_Pre; - case FDE_CSSPROPERTYVALUE_Nowrap: - return FDE_CSSWHITESPACE_Nowrap; - case FDE_CSSPROPERTYVALUE_PreWrap: - return FDE_CSSWHITESPACE_PreWrap; - case FDE_CSSPROPERTYVALUE_PreLine: - return FDE_CSSWHITESPACE_PreLine; + case FDE_CSSPropertyValue::Middle: + return FDE_CSSVerticalAlign::Middle; + case FDE_CSSPropertyValue::Bottom: + return FDE_CSSVerticalAlign::Bottom; + case FDE_CSSPropertyValue::Super: + return FDE_CSSVerticalAlign::Super; + case FDE_CSSPropertyValue::Sub: + return FDE_CSSVerticalAlign::Sub; + case FDE_CSSPropertyValue::Top: + return FDE_CSSVerticalAlign::Top; + case FDE_CSSPropertyValue::TextTop: + return FDE_CSSVerticalAlign::TextTop; + case FDE_CSSPropertyValue::TextBottom: + return FDE_CSSVerticalAlign::TextBottom; + case FDE_CSSPropertyValue::Baseline: default: - return FDE_CSSWHITESPACE_Normal; + return FDE_CSSVerticalAlign::Baseline; } } @@ -1647,21 +856,21 @@ uint32_t CFDE_CSSStyleSelector::ToTextDecoration(IFDE_CSSValueList* pValue) { for (int32_t i = pValue->CountValues() - 1; i >= 0; --i) { IFDE_CSSPrimitiveValue* pPrimitive = static_cast(pValue->GetValue(i)); - if (pPrimitive->GetPrimitiveType() == FDE_CSSPRIMITIVETYPE_Enum) { + if (pPrimitive->GetPrimitiveType() == FDE_CSSPrimitiveType::Enum) { switch (pPrimitive->GetEnum()) { - case FDE_CSSPROPERTYVALUE_Underline: + case FDE_CSSPropertyValue::Underline: dwDecoration |= FDE_CSSTEXTDECORATION_Underline; break; - case FDE_CSSPROPERTYVALUE_LineThrough: + case FDE_CSSPropertyValue::LineThrough: dwDecoration |= FDE_CSSTEXTDECORATION_LineThrough; break; - case FDE_CSSPROPERTYVALUE_Overline: + case FDE_CSSPropertyValue::Overline: dwDecoration |= FDE_CSSTEXTDECORATION_Overline; break; - case FDE_CSSPROPERTYVALUE_Blink: + case FDE_CSSPropertyValue::Blink: dwDecoration |= FDE_CSSTEXTDECORATION_Blink; break; - case FDE_CSSPROPERTYVALUE_Double: + case FDE_CSSPropertyValue::Double: dwDecoration |= FDE_CSSTEXTDECORATION_Double; break; default: @@ -1672,26 +881,11 @@ uint32_t CFDE_CSSStyleSelector::ToTextDecoration(IFDE_CSSValueList* pValue) { return dwDecoration; } -FDE_CSSTEXTTRANSFORM CFDE_CSSStyleSelector::ToTextTransform( - FDE_CSSPROPERTYVALUE eValue) { - switch (eValue) { - case FDE_CSSPROPERTYVALUE_None: - return FDE_CSSTEXTTRANSFORM_None; - case FDE_CSSPROPERTYVALUE_Capitalize: - return FDE_CSSTEXTTRANSFORM_Capitalize; - case FDE_CSSPROPERTYVALUE_Uppercase: - return FDE_CSSTEXTTRANSFORM_UpperCase; - case FDE_CSSPROPERTYVALUE_Lowercase: - return FDE_CSSTEXTTRANSFORM_LowerCase; - default: - return FDE_CSSTEXTTRANSFORM_None; - } -} - -FDE_CSSFONTVARIANT CFDE_CSSStyleSelector::ToFontVariant( - FDE_CSSPROPERTYVALUE eValue) { - return eValue == FDE_CSSPROPERTYVALUE_SmallCaps ? FDE_CSSFONTVARIANT_SmallCaps - : FDE_CSSFONTVARIANT_Normal; +FDE_CSSFontVariant CFDE_CSSStyleSelector::ToFontVariant( + FDE_CSSPropertyValue eValue) { + return eValue == FDE_CSSPropertyValue::SmallCaps + ? FDE_CSSFontVariant::SmallCaps + : FDE_CSSFontVariant::Normal; } CFDE_CSSComputedStyle::CFDE_CSSComputedStyle() : m_dwRefCount(1) {} @@ -1704,18 +898,11 @@ uint32_t CFDE_CSSComputedStyle::Retain() { uint32_t CFDE_CSSComputedStyle::Release() { uint32_t dwRefCount = --m_dwRefCount; - if (dwRefCount == 0) { - delete m_NonInheritedData.m_pCounterStyle; + if (dwRefCount == 0) delete this; - } return dwRefCount; } -void CFDE_CSSComputedStyle::Reset() { - m_InheritedData.Reset(); - m_NonInheritedData.Reset(); -} - IFDE_CSSFontStyle* CFDE_CSSComputedStyle::GetFontStyles() { return static_cast(this); } @@ -1760,12 +947,12 @@ uint16_t CFDE_CSSComputedStyle::GetFontWeight() const { return m_InheritedData.m_wFontWeight; } -FDE_CSSFONTVARIANT CFDE_CSSComputedStyle::GetFontVariant() const { - return static_cast(m_InheritedData.m_eFontVariant); +FDE_CSSFontVariant CFDE_CSSComputedStyle::GetFontVariant() const { + return static_cast(m_InheritedData.m_eFontVariant); } -FDE_CSSFONTSTYLE CFDE_CSSComputedStyle::GetFontStyle() const { - return static_cast(m_InheritedData.m_eFontStyle); +FDE_CSSFontStyle CFDE_CSSComputedStyle::GetFontStyle() const { + return static_cast(m_InheritedData.m_eFontStyle); } FX_FLOAT CFDE_CSSComputedStyle::GetFontSize() const { @@ -1780,11 +967,11 @@ void CFDE_CSSComputedStyle::SetFontWeight(uint16_t wFontWeight) { m_InheritedData.m_wFontWeight = wFontWeight; } -void CFDE_CSSComputedStyle::SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) { +void CFDE_CSSComputedStyle::SetFontVariant(FDE_CSSFontVariant eFontVariant) { m_InheritedData.m_eFontVariant = eFontVariant; } -void CFDE_CSSComputedStyle::SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) { +void CFDE_CSSComputedStyle::SetFontStyle(FDE_CSSFontStyle eFontStyle) { m_InheritedData.m_eFontStyle = eFontStyle; } @@ -1821,8 +1008,8 @@ void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRECT& rect) { m_NonInheritedData.m_bHasPadding = true; } -FDE_CSSDISPLAY CFDE_CSSComputedStyle::GetDisplay() const { - return static_cast(m_NonInheritedData.m_eDisplay); +FDE_CSSDisplay CFDE_CSSComputedStyle::GetDisplay() const { + return static_cast(m_NonInheritedData.m_eDisplay); } FX_FLOAT CFDE_CSSComputedStyle::GetLineHeight() const { @@ -1833,12 +1020,12 @@ const FDE_CSSLENGTH& CFDE_CSSComputedStyle::GetTextIndent() const { return m_InheritedData.m_TextIndent; } -FDE_CSSTEXTALIGN CFDE_CSSComputedStyle::GetTextAlign() const { - return static_cast(m_InheritedData.m_eTextAligh); +FDE_CSSTextAlign CFDE_CSSComputedStyle::GetTextAlign() const { + return static_cast(m_InheritedData.m_eTextAlign); } -FDE_CSSVERTICALALIGN CFDE_CSSComputedStyle::GetVerticalAlign() const { - return static_cast(m_NonInheritedData.m_eVerticalAlign); +FDE_CSSVerticalAlign CFDE_CSSComputedStyle::GetVerticalAlign() const { + return static_cast(m_NonInheritedData.m_eVerticalAlign); } FX_FLOAT CFDE_CSSComputedStyle::GetNumberVerticalAlign() const { @@ -1861,12 +1048,12 @@ void CFDE_CSSComputedStyle::SetTextIndent(const FDE_CSSLENGTH& textIndent) { m_InheritedData.m_TextIndent = textIndent; } -void CFDE_CSSComputedStyle::SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) { - m_InheritedData.m_eTextAligh = eTextAlign; +void CFDE_CSSComputedStyle::SetTextAlign(FDE_CSSTextAlign eTextAlign) { + m_InheritedData.m_eTextAlign = eTextAlign; } void CFDE_CSSComputedStyle::SetNumberVerticalAlign(FX_FLOAT fAlign) { - m_NonInheritedData.m_eVerticalAlign = FDE_CSSVERTICALALIGN_Number, + m_NonInheritedData.m_eVerticalAlign = FDE_CSSVerticalAlign::Number, m_NonInheritedData.m_fVerticalAlign = fAlign; } @@ -1885,41 +1072,27 @@ void CFDE_CSSComputedStyle::AddCustomStyle(const CFX_WideString& wsName, m_CustomProperties.push_back(wsValue); } -CFDE_CSSInheritedData::CFDE_CSSInheritedData() { - Reset(); -} - -void CFDE_CSSInheritedData::Reset() { - FXSYS_memset(this, 0, sizeof(CFDE_CSSInheritedData)); - m_LetterSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - m_WordSpacing.Set(FDE_CSSLENGTHUNIT_Normal); - m_TextIndent.Set(FDE_CSSLENGTHUNIT_Point, 0); - m_fFontSize = 12.0f; - m_fLineHeight = 14.0f; - m_wFontWeight = 400; - m_dwFontColor = 0xFF000000; - m_iWidows = 2; - m_bTextEmphasisColorCurrent = true; - m_iOrphans = 2; -} - -CFDE_CSSNonInheritedData::CFDE_CSSNonInheritedData() { - Reset(); -} - -void CFDE_CSSNonInheritedData::Reset() { - FXSYS_memset(this, 0, sizeof(CFDE_CSSNonInheritedData)); - m_PaddingWidth.Set(FDE_CSSLENGTHUNIT_Point, 0); - m_MarginWidth = m_PaddingWidth; - m_BorderWidth = m_PaddingWidth; - m_MinBoxSize.Set(FDE_CSSLENGTHUNIT_Point, 0); - m_MaxBoxSize.Set(FDE_CSSLENGTHUNIT_None); - m_eDisplay = FDE_CSSDISPLAY_Inline; - m_fVerticalAlign = 0.0f; - m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); - m_ColumnGap.Set(FDE_CSSLENGTHUNIT_Normal); - m_bColumnRuleColorSame = true; - m_ColumnWidth.Set(FDE_CSSLENGTHUNIT_Auto); - m_ColumnRuleWidth.Set(FDE_CSSLENGTHUNIT_Auto); - m_eTextCombine = FDE_CSSTEXTCOMBINE_None; -} +CFDE_CSSInheritedData::CFDE_CSSInheritedData() + : m_LetterSpacing(FDE_CSSLengthUnit::Normal), + m_WordSpacing(FDE_CSSLengthUnit::Normal), + m_TextIndent(FDE_CSSLengthUnit::Point, 0), + m_pFontFamily(nullptr), + m_fFontSize(12.0f), + m_fLineHeight(14.0f), + m_dwFontColor(0xFF000000), + m_wFontWeight(400), + m_eFontVariant(FDE_CSSFontVariant::Normal), + m_eFontStyle(FDE_CSSFontStyle::Normal), + m_eTextAlign(FDE_CSSTextAlign::Left) {} + +CFDE_CSSNonInheritedData::CFDE_CSSNonInheritedData() + : m_MarginWidth(FDE_CSSLengthUnit::Point, 0), + m_BorderWidth(FDE_CSSLengthUnit::Point, 0), + m_PaddingWidth(FDE_CSSLengthUnit::Point, 0), + m_fVerticalAlign(0.0f), + m_eDisplay(FDE_CSSDisplay::Inline), + m_eVerticalAlign(FDE_CSSVerticalAlign::Baseline), + m_dwTextDecoration(0), + m_bHasMargin(false), + m_bHasBorder(false), + m_bHasPadding(false) {} diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index 13ed58910b..b20cdec8af 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -37,7 +37,7 @@ class CFDE_CSSRuleCollection { CFDE_CSSRuleCollection(); ~CFDE_CSSRuleCollection(); - void AddRulesFrom(const CFDE_CSSStyleSheetArray& sheets, + void AddRulesFrom(const CFX_ArrayTemplate& sheets, uint32_t dwMediaList, CFGAS_FontMgr* pFontMgr); void Clear(); @@ -89,18 +89,18 @@ class CFDE_CSSStyleSelector { void SetDefFontSize(FX_FLOAT fFontSize); - bool SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, IFDE_CSSStyleSheet* pSheet); - bool SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, - const CFDE_CSSStyleSheetArray* pArray); - void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, - FDE_CSSSTYLESHEETPRIORITY ePriority); + bool SetStyleSheet(FDE_CSSStyleSheetGroup eType, IFDE_CSSStyleSheet* pSheet); + bool SetStyleSheets(FDE_CSSStyleSheetGroup eType, + const CFX_ArrayTemplate* pArray); + void SetStylePriority(FDE_CSSStyleSheetGroup eType, + FDE_CSSStyleSheetPriority ePriority); void UpdateStyleIndex(uint32_t dwMediaList); CFDE_CSSAccelerator* InitAccelerator(); IFDE_CSSComputedStyle* CreateComputedStyle( IFDE_CSSComputedStyle* pParentStyle); int32_t MatchDeclarations(CXFA_CSSTagProvider* pTag, CFDE_CSSDeclarationArray& matchedDecls, - FDE_CSSPSEUDO ePseudoType = FDE_CSSPSEUDO_NONE); + FDE_CSSPseudo ePseudoType = FDE_CSSPseudo::NONE); void ComputeStyle(CXFA_CSSTagProvider* pTag, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, @@ -110,10 +110,10 @@ class CFDE_CSSStyleSelector { void Reset(); void MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, - FDE_CSSPSEUDO ePseudoType); + FDE_CSSPseudo ePseudoType); bool MatchSelector(FDE_CSSTagCache* pCache, CFDE_CSSSelector* pSel, - FDE_CSSPSEUDO ePseudoType); + FDE_CSSPseudo ePseudoType); void AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen); @@ -121,222 +121,70 @@ class CFDE_CSSStyleSelector { const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, IFDE_CSSComputedStyle* pDestStyle); - void ApplyProperty(FDE_CSSPROPERTY eProperty, + void ApplyProperty(FDE_CSSProperty eProperty, IFDE_CSSValue* pValue, CFDE_CSSComputedStyle* pComputedStyle); - FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, + FX_FLOAT ApplyNumber(FDE_CSSPrimitiveType eUnit, FX_FLOAT fValue, FX_FLOAT fPercentBase); bool SetLengthWithPercent(FDE_CSSLENGTH& width, - FDE_CSSPRIMITIVETYPE eType, + FDE_CSSPrimitiveType eType, IFDE_CSSPrimitiveValue* pPrimitive, FX_FLOAT fFontSize); - FX_FLOAT ToFontSize(FDE_CSSPROPERTYVALUE eValue, FX_FLOAT fCurFontSize); - FDE_CSSDISPLAY ToDisplay(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSTEXTALIGN ToTextAlign(FDE_CSSPROPERTYVALUE eValue); - uint16_t ToFontWeight(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSFONTSTYLE ToFontStyle(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSBORDERSTYLE ToBorderStyle(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSVERTICALALIGN ToVerticalAlign(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSLISTSTYLETYPE ToListStyleType(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSLISTSTYLEPOSITION ToListStylePosition(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSVISIBILITY ToVisibility(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSWHITESPACE ToWhiteSpace(FDE_CSSPROPERTYVALUE eValue); + FX_FLOAT ToFontSize(FDE_CSSPropertyValue eValue, FX_FLOAT fCurFontSize); + FDE_CSSDisplay ToDisplay(FDE_CSSPropertyValue eValue); + FDE_CSSTextAlign ToTextAlign(FDE_CSSPropertyValue eValue); + uint16_t ToFontWeight(FDE_CSSPropertyValue eValue); + FDE_CSSFontStyle ToFontStyle(FDE_CSSPropertyValue eValue); + FDE_CSSVerticalAlign ToVerticalAlign(FDE_CSSPropertyValue eValue); uint32_t ToTextDecoration(IFDE_CSSValueList* pList); - FDE_CSSTEXTTRANSFORM ToTextTransform(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSFONTVARIANT ToFontVariant(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSFLOAT ToFloat(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSCLEAR ToClear(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSWRITINGMODE ToWritingMode(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSWORDBREAK ToWordBreak(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSPAGEBREAK ToPageBreak(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSOVERFLOW ToOverflow(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSLINEBREAK ToLineBreak(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSTEXTCOMBINE ToTextCombine(FDE_CSSPROPERTYVALUE eValue); - bool ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark); - bool ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill); - FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSBKGREPEAT ToBKGRepeat(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSBKGATTACHMENT ToBKGAttachment(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSRUBYALIGN ToRubyAlign(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSRUBYOVERHANG ToRubyOverhang(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSRUBYPOSITION ToRubyPosition(FDE_CSSPROPERTYVALUE eValue); - FDE_CSSRUBYSPAN ToRubySpan(FDE_CSSPROPERTYVALUE eValue); + FDE_CSSFontVariant ToFontVariant(FDE_CSSPropertyValue eValue); CFGAS_FontMgr* const m_pFontMgr; FX_FLOAT m_fDefFontSize; - CFDE_CSSStyleSheetArray m_SheetGroups[FDE_CSSSTYLESHEETGROUP_MAX]; - CFDE_CSSRuleCollection m_RuleCollection[FDE_CSSSTYLESHEETGROUP_MAX]; - FDE_CSSSTYLESHEETGROUP m_ePriorities[FDE_CSSSTYLESHEETPRIORITY_MAX]; + CFX_ArrayTemplate m_SheetGroups[3]; + CFDE_CSSRuleCollection m_RuleCollection[3]; + FDE_CSSStyleSheetGroup m_ePriorities[3]; std::unique_ptr m_pAccelerator; std::vector m_MatchedRules; }; -struct FDE_CSSCOUNTERDATA { - public: - FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } - bool GetCounterIncrement(int32_t& iValue) { - iValue = m_iIncVal; - return m_bIncrement; - } - bool GetCounterReset(int32_t& iValue) { - iValue = m_iResetVal; - return m_bReset; - } - - const FX_WCHAR* m_pszIdent; - bool m_bIncrement; - bool m_bReset; - int32_t m_iIncVal; - int32_t m_iResetVal; -}; - -class CFDE_CSSCounterStyle { - public: - CFDE_CSSCounterStyle(); - ~CFDE_CSSCounterStyle(); - - void SetCounterIncrementList(IFDE_CSSValueList* pList) { - m_pCounterInc = pList; - m_bIndexDirty = true; - } - void SetCounterResetList(IFDE_CSSValueList* pList) { - m_pCounterReset = pList; - m_bIndexDirty = true; - } - int32_t CountCounters() { - UpdateIndex(); - return m_arrCounterData.GetSize(); - } - bool GetCounterIncrement(int32_t index, int32_t& iValue) { - UpdateIndex(); - return m_arrCounterData.ElementAt(index).GetCounterIncrement(iValue); - } - bool GetCounterReset(int32_t index, int32_t& iValue) { - UpdateIndex(); - return m_arrCounterData.ElementAt(index).GetCounterReset(iValue); - } - const FX_WCHAR* GetCounterIdentifier(int32_t index) { - UpdateIndex(); - return m_arrCounterData.ElementAt(index).m_pszIdent; - } - - protected: - void UpdateIndex(); - void DoUpdateIndex(IFDE_CSSValueList* pList); - int32_t FindIndex(const FX_WCHAR* pszIdentifier); - - IFDE_CSSValueList* m_pCounterInc; - IFDE_CSSValueList* m_pCounterReset; - CFX_ArrayTemplate m_arrCounterData; - bool m_bIndexDirty; -}; - class CFDE_CSSInheritedData { public: CFDE_CSSInheritedData(); - void Reset(); - - const FX_WCHAR* m_pszListStyleImage; FDE_CSSLENGTH m_LetterSpacing; FDE_CSSLENGTH m_WordSpacing; FDE_CSSLENGTH m_TextIndent; IFDE_CSSValueList* m_pFontFamily; - IFDE_CSSValueList* m_pQuotes; - IFDE_CSSValueList* m_pCursorUris; - FDE_CSSCURSOR m_eCursor; FX_FLOAT m_fFontSize; FX_FLOAT m_fLineHeight; FX_ARGB m_dwFontColor; - FX_ARGB m_dwTextEmphasisColor; uint16_t m_wFontWeight; - int32_t m_iWidows; - int32_t m_iOrphans; - const FX_WCHAR* m_pszTextEmphasisCustomMark; - uint32_t m_eFontVariant : 1; - uint32_t m_eFontStyle : 1; - uint32_t m_bTextEmphasisColorCurrent : 1; - uint32_t m_eTextAligh : 2; - uint32_t m_eVisibility : 2; - uint32_t m_eWhiteSpace : 3; - uint32_t m_eTextTransform : 2; - uint32_t m_eWritingMode : 2; - uint32_t m_eWordBreak : 2; - uint32_t m_eLineBreak : 2; - uint32_t m_eTextEmphasisFill : 1; - uint32_t m_eTextEmphasisMark : 3; - uint32_t m_eCaptionSide : 3; - uint8_t m_eRubyAlign : 4; - uint8_t m_eRubyOverhang : 2; - uint8_t m_eRubyPosition : 2; + FDE_CSSFontVariant m_eFontVariant; + FDE_CSSFontStyle m_eFontStyle; + FDE_CSSTextAlign m_eTextAlign; }; class CFDE_CSSNonInheritedData { public: CFDE_CSSNonInheritedData(); - void Reset(); - - IFDE_CSSValueList* m_pContentList; - CFDE_CSSCounterStyle* m_pCounterStyle; FDE_CSSRECT m_MarginWidth; FDE_CSSRECT m_BorderWidth; FDE_CSSRECT m_PaddingWidth; - FDE_CSSSIZE m_BoxSize; - FDE_CSSSIZE m_MinBoxSize; - FDE_CSSSIZE m_MaxBoxSize; - FDE_CSSPOINT m_BKGPosition; - const FX_WCHAR* m_pszBKGImage; - FX_ARGB m_dwBKGColor; - FX_ARGB m_dwBDRLeftColor; - FX_ARGB m_dwBDRTopColor; - FX_ARGB m_dwBDRRightColor; - FX_ARGB m_dwBDRBottomColor; - IFDE_CSSValue* m_pRubySpan; - FDE_CSSLENGTH m_ColumnCount; - FDE_CSSLENGTH m_ColumnGap; - FDE_CSSLENGTH m_ColumnRuleWidth; - FDE_CSSLENGTH m_ColumnWidth; - FX_ARGB m_dwColumnRuleColor; FDE_CSSLENGTH m_Top; FDE_CSSLENGTH m_Bottom; FDE_CSSLENGTH m_Left; FDE_CSSLENGTH m_Right; - FX_FLOAT m_fVerticalAlign; - FX_FLOAT m_fTextCombineNumber; - uint32_t m_eBDRLeftStyle : 4; - uint32_t m_eBDRTopStyle : 4; - uint32_t m_eBDRRightStyle : 4; - uint32_t m_eBDRBottomStyle : 4; - uint32_t m_eDisplay : 5; - uint32_t m_eVerticalAlign : 4; - uint32_t m_eListStyleType : 5; - uint32_t m_eColumnRuleStyle : 4; - uint32_t m_ePageBreakInside : 3; - uint32_t m_ePageBreakAfter : 3; - uint32_t m_ePageBreakBefore : 3; - uint32_t m_ePosition : 2; - uint32_t m_eBKGRepeat : 2; - uint32_t m_eFloat : 2; - uint32_t m_eClear : 2; - uint32_t m_eOverflowX : 3; - uint32_t m_eOverflowY : 3; - uint32_t m_eListStylePosition : 1; - uint32_t m_eBKGAttachment : 1; - uint32_t m_bHasMargin : 1; - uint32_t m_bHasBorder : 1; - uint32_t m_bHasPadding : 1; - uint32_t m_dwTextDecoration : 5; - uint32_t m_eTextCombine : 1; - uint32_t m_bColumnRuleColorSame : 1; - uint32_t m_bHasTextCombineNumber : 1; + FDE_CSSDisplay m_eDisplay; + FDE_CSSVerticalAlign m_eVerticalAlign; + uint8_t m_dwTextDecoration; + bool m_bHasMargin; + bool m_bHasBorder; + bool m_bHasPadding; }; class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, @@ -353,7 +201,6 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, uint32_t Release() override; // IFDE_CSSComputedStyle - void Reset() override; IFDE_CSSFontStyle* GetFontStyles() override; IFDE_CSSBoundaryStyle* GetBoundaryStyles() override; IFDE_CSSPositionStyle* GetPositionStyles() override; @@ -365,13 +212,13 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, int32_t CountFontFamilies() const override; const FX_WCHAR* GetFontFamily(int32_t index) const override; uint16_t GetFontWeight() const override; - FDE_CSSFONTVARIANT GetFontVariant() const override; - FDE_CSSFONTSTYLE GetFontStyle() const override; + FDE_CSSFontVariant GetFontVariant() const override; + FDE_CSSFontStyle GetFontStyle() const override; FX_FLOAT GetFontSize() const override; FX_ARGB GetColor() const override; void SetFontWeight(uint16_t wFontWeight) override; - void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) override; - void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) override; + void SetFontVariant(FDE_CSSFontVariant eFontVariant) override; + void SetFontStyle(FDE_CSSFontStyle eFontStyle) override; void SetFontSize(FX_FLOAT fFontSize) override; void SetColor(FX_ARGB dwFontColor) override; @@ -383,19 +230,19 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, void SetPaddingWidth(const FDE_CSSRECT& rect) override; // IFDE_CSSPositionStyle: - FDE_CSSDISPLAY GetDisplay() const override; + FDE_CSSDisplay GetDisplay() const override; // IFDE_CSSParagraphStyle: FX_FLOAT GetLineHeight() const override; const FDE_CSSLENGTH& GetTextIndent() const override; - FDE_CSSTEXTALIGN GetTextAlign() const override; - FDE_CSSVERTICALALIGN GetVerticalAlign() const override; + FDE_CSSTextAlign GetTextAlign() const override; + FDE_CSSVerticalAlign GetVerticalAlign() const override; FX_FLOAT GetNumberVerticalAlign() const override; uint32_t GetTextDecoration() const override; const FDE_CSSLENGTH& GetLetterSpacing() const override; void SetLineHeight(FX_FLOAT fLineHeight) override; void SetTextIndent(const FDE_CSSLENGTH& textIndent) override; - void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) override; + void SetTextAlign(FDE_CSSTextAlign eTextAlign) override; void SetNumberVerticalAlign(FX_FLOAT fAlign) override; void SetTextDecoration(uint32_t dwTextDecoration) override; void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) override; diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index 1779ad95f8..1c780cd1c1 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -91,13 +91,13 @@ void CFDE_CSSStyleSheet::Reset() { for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) { IFDE_CSSRule* pRule = m_RuleArray.GetAt(i); switch (pRule->GetType()) { - case FDE_CSSRULETYPE_Style: + case FDE_CSSRuleType::Style: static_cast(pRule)->~CFDE_CSSStyleRule(); break; - case FDE_CSSRULETYPE_Media: + case FDE_CSSRuleType::Media: static_cast(pRule)->~CFDE_CSSMediaRule(); break; - case FDE_CSSRULETYPE_FontFace: + case FDE_CSSRuleType::FontFace: static_cast(pRule)->~CFDE_CSSFontFaceRule(); break; default: @@ -171,40 +171,40 @@ bool CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, bool CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { Reset(); - FDE_CSSSYNTAXSTATUS eStatus; + FDE_CSSSyntaxStatus eStatus; do { switch (eStatus = pSyntax->DoSyntaxParse()) { - case FDE_CSSSYNTAXSTATUS_StyleRule: + case FDE_CSSSyntaxStatus::StyleRule: eStatus = LoadStyleRule(pSyntax, m_RuleArray); break; - case FDE_CSSSYNTAXSTATUS_MediaRule: + case FDE_CSSSyntaxStatus::MediaRule: eStatus = LoadMediaRule(pSyntax); break; - case FDE_CSSSYNTAXSTATUS_FontFaceRule: + case FDE_CSSSyntaxStatus::FontFaceRule: eStatus = LoadFontFaceRule(pSyntax, m_RuleArray); break; - case FDE_CSSSYNTAXSTATUS_ImportRule: + case FDE_CSSSyntaxStatus::ImportRule: eStatus = LoadImportRule(pSyntax); break; - case FDE_CSSSYNTAXSTATUS_PageRule: + case FDE_CSSSyntaxStatus::PageRule: eStatus = LoadPageRule(pSyntax); break; default: break; } - } while (eStatus >= FDE_CSSSYNTAXSTATUS_None); + } while (eStatus >= FDE_CSSSyntaxStatus::None); m_Selectors.RemoveAll(); m_StringCache.clear(); - return eStatus != FDE_CSSSYNTAXSTATUS_Error; + return eStatus != FDE_CSSSyntaxStatus::Error; } -FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( +FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadMediaRule( CFDE_CSSSyntaxParser* pSyntax) { uint32_t dwMediaList = 0; CFDE_CSSMediaRule* pMediaRule = nullptr; for (;;) { switch (pSyntax->DoSyntaxParse()) { - case FDE_CSSSYNTAXSTATUS_MediaType: { + case FDE_CSSSyntaxStatus::MediaType: { int32_t iLen; const FX_WCHAR* psz = pSyntax->GetCurrentString(iLen); const FDE_CSSMEDIATYPETABLE* pMediaType = @@ -212,58 +212,62 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadMediaRule( if (pMediaType) dwMediaList |= pMediaType->wValue; } break; - case FDE_CSSSYNTAXSTATUS_StyleRule: + case FDE_CSSSyntaxStatus::StyleRule: if (pMediaRule) { - FDE_CSSSYNTAXSTATUS eStatus = + FDE_CSSSyntaxStatus eStatus = LoadStyleRule(pSyntax, pMediaRule->GetArray()); - if (eStatus < FDE_CSSSYNTAXSTATUS_None) { + if (eStatus < FDE_CSSSyntaxStatus::None) { return eStatus; } } else { SkipRuleSet(pSyntax); } break; - case FDE_CSSSYNTAXSTATUS_DeclOpen: + case FDE_CSSSyntaxStatus::DeclOpen: if ((dwMediaList & m_dwMediaList) > 0 && !pMediaRule) { pMediaRule = new CFDE_CSSMediaRule(dwMediaList); m_RuleArray.Add(pMediaRule); } break; - case FDE_CSSSYNTAXSTATUS_DeclClose: - return FDE_CSSSYNTAXSTATUS_None; - FDE_CSSSWITCHDEFAULTS(); + case FDE_CSSSyntaxStatus::DeclClose: + return FDE_CSSSyntaxStatus::None; + case FDE_CSSSyntaxStatus::EOS: + return FDE_CSSSyntaxStatus::EOS; + case FDE_CSSSyntaxStatus::Error: + default: + return FDE_CSSSyntaxStatus::Error; } } } -FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( +FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadStyleRule( CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate& ruleArray) { m_Selectors.RemoveAt(0, m_Selectors.GetSize()); CFDE_CSSStyleRule* pStyleRule = nullptr; const FX_WCHAR* pszValue = nullptr; int32_t iValueLen = 0; - FDE_CSSPROPERTYARGS propertyArgs; + FDE_CSSPropertyArgs propertyArgs; propertyArgs.pStringCache = &m_StringCache; propertyArgs.pProperty = nullptr; CFX_WideString wsName; for (;;) { switch (pSyntax->DoSyntaxParse()) { - case FDE_CSSSYNTAXSTATUS_Selector: { + case FDE_CSSSyntaxStatus::Selector: { pszValue = pSyntax->GetCurrentString(iValueLen); CFDE_CSSSelector* pSelector = CFDE_CSSSelector::FromString(pszValue, iValueLen); if (pSelector) m_Selectors.Add(pSelector); } break; - case FDE_CSSSYNTAXSTATUS_PropertyName: + case FDE_CSSSyntaxStatus::PropertyName: pszValue = pSyntax->GetCurrentString(iValueLen); propertyArgs.pProperty = FDE_GetCSSPropertyByName(CFX_WideStringC(pszValue, iValueLen)); if (!propertyArgs.pProperty) wsName = CFX_WideStringC(pszValue, iValueLen); break; - case FDE_CSSSYNTAXSTATUS_PropertyValue: + case FDE_CSSSyntaxStatus::PropertyValue: if (propertyArgs.pProperty) { pszValue = pSyntax->GetCurrentString(iValueLen); if (iValueLen > 0) { @@ -279,44 +283,48 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( } } break; - case FDE_CSSSYNTAXSTATUS_DeclOpen: + case FDE_CSSSyntaxStatus::DeclOpen: if (!pStyleRule && m_Selectors.GetSize() > 0) { pStyleRule = new CFDE_CSSStyleRule; pStyleRule->SetSelector(m_Selectors); ruleArray.Add(pStyleRule); } else { SkipRuleSet(pSyntax); - return FDE_CSSSYNTAXSTATUS_None; + return FDE_CSSSyntaxStatus::None; } break; - case FDE_CSSSYNTAXSTATUS_DeclClose: + case FDE_CSSSyntaxStatus::DeclClose: if (pStyleRule && !pStyleRule->GetDeclImp().GetStartPosition()) { pStyleRule->~CFDE_CSSStyleRule(); ruleArray.RemoveLast(1); } - return FDE_CSSSYNTAXSTATUS_None; - FDE_CSSSWITCHDEFAULTS(); + return FDE_CSSSyntaxStatus::None; + case FDE_CSSSyntaxStatus::EOS: + return FDE_CSSSyntaxStatus::EOS; + case FDE_CSSSyntaxStatus::Error: + default: + return FDE_CSSSyntaxStatus::Error; } } } -FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule( +FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadFontFaceRule( CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate& ruleArray) { CFDE_CSSFontFaceRule* pFontFaceRule = nullptr; const FX_WCHAR* pszValue = nullptr; int32_t iValueLen = 0; - FDE_CSSPROPERTYARGS propertyArgs; + FDE_CSSPropertyArgs propertyArgs; propertyArgs.pStringCache = &m_StringCache; propertyArgs.pProperty = nullptr; for (;;) { switch (pSyntax->DoSyntaxParse()) { - case FDE_CSSSYNTAXSTATUS_PropertyName: + case FDE_CSSSyntaxStatus::PropertyName: pszValue = pSyntax->GetCurrentString(iValueLen); propertyArgs.pProperty = FDE_GetCSSPropertyByName(CFX_WideStringC(pszValue, iValueLen)); break; - case FDE_CSSSYNTAXSTATUS_PropertyValue: + case FDE_CSSSyntaxStatus::PropertyValue: if (propertyArgs.pProperty) { pszValue = pSyntax->GetCurrentString(iValueLen); if (iValueLen > 0) { @@ -325,49 +333,61 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadFontFaceRule( } } break; - case FDE_CSSSYNTAXSTATUS_DeclOpen: + case FDE_CSSSyntaxStatus::DeclOpen: if (!pFontFaceRule) { pFontFaceRule = new CFDE_CSSFontFaceRule; ruleArray.Add(pFontFaceRule); } break; - case FDE_CSSSYNTAXSTATUS_DeclClose: - return FDE_CSSSYNTAXSTATUS_None; - FDE_CSSSWITCHDEFAULTS(); + case FDE_CSSSyntaxStatus::DeclClose: + return FDE_CSSSyntaxStatus::None; + case FDE_CSSSyntaxStatus::EOS: + return FDE_CSSSyntaxStatus::EOS; + case FDE_CSSSyntaxStatus::Error: + default: + return FDE_CSSSyntaxStatus::Error; } } } -FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadImportRule( +FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadImportRule( CFDE_CSSSyntaxParser* pSyntax) { for (;;) { switch (pSyntax->DoSyntaxParse()) { - case FDE_CSSSYNTAXSTATUS_ImportClose: - return FDE_CSSSYNTAXSTATUS_None; - case FDE_CSSSYNTAXSTATUS_URI: + case FDE_CSSSyntaxStatus::ImportClose: + return FDE_CSSSyntaxStatus::None; + case FDE_CSSSyntaxStatus::URI: break; - FDE_CSSSWITCHDEFAULTS(); + case FDE_CSSSyntaxStatus::EOS: + return FDE_CSSSyntaxStatus::EOS; + case FDE_CSSSyntaxStatus::Error: + default: + return FDE_CSSSyntaxStatus::Error; } } } -FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadPageRule( +FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::LoadPageRule( CFDE_CSSSyntaxParser* pSyntax) { return SkipRuleSet(pSyntax); } -FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::SkipRuleSet( +FDE_CSSSyntaxStatus CFDE_CSSStyleSheet::SkipRuleSet( CFDE_CSSSyntaxParser* pSyntax) { for (;;) { switch (pSyntax->DoSyntaxParse()) { - case FDE_CSSSYNTAXSTATUS_Selector: - case FDE_CSSSYNTAXSTATUS_DeclOpen: - case FDE_CSSSYNTAXSTATUS_PropertyName: - case FDE_CSSSYNTAXSTATUS_PropertyValue: + case FDE_CSSSyntaxStatus::Selector: + case FDE_CSSSyntaxStatus::DeclOpen: + case FDE_CSSSyntaxStatus::PropertyName: + case FDE_CSSSyntaxStatus::PropertyValue: break; - case FDE_CSSSYNTAXSTATUS_DeclClose: - return FDE_CSSSYNTAXSTATUS_None; - FDE_CSSSWITCHDEFAULTS(); + case FDE_CSSSyntaxStatus::DeclClose: + return FDE_CSSSyntaxStatus::None; + case FDE_CSSSyntaxStatus::EOS: + return FDE_CSSSyntaxStatus::EOS; + case FDE_CSSSyntaxStatus::Error: + default: + return FDE_CSSSyntaxStatus::Error; } } } @@ -405,8 +425,8 @@ CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) { IFDE_CSSRule* pRule = m_RuleArray.GetAt(i); switch (pRule->GetType()) { - case FDE_CSSRULETYPE_Style: - ((CFDE_CSSStyleRule*)pRule)->~CFDE_CSSStyleRule(); + case FDE_CSSRuleType::Style: + static_cast(pRule)->~CFDE_CSSStyleRule(); break; default: ASSERT(false); @@ -459,7 +479,7 @@ int32_t FDE_GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { return psz - pStart; } -CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSELECTORTYPE eType, +CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSelectorType eType, const FX_WCHAR* psz, int32_t iLen, bool bIgnoreCase) @@ -467,7 +487,7 @@ CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSELECTORTYPE eType, m_dwHash(FX_HashCode_GetW(CFX_WideStringC(psz, iLen), bIgnoreCase)), m_pNext(nullptr) {} -FDE_CSSSELECTORTYPE CFDE_CSSSelector::GetType() const { +FDE_CSSSelectorType CFDE_CSSSelector::GetType() const { return m_eType; } @@ -503,12 +523,12 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( if (wch == '.' || wch == '#') { if (psz == pStart || psz[-1] == ' ') { CFDE_CSSSelector* p = - new CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, L"*", 1, true); + new CFDE_CSSSelector(FDE_CSSSelectorType::Element, L"*", 1, true); if (!p) return nullptr; if (pFirst) { - pFirst->SetType(FDE_CSSSELECTORTYPE_Descendant); + pFirst->SetType(FDE_CSSSelectorType::Descendant); p->SetNext(pFirst); } pFirst = pLast = p; @@ -518,8 +538,8 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( if (iNameLen == 0) { return nullptr; } - FDE_CSSSELECTORTYPE eType = - wch == '.' ? FDE_CSSSELECTORTYPE_Class : FDE_CSSSELECTORTYPE_ID; + FDE_CSSSelectorType eType = + wch == '.' ? FDE_CSSSelectorType::Class : FDE_CSSSelectorType::ID; CFDE_CSSSelector* p = new CFDE_CSSSelector(eType, psz, iNameLen, false); if (!p) return nullptr; @@ -533,13 +553,13 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( if (iNameLen == 0) { return nullptr; } - CFDE_CSSSelector* p = new CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Element, + CFDE_CSSSelector* p = new CFDE_CSSSelector(FDE_CSSSelectorType::Element, psz, iNameLen, true); if (!p) return nullptr; if (pFirst) { - pFirst->SetType(FDE_CSSSELECTORTYPE_Descendant); + pFirst->SetType(FDE_CSSSelectorType::Descendant); p->SetNext(pFirst); } pFirst = p; @@ -550,8 +570,8 @@ CFDE_CSSSelector* CFDE_CSSSelector::FromString( if (iNameLen == 0) { return nullptr; } - CFDE_CSSSelector* p = - new CFDE_CSSSelector(FDE_CSSSELECTORTYPE_Pseudo, psz, iNameLen, true); + CFDE_CSSSelector* p = new CFDE_CSSSelector(FDE_CSSSelectorType::Pseudo, + psz, iNameLen, true); if (!p) return nullptr; diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index a67c2d816f..c00be4384a 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -17,12 +17,12 @@ class CFDE_CSSSyntaxParser; class CFDE_CSSSelector { public: - CFDE_CSSSelector(FDE_CSSSELECTORTYPE eType, + CFDE_CSSSelector(FDE_CSSSelectorType eType, const FX_WCHAR* psz, int32_t iLen, bool bIgnoreCase); - virtual FDE_CSSSELECTORTYPE GetType() const; + virtual FDE_CSSSelectorType GetType() const; virtual uint32_t GetNameHash() const; virtual CFDE_CSSSelector* GetNextSelector() const; @@ -31,9 +31,9 @@ class CFDE_CSSSelector { void SetNext(CFDE_CSSSelector* pNext) { m_pNext = pNext; } protected: - void SetType(FDE_CSSSELECTORTYPE eType) { m_eType = eType; } + void SetType(FDE_CSSSelectorType eType) { m_eType = eType; } - FDE_CSSSELECTORTYPE m_eType; + FDE_CSSSelectorType m_eType; uint32_t m_dwHash; CFDE_CSSSelector* m_pNext; }; @@ -84,13 +84,6 @@ class CFDE_CSSFontFaceRule : public IFDE_CSSFontFaceRule { CFDE_CSSDeclaration m_Declaration; }; -#define FDE_CSSSWITCHDEFAULTS() \ - case FDE_CSSSYNTAXSTATUS_EOS: \ - return FDE_CSSSYNTAXSTATUS_EOS; \ - case FDE_CSSSYNTAXSTATUS_Error: \ - default: \ - return FDE_CSSSYNTAXSTATUS_Error; - class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet { public: explicit CFDE_CSSStyleSheet(uint32_t dwMediaList); @@ -118,16 +111,16 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet { protected: void Reset(); bool LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); - FDE_CSSSYNTAXSTATUS LoadStyleRule( + FDE_CSSSyntaxStatus LoadStyleRule( CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate& ruleArray); - FDE_CSSSYNTAXSTATUS LoadImportRule(CFDE_CSSSyntaxParser* pSyntax); - FDE_CSSSYNTAXSTATUS LoadPageRule(CFDE_CSSSyntaxParser* pSyntax); - FDE_CSSSYNTAXSTATUS LoadMediaRule(CFDE_CSSSyntaxParser* pSyntax); - FDE_CSSSYNTAXSTATUS LoadFontFaceRule( + FDE_CSSSyntaxStatus LoadImportRule(CFDE_CSSSyntaxParser* pSyntax); + FDE_CSSSyntaxStatus LoadPageRule(CFDE_CSSSyntaxParser* pSyntax); + FDE_CSSSyntaxStatus LoadMediaRule(CFDE_CSSSyntaxParser* pSyntax); + FDE_CSSSyntaxStatus LoadFontFaceRule( CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate& ruleArray); - FDE_CSSSYNTAXSTATUS SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); + FDE_CSSSyntaxStatus SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); uint16_t m_wCodePage; uint16_t m_wRefCount; uint32_t m_dwMediaList; diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp index 50ad190857..f25eb4b115 100644 --- a/xfa/fde/css/fde_csssyntax.cpp +++ b/xfa/fde/css/fde_csssyntax.cpp @@ -27,7 +27,7 @@ CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser() m_iTextDatLen(0), m_dwCheck((uint32_t)-1), m_eMode(FDE_CSSSYNTAXMODE_RuleSet), - m_eStatus(FDE_CSSSYNTAXSTATUS_None), + m_eStatus(FDE_CSSSyntaxStatus::None), m_ModeStack(100) {} CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { @@ -68,20 +68,22 @@ void CFDE_CSSSyntaxParser::Reset(bool bOnlyDeclaration) { m_iStreamPos = 0; m_iTextDatLen = 0; m_dwCheck = (uint32_t)-1; - m_eStatus = FDE_CSSSYNTAXSTATUS_None; + m_eStatus = FDE_CSSSyntaxStatus::None; m_eMode = bOnlyDeclaration ? FDE_CSSSYNTAXMODE_PropertyName : FDE_CSSSYNTAXMODE_RuleSet; } -FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { - while (m_eStatus >= FDE_CSSSYNTAXSTATUS_None) { +FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() { + while (m_eStatus >= FDE_CSSSyntaxStatus::None) { if (m_TextPlane.IsEOF()) { if (!m_pStream) { if (m_eMode == FDE_CSSSYNTAXMODE_PropertyValue && m_TextData.GetLength() > 0) { SaveTextData(); - return m_eStatus = FDE_CSSSYNTAXSTATUS_PropertyValue; + m_eStatus = FDE_CSSSyntaxStatus::PropertyValue; + return m_eStatus; } - return m_eStatus = FDE_CSSSYNTAXSTATUS_EOS; + m_eStatus = FDE_CSSSyntaxStatus::EOS; + return m_eStatus; } bool bEOS; int32_t iLen = m_TextPlane.LoadFromStream(m_pStream, m_iStreamPos, @@ -91,9 +93,11 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { if (m_eMode == FDE_CSSSYNTAXMODE_PropertyValue && m_TextData.GetLength() > 0) { SaveTextData(); - return m_eStatus = FDE_CSSSYNTAXSTATUS_PropertyValue; + m_eStatus = FDE_CSSSyntaxStatus::PropertyValue; + return m_eStatus; } - return m_eStatus = FDE_CSSSYNTAXSTATUS_EOS; + m_eStatus = FDE_CSSSyntaxStatus::EOS; + return m_eStatus; } } FX_WCHAR wch; @@ -109,9 +113,10 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { case '}': m_TextPlane.MoveNext(); if (RestoreMode()) { - return FDE_CSSSYNTAXSTATUS_DeclClose; + return FDE_CSSSyntaxStatus::DeclClose; } else { - return m_eStatus = FDE_CSSSYNTAXSTATUS_Error; + m_eStatus = FDE_CSSSyntaxStatus::Error; + return m_eStatus; } break; case '/': @@ -125,9 +130,10 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextPlane.MoveNext(); } else if (FDE_IsSelectorStart(wch)) { SwitchMode(FDE_CSSSYNTAXMODE_Selector); - return FDE_CSSSYNTAXSTATUS_StyleRule; + return FDE_CSSSyntaxStatus::StyleRule; } else { - return m_eStatus = FDE_CSSSYNTAXSTATUS_Error; + m_eStatus = FDE_CSSSyntaxStatus::Error; + return m_eStatus; } break; } @@ -138,24 +144,24 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextPlane.MoveNext(); SwitchMode(FDE_CSSSYNTAXMODE_Selector); if (m_iTextDatLen > 0) { - return FDE_CSSSYNTAXSTATUS_Selector; + return FDE_CSSSyntaxStatus::Selector; } break; case '{': if (m_TextData.GetLength() > 0) { SaveTextData(); - return FDE_CSSSYNTAXSTATUS_Selector; + return FDE_CSSSyntaxStatus::Selector; } else { m_TextPlane.MoveNext(); m_ModeStack.Push(FDE_CSSSYNTAXMODE_RuleSet); SwitchMode(FDE_CSSSYNTAXMODE_PropertyName); - return FDE_CSSSYNTAXSTATUS_DeclOpen; + return FDE_CSSSyntaxStatus::DeclOpen; } break; case '/': if (m_TextPlane.GetNextChar() == '*') { if (SwitchToComment() > 0) { - return FDE_CSSSYNTAXSTATUS_Selector; + return FDE_CSSSyntaxStatus::Selector; } break; } @@ -169,19 +175,20 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { case ':': m_TextPlane.MoveNext(); SwitchMode(FDE_CSSSYNTAXMODE_PropertyValue); - return FDE_CSSSYNTAXSTATUS_PropertyName; + return FDE_CSSSyntaxStatus::PropertyName; case '}': m_TextPlane.MoveNext(); if (RestoreMode()) { - return FDE_CSSSYNTAXSTATUS_DeclClose; + return FDE_CSSSyntaxStatus::DeclClose; } else { - return m_eStatus = FDE_CSSSYNTAXSTATUS_Error; + m_eStatus = FDE_CSSSyntaxStatus::Error; + return m_eStatus; } break; case '/': if (m_TextPlane.GetNextChar() == '*') { if (SwitchToComment() > 0) { - return FDE_CSSSYNTAXSTATUS_PropertyName; + return FDE_CSSSyntaxStatus::PropertyName; } break; } @@ -196,11 +203,11 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextPlane.MoveNext(); case '}': SwitchMode(FDE_CSSSYNTAXMODE_PropertyName); - return FDE_CSSSYNTAXSTATUS_PropertyValue; + return FDE_CSSSyntaxStatus::PropertyValue; case '/': if (m_TextPlane.GetNextChar() == '*') { if (SwitchToComment() > 0) { - return FDE_CSSSYNTAXSTATUS_PropertyValue; + return FDE_CSSSyntaxStatus::PropertyValue; } break; } @@ -224,33 +231,37 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextPlane.MoveNext(); SwitchMode(FDE_CSSSYNTAXMODE_MediaType); if (m_iTextDatLen > 0) { - return FDE_CSSSYNTAXSTATUS_MediaType; + return FDE_CSSSyntaxStatus::MediaType; } break; case '{': { FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement(); - if (!pMode || *pMode != FDE_CSSSYNTAXMODE_MediaRule) - return m_eStatus = FDE_CSSSYNTAXSTATUS_Error; + if (!pMode || *pMode != FDE_CSSSYNTAXMODE_MediaRule) { + m_eStatus = FDE_CSSSyntaxStatus::Error; + return m_eStatus; + } if (m_TextData.GetLength() > 0) { SaveTextData(); - return FDE_CSSSYNTAXSTATUS_MediaType; + return FDE_CSSSyntaxStatus::MediaType; } else { m_TextPlane.MoveNext(); *pMode = FDE_CSSSYNTAXMODE_RuleSet; SwitchMode(FDE_CSSSYNTAXMODE_RuleSet); - return FDE_CSSSYNTAXSTATUS_DeclOpen; + return FDE_CSSSyntaxStatus::DeclOpen; } } break; case ';': { FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement(); - if (!pMode || *pMode != FDE_CSSSYNTAXMODE_Import) - return m_eStatus = FDE_CSSSYNTAXSTATUS_Error; + if (!pMode || *pMode != FDE_CSSSYNTAXMODE_Import) { + m_eStatus = FDE_CSSSyntaxStatus::Error; + return m_eStatus; + } if (m_TextData.GetLength() > 0) { SaveTextData(); if (IsImportEnabled()) { - return FDE_CSSSYNTAXSTATUS_MediaType; + return FDE_CSSSyntaxStatus::MediaType; } } else { bool bEnabled = IsImportEnabled(); @@ -259,14 +270,14 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { SwitchMode(FDE_CSSSYNTAXMODE_RuleSet); if (bEnabled) { DisableImport(); - return FDE_CSSSYNTAXSTATUS_ImportClose; + return FDE_CSSSyntaxStatus::ImportClose; } } } break; case '/': if (m_TextPlane.GetNextChar() == '*') { if (SwitchToComment() > 0) { - return FDE_CSSSYNTAXSTATUS_MediaType; + return FDE_CSSSyntaxStatus::MediaType; } break; } @@ -277,8 +288,10 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { break; case FDE_CSSSYNTAXMODE_URI: { FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement(); - if (!pMode || *pMode != FDE_CSSSYNTAXMODE_Import) - return m_eStatus = FDE_CSSSYNTAXSTATUS_Error; + if (!pMode || *pMode != FDE_CSSSYNTAXMODE_Import) { + m_eStatus = FDE_CSSSyntaxStatus::Error; + return m_eStatus; + } if (wch <= ' ' || wch == ';') { int32_t iURIStart, iURILength = m_TextData.GetLength(); @@ -287,7 +300,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextData.Subtract(iURIStart, iURILength); SwitchMode(FDE_CSSSYNTAXMODE_MediaType); if (IsImportEnabled()) - return FDE_CSSSYNTAXSTATUS_URI; + return FDE_CSSSyntaxStatus::URI; break; } } @@ -305,20 +318,20 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_ModeStack.Push(FDE_CSSSYNTAXMODE_Import); SwitchMode(FDE_CSSSYNTAXMODE_URI); if (IsImportEnabled()) { - return FDE_CSSSYNTAXSTATUS_ImportRule; + return FDE_CSSSyntaxStatus::ImportRule; } else { break; } } else if (FXSYS_wcsncmp(L"media", psz, iLen) == 0) { m_ModeStack.Push(FDE_CSSSYNTAXMODE_MediaRule); SwitchMode(FDE_CSSSYNTAXMODE_MediaType); - return FDE_CSSSYNTAXSTATUS_MediaRule; + return FDE_CSSSyntaxStatus::MediaRule; } else if (FXSYS_wcsncmp(L"font-face", psz, iLen) == 0) { SwitchMode(FDE_CSSSYNTAXMODE_Selector); - return FDE_CSSSYNTAXSTATUS_FontFaceRule; + return FDE_CSSSyntaxStatus::FontFaceRule; } else if (FXSYS_wcsncmp(L"page", psz, iLen) == 0) { SwitchMode(FDE_CSSSYNTAXMODE_Selector); - return FDE_CSSSYNTAXSTATUS_PageRule; + return FDE_CSSSyntaxStatus::PageRule; } else { SwitchMode(FDE_CSSSYNTAXMODE_UnknownRule); } @@ -339,7 +352,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_pStream->SetCodePage(wCodePage); } } - return FDE_CSSSYNTAXSTATUS_Charset; + return FDE_CSSSyntaxStatus::Charset; } } } else { diff --git a/xfa/fde/css/fde_csssyntax.h b/xfa/fde/css/fde_csssyntax.h index 993eb4c7dc..c7578e170b 100644 --- a/xfa/fde/css/fde_csssyntax.h +++ b/xfa/fde/css/fde_csssyntax.h @@ -88,7 +88,7 @@ class CFDE_CSSSyntaxParser { int32_t iBufferSize, int32_t iTextDatSize = 32, bool bOnlyDeclaration = false); - FDE_CSSSYNTAXSTATUS DoSyntaxParse(); + FDE_CSSSyntaxStatus DoSyntaxParse(); const FX_WCHAR* GetCurrentString(int32_t& iLength) const; protected: @@ -114,7 +114,7 @@ class CFDE_CSSSyntaxParser { int32_t m_iTextDatLen; uint32_t m_dwCheck; FDE_CSSSYNTAXMODE m_eMode; - FDE_CSSSYNTAXSTATUS m_eStatus; + FDE_CSSSyntaxStatus m_eStatus; CFX_StackTemplate m_ModeStack; }; -- cgit v1.2.3