OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #include "xfa/src/fde/css/fde_cssdatatable.h" | |
8 | |
9 #include "core/include/fxcrt/fx_ext.h" | |
10 #include "xfa/src/fgas/crt/fgas_algorithm.h" | |
11 #include "xfa/src/fgas/crt/fgas_codepage.h" | |
12 #include "xfa/src/fgas/crt/fgas_system.h" | |
13 | |
14 FX_BOOL FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, | |
15 FX_FLOAT fPercentBase, | |
16 FX_FLOAT& fResult) { | |
17 switch (len.GetUnit()) { | |
18 case FDE_CSSLENGTHUNIT_Point: | |
19 fResult = len.GetValue(); | |
20 return TRUE; | |
21 case FDE_CSSLENGTHUNIT_Percent: | |
22 fResult = len.GetValue() * fPercentBase; | |
23 return TRUE; | |
24 default: | |
25 return FALSE; | |
26 } | |
27 } | |
28 CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle, | |
29 FX_FLOAT fContainerWidth, | |
30 FX_BOOL bPadding, | |
31 FX_BOOL bBorder, | |
32 FX_BOOL bMargin) { | |
33 FXSYS_assert(pBoundStyle != NULL); | |
34 FX_FLOAT fResult; | |
35 const FDE_CSSRECT* pRect; | |
36 CFX_FloatRect rect(0, 0, 0, 0); | |
37 if (bPadding) { | |
38 pRect = pBoundStyle->GetPaddingWidth(); | |
39 if (pRect != NULL) { | |
40 if (FDE_CSSLengthToFloat(pRect->left, fContainerWidth, fResult)) { | |
41 rect.left += fResult; | |
42 } | |
43 if (FDE_CSSLengthToFloat(pRect->top, fContainerWidth, fResult)) { | |
44 rect.top += fResult; | |
45 } | |
46 if (FDE_CSSLengthToFloat(pRect->right, fContainerWidth, fResult)) { | |
47 rect.right += fResult; | |
48 } | |
49 if (FDE_CSSLengthToFloat(pRect->bottom, fContainerWidth, fResult)) { | |
50 rect.bottom += fResult; | |
51 } | |
52 } | |
53 } | |
54 if (bBorder) { | |
55 pRect = pBoundStyle->GetBorderWidth(); | |
56 if (pRect != NULL) { | |
57 if (FDE_CSSLengthToFloat(pRect->left, fContainerWidth, fResult)) { | |
58 rect.left += fResult; | |
59 } | |
60 if (FDE_CSSLengthToFloat(pRect->top, fContainerWidth, fResult)) { | |
61 rect.top += fResult; | |
62 } | |
63 if (FDE_CSSLengthToFloat(pRect->right, fContainerWidth, fResult)) { | |
64 rect.right += fResult; | |
65 } | |
66 if (FDE_CSSLengthToFloat(pRect->bottom, fContainerWidth, fResult)) { | |
67 rect.bottom += fResult; | |
68 } | |
69 } | |
70 } | |
71 if (bMargin) { | |
72 pRect = pBoundStyle->GetMarginWidth(); | |
73 if (pRect != NULL) { | |
74 if (FDE_CSSLengthToFloat(pRect->left, fContainerWidth, fResult)) { | |
75 rect.left += fResult; | |
76 } | |
77 if (FDE_CSSLengthToFloat(pRect->top, fContainerWidth, fResult)) { | |
78 rect.top += fResult; | |
79 } | |
80 if (FDE_CSSLengthToFloat(pRect->right, fContainerWidth, fResult)) { | |
81 rect.right += fResult; | |
82 } | |
83 if (FDE_CSSLengthToFloat(pRect->bottom, fContainerWidth, fResult)) { | |
84 rect.bottom += fResult; | |
85 } | |
86 } | |
87 } | |
88 return rect; | |
89 } | |
90 FX_DWORD FDE_CSSFontStyleToFDE(IFDE_CSSFontStyle* pFontStyle) { | |
91 FXSYS_assert(pFontStyle != NULL); | |
92 FX_DWORD dwFontStyle = FX_FONTSTYLE_Normal; | |
93 if (pFontStyle->GetFontStyle() == FDE_CSSFONTSTYLE_Italic) { | |
94 dwFontStyle |= FX_FONTSTYLE_Italic; | |
95 } | |
96 if (pFontStyle->GetFontWeight() >= 700) { | |
97 dwFontStyle |= FX_FONTSTYLE_Bold; | |
98 } | |
99 return dwFontStyle; | |
100 } | |
101 static const FDE_CSSPROPERTYTABLE g_FDE_CSSProperties[] = { | |
102 {FDE_CSSPROPERTY_WritingMode, L"writing-mode", 0x01878076, | |
103 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
104 {FDE_CSSPROPERTY_ColumnRuleWidth, L"column-rule-width", 0x0200FB00, | |
105 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
106 FDE_CSSVALUETYPE_MaybeNumber}, | |
107 {FDE_CSSPROPERTY_BorderLeft, L"border-left", 0x04080036, | |
108 FDE_CSSVALUETYPE_Shorthand}, | |
109 {FDE_CSSPROPERTY_ColumnRule, L"column-rule", 0x04C83DF3, | |
110 FDE_CSSVALUETYPE_Shorthand}, | |
111 {FDE_CSSPROPERTY_Height, L"height", 0x05A5C519, | |
112 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
113 FDE_CSSVALUETYPE_MaybeNumber}, | |
114 {FDE_CSSPROPERTY_CounterReset, L"counter-reset", 0x0894F9B0, | |
115 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
116 FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeString}, | |
117 {FDE_CSSPROPERTY_Content, L"content", 0x097BE91B, | |
118 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
119 FDE_CSSVALUETYPE_MaybeURI | FDE_CSSVALUETYPE_MaybeString}, | |
120 {FDE_CSSPROPERTY_RubyPosition, L"ruby-position", 0x09ACD024, | |
121 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
122 {FDE_CSSPROPERTY_BackgroundColor, L"background-color", 0x09E8E8AC, | |
123 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
124 FDE_CSSVALUETYPE_MaybeColor}, | |
125 {FDE_CSSPROPERTY_Width, L"width", 0x0A8A8F80, | |
126 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
127 FDE_CSSVALUETYPE_MaybeNumber}, | |
128 {FDE_CSSPROPERTY_Src, L"src", 0x0BD37048, | |
129 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeURI}, | |
130 {FDE_CSSPROPERTY_Top, L"top", 0x0BEDAF33, FDE_CSSVALUETYPE_Primitive | | |
131 FDE_CSSVALUETYPE_MaybeEnum | | |
132 FDE_CSSVALUETYPE_MaybeNumber}, | |
133 {FDE_CSSPROPERTY_Margin, L"margin", 0x0CB016BE, | |
134 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
135 FDE_CSSVALUETYPE_MaybeNumber}, | |
136 {FDE_CSSPROPERTY_BorderColor, L"border-color", 0x0CBB528A, | |
137 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
138 FDE_CSSVALUETYPE_MaybeColor}, | |
139 {FDE_CSSPROPERTY_Widows, L"widows", 0x1026C59D, | |
140 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
141 {FDE_CSSPROPERTY_BorderBottomColor, L"border-bottom-color", 0x121E22EC, | |
142 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
143 FDE_CSSVALUETYPE_MaybeColor}, | |
144 {FDE_CSSPROPERTY_TextIndent, L"text-indent", 0x169ADB74, | |
145 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
146 {FDE_CSSPROPERTY_Right, L"right", 0x193ADE3E, | |
147 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
148 FDE_CSSVALUETYPE_MaybeNumber}, | |
149 {FDE_CSSPROPERTY_TextEmphasisStyle, L"text-emphasis-style", 0x20DBAF4A, | |
150 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
151 FDE_CSSVALUETYPE_MaybeString}, | |
152 {FDE_CSSPROPERTY_PaddingLeft, L"padding-left", 0x228CF02F, | |
153 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
154 {FDE_CSSPROPERTY_ColumnWidth, L"column-width", 0x24C9AC9B, | |
155 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
156 FDE_CSSVALUETYPE_MaybeNumber}, | |
157 {FDE_CSSPROPERTY_MarginLeft, L"margin-left", 0x297C5656, | |
158 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | | |
159 FDE_CSSVALUETYPE_MaybeEnum}, | |
160 {FDE_CSSPROPERTY_Border, L"border", 0x2A23349E, FDE_CSSVALUETYPE_Shorthand}, | |
161 {FDE_CSSPROPERTY_BorderTop, L"border-top", 0x2B866ADE, | |
162 FDE_CSSVALUETYPE_Shorthand}, | |
163 {FDE_CSSPROPERTY_RubyOverhang, L"ruby-overhang", 0x2CCA0D89, | |
164 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
165 {FDE_CSSPROPERTY_PageBreakBefore, L"page-break-before", 0x3119B36F, | |
166 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
167 {FDE_CSSPROPERTY_MaxHeight, L"max-height", 0x343597EC, | |
168 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
169 {FDE_CSSPROPERTY_MinWidth, L"min-width", 0x35832871, | |
170 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
171 {FDE_CSSPROPERTY_BorderLeftColor, L"border-left-color", 0x35C64022, | |
172 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
173 FDE_CSSVALUETYPE_MaybeColor}, | |
174 {FDE_CSSPROPERTY_Bottom, L"bottom", 0x399F02B5, | |
175 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
176 FDE_CSSVALUETYPE_MaybeNumber}, | |
177 {FDE_CSSPROPERTY_Quotes, L"quotes", 0x3D8C6A01, | |
178 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeString}, | |
179 {FDE_CSSPROPERTY_MaxWidth, L"max-width", 0x3EA274F3, | |
180 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
181 {FDE_CSSPROPERTY_PaddingRight, L"padding-right", 0x3F616AC2, | |
182 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
183 {FDE_CSSPROPERTY_ListStyleImage, L"list-style-image", 0x42A8A86A, | |
184 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
185 FDE_CSSVALUETYPE_MaybeURI}, | |
186 {FDE_CSSPROPERTY_WhiteSpace, L"white-space", 0x42F0429A, | |
187 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
188 {FDE_CSSPROPERTY_BorderBottom, L"border-bottom", 0x452CE780, | |
189 FDE_CSSVALUETYPE_Shorthand}, | |
190 {FDE_CSSPROPERTY_ListStyleType, L"list-style-type", 0x48094789, | |
191 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
192 {FDE_CSSPROPERTY_WordBreak, L"word-break", 0x4D74A3CE, | |
193 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
194 {FDE_CSSPROPERTY_OverflowX, L"overflow-x", 0x4ECEBF99, | |
195 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
196 {FDE_CSSPROPERTY_OverflowY, L"overflow-y", 0x4ECEBF9A, | |
197 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
198 {FDE_CSSPROPERTY_BorderTopColor, L"border-top-color", 0x5109B8CA, | |
199 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
200 FDE_CSSVALUETYPE_MaybeColor}, | |
201 {FDE_CSSPROPERTY_FontFamily, L"font-family", 0x574686E6, | |
202 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeString}, | |
203 {FDE_CSSPROPERTY_Cursor, L"cursor", 0x59DFCA5E, | |
204 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
205 FDE_CSSVALUETYPE_MaybeString}, | |
206 {FDE_CSSPROPERTY_RubyAlign, L"ruby-align", 0x6077BDFA, | |
207 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
208 {FDE_CSSPROPERTY_ColumnRuleColor, L"column-rule-color", 0x65DDFD9F, | |
209 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
210 FDE_CSSVALUETYPE_MaybeColor}, | |
211 {FDE_CSSPROPERTY_FontWeight, L"font-weight", 0x6692F60C, | |
212 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
213 FDE_CSSVALUETYPE_MaybeNumber}, | |
214 {FDE_CSSPROPERTY_BorderRightStyle, L"border-right-style", 0x6920DDA7, | |
215 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
216 {FDE_CSSPROPERTY_MinHeight, L"min-height", 0x6AAE312A, | |
217 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
218 {FDE_CSSPROPERTY_Color, L"color", 0x6E67921F, | |
219 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
220 FDE_CSSVALUETYPE_MaybeColor}, | |
221 {FDE_CSSPROPERTY_LetterSpacing, L"letter-spacing", 0x70536102, | |
222 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
223 FDE_CSSVALUETYPE_MaybeNumber}, | |
224 {FDE_CSSPROPERTY_EmptyCells, L"empty-cells", 0x7531528F, | |
225 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
226 {FDE_CSSPROPERTY_TextAlign, L"text-align", 0x7553F1BD, | |
227 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
228 {FDE_CSSPROPERTY_RubySpan, L"ruby-span", 0x76FCFCE1, | |
229 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
230 FDE_CSSVALUETYPE_MaybeFunction}, | |
231 {FDE_CSSPROPERTY_Position, L"position", 0x814F82B5, | |
232 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
233 {FDE_CSSPROPERTY_BorderStyle, L"border-style", 0x82A4CD5C, | |
234 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum}, | |
235 {FDE_CSSPROPERTY_BorderBottomStyle, L"border-bottom-style", 0x88079DBE, | |
236 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
237 {FDE_CSSPROPERTY_BorderCollapse, L"border-collapse", 0x8883C7FE, | |
238 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
239 {FDE_CSSPROPERTY_ColumnCount, L"column-count", 0x89936A64, | |
240 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
241 FDE_CSSVALUETYPE_MaybeNumber}, | |
242 {FDE_CSSPROPERTY_BorderRightWidth, L"border-right-width", 0x8F5A6036, | |
243 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
244 FDE_CSSVALUETYPE_MaybeNumber}, | |
245 {FDE_CSSPROPERTY_UnicodeBidi, L"unicode-bidi", 0x91670F6C, | |
246 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
247 {FDE_CSSPROPERTY_VerticalAlign, L"vertical-align", 0x934A87D2, | |
248 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
249 FDE_CSSVALUETYPE_MaybeNumber}, | |
250 {FDE_CSSPROPERTY_PaddingTop, L"padding-top", 0x959D22B7, | |
251 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
252 {FDE_CSSPROPERTY_Columns, L"columns", 0x96FA5D81, | |
253 FDE_CSSVALUETYPE_Shorthand}, | |
254 {FDE_CSSPROPERTY_Overflow, L"overflow", 0x97B76B54, | |
255 FDE_CSSVALUETYPE_Shorthand}, | |
256 {FDE_CSSPROPERTY_TableLayout, L"table-layout", 0x9B1CB4B3, | |
257 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
258 {FDE_CSSPROPERTY_FontVariant, L"font-variant", 0x9C785779, | |
259 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
260 {FDE_CSSPROPERTY_ListStyle, L"list-style", 0x9E6C471A, | |
261 FDE_CSSVALUETYPE_Shorthand}, | |
262 {FDE_CSSPROPERTY_BackgroundPosition, L"background-position", 0xA8846D22, | |
263 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
264 FDE_CSSVALUETYPE_MaybeNumber}, | |
265 {FDE_CSSPROPERTY_BorderWidth, L"border-width", 0xA8DE4FEB, | |
266 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
267 FDE_CSSVALUETYPE_MaybeNumber}, | |
268 {FDE_CSSPROPERTY_TextEmphasisColor, L"text-emphasis-color", 0xAAF23478, | |
269 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
270 FDE_CSSVALUETYPE_MaybeColor}, | |
271 {FDE_CSSPROPERTY_BorderLeftStyle, L"border-left-style", 0xABAFBAF4, | |
272 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
273 {FDE_CSSPROPERTY_PageBreakInside, L"page-break-inside", 0xACB695F8, | |
274 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
275 {FDE_CSSPROPERTY_TextEmphasis, L"text-emphasis", 0xAD0E580C, | |
276 FDE_CSSVALUETYPE_Shorthand}, | |
277 {FDE_CSSPROPERTY_BorderBottomWidth, L"border-bottom-width", 0xAE41204D, | |
278 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
279 FDE_CSSVALUETYPE_MaybeNumber}, | |
280 {FDE_CSSPROPERTY_ColumnGap, L"column-gap", 0xB5C1BA73, | |
281 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
282 FDE_CSSVALUETYPE_MaybeNumber}, | |
283 {FDE_CSSPROPERTY_Orphans, L"orphans", 0xB716467B, | |
284 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
285 {FDE_CSSPROPERTY_BorderRight, L"border-right", 0xB78E9EA9, | |
286 FDE_CSSVALUETYPE_Shorthand}, | |
287 {FDE_CSSPROPERTY_FontSize, L"font-size", 0xB93956DF, | |
288 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
289 FDE_CSSVALUETYPE_MaybeNumber}, | |
290 {FDE_CSSPROPERTY_PageBreakAfter, L"page-break-after", 0xBC358AEE, | |
291 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
292 {FDE_CSSPROPERTY_CaptionSide, L"caption-side", 0xC03F3560, | |
293 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
294 {FDE_CSSPROPERTY_BackgroundRepeat, L"background-repeat", 0xC2C2FDCE, | |
295 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
296 {FDE_CSSPROPERTY_BorderTopStyle, L"border-top-style", 0xC6F3339C, | |
297 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
298 {FDE_CSSPROPERTY_BorderSpacing, L"border-spacing", 0xC72030F0, | |
299 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeNumber}, | |
300 {FDE_CSSPROPERTY_TextTransform, L"text-transform", 0xC88EEA6E, | |
301 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
302 {FDE_CSSPROPERTY_FontStyle, L"font-style", 0xCB1950F5, | |
303 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
304 {FDE_CSSPROPERTY_Font, L"font", 0xCD308B77, FDE_CSSVALUETYPE_Shorthand}, | |
305 {FDE_CSSPROPERTY_LineHeight, L"line-height", 0xCFCACE2E, | |
306 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
307 FDE_CSSVALUETYPE_MaybeNumber}, | |
308 {FDE_CSSPROPERTY_MarginRight, L"margin-right", 0xD13C58C9, | |
309 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | | |
310 FDE_CSSVALUETYPE_MaybeEnum}, | |
311 {FDE_CSSPROPERTY_Float, L"float", 0xD1532876, | |
312 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
313 {FDE_CSSPROPERTY_BorderLeftWidth, L"border-left-width", 0xD1E93D83, | |
314 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
315 FDE_CSSVALUETYPE_MaybeNumber}, | |
316 {FDE_CSSPROPERTY_Display, L"display", 0xD4224C36, | |
317 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
318 {FDE_CSSPROPERTY_Clear, L"clear", 0xD8ED1467, | |
319 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
320 {FDE_CSSPROPERTY_ColumnRuleStyle, L"column-rule-style", 0xDBC77871, | |
321 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
322 {FDE_CSSPROPERTY_TextCombine, L"text-combine", 0xDC5207CF, | |
323 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
324 FDE_CSSVALUETYPE_MaybeNumber}, | |
325 {FDE_CSSPROPERTY_ListStylePosition, L"list-style-position", 0xE1A1DE3C, | |
326 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
327 {FDE_CSSPROPERTY_Visibility, L"visibility", 0xE29F5168, | |
328 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
329 {FDE_CSSPROPERTY_PaddingBottom, L"padding-bottom", 0xE555B3B9, | |
330 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber}, | |
331 {FDE_CSSPROPERTY_BackgroundAttachment, L"background-attachment", 0xE77981F6, | |
332 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
333 {FDE_CSSPROPERTY_BackgroundImage, L"background-image", 0xE9AEB710, | |
334 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
335 FDE_CSSVALUETYPE_MaybeURI}, | |
336 {FDE_CSSPROPERTY_LineBreak, L"line-break", 0xEA2D1D9A, | |
337 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
338 {FDE_CSSPROPERTY_Background, L"background", 0xEB49DD40, | |
339 FDE_CSSVALUETYPE_Shorthand}, | |
340 {FDE_CSSPROPERTY_BorderTopWidth, L"border-top-width", 0xED2CB62B, | |
341 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
342 FDE_CSSVALUETYPE_MaybeNumber}, | |
343 {FDE_CSSPROPERTY_WordSpacing, L"word-spacing", 0xEDA63BAE, | |
344 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
345 FDE_CSSVALUETYPE_MaybeNumber}, | |
346 {FDE_CSSPROPERTY_BorderRightColor, L"border-right-color", 0xF33762D5, | |
347 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
348 FDE_CSSVALUETYPE_MaybeColor}, | |
349 {FDE_CSSPROPERTY_CounterIncrement, L"counter-increment", 0xF4CFB1B2, | |
350 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum | | |
351 FDE_CSSVALUETYPE_MaybeNumber | FDE_CSSVALUETYPE_MaybeString}, | |
352 {FDE_CSSPROPERTY_Left, L"left", 0xF5AD782B, | |
353 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum | | |
354 FDE_CSSVALUETYPE_MaybeNumber}, | |
355 {FDE_CSSPROPERTY_TextDecoration, L"text-decoration", 0xF7C634BA, | |
356 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeEnum}, | |
357 {FDE_CSSPROPERTY_Padding, L"padding", 0xF8C373F7, | |
358 FDE_CSSVALUETYPE_List | FDE_CSSVALUETYPE_MaybeNumber}, | |
359 {FDE_CSSPROPERTY_MarginBottom, L"margin-bottom", 0xF93485A0, | |
360 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | | |
361 FDE_CSSVALUETYPE_MaybeEnum}, | |
362 {FDE_CSSPROPERTY_MarginTop, L"margin-top", 0xFE51DCFE, | |
363 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeNumber | | |
364 FDE_CSSVALUETYPE_MaybeEnum}, | |
365 {FDE_CSSPROPERTY_Direction, L"direction", 0xFE746E61, | |
366 FDE_CSSVALUETYPE_Primitive | FDE_CSSVALUETYPE_MaybeEnum}, | |
367 }; | |
368 static const FDE_CSSPROPERTYVALUETABLE g_FDE_CSSPropertyValues[] = { | |
369 {FDE_CSSPROPERTYVALUE_Bolder, L"bolder", 0x009F1058}, | |
370 {FDE_CSSPROPERTYVALUE_LowerLatin, L"lower-latin", 0x016014CE}, | |
371 {FDE_CSSPROPERTYVALUE_Lowercase, L"lowercase", 0x02ACB805}, | |
372 {FDE_CSSPROPERTYVALUE_LowerGreek, L"lower-greek", 0x03D81D64}, | |
373 {FDE_CSSPROPERTYVALUE_Sesame, L"sesame", 0x0432ECDE}, | |
374 {FDE_CSSPROPERTYVALUE_None, L"none", 0x048B6670}, | |
375 {FDE_CSSPROPERTYVALUE_NwResize, L"nw-resize", 0x054B4BE4}, | |
376 {FDE_CSSPROPERTYVALUE_WResize, L"w-resize", 0x0A2F8D76}, | |
377 {FDE_CSSPROPERTYVALUE_Dot, L"dot", 0x0A48CB27}, | |
378 {FDE_CSSPROPERTYVALUE_End, L"end", 0x0A631437}, | |
379 {FDE_CSSPROPERTYVALUE_Ltr, L"ltr", 0x0B1B56D2}, | |
380 {FDE_CSSPROPERTYVALUE_Pre, L"pre", 0x0B848587}, | |
381 {FDE_CSSPROPERTYVALUE_Rtl, L"rtl", 0x0BB92C52}, | |
382 {FDE_CSSPROPERTYVALUE_Sub, L"sub", 0x0BD37FAA}, | |
383 {FDE_CSSPROPERTYVALUE_Top, L"top", 0x0BEDAF33}, | |
384 {FDE_CSSPROPERTYVALUE_Visible, L"visible", 0x0F55D7EE}, | |
385 {FDE_CSSPROPERTYVALUE_Filled, L"filled", 0x10827DD0}, | |
386 {FDE_CSSPROPERTYVALUE_SwResize, L"sw-resize", 0x10B548E9}, | |
387 {FDE_CSSPROPERTYVALUE_NoRepeat, L"no-repeat", 0x1235C18B}, | |
388 {FDE_CSSPROPERTYVALUE_Default, L"default", 0x14DA2125}, | |
389 {FDE_CSSPROPERTYVALUE_Transparent, L"transparent", 0x17B64DB2}, | |
390 {FDE_CSSPROPERTYVALUE_Ridge, L"ridge", 0x18EBEE4B}, | |
391 {FDE_CSSPROPERTYVALUE_Right, L"right", 0x193ADE3E}, | |
392 {FDE_CSSPROPERTYVALUE_HorizontalTb, L"horizontal-tb", 0x1A66A86D}, | |
393 {FDE_CSSPROPERTYVALUE_DistributeLetter, L"distribute-letter", 0x1EDBD75C}, | |
394 {FDE_CSSPROPERTYVALUE_DoubleCircle, L"double-circle", 0x1FF082BA}, | |
395 {FDE_CSSPROPERTYVALUE_Ruby, L"ruby", 0x20D66C02}, | |
396 {FDE_CSSPROPERTYVALUE_Collapse, L"collapse", 0x2128D673}, | |
397 {FDE_CSSPROPERTYVALUE_Normal, L"normal", 0x247CF3E9}, | |
398 {FDE_CSSPROPERTYVALUE_Avoid, L"avoid", 0x24E684B3}, | |
399 {FDE_CSSPROPERTYVALUE_UpperRoman, L"upper-roman", 0x28BAC2B6}, | |
400 {FDE_CSSPROPERTYVALUE_Auto, L"auto", 0x2B35B6D9}, | |
401 {FDE_CSSPROPERTYVALUE_Text, L"text", 0x2D08AF85}, | |
402 {FDE_CSSPROPERTYVALUE_XSmall, L"x-small", 0x2D2FCAFE}, | |
403 {FDE_CSSPROPERTYVALUE_Thin, L"thin", 0x2D574D53}, | |
404 {FDE_CSSPROPERTYVALUE_Repeat, L"repeat", 0x306614A1}, | |
405 {FDE_CSSPROPERTYVALUE_Small, L"small", 0x316A3739}, | |
406 {FDE_CSSPROPERTYVALUE_NeResize, L"ne-resize", 0x31FD5E12}, | |
407 {FDE_CSSPROPERTYVALUE_NoContent, L"no-content", 0x33A1C545}, | |
408 {FDE_CSSPROPERTYVALUE_Outside, L"outside", 0x36DF693D}, | |
409 {FDE_CSSPROPERTYVALUE_EResize, L"e-resize", 0x36E19FA4}, | |
410 {FDE_CSSPROPERTYVALUE_TableRow, L"table-row", 0x3912A02D}, | |
411 {FDE_CSSPROPERTYVALUE_Bottom, L"bottom", 0x399F02B5}, | |
412 {FDE_CSSPROPERTYVALUE_Underline, L"underline", 0x3A0273A6}, | |
413 {FDE_CSSPROPERTYVALUE_CjkIdeographic, L"cjk-ideographic", 0x3A641CC4}, | |
414 {FDE_CSSPROPERTYVALUE_SeResize, L"se-resize", 0x3D675B17}, | |
415 {FDE_CSSPROPERTYVALUE_Fixed, L"fixed", 0x3D7DEB10}, | |
416 {FDE_CSSPROPERTYVALUE_Double, L"double", 0x3D98515B}, | |
417 {FDE_CSSPROPERTYVALUE_Solid, L"solid", 0x40623B5B}, | |
418 {FDE_CSSPROPERTYVALUE_RubyBaseGroup, L"ruby-base-group", 0x41014E84}, | |
419 {FDE_CSSPROPERTYVALUE_OpenQuote, L"open-quote", 0x44A41E8D}, | |
420 {FDE_CSSPROPERTYVALUE_Lighter, L"lighter", 0x45BEB7AF}, | |
421 {FDE_CSSPROPERTYVALUE_LowerRoman, L"lower-roman", 0x5044D253}, | |
422 {FDE_CSSPROPERTYVALUE_Strict, L"strict", 0x52F4EBD9}, | |
423 {FDE_CSSPROPERTYVALUE_TableCaption, L"table-caption", 0x5325CD63}, | |
424 {FDE_CSSPROPERTYVALUE_Oblique, L"oblique", 0x53EBDDB1}, | |
425 {FDE_CSSPROPERTYVALUE_Decimal, L"decimal", 0x54034C2F}, | |
426 {FDE_CSSPROPERTYVALUE_Loose, L"loose", 0x54D3A1E2}, | |
427 {FDE_CSSPROPERTYVALUE_Hebrew, L"hebrew", 0x565792DD}, | |
428 {FDE_CSSPROPERTYVALUE_Hidden, L"hidden", 0x573CB40C}, | |
429 {FDE_CSSPROPERTYVALUE_Dashed, L"dashed", 0x58A3DD29}, | |
430 {FDE_CSSPROPERTYVALUE_Embed, L"embed", 0x59C8F27D}, | |
431 {FDE_CSSPROPERTYVALUE_TableRowGroup, L"table-row-group", 0x5A43BD07}, | |
432 {FDE_CSSPROPERTYVALUE_TableColumn, L"table-column", 0x5E705DA3}, | |
433 {FDE_CSSPROPERTYVALUE_Static, L"static", 0x5E7555E8}, | |
434 {FDE_CSSPROPERTYVALUE_Outset, L"outset", 0x61236164}, | |
435 {FDE_CSSPROPERTYVALUE_DecimalLeadingZero, L"decimal-leading-zero", | |
436 0x61DFC55D}, | |
437 {FDE_CSSPROPERTYVALUE_KeepWords, L"keep-words", 0x63964801}, | |
438 {FDE_CSSPROPERTYVALUE_KatakanaIroha, L"katakana-iroha", 0x65D7C91C}, | |
439 {FDE_CSSPROPERTYVALUE_Super, L"super", 0x6A4F842F}, | |
440 {FDE_CSSPROPERTYVALUE_Center, L"center", 0x6C51AFC1}, | |
441 {FDE_CSSPROPERTYVALUE_TableHeaderGroup, L"table-header-group", 0x706103D8}, | |
442 {FDE_CSSPROPERTYVALUE_Inside, L"inside", 0x709CB0FC}, | |
443 {FDE_CSSPROPERTYVALUE_XxLarge, L"xx-large", 0x70BB1508}, | |
444 {FDE_CSSPROPERTYVALUE_Triangle, L"triangle", 0x7524EDF6}, | |
445 {FDE_CSSPROPERTYVALUE_RubyTextGroup, L"ruby-text-group", 0x78C2B98E}, | |
446 {FDE_CSSPROPERTYVALUE_Circle, L"circle", 0x7ABEC0D2}, | |
447 {FDE_CSSPROPERTYVALUE_Hiragana, L"hiragana", 0x7BF5E25B}, | |
448 {FDE_CSSPROPERTYVALUE_RepeatX, L"repeat-x", 0x7C8F3226}, | |
449 {FDE_CSSPROPERTYVALUE_RepeatY, L"repeat-y", 0x7C8F3227}, | |
450 {FDE_CSSPROPERTYVALUE_Move, L"move", 0x7DA03417}, | |
451 {FDE_CSSPROPERTYVALUE_HiraganaIroha, L"hiragana-iroha", 0x7EE863FB}, | |
452 {FDE_CSSPROPERTYVALUE_RubyBase, L"ruby-base", 0x7FD1B1EA}, | |
453 {FDE_CSSPROPERTYVALUE_Scroll, L"scroll", 0x84787AEF}, | |
454 {FDE_CSSPROPERTYVALUE_Smaller, L"smaller", 0x849769F0}, | |
455 {FDE_CSSPROPERTYVALUE_TableFooterGroup, L"table-footer-group", 0x85BDD97E}, | |
456 {FDE_CSSPROPERTYVALUE_Baseline, L"baseline", 0x87436BA3}, | |
457 {FDE_CSSPROPERTYVALUE_Separate, L"separate", 0x877C66B5}, | |
458 {FDE_CSSPROPERTYVALUE_Armenian, L"armenian", 0x889BE4EB}, | |
459 {FDE_CSSPROPERTYVALUE_Open, L"open", 0x8B90E1F2}, | |
460 {FDE_CSSPROPERTYVALUE_Relative, L"relative", 0x8C995B5C}, | |
461 {FDE_CSSPROPERTYVALUE_Thick, L"thick", 0x8CC35EB3}, | |
462 {FDE_CSSPROPERTYVALUE_Justify, L"justify", 0x8D269CAE}, | |
463 {FDE_CSSPROPERTYVALUE_Middle, L"middle", 0x947FA00F}, | |
464 {FDE_CSSPROPERTYVALUE_Always, L"always", 0x959AB231}, | |
465 {FDE_CSSPROPERTYVALUE_DistributeSpace, L"distribute-space", 0x97A20E58}, | |
466 {FDE_CSSPROPERTYVALUE_LineEdge, L"line-edge", 0x9A845D2A}, | |
467 {FDE_CSSPROPERTYVALUE_PreWrap, L"pre-wrap", 0x9D59588E}, | |
468 {FDE_CSSPROPERTYVALUE_Medium, L"medium", 0xA084A381}, | |
469 {FDE_CSSPROPERTYVALUE_NResize, L"n-resize", 0xA088968D}, | |
470 {FDE_CSSPROPERTYVALUE_ListItem, L"list-item", 0xA32382B8}, | |
471 {FDE_CSSPROPERTYVALUE_Show, L"show", 0xA66C10C1}, | |
472 {FDE_CSSPROPERTYVALUE_Currentcolor, L"currentColor", 0xA7883922}, | |
473 {FDE_CSSPROPERTYVALUE_NoCloseQuote, L"no-close-quote", 0xA79CBFFB}, | |
474 {FDE_CSSPROPERTYVALUE_VerticalLr, L"vertical-lr", 0xA8673F65}, | |
475 {FDE_CSSPROPERTYVALUE_VerticalRl, L"vertical-rl", 0xA8675E25}, | |
476 {FDE_CSSPROPERTYVALUE_Pointer, L"pointer", 0xA90929C1}, | |
477 {FDE_CSSPROPERTYVALUE_XxSmall, L"xx-small", 0xADE1FC76}, | |
478 {FDE_CSSPROPERTYVALUE_Bold, L"bold", 0xB18313A1}, | |
479 {FDE_CSSPROPERTYVALUE_Both, L"both", 0xB1833CAD}, | |
480 {FDE_CSSPROPERTYVALUE_SmallCaps, L"small-caps", 0xB299428D}, | |
481 {FDE_CSSPROPERTYVALUE_Katakana, L"katakana", 0xB421A4BC}, | |
482 {FDE_CSSPROPERTYVALUE_After, L"after", 0xB6B44172}, | |
483 {FDE_CSSPROPERTYVALUE_Horizontal, L"horizontal", 0xB7732DEA}, | |
484 {FDE_CSSPROPERTYVALUE_Dotted, L"dotted", 0xB88652A4}, | |
485 {FDE_CSSPROPERTYVALUE_Disc, L"disc", 0xBEBC18C3}, | |
486 {FDE_CSSPROPERTYVALUE_Georgian, L"georgian", 0xBEF99E8C}, | |
487 {FDE_CSSPROPERTYVALUE_Inline, L"inline", 0xC02D649F}, | |
488 {FDE_CSSPROPERTYVALUE_Overline, L"overline", 0xC0EC9FA4}, | |
489 {FDE_CSSPROPERTYVALUE_Wait, L"wait", 0xC1613BB5}, | |
490 {FDE_CSSPROPERTYVALUE_BreakAll, L"break-all", 0xC3145BAB}, | |
491 {FDE_CSSPROPERTYVALUE_UpperAlpha, L"upper-alpha", 0xC52D4A9F}, | |
492 {FDE_CSSPROPERTYVALUE_Capitalize, L"capitalize", 0xC5321D46}, | |
493 {FDE_CSSPROPERTYVALUE_Nowrap, L"nowrap", 0xC7994417}, | |
494 {FDE_CSSPROPERTYVALUE_TextBottom, L"text-bottom", 0xC7D08D87}, | |
495 {FDE_CSSPROPERTYVALUE_NoOpenQuote, L"no-open-quote", 0xC8CD7877}, | |
496 {FDE_CSSPROPERTYVALUE_Groove, L"groove", 0xCB24A412}, | |
497 {FDE_CSSPROPERTYVALUE_Progress, L"progress", 0xCD1D9835}, | |
498 {FDE_CSSPROPERTYVALUE_Larger, L"larger", 0xCD3C409D}, | |
499 {FDE_CSSPROPERTYVALUE_CloseQuote, L"close-quote", 0xCF8696D1}, | |
500 {FDE_CSSPROPERTYVALUE_TableCell, L"table-cell", 0xCFB5E595}, | |
501 {FDE_CSSPROPERTYVALUE_PreLine, L"pre-line", 0xD04FEDBC}, | |
502 {FDE_CSSPROPERTYVALUE_Absolute, L"absolute", 0xD0B2D55F}, | |
503 {FDE_CSSPROPERTYVALUE_InlineTable, L"inline-table", 0xD131F494}, | |
504 {FDE_CSSPROPERTYVALUE_BidiOverride, L"bidi-override", 0xD161FDE5}, | |
505 {FDE_CSSPROPERTYVALUE_InlineBlock, L"inline-block", 0xD26A8BD7}, | |
506 {FDE_CSSPROPERTYVALUE_Inset, L"inset", 0xD6F23243}, | |
507 {FDE_CSSPROPERTYVALUE_Crosshair, L"crosshair", 0xD6F8018E}, | |
508 {FDE_CSSPROPERTYVALUE_UpperLatin, L"upper-latin", 0xD9D60531}, | |
509 {FDE_CSSPROPERTYVALUE_Help, L"help", 0xDA002969}, | |
510 {FDE_CSSPROPERTYVALUE_Hide, L"hide", 0xDA69395A}, | |
511 {FDE_CSSPROPERTYVALUE_Uppercase, L"uppercase", 0xDAD595A8}, | |
512 {FDE_CSSPROPERTYVALUE_SResize, L"s-resize", 0xDB3AADF2}, | |
513 {FDE_CSSPROPERTYVALUE_Table, L"table", 0xDB9BE968}, | |
514 {FDE_CSSPROPERTYVALUE_Blink, L"blink", 0xDC36E390}, | |
515 {FDE_CSSPROPERTYVALUE_Block, L"block", 0xDCD480AB}, | |
516 {FDE_CSSPROPERTYVALUE_Start, L"start", 0xE1D9D5AE}, | |
517 {FDE_CSSPROPERTYVALUE_TableColumnGroup, L"table-column-group", 0xE2258EFD}, | |
518 {FDE_CSSPROPERTYVALUE_Italic, L"italic", 0xE31D5396}, | |
519 {FDE_CSSPROPERTYVALUE_LineThrough, L"line-through", 0xE4C5A276}, | |
520 {FDE_CSSPROPERTYVALUE_KeepAll, L"keep-all", 0xE704A72B}, | |
521 {FDE_CSSPROPERTYVALUE_LowerAlpha, L"lower-alpha", 0xECB75A3C}, | |
522 {FDE_CSSPROPERTYVALUE_RunIn, L"run-in", 0xEEC930B9}, | |
523 {FDE_CSSPROPERTYVALUE_Square, L"square", 0xEF85D351}, | |
524 {FDE_CSSPROPERTYVALUE_XLarge, L"x-large", 0xF008E390}, | |
525 {FDE_CSSPROPERTYVALUE_Large, L"large", 0xF4434FCB}, | |
526 {FDE_CSSPROPERTYVALUE_Before, L"before", 0xF4FFCE73}, | |
527 {FDE_CSSPROPERTYVALUE_Left, L"left", 0xF5AD782B}, | |
528 {FDE_CSSPROPERTYVALUE_TextTop, L"text-top", 0xFCB58D45}, | |
529 {FDE_CSSPROPERTYVALUE_RubyText, L"ruby-text", 0xFCC77174}, | |
530 {FDE_CSSPROPERTYVALUE_NoDisplay, L"no-display", 0xFE482860}, | |
531 }; | |
532 static const FDE_CSSMEDIATYPETABLE g_FDE_CSSMediaTypes[] = { | |
533 {0xF09, 0x02}, {0x4880, 0x20}, {0x536A, 0x80}, | |
534 {0x741D, 0x10}, {0x76ED, 0x08}, {0x7CFB, 0x01}, | |
535 {0x9578, 0x04}, {0xC8E1, 0x40}, {0xD0F9, 0xFF}, | |
536 }; | |
537 static const FDE_CSSLENGTHUNITTABLE g_FDE_CSSLengthUnits[] = { | |
538 {0x0672, 3}, {0x067D, 4}, {0x1AF7, 8}, {0x2F7A, 7}, | |
539 {0x3ED3, 10}, {0x3EE4, 9}, {0x3EE8, 5}, {0xFC30, 6}, | |
540 }; | |
541 static const FDE_CSSCOLORTABLE g_FDE_CSSColors[] = { | |
542 {0x031B47FE, 0xff000080}, {0x0BB8DF5B, 0xffff0000}, | |
543 {0x0D82A78C, 0xff800000}, {0x2ACC82E8, 0xff00ffff}, | |
544 {0x2D083986, 0xff008080}, {0x4A6A6195, 0xffc0c0c0}, | |
545 {0x546A8EF3, 0xff808080}, {0x65C9169C, 0xffffa500}, | |
546 {0x8422BB61, 0xffffffff}, {0x9271A558, 0xff800080}, | |
547 {0xA65A3EE3, 0xffff00ff}, {0xB1345708, 0xff0000ff}, | |
548 {0xB6D2CF1F, 0xff808000}, {0xD19B5E1C, 0xffffff00}, | |
549 {0xDB64391D, 0xff000000}, {0xF616D507, 0xff00ff00}, | |
550 {0xF6EFFF31, 0xff008000}, | |
551 }; | |
552 static const FDE_CSSPERSUDOTABLE g_FDE_CSSPersudoType[] = { | |
553 {FDE_CSSPERSUDO_After, L":after", 0x16EE1FEC}, | |
554 {FDE_CSSPERSUDO_Before, L":before", 0x7DCDDE2D}, | |
555 }; | |
556 FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo) { | |
557 return (ePersudo < FDE_CSSPERSUDO_NONE) ? (g_FDE_CSSPersudoType + ePersudo) | |
558 : NULL; | |
559 } | |
560 FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByName(const FX_WCHAR* pszName, | |
561 int32_t iLength) { | |
562 FXSYS_assert(pszName != NULL && iLength > 0); | |
563 FX_DWORD dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE); | |
564 int32_t iEnd = FDE_CSSPROPERTY_MAX - 1; | |
565 int32_t iMid, iStart = 0; | |
566 FX_DWORD dwMid; | |
567 do { | |
568 iMid = (iStart + iEnd) / 2; | |
569 dwMid = g_FDE_CSSProperties[iMid].dwHash; | |
570 if (dwHash == dwMid) { | |
571 return g_FDE_CSSProperties + iMid; | |
572 } else if (dwHash > dwMid) { | |
573 iStart = iMid + 1; | |
574 } else { | |
575 iEnd = iMid - 1; | |
576 } | |
577 } while (iStart <= iEnd); | |
578 return NULL; | |
579 } | |
580 FDE_LPCCSSPROPERTYTABLE FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY eName) { | |
581 return (eName < FDE_CSSPROPERTY_MAX) ? (g_FDE_CSSProperties + eName) : NULL; | |
582 } | |
583 FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByName( | |
584 const FX_WCHAR* pszName, | |
585 int32_t iLength) { | |
586 FXSYS_assert(pszName != NULL && iLength > 0); | |
587 FX_DWORD dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE); | |
588 int32_t iEnd = FDE_CSSPROPERTYVALUE_MAX - 1; | |
589 int32_t iMid, iStart = 0; | |
590 FX_DWORD dwMid; | |
591 do { | |
592 iMid = (iStart + iEnd) / 2; | |
593 dwMid = g_FDE_CSSPropertyValues[iMid].dwHash; | |
594 if (dwHash == dwMid) { | |
595 return g_FDE_CSSPropertyValues + iMid; | |
596 } else if (dwHash > dwMid) { | |
597 iStart = iMid + 1; | |
598 } else { | |
599 iEnd = iMid - 1; | |
600 } | |
601 } while (iStart <= iEnd); | |
602 return NULL; | |
603 } | |
604 FDE_LPCCSSPROPERTYVALUETABLE FDE_GetCSSPropertyValueByEnum( | |
605 FDE_CSSPROPERTYVALUE eName) { | |
606 return (eName < FDE_CSSPROPERTYVALUE_MAX) ? (g_FDE_CSSPropertyValues + eName) | |
607 : NULL; | |
608 } | |
609 FDE_LPCCSSMEDIATYPETABLE FDE_GetCSSMediaTypeByName(const FX_WCHAR* pszName, | |
610 int32_t iLength) { | |
611 FXSYS_assert(pszName != NULL && iLength > 0); | |
612 FX_WORD wHash = (FX_WORD)FX_HashCode_String_GetW(pszName, iLength, TRUE); | |
613 int32_t iEnd = | |
614 sizeof(g_FDE_CSSMediaTypes) / sizeof(FDE_CSSMEDIATYPETABLE) - 1; | |
615 int32_t iMid, iStart = 0; | |
616 FX_WORD uMid; | |
617 do { | |
618 iMid = (iStart + iEnd) / 2; | |
619 uMid = g_FDE_CSSMediaTypes[iMid].wHash; | |
620 if (wHash == uMid) { | |
621 return g_FDE_CSSMediaTypes + iMid; | |
622 } else if (wHash > uMid) { | |
623 iStart = iMid + 1; | |
624 } else { | |
625 iEnd = iMid - 1; | |
626 } | |
627 } while (iStart <= iEnd); | |
628 return NULL; | |
629 } | |
630 FDE_LPCCSSLENGTHUNITTABLE FDE_GetCSSLengthUnitByName(const FX_WCHAR* pszName, | |
631 int32_t iLength) { | |
632 FXSYS_assert(pszName != NULL && iLength > 0); | |
633 FX_WORD wHash = (FX_WORD)FX_HashCode_String_GetW(pszName, iLength, TRUE); | |
634 int32_t iEnd = | |
635 sizeof(g_FDE_CSSLengthUnits) / sizeof(FDE_CSSLENGTHUNITTABLE) - 1; | |
636 int32_t iMid, iStart = 0; | |
637 FX_WORD wMid; | |
638 do { | |
639 iMid = (iStart + iEnd) / 2; | |
640 wMid = g_FDE_CSSLengthUnits[iMid].wHash; | |
641 if (wHash == wMid) { | |
642 return g_FDE_CSSLengthUnits + iMid; | |
643 } else if (wHash > wMid) { | |
644 iStart = iMid + 1; | |
645 } else { | |
646 iEnd = iMid - 1; | |
647 } | |
648 } while (iStart <= iEnd); | |
649 return NULL; | |
650 } | |
651 FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const FX_WCHAR* pszName, | |
652 int32_t iLength) { | |
653 FXSYS_assert(pszName != NULL && iLength > 0); | |
654 FX_DWORD dwHash = FX_HashCode_String_GetW(pszName, iLength, TRUE); | |
655 int32_t iEnd = sizeof(g_FDE_CSSColors) / sizeof(FDE_CSSCOLORTABLE) - 1; | |
656 int32_t iMid, iStart = 0; | |
657 FX_DWORD dwMid; | |
658 do { | |
659 iMid = (iStart + iEnd) / 2; | |
660 dwMid = g_FDE_CSSColors[iMid].dwHash; | |
661 if (dwHash == dwMid) { | |
662 return g_FDE_CSSColors + iMid; | |
663 } else if (dwHash > dwMid) { | |
664 iStart = iMid + 1; | |
665 } else { | |
666 iEnd = iMid - 1; | |
667 } | |
668 } while (iStart <= iEnd); | |
669 return NULL; | |
670 } | |
671 FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, | |
672 int32_t iValueLen, | |
673 FX_FLOAT& fValue, | |
674 FDE_CSSPRIMITIVETYPE& eUnit) { | |
675 FXSYS_assert(pszValue != NULL && iValueLen > 0); | |
676 int32_t iUsedLen = 0; | |
677 fValue = FX_wcstof(pszValue, iValueLen, &iUsedLen); | |
678 if (iUsedLen <= 0) { | |
679 return FALSE; | |
680 } | |
681 iValueLen -= iUsedLen; | |
682 pszValue += iUsedLen; | |
683 eUnit = FDE_CSSPRIMITIVETYPE_Number; | |
684 if (iValueLen >= 1 && *pszValue == '%') { | |
685 eUnit = FDE_CSSPRIMITIVETYPE_Percent; | |
686 } else if (iValueLen == 2) { | |
687 FDE_LPCCSSLENGTHUNITTABLE pUnit = FDE_GetCSSLengthUnitByName(pszValue, 2); | |
688 if (pUnit != NULL) { | |
689 eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; | |
690 } | |
691 } | |
692 return TRUE; | |
693 } | |
694 | |
695 FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, | |
696 int32_t iValueLen, | |
697 int32_t& iOffset, | |
698 int32_t& iLength) { | |
699 FXSYS_assert(pszValue != NULL && iValueLen > 0); | |
700 iOffset = 0; | |
701 iLength = iValueLen; | |
702 if (iValueLen >= 2) { | |
703 FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1]; | |
704 if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) { | |
705 iOffset = 1, iLength -= 2; | |
706 } | |
707 } | |
708 return iValueLen > 0; | |
709 } | |
710 | |
711 FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, | |
712 int32_t iValueLen, | |
713 int32_t& iOffset, | |
714 int32_t& iLength) { | |
715 FXSYS_assert(pszValue != NULL && iValueLen > 0); | |
716 if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' || | |
717 FX_wcsnicmp(L"url(", pszValue, 4)) { | |
718 return FALSE; | |
719 } | |
720 if (FDE_ParseCSSString(pszValue + 4, iValueLen - 5, iOffset, iLength)) { | |
721 iOffset += 4; | |
722 return TRUE; | |
723 } | |
724 return FALSE; | |
725 } | |
726 | |
727 FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, | |
728 int32_t iValueLen, | |
729 FX_ARGB& dwColor) { | |
730 FXSYS_assert(pszValue != NULL && iValueLen > 0); | |
731 if (*pszValue == '#') { | |
732 switch (iValueLen) { | |
733 case 4: { | |
734 uint8_t red = FX_Hex2Dec((uint8_t)pszValue[1], (uint8_t)pszValue[1]); | |
735 uint8_t green = FX_Hex2Dec((uint8_t)pszValue[2], (uint8_t)pszValue[2]); | |
736 uint8_t blue = FX_Hex2Dec((uint8_t)pszValue[3], (uint8_t)pszValue[3]); | |
737 dwColor = ArgbEncode(255, red, green, blue); | |
738 } | |
739 return TRUE; | |
740 case 7: { | |
741 uint8_t red = FX_Hex2Dec((uint8_t)pszValue[1], (uint8_t)pszValue[2]); | |
742 uint8_t green = FX_Hex2Dec((uint8_t)pszValue[3], (uint8_t)pszValue[4]); | |
743 uint8_t blue = FX_Hex2Dec((uint8_t)pszValue[5], (uint8_t)pszValue[6]); | |
744 dwColor = ArgbEncode(255, red, green, blue); | |
745 } | |
746 return TRUE; | |
747 } | |
748 } else if (iValueLen >= 10) { | |
749 if (pszValue[iValueLen - 1] != ')' || FX_wcsnicmp(L"rgb(", pszValue, 4)) { | |
750 return FALSE; | |
751 } | |
752 uint8_t rgb[3] = {0}; | |
753 FX_FLOAT fValue; | |
754 FDE_CSSPRIMITIVETYPE eType; | |
755 CFDE_CSSValueListParser list(pszValue + 4, iValueLen - 5, ','); | |
756 for (int32_t i = 0; i < 3; ++i) { | |
757 if (!list.NextValue(eType, pszValue, iValueLen)) { | |
758 return FALSE; | |
759 } | |
760 if (eType != FDE_CSSPRIMITIVETYPE_Number) { | |
761 return FALSE; | |
762 } | |
763 if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) { | |
764 return FALSE; | |
765 } | |
766 rgb[i] = eType == FDE_CSSPRIMITIVETYPE_Percent | |
767 ? FXSYS_round(fValue * 2.55f) | |
768 : FXSYS_round(fValue); | |
769 } | |
770 dwColor = ArgbEncode(255, rgb[0], rgb[1], rgb[2]); | |
771 return TRUE; | |
772 } else { | |
773 FDE_LPCCSSCOLORTABLE pColor = FDE_GetCSSColorByName(pszValue, iValueLen); | |
774 if (pColor != NULL) { | |
775 dwColor = pColor->dwValue; | |
776 return TRUE; | |
777 } | |
778 } | |
779 return FALSE; | |
780 } | |
781 | |
782 CFDE_CSSValueList::CFDE_CSSValueList(IFX_MEMAllocator* pStaticStore, | |
783 const CFDE_CSSValueArray& list) { | |
784 m_iCount = list.GetSize(); | |
785 int32_t iByteCount = m_iCount * sizeof(IFDE_CSSValue*); | |
786 m_ppList = (IFDE_CSSValue**)pStaticStore->Alloc(iByteCount); | |
787 FXSYS_memcpy(m_ppList, list.GetData(), iByteCount); | |
788 } | |
789 FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, | |
790 const FX_WCHAR*& pStart, | |
791 int32_t& iLength) { | |
792 while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) { | |
793 ++m_pCur; | |
794 } | |
795 if (m_pCur >= m_pEnd) { | |
796 return FALSE; | |
797 } | |
798 eType = FDE_CSSPRIMITIVETYPE_Unknown; | |
799 pStart = m_pCur; | |
800 iLength = 0; | |
801 FX_WCHAR wch = *m_pCur; | |
802 if (wch == '#') { | |
803 iLength = SkipTo(' '); | |
804 if (iLength == 4 || iLength == 7) { | |
805 eType = FDE_CSSPRIMITIVETYPE_RGB; | |
806 } | |
807 } else if ((wch >= '0' && wch <= '9') || wch == '.' || wch == '-' || | |
808 wch == '+') { | |
809 while (m_pCur < m_pEnd && (*m_pCur > ' ' && *m_pCur != m_Separator)) { | |
810 ++m_pCur; | |
811 } | |
812 iLength = m_pCur - pStart; | |
813 if (iLength > 0) { | |
814 eType = FDE_CSSPRIMITIVETYPE_Number; | |
815 } | |
816 } else if (wch == '\"' || wch == '\'') { | |
817 pStart++; | |
818 iLength = SkipTo(wch) - 1; | |
819 m_pCur++; | |
820 eType = FDE_CSSPRIMITIVETYPE_String; | |
821 } else if (m_pEnd - m_pCur > 5 && m_pCur[3] == '(') { | |
822 if (FX_wcsnicmp(L"url", m_pCur, 3) == 0) { | |
823 wch = m_pCur[4]; | |
824 if (wch == '\"' || wch == '\'') { | |
825 pStart += 5; | |
826 iLength = SkipTo(wch) - 6; | |
827 m_pCur += 2; | |
828 } else { | |
829 pStart += 4; | |
830 iLength = SkipTo(')') - 4; | |
831 m_pCur++; | |
832 } | |
833 eType = FDE_CSSPRIMITIVETYPE_URI; | |
834 } else if (FX_wcsnicmp(L"rgb", m_pCur, 3) == 0) { | |
835 iLength = SkipTo(')') + 1; | |
836 m_pCur++; | |
837 eType = FDE_CSSPRIMITIVETYPE_RGB; | |
838 } | |
839 } else { | |
840 iLength = SkipTo(m_Separator, TRUE, TRUE); | |
841 eType = FDE_CSSPRIMITIVETYPE_String; | |
842 } | |
843 return m_pCur <= m_pEnd && iLength > 0; | |
844 } | |
845 int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch, | |
846 FX_BOOL bWSSeparator, | |
847 FX_BOOL bBrContinue) { | |
848 const FX_WCHAR* pStart = m_pCur; | |
849 if (!bBrContinue) { | |
850 if (bWSSeparator) { | |
851 while ((++m_pCur < m_pEnd) && (*m_pCur != wch) && (*m_pCur > ' ')) { | |
852 continue; | |
853 } | |
854 } else { | |
855 while (++m_pCur < m_pEnd && *m_pCur != wch) { | |
856 continue; | |
857 } | |
858 } | |
859 | |
860 } else { | |
861 int32_t iBracketCount = 0; | |
862 if (bWSSeparator) { | |
863 while ((m_pCur < m_pEnd) && (*m_pCur != wch) && (*m_pCur > ' ')) { | |
864 if (*m_pCur == '(') { | |
865 iBracketCount++; | |
866 } else if (*m_pCur == ')') { | |
867 iBracketCount--; | |
868 } | |
869 m_pCur++; | |
870 } | |
871 } else { | |
872 while (m_pCur < m_pEnd && *m_pCur != wch) { | |
873 if (*m_pCur == '(') { | |
874 iBracketCount++; | |
875 } else if (*m_pCur == ')') { | |
876 iBracketCount--; | |
877 } | |
878 m_pCur++; | |
879 } | |
880 } | |
881 while (iBracketCount > 0 && m_pCur < m_pEnd) { | |
882 if (*m_pCur == ')') { | |
883 iBracketCount--; | |
884 } | |
885 m_pCur++; | |
886 } | |
887 } | |
888 return m_pCur - pStart; | |
889 } | |
OLD | NEW |