diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-12 10:27:16 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-12 19:22:47 +0000 |
commit | 98d00b230aa14924dfde2eba3aaf69f86d18a45b (patch) | |
tree | f52e00fa9e69be083ecbfcdf795d534e79f07005 /xfa/fde/css | |
parent | 6cf5ecae75a5cd6fea9ae7f4e28cc28abb3e69c6 (diff) | |
download | pdfium-chromium/2980.tar.xz |
Remove used items from the CSS code.chromium/2980
This Cl cleans up the property and property value definitions which are never
used in the FDE CSS parser code. A few other unused methods are also removed.
Change-Id: Ib5a316d9c877d87f1d5e0003de4d85d59eab087a
Reviewed-on: https://pdfium-review.googlesource.com/2175
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css')
-rw-r--r-- | xfa/fde/css/fde_css.h | 218 | ||||
-rw-r--r-- | xfa/fde/css/fde_csscache.cpp | 9 | ||||
-rw-r--r-- | xfa/fde/css/fde_csscache.h | 15 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.cpp | 300 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdeclaration.cpp | 720 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssdeclaration.h | 48 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.cpp | 61 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstyleselector.h | 7 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.cpp | 62 | ||||
-rw-r--r-- | xfa/fde/css/fde_cssstylesheet.h | 4 |
10 files changed, 87 insertions, 1357 deletions
diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 88b0fe2db4..42662cfb73 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -26,15 +26,17 @@ class IFDE_CSSStyleSheet; class IFDE_CSSValue; class IFDE_CSSValueList; -#define FDE_CSSMEDIATYPE_Braille 0x01 -#define FDE_CSSMEDIATYPE_Emboss 0x02 -#define FDE_CSSMEDIATYPE_Handheld 0x04 -#define FDE_CSSMEDIATYPE_Print 0x08 -#define FDE_CSSMEDIATYPE_Projection 0x10 -#define FDE_CSSMEDIATYPE_Screen 0x20 -#define FDE_CSSMEDIATYPE_TTY 0x40 -#define FDE_CSSMEDIATYPE_TV 0x80 -#define FDE_CSSMEDIATYPE_ALL 0xFF +enum FDE_CSSMEDIATYPE { + FDE_CSSMEDIATYPE_Braille = 0x01, + FDE_CSSMEDIATYPE_Emboss = 0x02, + FDE_CSSMEDIATYPE_Handheld = 0x04, + FDE_CSSMEDIATYPE_Print = 0x08, + FDE_CSSMEDIATYPE_Projection = 0x10, + FDE_CSSMEDIATYPE_Screen = 0x20, + FDE_CSSMEDIATYPE_TTY = 0x40, + FDE_CSSMEDIATYPE_TV = 0x80, + FDE_CSSMEDIATYPE_ALL = 0xFF, +}; enum FDE_CSSVALUETYPE { FDE_CSSVALUETYPE_Primitive = 1 << 0, @@ -70,280 +72,94 @@ enum class FDE_CSSPrimitiveType : uint8_t { 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 + LAST_MARKER }; enum class FDE_CSSProperty : uint8_t { - WritingMode, - ColumnRuleWidth, - BorderLeft, - ColumnRule, - Height, - CounterReset, - Content, - RubyPosition, - BackgroundColor, - Width, - Src, + BorderLeft = 0, 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 + LAST_MARKER }; enum class FDE_CSSPseudo : uint8_t { After, Before, NONE }; @@ -512,12 +328,6 @@ class IFDE_CSSFontFaceRule : public IFDE_CSSRule { class IFDE_CSSStyleSheet : public IFX_Retainable { public: - static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet(); - static IFDE_CSSStyleSheet* LoadFromStream( - const CFX_WideString& szUrl, - const CFX_RetainPtr<IFGAS_Stream>& pStream, - uint16_t wCodePage, - uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); static IFDE_CSSStyleSheet* LoadFromBuffer( const CFX_WideString& szUrl, const FX_WCHAR* pBuffer, diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp index bf00fbbd46..bf4176b787 100644 --- a/xfa/fde/css/fde_csscache.cpp +++ b/xfa/fde/css/fde_csscache.cpp @@ -11,15 +11,6 @@ #include "core/fxcrt/fx_ext.h" #include "xfa/fxfa/app/cxfa_csstagprovider.h" -FDE_CSSCacheItem::FDE_CSSCacheItem(IFDE_CSSStyleSheet* p) - : pStylesheet(p), dwActivity(0) { - pStylesheet->Retain(); -} - -FDE_CSSCacheItem::~FDE_CSSCacheItem() { - pStylesheet->Release(); -} - FDE_CSSTagCache::FDE_CSSTagCache(FDE_CSSTagCache* parent, CXFA_CSSTagProvider* tag) : pTag(tag), diff --git a/xfa/fde/css/fde_csscache.h b/xfa/fde/css/fde_csscache.h index 40494fade5..0ddaf39565 100644 --- a/xfa/fde/css/fde_csscache.h +++ b/xfa/fde/css/fde_csscache.h @@ -11,15 +11,6 @@ #include "xfa/fde/css/fde_css.h" -class FDE_CSSCacheItem { - public: - explicit FDE_CSSCacheItem(IFDE_CSSStyleSheet* p); - ~FDE_CSSCacheItem(); - - IFDE_CSSStyleSheet* pStylesheet; - uint32_t dwActivity; -}; - class FDE_CSSTagCache { public: FDE_CSSTagCache(FDE_CSSTagCache* parent, CXFA_CSSTagProvider* tag); @@ -28,11 +19,9 @@ class FDE_CSSTagCache { FDE_CSSTagCache* GetParent() const { return pParent; } CXFA_CSSTagProvider* GetTag() const { return pTag; } - uint32_t HashID() const { return dwIDHash; } uint32_t HashTag() const { return dwTagHash; } int32_t CountHashClass() const { return dwClassHashs.GetSize(); } - void SetClassIndex(int32_t index) { iClassIndex = index; } uint32_t HashClass() const { return iClassIndex < dwClassHashs.GetSize() @@ -40,7 +29,7 @@ class FDE_CSSTagCache { : 0; } - protected: + private: CXFA_CSSTagProvider* pTag; FDE_CSSTagCache* pParent; uint32_t dwIDHash; @@ -61,7 +50,7 @@ class CFDE_CSSAccelerator { FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } - protected: + private: CFX_ObjectStackTemplate<FDE_CSSTagCache> m_Stack; }; diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 910f7f4be0..7421f407b5 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -104,61 +104,21 @@ uint32_t FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) { } 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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::BorderLeft, L"border-left", 0x04080036, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::ColumnRule, L"column-rule", 0x04C83DF3, - FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::Height, L"height", 0x05A5C519, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, - {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_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeURI | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSProperty::RubyPosition, L"ruby-position", 0x09ACD024, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::BackgroundColor, L"background-color", 0x09E8E8AC, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSProperty::Width, L"width", 0x0A8A8F80, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, - {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_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::BorderColor, L"border-color", 0x0CBB528A, - FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSProperty::Widows, L"widows", 0x1026C59D, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::Right, L"right", 0x193ADE3E, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::ColumnWidth, L"column-width", 0x24C9AC9B, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::MarginLeft, L"margin-left", 0x297C5656, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, @@ -166,145 +126,49 @@ static const FDE_CSSPropertyTable g_FDE_CSSProperties[] = { FDE_CSSVALUETYPE_Shorthand}, {FDE_CSSProperty::BorderTop, L"border-top", 0x2B866ADE, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::RubyOverhang, L"ruby-overhang", 0x2CCA0D89, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::PageBreakBefore, L"page-break-before", 0x3119B36F, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::MaxHeight, L"max-height", 0x343597EC, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::MinWidth, L"min-width", 0x35832871, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::BorderLeftColor, L"border-left-color", 0x35C64022, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeColor}, {FDE_CSSProperty::Bottom, L"bottom", 0x399F02B5, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::Quotes, L"quotes", 0x3D8C6A01, - FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSProperty::MaxWidth, L"max-width", 0x3EA274F3, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::PaddingRight, L"padding-right", 0x3F616AC2, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::BorderBottom, L"border-bottom", 0x452CE780, FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::ListStyleType, L"list-style-type", 0x48094789, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::WordBreak, L"word-break", 0x4D74A3CE, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::OverflowX, L"overflow-x", 0x4ECEBF99, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::OverflowY, L"overflow-y", 0x4ECEBF9A, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {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_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSProperty::Cursor, L"cursor", 0x59DFCA5E, - FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeString}, - {FDE_CSSProperty::RubyAlign, L"ruby-align", 0x6077BDFA, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::BorderRightStyle, L"border-right-style", 0x6920DDA7, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::MinHeight, L"min-height", 0x6AAE312A, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::Color, L"color", 0x6E67921F, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeColor}, {FDE_CSSProperty::LetterSpacing, L"letter-spacing", 0x70536102, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::EmptyCells, L"empty-cells", 0x7531528F, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::TextAlign, L"text-align", 0x7553F1BD, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::RubySpan, L"ruby-span", 0x76FCFCE1, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeFunction}, - {FDE_CSSProperty::Position, L"position", 0x814F82B5, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::BorderStyle, L"border-style", 0x82A4CD5C, - FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::BorderBottomStyle, L"border-bottom-style", 0x88079DBE, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::BorderCollapse, L"border-collapse", 0x8883C7FE, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::UnicodeBidi, L"unicode-bidi", 0x91670F6C, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::VerticalAlign, L"vertical-align", 0x934A87D2, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::PaddingTop, L"padding-top", 0x959D22B7, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::Columns, L"columns", 0x96FA5D81, - FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::Overflow, L"overflow", 0x97B76B54, - FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::TableLayout, L"table-layout", 0x9B1CB4B3, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::FontVariant, L"font-variant", 0x9C785779, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::ListStyle, L"list-style", 0x9E6C471A, - FDE_CSSVALUETYPE_Shorthand}, - {FDE_CSSProperty::BackgroundPosition, L"background-position", 0xA8846D22, - FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeColor}, - {FDE_CSSProperty::BorderLeftStyle, L"border-left-style", 0xABAFBAF4, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::PageBreakInside, L"page-break-inside", 0xACB695F8, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::TextEmphasis, L"text-emphasis", 0xAD0E580C, - FDE_CSSVALUETYPE_Shorthand}, {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::Orphans, L"orphans", 0xB716467B, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::BorderRight, L"border-right", 0xB78E9EA9, FDE_CSSVALUETYPE_Shorthand}, {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::CaptionSide, L"caption-side", 0xC03F3560, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::BackgroundRepeat, L"background-repeat", 0xC2C2FDCE, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::BorderTopStyle, L"border-top-style", 0xC6F3339C, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::BorderSpacing, L"border-spacing", 0xC72030F0, FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeNumber}, - {FDE_CSSProperty::TextTransform, L"text-transform", 0xC88EEA6E, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::FontStyle, L"font-style", 0xCB1950F5, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::Font, L"font", 0xCD308B77, FDE_CSSVALUETYPE_Shorthand}, @@ -314,47 +178,19 @@ static const FDE_CSSPropertyTable g_FDE_CSSProperties[] = { {FDE_CSSProperty::MarginRight, L"margin-right", 0xD13C58C9, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::Float, L"float", 0xD1532876, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {FDE_CSSProperty::BorderLeftWidth, L"border-left-width", 0xD1E93D83, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, {FDE_CSSProperty::Display, L"display", 0xD4224C36, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::Clear, L"clear", 0xD8ED1467, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::ColumnRuleStyle, L"column-rule-style", 0xDBC77871, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::Visibility, L"visibility", 0xE29F5168, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeURI}, - {FDE_CSSProperty::LineBreak, L"line-break", 0xEA2D1D9A, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::Background, L"background", 0xEB49DD40, - FDE_CSSVALUETYPE_Shorthand}, {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_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, - {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_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | - FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeString}, {FDE_CSSProperty::Left, L"left", 0xF5AD782B, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | FDE_CSSVALUETYPE_MaybeNumber}, @@ -368,184 +204,73 @@ static const FDE_CSSPropertyTable g_FDE_CSSProperties[] = { {FDE_CSSProperty::MarginTop, L"margin-top", 0xFE51DCFE, FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeEnum}, - {FDE_CSSProperty::Direction, L"direction", 0xFE746E61, - FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, }; const int32_t g_iCSSPropertyCount = sizeof(g_FDE_CSSProperties) / sizeof(FDE_CSSPropertyTable); +static_assert(g_iCSSPropertyCount == + static_cast<int32_t>(FDE_CSSProperty::LAST_MARKER), + "Property table differs in size from property enum"); 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}, }; const int32_t g_iCSSPropertyValueCount = sizeof(g_FDE_CSSPropertyValues) / sizeof(FDE_CSSPropertyValueTable); +static_assert(g_iCSSPropertyValueCount == + static_cast<int32_t>(FDE_CSSPropertyValue::LAST_MARKER), + "Property value table differs in size from property value enum"); 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}, + {0xF09, FDE_CSSMEDIATYPE_Emboss}, {FDE_CSSMEDIATYPE_Screen}, + {0x536A, FDE_CSSMEDIATYPE_TV}, {0x741D, FDE_CSSMEDIATYPE_Projection}, + {0x76ED, FDE_CSSMEDIATYPE_Print}, {0x7CFB, FDE_CSSMEDIATYPE_Braille}, + {0x9578, FDE_CSSMEDIATYPE_Handheld}, {0xC8E1, FDE_CSSMEDIATYPE_TTY}, + {0xD0F9, FDE_CSSMEDIATYPE_ALL}, }; + static const FDE_CSSLengthUnitTable g_FDE_CSSLengthUnits[] = { {0x0672, FDE_CSSPrimitiveType::EMS}, {0x067D, FDE_CSSPrimitiveType::EXS}, @@ -556,6 +281,7 @@ static const FDE_CSSLengthUnitTable g_FDE_CSSLengthUnits[] = { {0x3EE8, FDE_CSSPrimitiveType::Pixels}, {0xFC30, FDE_CSSPrimitiveType::CentiMeters}, }; + static const FDE_CSSCOLORTABLE g_FDE_CSSColors[] = { {0x031B47FE, 0xff000080}, {0x0BB8DF5B, 0xffff0000}, {0x0D82A78C, 0xff800000}, {0x2ACC82E8, 0xff00ffff}, diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index e723ee6801..23c92343d0 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -154,96 +154,57 @@ bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyArgs* pArgs, } } break; case FDE_CSSVALUETYPE_Shorthand: { - IFDE_CSSValue *pColor, *pStyle, *pWidth; + IFDE_CSSValue* pWidth; switch (pArgs->pProperty->eName) { case FDE_CSSProperty::Font: return ParseFontProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSProperty::Background: - return ParseBackgroundProperty(pArgs, pszValue, iValueLen, - bImportant); - case FDE_CSSProperty::ListStyle: - return ParseListStyleProperty(pArgs, pszValue, iValueLen, bImportant); 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); - AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSProperty::BorderTopColor, - FDE_CSSProperty::BorderTopStyle, - FDE_CSSProperty::BorderTopWidth); - AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSProperty::BorderRightColor, - FDE_CSSProperty::BorderRightStyle, - FDE_CSSProperty::BorderRightWidth); - AddBorderProperty(pColor, pStyle, pWidth, bImportant, - FDE_CSSProperty::BorderBottomColor, - FDE_CSSProperty::BorderBottomStyle, - FDE_CSSProperty::BorderBottomWidth); + if (ParseBorderProperty(pszValue, iValueLen, pWidth)) { + AddPropertyHolder(FDE_CSSProperty::BorderLeftWidth, pWidth, + bImportant); + AddPropertyHolder(FDE_CSSProperty::BorderTopWidth, pWidth, + bImportant); + AddPropertyHolder(FDE_CSSProperty::BorderRightWidth, pWidth, + bImportant); + AddPropertyHolder(FDE_CSSProperty::BorderBottomWidth, pWidth, + bImportant); return true; } break; 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); + if (ParseBorderProperty(pszValue, iValueLen, pWidth)) { + AddPropertyHolder(FDE_CSSProperty::BorderLeftWidth, pWidth, + bImportant); return true; } break; 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); + if (ParseBorderProperty(pszValue, iValueLen, pWidth)) { + AddPropertyHolder(FDE_CSSProperty::BorderTopWidth, pWidth, + bImportant); return true; } break; 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); + if (ParseBorderProperty(pszValue, iValueLen, pWidth)) { + AddPropertyHolder(FDE_CSSProperty::BorderRightWidth, pWidth, + bImportant); return true; } break; 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); + if (ParseBorderProperty(pszValue, iValueLen, pWidth)) { + AddPropertyHolder(FDE_CSSProperty::BorderBottomWidth, pWidth, + bImportant); return true; } break; - case FDE_CSSProperty::Overflow: - return ParseOverflowProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSProperty::ColumnRule: - return ParseColumnRuleProperty(pArgs, pszValue, iValueLen, - bImportant); default: break; } } break; case FDE_CSSVALUETYPE_List: - switch (pArgs->pProperty->eName) { - case FDE_CSSProperty::CounterIncrement: - case FDE_CSSProperty::CounterReset: - return ParseCounterProperty(pArgs, pszValue, iValueLen, bImportant); - case FDE_CSSProperty::Content: - return ParseContentProperty(pArgs, pszValue, iValueLen, bImportant); - default: - return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); - } + return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); default: ASSERT(false); break; @@ -359,6 +320,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( argumentArr.Add(NewEnumValue(pPropertyValue->eName)); continue; } + IFDE_CSSValue* pFunctionValue = ParseFunction(pArgs, pszValue, iValueLen); if (pFunctionValue) { @@ -368,13 +330,14 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( argumentArr.Add(new CFDE_CSSPrimitiveValue( FDE_CSSPrimitiveType::String, CopyToLocal(pArgs, pszValue, iValueLen))); - } break; + break; + } case FDE_CSSPrimitiveType::Number: { FX_FLOAT fValue; - if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, ePrimitiveType)) { + if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, ePrimitiveType)) argumentArr.Add(NewNumberValue(ePrimitiveType, fValue)); - } - } break; + break; + } default: argumentArr.Add(new CFDE_CSSPrimitiveValue( FDE_CSSPrimitiveType::String, @@ -387,115 +350,7 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( new CFDE_CSSFunction(pszFuncName, pArgumentList); return new CFDE_CSSPrimitiveValue(pFunction); } -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; - CFDE_CSSValueArray list; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - case FDE_CSSPrimitiveType::URI: - list.Add(new CFDE_CSSPrimitiveValue( - eType, CopyToLocal(pArgs, pszValue, iValueLen))); - break; - case FDE_CSSPrimitiveType::Number: - return false; - 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: { - 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: - list.Add(NewEnumValue(pValue->eName)); - break; - default: - return false; - } - continue; - } - IFDE_CSSValue* pFunction = ParseFunction(pArgs, pszValue, iValueLen); - if (pFunction) { - list.Add(pFunction); - continue; - } - list.Add(new CFDE_CSSPrimitiveValue( - eType, CopyToLocal(pArgs, pszValue, iValueLen))); - } break; - case FDE_CSSPrimitiveType::RGB: - return false; - default: - break; - } - } - if (list.GetSize() == 0) { - return false; - } - AddPropertyHolder(pArgs->pProperty->eName, new CFDE_CSSValueList(list), - bImportant); - return true; -} -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; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - case FDE_CSSPrimitiveType::Number: { - FX_FLOAT fValue; - if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { - if (list.GetSize() == 1) { - list.Add(NewNumberValue(eType, fValue)); - listFull.Add(new CFDE_CSSValueList(list)); - list.RemoveAll(); - } else { - return false; - } - } - } break; - case FDE_CSSPrimitiveType::String: { - if (list.GetSize() == 0) { - pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - 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, - pszValue)); - } - } break; - default: - break; - } - } - if (list.GetSize() == 1) { - listFull.Add(new CFDE_CSSValueList(list)); - } - if (listFull.GetSize() == 0) { - return false; - } - AddPropertyHolder(pArgs->pProperty->eName, new CFDE_CSSValueList(listFull), - bImportant); - return true; -} + bool CFDE_CSSDeclaration::ParseValueListProperty( const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, @@ -512,9 +367,8 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( case FDE_CSSPrimitiveType::Number: if (dwType & FDE_CSSVALUETYPE_MaybeNumber) { FX_FLOAT fValue; - if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { + if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) list.Add(NewNumberValue(eType, fValue)); - } } break; case FDE_CSSPrimitiveType::String: @@ -556,16 +410,6 @@ bool CFDE_CSSDeclaration::ParseValueListProperty( return false; } switch (pArgs->pProperty->eName) { - case FDE_CSSProperty::BorderColor: - return Add4ValuesProperty( - 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: return Add4ValuesProperty( list, bImportant, FDE_CSSProperty::BorderLeftWidth, @@ -626,299 +470,56 @@ bool CFDE_CSSDeclaration::Add4ValuesProperty(const CFDE_CSSValueArray& list, } return false; } -bool CFDE_CSSDeclaration::ParseBorderPropoerty( - const FX_WCHAR* pszValue, - int32_t iValueLen, - IFDE_CSSValue*& pColor, - IFDE_CSSValue*& pStyle, - IFDE_CSSValue*& pWidth) const { - pColor = pStyle = pWidth = nullptr; +bool CFDE_CSSDeclaration::ParseBorderProperty(const FX_WCHAR* pszValue, + int32_t iValueLen, + IFDE_CSSValue*& pWidth) const { + pWidth = nullptr; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); FDE_CSSPrimitiveType eType; while (parser.NextValue(eType, pszValue, iValueLen)) { switch (eType) { - case FDE_CSSPrimitiveType::Number: - if (!pWidth) { - FX_FLOAT fValue; - if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { - pWidth = NewNumberValue(eType, fValue); - } - } - break; - case FDE_CSSPrimitiveType::RGB: - if (!pColor) { - FX_ARGB dwColor; - if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pColor = new CFDE_CSSPrimitiveValue(dwColor); - } - } + case FDE_CSSPrimitiveType::Number: { + if (pWidth) + continue; + + FX_FLOAT fValue; + if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) + pWidth = NewNumberValue(eType, fValue); break; + } case FDE_CSSPrimitiveType::String: { const FDE_CSSCOLORTABLE* pColorItem = FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); - if (pColorItem) { - if (!pColor) { - pColor = new CFDE_CSSPrimitiveValue(pColorItem->dwValue); - } + if (pColorItem) continue; - } + const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); if (!pValue) continue; switch (pValue->eName) { - 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: 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: - if (!pStyle) - pStyle = NewEnumValue(pValue->eName); - break; default: break; } - }; break; + break; + } default: break; } } - if (!pColor) - pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); - if (!pStyle) - pStyle = NewEnumValue(FDE_CSSPropertyValue::None); if (!pWidth) 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) { - AddPropertyHolder(eStyle, pStyle, bImportant); - AddPropertyHolder(eWidth, pWidth, bImportant); - AddPropertyHolder(eColor, pColor, bImportant); -} -bool CFDE_CSSDeclaration::ParseListStyleProperty( - const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant) { - CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - IFDE_CSSPrimitiveValue* pType = nullptr; - IFDE_CSSPrimitiveValue* pImage = nullptr; - IFDE_CSSPrimitiveValue* pPosition = nullptr; - FDE_CSSPrimitiveType eType; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - case FDE_CSSPrimitiveType::URI: - if (!pImage) { - pImage = new CFDE_CSSPrimitiveValue( - eType, CopyToLocal(pArgs, pszValue, iValueLen)); - } - break; - case FDE_CSSPrimitiveType::String: { - const FDE_CSSPropertyValueTable* pValue = - FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (!pValue) - break; - switch (pValue->eName) { - 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: - 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: - if (!pType) - pType = NewEnumValue(pValue->eName); - break; - default: - break; - } - }; break; - default: - break; - } - } - if (!pPosition) - pPosition = NewEnumValue(FDE_CSSPropertyValue::Outside); - if (!pImage) - 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); return true; } -bool CFDE_CSSDeclaration::ParseBackgroundProperty( - const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant) { - CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - IFDE_CSSPrimitiveValue* pColor = nullptr; - IFDE_CSSPrimitiveValue* pImage = nullptr; - IFDE_CSSPrimitiveValue* pRepeat = nullptr; - IFDE_CSSPrimitiveValue* pPosX = nullptr; - IFDE_CSSPrimitiveValue* pPosY = nullptr; - IFDE_CSSPrimitiveValue* pAttachment = nullptr; - FDE_CSSPrimitiveType eType; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - case FDE_CSSPrimitiveType::URI: - if (!pImage) { - pImage = new CFDE_CSSPrimitiveValue( - eType, CopyToLocal(pArgs, pszValue, iValueLen)); - } - break; - case FDE_CSSPrimitiveType::Number: { - FX_FLOAT fValue; - if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { - break; - } - if (!pPosX) - pPosX = NewNumberValue(eType, fValue); - else if (!pPosY) - pPosY = NewNumberValue(eType, fValue); - } break; - case FDE_CSSPrimitiveType::String: { - const FDE_CSSPropertyValueTable* pValue = - FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (pValue) { - switch (pValue->eName) { - case FDE_CSSPropertyValue::None: - if (!pImage) - pImage = NewEnumValue(pValue->eName); - break; - case FDE_CSSPropertyValue::Transparent: - if (!pColor) { - pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); - } - break; - 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: - if (!pRepeat) - pRepeat = NewEnumValue(pValue->eName); - break; - case FDE_CSSPropertyValue::Left: - case FDE_CSSPropertyValue::Right: - if (!pPosX) - pPosX = NewEnumValue(pValue->eName); - break; - case FDE_CSSPropertyValue::Top: - case FDE_CSSPropertyValue::Bottom: - if (!pPosY) - pPosX = NewEnumValue(pValue->eName); - break; - case FDE_CSSPropertyValue::Center: - if (!pPosX) - pPosX = NewEnumValue(pValue->eName); - else if (!pPosY) - pPosX = NewEnumValue(pValue->eName); - break; - default: - break; - } - break; - } - const FDE_CSSCOLORTABLE* pColorItem = - FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); - if (pColorItem) { - if (!pColor) { - pColor = new CFDE_CSSPrimitiveValue(pColorItem->dwValue); - } - } - } break; - case FDE_CSSPrimitiveType::RGB: - if (!pColor) { - FX_ARGB dwColor; - if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pColor = new CFDE_CSSPrimitiveValue(dwColor); - } - } - break; - default: - break; - } - } - if (!pColor) { - pColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); - } - if (!pImage) - pImage = NewEnumValue(FDE_CSSPropertyValue::None); - if (!pRepeat) - pRepeat = NewEnumValue(FDE_CSSPropertyValue::Repeat); - - if (!pAttachment) - pAttachment = NewEnumValue(FDE_CSSPropertyValue::Scroll); - - if (!pPosX) { - pPosX = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); - pPosY = NewNumberValue(FDE_CSSPrimitiveType::Number, 0.0f); - } else if (!pPosY) { - 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, - bImportant); - return true; -} bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, @@ -1040,230 +641,3 @@ bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, } return true; } -bool CFDE_CSSDeclaration::ParseColumnRuleProperty( - const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant) { - CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); - IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; - IFDE_CSSPrimitiveValue* pColumnRuleStyle = nullptr; - IFDE_CSSPrimitiveValue* pColumnRuleColor = nullptr; - FDE_CSSPrimitiveType eType; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - 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: - if (!pColumnRuleStyle) - pColumnRuleStyle = NewEnumValue(pValue->eName); - break; - case FDE_CSSPropertyValue::Transparent: - if (!pColumnRuleColor) - pColumnRuleColor = NewEnumValue(pValue->eName); - break; - case FDE_CSSPropertyValue::Thin: - case FDE_CSSPropertyValue::Medium: - case FDE_CSSPropertyValue::Thick: - if (!pColumnRuleWidth) - pColumnRuleWidth = NewEnumValue(pValue->eName); - break; - default: - break; - } - continue; - } - FX_ARGB dwColor; - if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor) && - !pColumnRuleColor) { - pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); - continue; - } - } break; - case FDE_CSSPrimitiveType::Number: { - FX_FLOAT fValue; - if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType) && - !pColumnRuleWidth) { - pColumnRuleWidth = NewNumberValue(eType, fValue); - } - } break; - case FDE_CSSPrimitiveType::RGB: { - FX_ARGB dwColor; - if (!pColumnRuleColor && - FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)dwColor); - } - } break; - default: - break; - } - } - if (!pColumnRuleColor && !pColumnRuleStyle && !pColumnRuleWidth) - return false; - - if (!pColumnRuleStyle) - pColumnRuleStyle = NewEnumValue(FDE_CSSPropertyValue::None); - if (!pColumnRuleWidth) - pColumnRuleWidth = NewEnumValue(FDE_CSSPropertyValue::Medium); - if (!pColumnRuleColor) { - pColumnRuleColor = new CFDE_CSSPrimitiveValue((FX_ARGB)0); - } - AddPropertyHolder(FDE_CSSProperty::ColumnRuleStyle, pColumnRuleStyle, - bImportant); - AddPropertyHolder(FDE_CSSProperty::ColumnRuleWidth, pColumnRuleWidth, - bImportant); - AddPropertyHolder(FDE_CSSProperty::ColumnRuleColor, pColumnRuleColor, - bImportant); - return true; -} -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; - IFDE_CSSPrimitiveValue* pEmphasisColor = nullptr; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - case FDE_CSSPrimitiveType::String: { - const FDE_CSSPropertyValueTable* pValue = - FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (pValue) { - arrEmphasisStyle.Add(NewEnumValue(pValue->eName)); - continue; - } - FX_ARGB dwColor; - if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pEmphasisColor = new CFDE_CSSPrimitiveValue(dwColor); - continue; - } - pszValue = CopyToLocal(pArgs, pszValue, iValueLen); - arrEmphasisStyle.Add( - new CFDE_CSSPrimitiveValue(FDE_CSSPrimitiveType::String, pszValue)); - } break; - case FDE_CSSPrimitiveType::RGB: { - FX_ARGB dwColor; - if (FDE_ParseCSSColor(pszValue, iValueLen, dwColor)) { - pEmphasisColor = new CFDE_CSSPrimitiveValue(dwColor); - } - } break; - default: - break; - } - } - if (arrEmphasisStyle.GetSize() != 0) { - AddPropertyHolder(FDE_CSSProperty::TextEmphasisStyle, - new CFDE_CSSValueList(arrEmphasisStyle), bImportant); - } - if (pEmphasisColor) { - AddPropertyHolder(FDE_CSSProperty::TextEmphasisColor, pEmphasisColor, - bImportant); - } - return true; -} -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; - while (parser.NextValue(eType, pszValue, iValueLen)) { - switch (eType) { - case FDE_CSSPrimitiveType::String: { - const FDE_CSSPropertyValueTable* pValue = - FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (!pValue && pValue->eName == FDE_CSSPropertyValue::Auto) { - pColumnWidth = NewEnumValue(pValue->eName); - } - } break; - case FDE_CSSPrimitiveType::Number: { - FX_FLOAT fValue; - if (FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { - switch (eType) { - case FDE_CSSPrimitiveType::Number: - if (!pColumnCount) - pColumnCount = NewNumberValue(eType, fValue); - break; - default: - if (!pColumnWidth) - pColumnWidth = NewNumberValue(eType, fValue); - break; - } - } - } break; - default: - break; - } - } - if (!pColumnWidth && !pColumnCount) - return false; - - if (!pColumnWidth) - pColumnWidth = NewEnumValue(FDE_CSSPropertyValue::Auto); - else if (!pColumnCount) - pColumnCount = NewEnumValue(FDE_CSSPropertyValue::Auto); - - AddPropertyHolder(FDE_CSSProperty::ColumnWidth, pColumnWidth, bImportant); - AddPropertyHolder(FDE_CSSProperty::ColumnCount, pColumnCount, bImportant); - return true; -} -bool CFDE_CSSDeclaration::ParseOverflowProperty( - 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; - while (parser.NextValue(eType, pszValue, iValueLen)) { - if (eType == FDE_CSSPrimitiveType::String) { - const FDE_CSSPropertyValueTable* pValue = - FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); - if (pValue) { - switch (pValue->eName) { - 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) { - pOverflowX = NewEnumValue(pValue->eName); - } else if (!pOverflowY) { - pOverflowY = NewEnumValue(pValue->eName); - } - break; - default: - break; - } - } - } - } - if (!pOverflowX && !pOverflowY) - return false; - - if (!pOverflowY) - pOverflowY = NewEnumValue(pOverflowX->GetEnum()); - - 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 d6f405e842..18b769c00e 100644 --- a/xfa/fde/css/fde_cssdeclaration.h +++ b/xfa/fde/css/fde_cssdeclaration.h @@ -59,54 +59,13 @@ class CFDE_CSSDeclaration { int32_t iValueLen); protected: - bool ParseTextEmphasisProperty(FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); - bool ParseColumnsProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); - bool ParseColumnRuleProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); - bool ParseOverflowProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); bool ParseFontProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, bool bImportant); - bool ParseBackgroundProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); - bool ParseListStyleProperty(const FDE_CSSPropertyArgs* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); - bool ParseBorderPropoerty(const FX_WCHAR* pszValue, - int32_t iValueLen, - IFDE_CSSValue*& pColor, - IFDE_CSSValue*& pStyle, - IFDE_CSSValue*& pWidth) const; - void AddBorderProperty(IFDE_CSSValue* pColor, - IFDE_CSSValue* pStyle, - IFDE_CSSValue* pWidth, - bool bImportant, - 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, - const FX_WCHAR* pszValue, - int32_t iValueLen, - bool bImportant); + bool ParseBorderProperty(const FX_WCHAR* pszValue, + int32_t iValueLen, + IFDE_CSSValue*& pWidth) const; bool ParseValueListProperty(const FDE_CSSPropertyArgs* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, @@ -150,6 +109,5 @@ class CFDE_CSSDeclaration { FDE_CSSCustomProperty* m_pFirstCustom; FDE_CSSCustomProperty* m_pLastCustom; }; -using CFDE_CSSDeclarationArray = CFX_ArrayTemplate<CFDE_CSSDeclaration*>; #endif // XFA_FDE_CSS_FDE_CSSDECLARATION_H_ diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index 6808bab48a..4861edfb34 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -117,7 +117,7 @@ void CFDE_CSSStyleSelector::Reset() { int32_t CFDE_CSSStyleSelector::MatchDeclarations( CXFA_CSSTagProvider* pTag, - CFDE_CSSDeclarationArray& matchedDecls, + CFX_ArrayTemplate<CFDE_CSSDeclaration*>& matchedDecls, FDE_CSSPseudo ePseudoType) { ASSERT(pTag); FDE_CSSTagCache* pCache = m_pAccelerator->GetTopElement(); @@ -253,7 +253,7 @@ void CFDE_CSSStyleSelector::ComputeStyle( } if (pDecl) { - CFDE_CSSDeclarationArray decls; + CFX_ArrayTemplate<CFDE_CSSDeclaration*> decls; decls.SetSize(iDeclCount + 1); CFDE_CSSDeclaration** ppInline = decls.GetData(); FXSYS_memcpy(ppInline, ppDeclArray, @@ -305,7 +305,7 @@ void CFDE_CSSStyleSelector::ApplyDeclarations( ApplyProperty(FDE_CSSProperty::FontSize, pLastest, pComputedStyle); } } else { - CFDE_CSSDeclarationArray importants; + CFX_ArrayTemplate<CFDE_CSSDeclaration*> importants; const CFDE_CSSDeclaration* pDecl = nullptr; FDE_CSSProperty eProp; FX_POSITION pos; @@ -602,55 +602,6 @@ void CFDE_CSSStyleSelector::ApplyProperty( 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; } @@ -666,12 +617,6 @@ void CFDE_CSSStyleSelector::ApplyProperty( pComputedStyle->m_NonInheritedData.m_dwTextDecoration = ToTextDecoration(pList); 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; } diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index b20cdec8af..185ba75ba3 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -98,9 +98,10 @@ class CFDE_CSSStyleSelector { CFDE_CSSAccelerator* InitAccelerator(); IFDE_CSSComputedStyle* CreateComputedStyle( IFDE_CSSComputedStyle* pParentStyle); - int32_t MatchDeclarations(CXFA_CSSTagProvider* pTag, - CFDE_CSSDeclarationArray& matchedDecls, - FDE_CSSPseudo ePseudoType = FDE_CSSPseudo::NONE); + int32_t MatchDeclarations( + CXFA_CSSTagProvider* pTag, + CFX_ArrayTemplate<CFDE_CSSDeclaration*>& matchedDecls, + FDE_CSSPseudo ePseudoType = FDE_CSSPseudo::NONE); void ComputeStyle(CXFA_CSSTagProvider* pTag, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index 1c780cd1c1..f48789533c 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -13,54 +13,6 @@ #include "xfa/fde/css/fde_csssyntax.h" #include "xfa/fgas/crt/fgas_codepage.h" -IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadHTMLStandardStyleSheet() { - static const FX_WCHAR s_pStyle[] = - L"html,address,blockquote,body,dd,div,dl,dt,fieldset,form,frame,frameset," - L"h1,h2,h3,h4,h5,h6,noframes,ol,p,ul,center,dir,hr,menu,pre{display:" - L"block}" - L"li{display:list-item}head{display:none}table{display:table}tr{display:" - L"table-row}thead{display:table-header-group}tbody{display:table-row-" - L"group}tfoot{display:table-footer-group}" - L"col{display:table-column}colgroup{display:table-column-group}td,th{" - L"display:table-cell}caption{display:table-caption}th{font-weight:bolder;" - L"text-align:center}caption{text-align:center}" - L"body{margin:0}h1{font-size:2em;margin:.67em " - L"0}h2{font-size:1.5em;margin:.75em 0}h3{font-size:1.17em;margin:.83em " - L"0}h4,p,blockquote,ul,fieldset,form,ol,dl,dir,menu{margin:1.12em 0}" - L"h5{font-size:.83em;margin:1.5em 0}h6{font-size:.75em;margin:1.67em " - L"0}h1,h2,h3,h4,h5,h6,b,strong{font-weight:bolder}blockquote{margin-left:" - L"40px;margin-right:40px}i,cite,em,var,address{font-style:italic}" - L"pre,tt,code,kbd,samp{font-family:monospace}pre{white-space:pre}button," - L"textarea,input,select{display:inline-block}big{font-size:1.17em}small," - L"sub,sup{font-size:.83em}sub{vertical-align:sub}" - L"sup{vertical-align:super}table{border-spacing:2px}thead,tbody,tfoot{" - L"vertical-align:middle}td,th,tr{vertical-align:inherit}s,strike,del{" - L"text-decoration:line-through}hr{border:1px inset silver}" - L"ol,ul,dir,menu,dd{margin-left:40px}ol{list-style-type:decimal}ol ul,ul " - L"ol,ul ul,ol " - L"ol{margin-top:0;margin-bottom:0}u,ins{text-decoration:underline}center{" - L"text-align:center}" - L"ruby{display:ruby}rt{display:ruby-text;font-size:.5em}rb{display:ruby-" - L"base}rbc{display:ruby-base-group}rtc{display:ruby-text-group}" - L"q:before{content:open-quote}q:after{content:close-quote}" - L"rp{display:none}"; - return IFDE_CSSStyleSheet::LoadFromBuffer( - CFX_WideString(), s_pStyle, FXSYS_wcslen(s_pStyle), FX_CODEPAGE_UTF8); -} - -IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream( - const CFX_WideString& szUrl, - const CFX_RetainPtr<IFGAS_Stream>& pStream, - uint16_t wCodePage, - uint32_t dwMediaList) { - CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList); - if (!pStyleSheet->LoadFromStream(szUrl, pStream, wCodePage)) { - pStyleSheet->Release(); - pStyleSheet = nullptr; - } - return pStyleSheet; -} - IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromBuffer( const CFX_WideString& szUrl, const FX_WCHAR* pBuffer, @@ -143,20 +95,6 @@ IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } -bool CFDE_CSSStyleSheet::LoadFromStream( - const CFX_WideString& szUrl, - const CFX_RetainPtr<IFGAS_Stream>& pStream, - uint16_t wCodePage) { - auto pSyntax = pdfium::MakeUnique<CFDE_CSSSyntaxParser>(); - if (pStream->GetCodePage() != wCodePage) - pStream->SetCodePage(wCodePage); - - bool bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); - m_wCodePage = wCodePage; - m_szUrl = szUrl; - return bRet; -} - bool CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, const FX_WCHAR* pBuffer, int32_t iBufSize, diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index c00be4384a..0d038c9eb5 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -100,9 +100,6 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet { int32_t CountRules() const override; IFDE_CSSRule* GetRule(int32_t index) override; - bool LoadFromStream(const CFX_WideString& szUrl, - const CFX_RetainPtr<IFGAS_Stream>& pStream, - uint16_t wCodePage); bool LoadFromBuffer(const CFX_WideString& szUrl, const FX_WCHAR* pBuffer, int32_t iBufSize, @@ -121,6 +118,7 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet { CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray); FDE_CSSSyntaxStatus SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); + uint16_t m_wCodePage; uint16_t m_wRefCount; uint32_t m_dwMediaList; |