Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : /*
7 : * methods for dealing with CSS properties and tables of the keyword
8 : * values they accept
9 : */
10 :
11 : #include "nsCSSProps.h"
12 :
13 : #include "mozilla/ArrayUtils.h"
14 :
15 : #include "nsCSSKeywords.h"
16 : #include "nsLayoutUtils.h"
17 : #include "nsStyleConsts.h"
18 : #include "nsIWidget.h"
19 : #include "nsThemeConstants.h" // For system widget appearance types
20 :
21 : #include "mozilla/dom/AnimationEffectReadOnlyBinding.h" // for PlaybackDirection
22 : #include "mozilla/LookAndFeel.h" // for system colors
23 :
24 : #include "nsString.h"
25 : #include "nsStaticNameTable.h"
26 :
27 : #include "mozilla/Preferences.h"
28 :
29 : using namespace mozilla;
30 :
31 : typedef nsCSSProps::KTableEntry KTableEntry;
32 :
33 : // By wrapping internal-only properties in this macro, we are not
34 : // exposing them in the CSSOM. Since currently it is not necessary to
35 : // allow accessing them in that way, it is easier and cheaper to just
36 : // do this rather than exposing them conditionally.
37 : #define CSS_PROP(name_, id_, method_, flags_, pref_, ...) \
38 : static_assert(!((flags_) & CSS_PROPERTY_ENABLED_MASK) || pref_[0], \
39 : "Internal-only property '" #name_ "' should be wrapped in " \
40 : "#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL");
41 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
42 : #define CSS_PROP_LIST_EXCLUDE_INTERNAL
43 : #include "nsCSSPropList.h"
44 : #undef CSS_PROP_LIST_EXCLUDE_INTERNAL
45 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
46 : #undef CSS_PROP
47 :
48 : #define CSS_PROP(name_, id_, method_, flags_, pref_, ...) \
49 : static_assert(!((flags_) & CSS_PROPERTY_ENABLED_IN_CHROME) || \
50 : ((flags_) & CSS_PROPERTY_ENABLED_IN_UA_SHEETS), \
51 : "Property '" #name_ "' is enabled in chrome, so it should " \
52 : "also be enabled in UA sheets");
53 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
54 : #include "nsCSSPropList.h"
55 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
56 : #undef CSS_PROP
57 :
58 : // required to make the symbol external, so that TestCSSPropertyLookup.cpp can link with it
59 : extern const char* const kCSSRawProperties[];
60 :
61 : // define an array of all CSS properties
62 : const char* const kCSSRawProperties[eCSSProperty_COUNT_with_aliases] = {
63 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
64 : stylestruct_, stylestructoffset_, animtype_) \
65 : #name_,
66 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
67 : #include "nsCSSPropList.h"
68 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
69 : #undef CSS_PROP
70 : #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) #name_,
71 : #include "nsCSSPropList.h"
72 : #undef CSS_PROP_SHORTHAND
73 : #define CSS_PROP_ALIAS(aliasname_, id_, method_, pref_) #aliasname_,
74 : #include "nsCSSPropAliasList.h"
75 : #undef CSS_PROP_ALIAS
76 : };
77 :
78 : using namespace mozilla;
79 :
80 : static int32_t gPropertyTableRefCount;
81 : static nsStaticCaseInsensitiveNameTable* gPropertyTable;
82 : static nsStaticCaseInsensitiveNameTable* gFontDescTable;
83 : static nsStaticCaseInsensitiveNameTable* gCounterDescTable;
84 : static nsStaticCaseInsensitiveNameTable* gPredefinedCounterStyleTable;
85 : static nsDataHashtable<nsCStringHashKey,nsCSSPropertyID>* gPropertyIDLNameTable;
86 :
87 : /* static */ nsCSSPropertyID *
88 : nsCSSProps::gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands];
89 : /* static */ nsCSSPropertyID* nsCSSProps::gShorthandsContainingPool = nullptr;
90 :
91 : static const char* const kCSSRawFontDescs[] = {
92 : #define CSS_FONT_DESC(name_, method_) #name_,
93 : #include "nsCSSFontDescList.h"
94 : #undef CSS_FONT_DESC
95 : };
96 :
97 : static const char* const kCSSRawCounterDescs[] = {
98 : #define CSS_COUNTER_DESC(name_, method_) #name_,
99 : #include "nsCSSCounterDescList.h"
100 : #undef CSS_COUNTER_DESC
101 : };
102 :
103 : static const char* const kCSSRawPredefinedCounterStyles[] = {
104 : "none",
105 : // 6 Simple Predefined Counter Styles
106 : // 6.1 Numeric
107 : "decimal", "decimal-leading-zero", "arabic-indic", "armenian",
108 : "upper-armenian", "lower-armenian", "bengali", "cambodian", "khmer",
109 : "cjk-decimal", "devanagari", "georgian", "gujarati", "gurmukhi", "hebrew",
110 : "kannada", "lao", "malayalam", "mongolian", "myanmar", "oriya", "persian",
111 : "lower-roman", "upper-roman", "tamil", "telugu", "thai", "tibetan",
112 : // 6.2 Alphabetic
113 : "lower-alpha", "lower-latin", "upper-alpha", "upper-latin",
114 : "cjk-earthly-branch", "cjk-heavenly-stem", "lower-greek",
115 : "hiragana", "hiragana-iroha", "katakana", "katakana-iroha",
116 : // 6.3 Symbolic
117 : "disc", "circle", "square", "disclosure-open", "disclosure-closed",
118 : // 7 Complex Predefined Counter Styles
119 : // 7.1 Longhand East Asian Counter Styles
120 : // 7.1.1 Japanese
121 : "japanese-informal", "japanese-formal",
122 : // 7.1.2 Korean
123 : "korean-hangul-formal", "korean-hanja-informal", "korean-hanja-formal",
124 : // 7.1.3 Chinese
125 : "simp-chinese-informal", "simp-chinese-formal",
126 : "trad-chinese-informal", "trad-chinese-formal", "cjk-ideographic",
127 : // 7.2 Ethiopic Numeric Counter Style
128 : "ethiopic-numeric"
129 : };
130 :
131 : struct PropertyAndCount {
132 : nsCSSPropertyID property;
133 : uint32_t count;
134 : };
135 :
136 : static int
137 699 : SortPropertyAndCount(const void* s1, const void* s2, void *closure)
138 : {
139 699 : const PropertyAndCount *pc1 = static_cast<const PropertyAndCount*>(s1);
140 699 : const PropertyAndCount *pc2 = static_cast<const PropertyAndCount*>(s2);
141 : // Primary sort by count (lowest to highest)
142 699 : if (pc1->count != pc2->count)
143 336 : return pc1->count - pc2->count;
144 : // Secondary sort by property index (highest to lowest)
145 363 : return pc2->property - pc1->property;
146 : }
147 :
148 : // We need eCSSAliasCount so we can make gAliases nonzero size when there
149 : // are no aliases.
150 : enum {
151 : eCSSAliasCount = eCSSProperty_COUNT_with_aliases - eCSSProperty_COUNT
152 : };
153 :
154 : // The names are in kCSSRawProperties.
155 : static nsCSSPropertyID gAliases[eCSSAliasCount != 0 ? eCSSAliasCount : 1] = {
156 : #define CSS_PROP_ALIAS(aliasname_, propid_, aliasmethod_, pref_) \
157 : eCSSProperty_##propid_ ,
158 : #include "nsCSSPropAliasList.h"
159 : #undef CSS_PROP_ALIAS
160 : };
161 :
162 : nsStaticCaseInsensitiveNameTable*
163 12 : CreateStaticTable(const char* const aRawTable[], int32_t aLength)
164 : {
165 12 : auto table = new nsStaticCaseInsensitiveNameTable(aRawTable, aLength);
166 : #ifdef DEBUG
167 : // Partially verify the entries.
168 1671 : for (int32_t index = 0; index < aLength; ++index) {
169 3318 : nsAutoCString temp(aRawTable[index]);
170 1659 : MOZ_ASSERT(-1 == temp.FindChar('_'),
171 : "underscore char in case insensitive name table");
172 : }
173 : #endif
174 12 : return table;
175 : }
176 :
177 : void
178 3 : nsCSSProps::AddRefTable(void)
179 : {
180 3 : if (0 == gPropertyTableRefCount++) {
181 3 : MOZ_ASSERT(!gPropertyTable, "pre existing array!");
182 3 : MOZ_ASSERT(!gFontDescTable, "pre existing array!");
183 3 : MOZ_ASSERT(!gCounterDescTable, "pre existing array!");
184 3 : MOZ_ASSERT(!gPredefinedCounterStyleTable, "pre existing array!");
185 3 : MOZ_ASSERT(!gPropertyIDLNameTable, "pre existing array!");
186 :
187 3 : gPropertyTable = CreateStaticTable(
188 : kCSSRawProperties, eCSSProperty_COUNT_with_aliases);
189 3 : gFontDescTable = CreateStaticTable(kCSSRawFontDescs, eCSSFontDesc_COUNT);
190 3 : gCounterDescTable = CreateStaticTable(
191 : kCSSRawCounterDescs, eCSSCounterDesc_COUNT);
192 3 : gPredefinedCounterStyleTable = CreateStaticTable(
193 : kCSSRawPredefinedCounterStyles,
194 3 : ArrayLength(kCSSRawPredefinedCounterStyles));
195 :
196 3 : gPropertyIDLNameTable = new nsDataHashtable<nsCStringHashKey,nsCSSPropertyID>;
197 2226 : for (nsCSSPropertyID p = nsCSSPropertyID(0);
198 1113 : size_t(p) < ArrayLength(kIDLNameTable);
199 1110 : p = nsCSSPropertyID(p + 1)) {
200 1110 : if (kIDLNameTable[p]) {
201 1059 : gPropertyIDLNameTable->Put(nsDependentCString(kIDLNameTable[p]), p);
202 : }
203 : }
204 :
205 3 : BuildShorthandsContainingTable();
206 :
207 : static bool prefObserversInited = false;
208 3 : if (!prefObserversInited) {
209 3 : prefObserversInited = true;
210 :
211 : #define OBSERVE_PROP(pref_, id_) \
212 : if (pref_[0]) { \
213 : Preferences::AddBoolVarCache(&gPropertyEnabled[id_], \
214 : pref_); \
215 : }
216 :
217 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
218 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
219 : OBSERVE_PROP(pref_, eCSSProperty_##id_)
220 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
221 : #include "nsCSSPropList.h"
222 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
223 : #undef CSS_PROP
224 :
225 : #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
226 : OBSERVE_PROP(pref_, eCSSProperty_##id_)
227 : #include "nsCSSPropList.h"
228 : #undef CSS_PROP_SHORTHAND
229 :
230 : #define CSS_PROP_ALIAS(aliasname_, propid_, aliasmethod_, pref_) \
231 : OBSERVE_PROP(pref_, eCSSPropertyAlias_##aliasmethod_)
232 : #include "nsCSSPropAliasList.h"
233 : #undef CSS_PROP_ALIAS
234 :
235 : #undef OBSERVE_PROP
236 : }
237 :
238 : #ifdef DEBUG
239 : {
240 : // Assert that if CSS_PROPERTY_ENABLED_IN_UA_SHEETS or
241 : // CSS_PROPERTY_ENABLED_IN_CHROME is used on a shorthand property
242 : // that all of its component longhands also have the flag.
243 : static uint32_t flagsToCheck[] = {
244 : CSS_PROPERTY_ENABLED_IN_UA_SHEETS,
245 : CSS_PROPERTY_ENABLED_IN_CHROME
246 : };
247 147 : for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands;
248 147 : shorthand < eCSSProperty_COUNT;
249 144 : shorthand = nsCSSPropertyID(shorthand + 1)) {
250 432 : for (size_t i = 0; i < ArrayLength(flagsToCheck); i++) {
251 288 : uint32_t flag = flagsToCheck[i];
252 288 : if (!nsCSSProps::PropHasFlags(shorthand, flag)) {
253 288 : continue;
254 : }
255 0 : for (const nsCSSPropertyID* p =
256 0 : nsCSSProps::SubpropertyEntryFor(shorthand);
257 0 : *p != eCSSProperty_UNKNOWN;
258 : ++p) {
259 0 : MOZ_ASSERT(nsCSSProps::PropHasFlags(*p, flag),
260 : "all subproperties of a property with a "
261 : "CSS_PROPERTY_ENABLED_* flag must also have "
262 : "the flag");
263 : }
264 : }
265 : }
266 :
267 : // Assert that CSS_PROPERTY_INTERNAL is used on properties in
268 : // #ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL sections of nsCSSPropList.h
269 : // and on no others.
270 : static nsCSSPropertyID nonInternalProperties[] = {
271 : #define CSS_PROP(name_, id_, ...) eCSSProperty_##id_,
272 : #define CSS_PROP_SHORTHAND(name_, id_, ...) eCSSProperty_##id_,
273 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
274 : #define CSS_PROP_LIST_EXCLUDE_INTERNAL
275 : #include "nsCSSPropList.h"
276 : #undef CSS_PROP_LIST_EXCLUDE_INTERNAL
277 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
278 : #undef CSS_PROP_SHORTHAND
279 : #undef CSS_PROP
280 : };
281 3 : MOZ_ASSERT(ArrayLength(nonInternalProperties) <= eCSSProperty_COUNT);
282 :
283 : bool found[eCSSProperty_COUNT];
284 3 : PodArrayZero(found);
285 1062 : for (nsCSSPropertyID p : nonInternalProperties) {
286 1059 : MOZ_ASSERT(!nsCSSProps::PropHasFlags(p, CSS_PROPERTY_INTERNAL),
287 : "properties defined outside of #ifndef "
288 : "CSS_PROP_LIST_EXCLUDE_INTERNAL sections must not have "
289 : "the CSS_PROPERTY_INTERNAL flag");
290 1059 : found[p] = true;
291 : }
292 :
293 1113 : for (size_t i = 0; i < ArrayLength(found); ++i) {
294 1110 : if (!found[i]) {
295 51 : auto p = static_cast<nsCSSPropertyID>(i);
296 51 : MOZ_ASSERT(nsCSSProps::PropHasFlags(p, CSS_PROPERTY_INTERNAL),
297 : "properties defined in #ifndef "
298 : "CSS_PROP_LIST_EXCLUDE_INTERNAL sections must have "
299 : "the CSS_PROPERTY_INTERNAL flag");
300 : }
301 : }
302 : }
303 : #endif
304 : }
305 3 : }
306 :
307 : #undef DEBUG_SHORTHANDS_CONTAINING
308 :
309 : bool
310 3 : nsCSSProps::BuildShorthandsContainingTable()
311 : {
312 : uint32_t occurrenceCounts[eCSSProperty_COUNT_no_shorthands];
313 3 : memset(occurrenceCounts, 0, sizeof(occurrenceCounts));
314 : PropertyAndCount subpropCounts[eCSSProperty_COUNT -
315 : eCSSProperty_COUNT_no_shorthands];
316 147 : for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands;
317 147 : shorthand < eCSSProperty_COUNT;
318 144 : shorthand = nsCSSPropertyID(shorthand + 1)) {
319 : #ifdef DEBUG_SHORTHANDS_CONTAINING
320 : printf("Considering shorthand property '%s'.\n",
321 : nsCSSProps::GetStringValue(shorthand).get());
322 : #endif
323 : PropertyAndCount &subpropCountsEntry =
324 144 : subpropCounts[shorthand - eCSSProperty_COUNT_no_shorthands];
325 144 : subpropCountsEntry.property = shorthand;
326 144 : subpropCountsEntry.count = 0;
327 144 : if (nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS)) {
328 : // Don't put shorthands that are acting as aliases in the
329 : // shorthands-containing lists.
330 3 : continue;
331 : }
332 1653 : for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthand);
333 1653 : *subprops != eCSSProperty_UNKNOWN;
334 : ++subprops) {
335 1512 : MOZ_ASSERT(0 <= *subprops && *subprops < eCSSProperty_COUNT_no_shorthands,
336 : "subproperty must be a longhand");
337 1512 : ++occurrenceCounts[*subprops];
338 1512 : ++subpropCountsEntry.count;
339 : }
340 : }
341 :
342 3 : uint32_t poolEntries = 0;
343 969 : for (nsCSSPropertyID longhand = nsCSSPropertyID(0);
344 969 : longhand < eCSSProperty_COUNT_no_shorthands;
345 966 : longhand = nsCSSPropertyID(longhand + 1)) {
346 966 : uint32_t count = occurrenceCounts[longhand];
347 966 : if (count > 0)
348 : // leave room for terminator
349 936 : poolEntries += count + 1;
350 : }
351 :
352 6 : gShorthandsContainingPool = new nsCSSPropertyID[poolEntries];
353 3 : if (!gShorthandsContainingPool)
354 0 : return false;
355 :
356 : // Initialize all entries to point to their null-terminator.
357 : {
358 3 : nsCSSPropertyID *poolCursor = gShorthandsContainingPool - 1;
359 : nsCSSPropertyID *lastTerminator =
360 3 : gShorthandsContainingPool + poolEntries - 1;
361 969 : for (nsCSSPropertyID longhand = nsCSSPropertyID(0);
362 969 : longhand < eCSSProperty_COUNT_no_shorthands;
363 966 : longhand = nsCSSPropertyID(longhand + 1)) {
364 966 : uint32_t count = occurrenceCounts[longhand];
365 966 : if (count > 0) {
366 936 : poolCursor += count + 1;
367 936 : gShorthandsContainingTable[longhand] = poolCursor;
368 936 : *poolCursor = eCSSProperty_UNKNOWN;
369 : } else {
370 30 : gShorthandsContainingTable[longhand] = lastTerminator;
371 : }
372 : }
373 3 : MOZ_ASSERT(poolCursor == lastTerminator, "miscalculation");
374 : }
375 :
376 : // Sort with lowest count at the start and highest at the end, and
377 : // within counts sort in reverse property index order.
378 3 : NS_QuickSort(&subpropCounts, ArrayLength(subpropCounts),
379 3 : sizeof(subpropCounts[0]), SortPropertyAndCount, nullptr);
380 :
381 : // Fill in all the entries in gShorthandsContainingTable
382 147 : for (const PropertyAndCount *shorthandAndCount = subpropCounts,
383 3 : *shorthandAndCountEnd = ArrayEnd(subpropCounts);
384 147 : shorthandAndCount < shorthandAndCountEnd;
385 : ++shorthandAndCount) {
386 : #ifdef DEBUG_SHORTHANDS_CONTAINING
387 : printf("Entering %u subprops for '%s'.\n",
388 : shorthandAndCount->count,
389 : nsCSSProps::GetStringValue(shorthandAndCount->property).get());
390 : #endif
391 144 : if (nsCSSProps::PropHasFlags(shorthandAndCount->property,
392 : CSS_PROPERTY_IS_ALIAS)) {
393 : // Don't put shorthands that are acting as aliases in the
394 : // shorthands-containing lists.
395 3 : continue;
396 : }
397 1512 : for (const nsCSSPropertyID* subprops =
398 141 : SubpropertyEntryFor(shorthandAndCount->property);
399 1653 : *subprops != eCSSProperty_UNKNOWN;
400 : ++subprops) {
401 1512 : *(--gShorthandsContainingTable[*subprops]) = shorthandAndCount->property;
402 : }
403 : }
404 :
405 : #ifdef DEBUG_SHORTHANDS_CONTAINING
406 : for (nsCSSPropertyID longhand = nsCSSPropertyID(0);
407 : longhand < eCSSProperty_COUNT_no_shorthands;
408 : longhand = nsCSSPropertyID(longhand + 1)) {
409 : printf("Property %s is in %d shorthands.\n",
410 : nsCSSProps::GetStringValue(longhand).get(),
411 : occurrenceCounts[longhand]);
412 : for (const nsCSSPropertyID *shorthands = ShorthandsContaining(longhand);
413 : *shorthands != eCSSProperty_UNKNOWN;
414 : ++shorthands) {
415 : printf(" %s\n", nsCSSProps::GetStringValue(*shorthands).get());
416 : }
417 : }
418 : #endif
419 :
420 : #ifdef DEBUG
421 : // Verify that all values that should be are present.
422 147 : for (nsCSSPropertyID shorthand = eCSSProperty_COUNT_no_shorthands;
423 147 : shorthand < eCSSProperty_COUNT;
424 144 : shorthand = nsCSSPropertyID(shorthand + 1)) {
425 144 : if (nsCSSProps::PropHasFlags(shorthand, CSS_PROPERTY_IS_ALIAS)) {
426 : // Don't put shorthands that are acting as aliases in the
427 : // shorthands-containing lists.
428 3 : continue;
429 : }
430 1653 : for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(shorthand);
431 1653 : *subprops != eCSSProperty_UNKNOWN;
432 : ++subprops) {
433 1512 : uint32_t count = 0;
434 4536 : for (const nsCSSPropertyID *shcont = ShorthandsContaining(*subprops);
435 4536 : *shcont != eCSSProperty_UNKNOWN;
436 : ++shcont) {
437 3024 : if (*shcont == shorthand)
438 1512 : ++count;
439 : }
440 1512 : MOZ_ASSERT(count == 1,
441 : "subproperty of shorthand should have shorthand"
442 : " in its ShorthandsContaining() table");
443 : }
444 : }
445 :
446 : // Verify that there are no extra values
447 969 : for (nsCSSPropertyID longhand = nsCSSPropertyID(0);
448 969 : longhand < eCSSProperty_COUNT_no_shorthands;
449 966 : longhand = nsCSSPropertyID(longhand + 1)) {
450 2478 : for (const nsCSSPropertyID *shorthands = ShorthandsContaining(longhand);
451 2478 : *shorthands != eCSSProperty_UNKNOWN;
452 : ++shorthands) {
453 1512 : uint32_t count = 0;
454 297792 : for (const nsCSSPropertyID* subprops = SubpropertyEntryFor(*shorthands);
455 297792 : *subprops != eCSSProperty_UNKNOWN;
456 : ++subprops) {
457 296280 : if (*subprops == longhand)
458 1512 : ++count;
459 : }
460 1512 : MOZ_ASSERT(count == 1,
461 : "longhand should be in subproperty table of "
462 : "property in its ShorthandsContaining() table");
463 : }
464 : }
465 : #endif
466 :
467 3 : return true;
468 : }
469 :
470 : void
471 0 : nsCSSProps::ReleaseTable(void)
472 : {
473 0 : if (0 == --gPropertyTableRefCount) {
474 0 : delete gPropertyTable;
475 0 : gPropertyTable = nullptr;
476 :
477 0 : delete gFontDescTable;
478 0 : gFontDescTable = nullptr;
479 :
480 0 : delete gCounterDescTable;
481 0 : gCounterDescTable = nullptr;
482 :
483 0 : delete gPredefinedCounterStyleTable;
484 0 : gPredefinedCounterStyleTable = nullptr;
485 :
486 0 : delete gPropertyIDLNameTable;
487 0 : gPropertyIDLNameTable = nullptr;
488 :
489 0 : delete [] gShorthandsContainingPool;
490 0 : gShorthandsContainingPool = nullptr;
491 : }
492 0 : }
493 :
494 : /* static */ bool
495 0 : nsCSSProps::IsInherited(nsCSSPropertyID aProperty)
496 : {
497 0 : MOZ_ASSERT(!IsShorthand(aProperty));
498 :
499 0 : nsStyleStructID sid = kSIDTable[aProperty];
500 0 : return nsCachedStyleData::IsInherited(sid);
501 : }
502 :
503 : /* static */ bool
504 0 : nsCSSProps::IsCustomPropertyName(const nsACString& aProperty)
505 : {
506 : // Custom properties don't need to have a character after the "--" prefix.
507 0 : return aProperty.Length() >= CSS_CUSTOM_NAME_PREFIX_LENGTH &&
508 0 : StringBeginsWith(aProperty, NS_LITERAL_CSTRING("--"));
509 : }
510 :
511 : /* static */ bool
512 14543 : nsCSSProps::IsCustomPropertyName(const nsAString& aProperty)
513 : {
514 43629 : return aProperty.Length() >= CSS_CUSTOM_NAME_PREFIX_LENGTH &&
515 43629 : StringBeginsWith(aProperty, NS_LITERAL_STRING("--"));
516 : }
517 :
518 : nsCSSPropertyID
519 0 : nsCSSProps::LookupProperty(const nsACString& aProperty,
520 : EnabledState aEnabled)
521 : {
522 0 : MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
523 :
524 0 : if (IsCustomPropertyName(aProperty)) {
525 0 : return eCSSPropertyExtra_variable;
526 : }
527 :
528 0 : nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty));
529 0 : if (MOZ_LIKELY(res < eCSSProperty_COUNT)) {
530 0 : if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
531 0 : res = eCSSProperty_UNKNOWN;
532 : }
533 0 : return res;
534 : }
535 : MOZ_ASSERT(eCSSAliasCount != 0,
536 : "'res' must be an alias at this point so we better have some!");
537 : // We intentionally don't support CSSEnabledState::eInUASheets or
538 : // CSSEnabledState::eInChrome for aliases yet because it's unlikely
539 : // there will be a need for it.
540 0 : if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
541 0 : res = gAliases[res - eCSSProperty_COUNT];
542 0 : MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
543 : "aliases must not point to other aliases");
544 0 : if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
545 0 : return res;
546 : }
547 : }
548 0 : return eCSSProperty_UNKNOWN;
549 : }
550 :
551 : nsCSSPropertyID
552 6658 : nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
553 : {
554 6658 : if (IsCustomPropertyName(aProperty)) {
555 0 : return eCSSPropertyExtra_variable;
556 : }
557 :
558 : // This is faster than converting and calling
559 : // LookupProperty(nsACString&). The table will do its own
560 : // converting and avoid a PromiseFlatCString() call.
561 6658 : MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
562 6658 : nsCSSPropertyID res = nsCSSPropertyID(gPropertyTable->Lookup(aProperty));
563 6658 : if (MOZ_LIKELY(res < eCSSProperty_COUNT)) {
564 6615 : if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) {
565 0 : res = eCSSProperty_UNKNOWN;
566 : }
567 6615 : return res;
568 : }
569 : MOZ_ASSERT(eCSSAliasCount != 0,
570 : "'res' must be an alias at this point so we better have some!");
571 : // We intentionally don't support CSSEnabledState::eInUASheets or
572 : // CSSEnabledState::eInChrome for aliases yet because it's unlikely
573 : // there will be a need for it.
574 43 : if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
575 43 : res = gAliases[res - eCSSProperty_COUNT];
576 43 : MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
577 : "aliases must not point to other aliases");
578 43 : if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
579 43 : return res;
580 : }
581 : }
582 0 : return eCSSProperty_UNKNOWN;
583 : }
584 :
585 : nsCSSPropertyID
586 0 : nsCSSProps::LookupPropertyByIDLName(const nsACString& aPropertyIDLName,
587 : EnabledState aEnabled)
588 : {
589 : nsCSSPropertyID res;
590 0 : if (!gPropertyIDLNameTable->Get(aPropertyIDLName, &res)) {
591 0 : return eCSSProperty_UNKNOWN;
592 : }
593 0 : MOZ_ASSERT(res < eCSSProperty_COUNT);
594 0 : if (!IsEnabled(res, aEnabled)) {
595 0 : return eCSSProperty_UNKNOWN;
596 : }
597 0 : return res;
598 : }
599 :
600 : nsCSSPropertyID
601 0 : nsCSSProps::LookupPropertyByIDLName(const nsAString& aPropertyIDLName,
602 : EnabledState aEnabled)
603 : {
604 0 : MOZ_ASSERT(gPropertyIDLNameTable, "no lookup table, needs addref");
605 0 : return LookupPropertyByIDLName(NS_ConvertUTF16toUTF8(aPropertyIDLName),
606 0 : aEnabled);
607 : }
608 :
609 : nsCSSFontDesc
610 0 : nsCSSProps::LookupFontDesc(const nsACString& aFontDesc)
611 : {
612 0 : MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref");
613 0 : nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
614 :
615 0 : if (which == eCSSFontDesc_Display &&
616 0 : !Preferences::GetBool("layout.css.font-display.enabled")) {
617 0 : which = eCSSFontDesc_UNKNOWN;
618 0 : } else if (which == eCSSFontDesc_UNKNOWN) {
619 : // check for unprefixed font-feature-settings/font-language-override
620 0 : nsAutoCString prefixedProp;
621 0 : prefixedProp.AppendLiteral("-moz-");
622 0 : prefixedProp.Append(aFontDesc);
623 0 : which = nsCSSFontDesc(gFontDescTable->Lookup(prefixedProp));
624 : }
625 0 : return which;
626 : }
627 :
628 : nsCSSFontDesc
629 0 : nsCSSProps::LookupFontDesc(const nsAString& aFontDesc)
630 : {
631 0 : MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref");
632 0 : nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
633 :
634 0 : if (which == eCSSFontDesc_Display &&
635 0 : !Preferences::GetBool("layout.css.font-display.enabled")) {
636 0 : which = eCSSFontDesc_UNKNOWN;
637 0 : } else if (which == eCSSFontDesc_UNKNOWN) {
638 : // check for unprefixed font-feature-settings/font-language-override
639 0 : nsAutoString prefixedProp;
640 0 : prefixedProp.AppendLiteral("-moz-");
641 0 : prefixedProp.Append(aFontDesc);
642 0 : which = nsCSSFontDesc(gFontDescTable->Lookup(prefixedProp));
643 : }
644 0 : return which;
645 : }
646 :
647 : nsCSSCounterDesc
648 254 : nsCSSProps::LookupCounterDesc(const nsAString& aProperty)
649 : {
650 254 : MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref");
651 254 : return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty));
652 : }
653 :
654 : nsCSSCounterDesc
655 0 : nsCSSProps::LookupCounterDesc(const nsACString& aProperty)
656 : {
657 0 : MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref");
658 0 : return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty));
659 : }
660 :
661 : bool
662 214 : nsCSSProps::IsPredefinedCounterStyle(const nsAString& aStyle)
663 : {
664 214 : MOZ_ASSERT(gPredefinedCounterStyleTable,
665 : "no lookup table, needs addref");
666 214 : return gPredefinedCounterStyleTable->Lookup(aStyle) !=
667 214 : nsStaticCaseInsensitiveNameTable::NOT_FOUND;
668 : }
669 :
670 : bool
671 0 : nsCSSProps::IsPredefinedCounterStyle(const nsACString& aStyle)
672 : {
673 0 : MOZ_ASSERT(gPredefinedCounterStyleTable,
674 : "no lookup table, needs addref");
675 0 : return gPredefinedCounterStyleTable->Lookup(aStyle) !=
676 0 : nsStaticCaseInsensitiveNameTable::NOT_FOUND;
677 : }
678 :
679 : const nsCString&
680 10 : nsCSSProps::GetStringValue(nsCSSPropertyID aProperty)
681 : {
682 10 : MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref");
683 10 : if (gPropertyTable) {
684 10 : return gPropertyTable->GetStringValue(int32_t(aProperty));
685 : } else {
686 0 : static nsDependentCString sNullStr("");
687 0 : return sNullStr;
688 : }
689 : }
690 :
691 : const nsCString&
692 0 : nsCSSProps::GetStringValue(nsCSSFontDesc aFontDescID)
693 : {
694 0 : MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref");
695 0 : if (gFontDescTable) {
696 0 : return gFontDescTable->GetStringValue(int32_t(aFontDescID));
697 : } else {
698 0 : static nsDependentCString sNullStr("");
699 0 : return sNullStr;
700 : }
701 : }
702 :
703 : const nsCString&
704 0 : nsCSSProps::GetStringValue(nsCSSCounterDesc aCounterDesc)
705 : {
706 0 : MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref");
707 0 : if (gCounterDescTable) {
708 0 : return gCounterDescTable->GetStringValue(int32_t(aCounterDesc));
709 : } else {
710 0 : static nsDependentCString sNullStr("");
711 0 : return sNullStr;
712 : }
713 : }
714 :
715 : /***************************************************************************/
716 :
717 : const KTableEntry nsCSSProps::kAnimationDirectionKTable[] = {
718 : { eCSSKeyword_normal, static_cast<uint32_t>(dom::PlaybackDirection::Normal) },
719 : { eCSSKeyword_reverse, static_cast<uint32_t>(dom::PlaybackDirection::Reverse) },
720 : { eCSSKeyword_alternate, static_cast<uint32_t>(dom::PlaybackDirection::Alternate) },
721 : { eCSSKeyword_alternate_reverse, static_cast<uint32_t>(dom::PlaybackDirection::Alternate_reverse) },
722 : { eCSSKeyword_UNKNOWN, -1 }
723 : };
724 :
725 : const KTableEntry nsCSSProps::kAnimationFillModeKTable[] = {
726 : { eCSSKeyword_none, static_cast<uint32_t>(dom::FillMode::None) },
727 : { eCSSKeyword_forwards, static_cast<uint32_t>(dom::FillMode::Forwards) },
728 : { eCSSKeyword_backwards, static_cast<uint32_t>(dom::FillMode::Backwards) },
729 : { eCSSKeyword_both, static_cast<uint32_t>(dom::FillMode::Both) },
730 : { eCSSKeyword_UNKNOWN, -1 }
731 : };
732 :
733 : const KTableEntry nsCSSProps::kAnimationIterationCountKTable[] = {
734 : { eCSSKeyword_infinite, NS_STYLE_ANIMATION_ITERATION_COUNT_INFINITE },
735 : { eCSSKeyword_UNKNOWN, -1 }
736 : };
737 :
738 : const KTableEntry nsCSSProps::kAnimationPlayStateKTable[] = {
739 : { eCSSKeyword_running, NS_STYLE_ANIMATION_PLAY_STATE_RUNNING },
740 : { eCSSKeyword_paused, NS_STYLE_ANIMATION_PLAY_STATE_PAUSED },
741 : { eCSSKeyword_UNKNOWN, -1 }
742 : };
743 :
744 : const KTableEntry nsCSSProps::kAppearanceKTable[] = {
745 : { eCSSKeyword_none, NS_THEME_NONE },
746 : { eCSSKeyword_button, NS_THEME_BUTTON },
747 : { eCSSKeyword_radio, NS_THEME_RADIO },
748 : { eCSSKeyword_checkbox, NS_THEME_CHECKBOX },
749 : { eCSSKeyword_button_bevel, NS_THEME_BUTTON_BEVEL },
750 : { eCSSKeyword_toolbox, NS_THEME_TOOLBOX },
751 : { eCSSKeyword_toolbar, NS_THEME_TOOLBAR },
752 : { eCSSKeyword_toolbarbutton, NS_THEME_TOOLBARBUTTON },
753 : { eCSSKeyword_toolbargripper, NS_THEME_TOOLBARGRIPPER },
754 : { eCSSKeyword_dualbutton, NS_THEME_DUALBUTTON },
755 : { eCSSKeyword_toolbarbutton_dropdown, NS_THEME_TOOLBARBUTTON_DROPDOWN },
756 : { eCSSKeyword_button_arrow_up, NS_THEME_BUTTON_ARROW_UP },
757 : { eCSSKeyword_button_arrow_down, NS_THEME_BUTTON_ARROW_DOWN },
758 : { eCSSKeyword_button_arrow_next, NS_THEME_BUTTON_ARROW_NEXT },
759 : { eCSSKeyword_button_arrow_previous, NS_THEME_BUTTON_ARROW_PREVIOUS },
760 : { eCSSKeyword_meterbar, NS_THEME_METERBAR },
761 : { eCSSKeyword_meterchunk, NS_THEME_METERCHUNK },
762 : { eCSSKeyword_number_input, NS_THEME_NUMBER_INPUT },
763 : { eCSSKeyword_separator, NS_THEME_SEPARATOR },
764 : { eCSSKeyword_splitter, NS_THEME_SPLITTER },
765 : { eCSSKeyword_statusbar, NS_THEME_STATUSBAR },
766 : { eCSSKeyword_statusbarpanel, NS_THEME_STATUSBARPANEL },
767 : { eCSSKeyword_resizerpanel, NS_THEME_RESIZERPANEL },
768 : { eCSSKeyword_resizer, NS_THEME_RESIZER },
769 : { eCSSKeyword_listbox, NS_THEME_LISTBOX },
770 : { eCSSKeyword_listitem, NS_THEME_LISTITEM },
771 : { eCSSKeyword_treeview, NS_THEME_TREEVIEW },
772 : { eCSSKeyword_treeitem, NS_THEME_TREEITEM },
773 : { eCSSKeyword_treetwisty, NS_THEME_TREETWISTY },
774 : { eCSSKeyword_treetwistyopen, NS_THEME_TREETWISTYOPEN },
775 : { eCSSKeyword_treeline, NS_THEME_TREELINE },
776 : { eCSSKeyword_treeheader, NS_THEME_TREEHEADER },
777 : { eCSSKeyword_treeheadercell, NS_THEME_TREEHEADERCELL },
778 : { eCSSKeyword_treeheadersortarrow, NS_THEME_TREEHEADERSORTARROW },
779 : { eCSSKeyword_progressbar, NS_THEME_PROGRESSBAR },
780 : { eCSSKeyword_progresschunk, NS_THEME_PROGRESSCHUNK },
781 : { eCSSKeyword_progressbar_vertical, NS_THEME_PROGRESSBAR_VERTICAL },
782 : { eCSSKeyword_progresschunk_vertical, NS_THEME_PROGRESSCHUNK_VERTICAL },
783 : { eCSSKeyword_tab, NS_THEME_TAB },
784 : { eCSSKeyword_tabpanels, NS_THEME_TABPANELS },
785 : { eCSSKeyword_tabpanel, NS_THEME_TABPANEL },
786 : { eCSSKeyword_tab_scroll_arrow_back, NS_THEME_TAB_SCROLL_ARROW_BACK },
787 : { eCSSKeyword_tab_scroll_arrow_forward, NS_THEME_TAB_SCROLL_ARROW_FORWARD },
788 : { eCSSKeyword_tooltip, NS_THEME_TOOLTIP },
789 : { eCSSKeyword_spinner, NS_THEME_SPINNER },
790 : { eCSSKeyword_spinner_upbutton, NS_THEME_SPINNER_UPBUTTON },
791 : { eCSSKeyword_spinner_downbutton, NS_THEME_SPINNER_DOWNBUTTON },
792 : { eCSSKeyword_spinner_textfield, NS_THEME_SPINNER_TEXTFIELD },
793 : { eCSSKeyword_scrollbar, NS_THEME_SCROLLBAR },
794 : { eCSSKeyword_scrollbar_small, NS_THEME_SCROLLBAR_SMALL },
795 : { eCSSKeyword_scrollbar_horizontal, NS_THEME_SCROLLBAR_HORIZONTAL },
796 : { eCSSKeyword_scrollbar_vertical, NS_THEME_SCROLLBAR_VERTICAL },
797 : { eCSSKeyword_scrollbarbutton_up, NS_THEME_SCROLLBARBUTTON_UP },
798 : { eCSSKeyword_scrollbarbutton_down, NS_THEME_SCROLLBARBUTTON_DOWN },
799 : { eCSSKeyword_scrollbarbutton_left, NS_THEME_SCROLLBARBUTTON_LEFT },
800 : { eCSSKeyword_scrollbarbutton_right, NS_THEME_SCROLLBARBUTTON_RIGHT },
801 : { eCSSKeyword_scrollbartrack_horizontal, NS_THEME_SCROLLBARTRACK_HORIZONTAL },
802 : { eCSSKeyword_scrollbartrack_vertical, NS_THEME_SCROLLBARTRACK_VERTICAL },
803 : { eCSSKeyword_scrollbarthumb_horizontal, NS_THEME_SCROLLBARTHUMB_HORIZONTAL },
804 : { eCSSKeyword_scrollbarthumb_vertical, NS_THEME_SCROLLBARTHUMB_VERTICAL },
805 : { eCSSKeyword_textfield, NS_THEME_TEXTFIELD },
806 : { eCSSKeyword_textfield_multiline, NS_THEME_TEXTFIELD_MULTILINE },
807 : { eCSSKeyword_caret, NS_THEME_CARET },
808 : { eCSSKeyword_searchfield, NS_THEME_SEARCHFIELD },
809 : { eCSSKeyword_menulist, NS_THEME_MENULIST },
810 : { eCSSKeyword_menulist_button, NS_THEME_MENULIST_BUTTON },
811 : { eCSSKeyword_menulist_text, NS_THEME_MENULIST_TEXT },
812 : { eCSSKeyword_menulist_textfield, NS_THEME_MENULIST_TEXTFIELD },
813 : { eCSSKeyword_range, NS_THEME_RANGE },
814 : { eCSSKeyword_range_thumb, NS_THEME_RANGE_THUMB },
815 : { eCSSKeyword_scale_horizontal, NS_THEME_SCALE_HORIZONTAL },
816 : { eCSSKeyword_scale_vertical, NS_THEME_SCALE_VERTICAL },
817 : { eCSSKeyword_scalethumb_horizontal, NS_THEME_SCALETHUMB_HORIZONTAL },
818 : { eCSSKeyword_scalethumb_vertical, NS_THEME_SCALETHUMB_VERTICAL },
819 : { eCSSKeyword_scalethumbstart, NS_THEME_SCALETHUMBSTART },
820 : { eCSSKeyword_scalethumbend, NS_THEME_SCALETHUMBEND },
821 : { eCSSKeyword_scalethumbtick, NS_THEME_SCALETHUMBTICK },
822 : { eCSSKeyword_groupbox, NS_THEME_GROUPBOX },
823 : { eCSSKeyword_checkbox_container, NS_THEME_CHECKBOX_CONTAINER },
824 : { eCSSKeyword_radio_container, NS_THEME_RADIO_CONTAINER },
825 : { eCSSKeyword_checkbox_label, NS_THEME_CHECKBOX_LABEL },
826 : { eCSSKeyword_radio_label, NS_THEME_RADIO_LABEL },
827 : { eCSSKeyword_button_focus, NS_THEME_BUTTON_FOCUS },
828 : { eCSSKeyword_window, NS_THEME_WINDOW },
829 : { eCSSKeyword_dialog, NS_THEME_DIALOG },
830 : { eCSSKeyword_menubar, NS_THEME_MENUBAR },
831 : { eCSSKeyword_menupopup, NS_THEME_MENUPOPUP },
832 : { eCSSKeyword_menuitem, NS_THEME_MENUITEM },
833 : { eCSSKeyword_checkmenuitem, NS_THEME_CHECKMENUITEM },
834 : { eCSSKeyword_radiomenuitem, NS_THEME_RADIOMENUITEM },
835 : { eCSSKeyword_menucheckbox, NS_THEME_MENUCHECKBOX },
836 : { eCSSKeyword_menuradio, NS_THEME_MENURADIO },
837 : { eCSSKeyword_menuseparator, NS_THEME_MENUSEPARATOR },
838 : { eCSSKeyword_menuarrow, NS_THEME_MENUARROW },
839 : { eCSSKeyword_menuimage, NS_THEME_MENUIMAGE },
840 : { eCSSKeyword_menuitemtext, NS_THEME_MENUITEMTEXT },
841 : { eCSSKeyword__moz_win_media_toolbox, NS_THEME_WIN_MEDIA_TOOLBOX },
842 : { eCSSKeyword__moz_win_communications_toolbox, NS_THEME_WIN_COMMUNICATIONS_TOOLBOX },
843 : { eCSSKeyword__moz_win_browsertabbar_toolbox, NS_THEME_WIN_BROWSERTABBAR_TOOLBOX },
844 : { eCSSKeyword__moz_win_glass, NS_THEME_WIN_GLASS },
845 : { eCSSKeyword__moz_win_borderless_glass, NS_THEME_WIN_BORDERLESS_GLASS },
846 : { eCSSKeyword__moz_mac_fullscreen_button, NS_THEME_MAC_FULLSCREEN_BUTTON },
847 : { eCSSKeyword__moz_mac_help_button, NS_THEME_MAC_HELP_BUTTON },
848 : { eCSSKeyword__moz_window_titlebar, NS_THEME_WINDOW_TITLEBAR },
849 : { eCSSKeyword__moz_window_titlebar_maximized, NS_THEME_WINDOW_TITLEBAR_MAXIMIZED },
850 : { eCSSKeyword__moz_window_frame_left, NS_THEME_WINDOW_FRAME_LEFT },
851 : { eCSSKeyword__moz_window_frame_right, NS_THEME_WINDOW_FRAME_RIGHT },
852 : { eCSSKeyword__moz_window_frame_bottom, NS_THEME_WINDOW_FRAME_BOTTOM },
853 : { eCSSKeyword__moz_window_button_close, NS_THEME_WINDOW_BUTTON_CLOSE },
854 : { eCSSKeyword__moz_window_button_minimize, NS_THEME_WINDOW_BUTTON_MINIMIZE },
855 : { eCSSKeyword__moz_window_button_maximize, NS_THEME_WINDOW_BUTTON_MAXIMIZE },
856 : { eCSSKeyword__moz_window_button_restore, NS_THEME_WINDOW_BUTTON_RESTORE },
857 : { eCSSKeyword__moz_window_button_box, NS_THEME_WINDOW_BUTTON_BOX },
858 : { eCSSKeyword__moz_window_button_box_maximized, NS_THEME_WINDOW_BUTTON_BOX_MAXIMIZED },
859 : { eCSSKeyword__moz_win_exclude_glass, NS_THEME_WIN_EXCLUDE_GLASS },
860 : { eCSSKeyword__moz_mac_vibrancy_light, NS_THEME_MAC_VIBRANCY_LIGHT },
861 : { eCSSKeyword__moz_mac_vibrancy_dark, NS_THEME_MAC_VIBRANCY_DARK },
862 : { eCSSKeyword__moz_mac_disclosure_button_open, NS_THEME_MAC_DISCLOSURE_BUTTON_OPEN },
863 : { eCSSKeyword__moz_mac_disclosure_button_closed, NS_THEME_MAC_DISCLOSURE_BUTTON_CLOSED },
864 : { eCSSKeyword__moz_gtk_info_bar, NS_THEME_GTK_INFO_BAR },
865 : { eCSSKeyword__moz_mac_source_list, NS_THEME_MAC_SOURCE_LIST },
866 : { eCSSKeyword__moz_mac_source_list_selection, NS_THEME_MAC_SOURCE_LIST_SELECTION },
867 : { eCSSKeyword__moz_mac_active_source_list_selection, NS_THEME_MAC_ACTIVE_SOURCE_LIST_SELECTION },
868 : { eCSSKeyword_UNKNOWN, -1 }
869 : };
870 :
871 : const KTableEntry nsCSSProps::kBackfaceVisibilityKTable[] = {
872 : { eCSSKeyword_visible, NS_STYLE_BACKFACE_VISIBILITY_VISIBLE },
873 : { eCSSKeyword_hidden, NS_STYLE_BACKFACE_VISIBILITY_HIDDEN },
874 : { eCSSKeyword_UNKNOWN, -1 }
875 : };
876 :
877 : const KTableEntry nsCSSProps::kTransformStyleKTable[] = {
878 : { eCSSKeyword_flat, NS_STYLE_TRANSFORM_STYLE_FLAT },
879 : { eCSSKeyword_preserve_3d, NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D },
880 : { eCSSKeyword_UNKNOWN, -1 }
881 : };
882 :
883 : const KTableEntry nsCSSProps::kImageLayerAttachmentKTable[] = {
884 : { eCSSKeyword_fixed, NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED },
885 : { eCSSKeyword_scroll, NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL },
886 : { eCSSKeyword_local, NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL },
887 : { eCSSKeyword_UNKNOWN, -1 }
888 : };
889 :
890 : const KTableEntry nsCSSProps::kBackgroundOriginKTable[] = {
891 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
892 : { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox },
893 : { eCSSKeyword_content_box, StyleGeometryBox::ContentBox },
894 : { eCSSKeyword_UNKNOWN, -1 }
895 : };
896 :
897 : KTableEntry nsCSSProps::kBackgroundClipKTable[] = {
898 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
899 : { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox },
900 : { eCSSKeyword_content_box, StyleGeometryBox::ContentBox },
901 : { eCSSKeyword_text, StyleGeometryBox::Text },
902 : { eCSSKeyword_UNKNOWN, -1 }
903 : };
904 :
905 : const KTableEntry nsCSSProps::kMaskOriginKTable[] = {
906 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
907 : { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox },
908 : { eCSSKeyword_content_box, StyleGeometryBox::ContentBox },
909 : { eCSSKeyword_fill_box, StyleGeometryBox::FillBox },
910 : { eCSSKeyword_stroke_box, StyleGeometryBox::StrokeBox },
911 : { eCSSKeyword_view_box, StyleGeometryBox::ViewBox },
912 : { eCSSKeyword_UNKNOWN, -1 }
913 : };
914 :
915 : const KTableEntry nsCSSProps::kMaskClipKTable[] = {
916 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
917 : { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox },
918 : { eCSSKeyword_content_box, StyleGeometryBox::ContentBox },
919 : { eCSSKeyword_fill_box, StyleGeometryBox::FillBox },
920 : { eCSSKeyword_stroke_box, StyleGeometryBox::StrokeBox },
921 : { eCSSKeyword_view_box, StyleGeometryBox::ViewBox },
922 : { eCSSKeyword_no_clip, StyleGeometryBox::NoClip },
923 : { eCSSKeyword_UNKNOWN, -1 }
924 : };
925 :
926 : // Note: Don't change this table unless you update
927 : // ParseImageLayerPosition!
928 :
929 : const KTableEntry nsCSSProps::kImageLayerPositionKTable[] = {
930 : { eCSSKeyword_center, NS_STYLE_IMAGELAYER_POSITION_CENTER },
931 : { eCSSKeyword_top, NS_STYLE_IMAGELAYER_POSITION_TOP },
932 : { eCSSKeyword_bottom, NS_STYLE_IMAGELAYER_POSITION_BOTTOM },
933 : { eCSSKeyword_left, NS_STYLE_IMAGELAYER_POSITION_LEFT },
934 : { eCSSKeyword_right, NS_STYLE_IMAGELAYER_POSITION_RIGHT },
935 : { eCSSKeyword_UNKNOWN, -1 }
936 : };
937 :
938 : const KTableEntry nsCSSProps::kImageLayerRepeatKTable[] = {
939 : { eCSSKeyword_no_repeat, StyleImageLayerRepeat::NoRepeat },
940 : { eCSSKeyword_repeat, StyleImageLayerRepeat::Repeat },
941 : { eCSSKeyword_repeat_x, StyleImageLayerRepeat::RepeatX },
942 : { eCSSKeyword_repeat_y, StyleImageLayerRepeat::RepeatY },
943 : { eCSSKeyword_round, StyleImageLayerRepeat::Round},
944 : { eCSSKeyword_space, StyleImageLayerRepeat::Space},
945 : { eCSSKeyword_UNKNOWN, -1 }
946 : };
947 :
948 : const KTableEntry nsCSSProps::kImageLayerRepeatPartKTable[] = {
949 : { eCSSKeyword_no_repeat, StyleImageLayerRepeat::NoRepeat },
950 : { eCSSKeyword_repeat, StyleImageLayerRepeat::Repeat },
951 : { eCSSKeyword_round, StyleImageLayerRepeat::Round},
952 : { eCSSKeyword_space, StyleImageLayerRepeat::Space},
953 : { eCSSKeyword_UNKNOWN, -1 }
954 : };
955 :
956 : const KTableEntry nsCSSProps::kImageLayerSizeKTable[] = {
957 : { eCSSKeyword_contain, NS_STYLE_IMAGELAYER_SIZE_CONTAIN },
958 : { eCSSKeyword_cover, NS_STYLE_IMAGELAYER_SIZE_COVER },
959 : { eCSSKeyword_UNKNOWN, -1 }
960 : };
961 :
962 : const KTableEntry nsCSSProps::kImageLayerModeKTable[] = {
963 : { eCSSKeyword_alpha, NS_STYLE_MASK_MODE_ALPHA },
964 : { eCSSKeyword_luminance, NS_STYLE_MASK_MODE_LUMINANCE },
965 : { eCSSKeyword_match_source, NS_STYLE_MASK_MODE_MATCH_SOURCE },
966 : { eCSSKeyword_UNKNOWN, -1 }
967 : };
968 :
969 : const KTableEntry nsCSSProps::kImageLayerCompositeKTable[] = {
970 : { eCSSKeyword_add, NS_STYLE_MASK_COMPOSITE_ADD },
971 : { eCSSKeyword_subtract, NS_STYLE_MASK_COMPOSITE_SUBTRACT },
972 : { eCSSKeyword_intersect, NS_STYLE_MASK_COMPOSITE_INTERSECT },
973 : { eCSSKeyword_exclude, NS_STYLE_MASK_COMPOSITE_EXCLUDE },
974 : { eCSSKeyword_UNKNOWN, -1 }
975 : };
976 :
977 : const KTableEntry nsCSSProps::kBlendModeKTable[] = {
978 : { eCSSKeyword_normal, NS_STYLE_BLEND_NORMAL },
979 : { eCSSKeyword_multiply, NS_STYLE_BLEND_MULTIPLY },
980 : { eCSSKeyword_screen, NS_STYLE_BLEND_SCREEN },
981 : { eCSSKeyword_overlay, NS_STYLE_BLEND_OVERLAY },
982 : { eCSSKeyword_darken, NS_STYLE_BLEND_DARKEN },
983 : { eCSSKeyword_lighten, NS_STYLE_BLEND_LIGHTEN },
984 : { eCSSKeyword_color_dodge, NS_STYLE_BLEND_COLOR_DODGE },
985 : { eCSSKeyword_color_burn, NS_STYLE_BLEND_COLOR_BURN },
986 : { eCSSKeyword_hard_light, NS_STYLE_BLEND_HARD_LIGHT },
987 : { eCSSKeyword_soft_light, NS_STYLE_BLEND_SOFT_LIGHT },
988 : { eCSSKeyword_difference, NS_STYLE_BLEND_DIFFERENCE },
989 : { eCSSKeyword_exclusion, NS_STYLE_BLEND_EXCLUSION },
990 : { eCSSKeyword_hue, NS_STYLE_BLEND_HUE },
991 : { eCSSKeyword_saturation, NS_STYLE_BLEND_SATURATION },
992 : { eCSSKeyword_color, NS_STYLE_BLEND_COLOR },
993 : { eCSSKeyword_luminosity, NS_STYLE_BLEND_LUMINOSITY },
994 : { eCSSKeyword_UNKNOWN, -1 }
995 : };
996 :
997 : const KTableEntry nsCSSProps::kBorderCollapseKTable[] = {
998 : { eCSSKeyword_collapse, NS_STYLE_BORDER_COLLAPSE },
999 : { eCSSKeyword_separate, NS_STYLE_BORDER_SEPARATE },
1000 : { eCSSKeyword_UNKNOWN, -1 }
1001 : };
1002 :
1003 : const KTableEntry nsCSSProps::kBorderImageRepeatKTable[] = {
1004 : { eCSSKeyword_stretch, NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH },
1005 : { eCSSKeyword_repeat, NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT },
1006 : { eCSSKeyword_round, NS_STYLE_BORDER_IMAGE_REPEAT_ROUND },
1007 : { eCSSKeyword_space, NS_STYLE_BORDER_IMAGE_REPEAT_SPACE },
1008 : { eCSSKeyword_UNKNOWN, -1 }
1009 : };
1010 :
1011 : const KTableEntry nsCSSProps::kBorderImageSliceKTable[] = {
1012 : { eCSSKeyword_fill, NS_STYLE_BORDER_IMAGE_SLICE_FILL },
1013 : { eCSSKeyword_UNKNOWN, -1 }
1014 : };
1015 :
1016 : const KTableEntry nsCSSProps::kBorderStyleKTable[] = {
1017 : { eCSSKeyword_none, NS_STYLE_BORDER_STYLE_NONE },
1018 : { eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN },
1019 : { eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED },
1020 : { eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED },
1021 : { eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID },
1022 : { eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE },
1023 : { eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE },
1024 : { eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE },
1025 : { eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET },
1026 : { eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET },
1027 : { eCSSKeyword_UNKNOWN, -1 }
1028 : };
1029 :
1030 : const KTableEntry nsCSSProps::kBorderWidthKTable[] = {
1031 : { eCSSKeyword_thin, NS_STYLE_BORDER_WIDTH_THIN },
1032 : { eCSSKeyword_medium, NS_STYLE_BORDER_WIDTH_MEDIUM },
1033 : { eCSSKeyword_thick, NS_STYLE_BORDER_WIDTH_THICK },
1034 : { eCSSKeyword_UNKNOWN, -1 }
1035 : };
1036 :
1037 : const KTableEntry nsCSSProps::kBoxDecorationBreakKTable[] = {
1038 : { eCSSKeyword_slice, StyleBoxDecorationBreak::Slice },
1039 : { eCSSKeyword_clone, StyleBoxDecorationBreak::Clone },
1040 : { eCSSKeyword_UNKNOWN, -1 }
1041 : };
1042 :
1043 : const KTableEntry nsCSSProps::kBoxShadowTypeKTable[] = {
1044 : { eCSSKeyword_inset, uint8_t(StyleBoxShadowType::Inset) },
1045 : { eCSSKeyword_UNKNOWN, -1 }
1046 : };
1047 :
1048 : const KTableEntry nsCSSProps::kBoxSizingKTable[] = {
1049 : { eCSSKeyword_content_box, StyleBoxSizing::Content },
1050 : { eCSSKeyword_border_box, StyleBoxSizing::Border },
1051 : { eCSSKeyword_UNKNOWN, -1 }
1052 : };
1053 :
1054 : const KTableEntry nsCSSProps::kCaptionSideKTable[] = {
1055 : { eCSSKeyword_top, NS_STYLE_CAPTION_SIDE_TOP },
1056 : { eCSSKeyword_right, NS_STYLE_CAPTION_SIDE_RIGHT },
1057 : { eCSSKeyword_bottom, NS_STYLE_CAPTION_SIDE_BOTTOM },
1058 : { eCSSKeyword_left, NS_STYLE_CAPTION_SIDE_LEFT },
1059 : { eCSSKeyword_top_outside, NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE },
1060 : { eCSSKeyword_bottom_outside, NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE },
1061 : { eCSSKeyword_UNKNOWN, -1 }
1062 : };
1063 :
1064 : KTableEntry nsCSSProps::kClearKTable[] = {
1065 : { eCSSKeyword_none, StyleClear::None },
1066 : { eCSSKeyword_left, StyleClear::Left },
1067 : { eCSSKeyword_right, StyleClear::Right },
1068 : { eCSSKeyword_inline_start, StyleClear::InlineStart },
1069 : { eCSSKeyword_inline_end, StyleClear::InlineEnd },
1070 : { eCSSKeyword_both, StyleClear::Both },
1071 : { eCSSKeyword_UNKNOWN, -1 }
1072 : };
1073 :
1074 : // See also kContextPatternKTable for SVG paint-specific values
1075 : const KTableEntry nsCSSProps::kColorKTable[] = {
1076 : { eCSSKeyword_activeborder, LookAndFeel::eColorID_activeborder },
1077 : { eCSSKeyword_activecaption, LookAndFeel::eColorID_activecaption },
1078 : { eCSSKeyword_appworkspace, LookAndFeel::eColorID_appworkspace },
1079 : { eCSSKeyword_background, LookAndFeel::eColorID_background },
1080 : { eCSSKeyword_buttonface, LookAndFeel::eColorID_buttonface },
1081 : { eCSSKeyword_buttonhighlight, LookAndFeel::eColorID_buttonhighlight },
1082 : { eCSSKeyword_buttonshadow, LookAndFeel::eColorID_buttonshadow },
1083 : { eCSSKeyword_buttontext, LookAndFeel::eColorID_buttontext },
1084 : { eCSSKeyword_captiontext, LookAndFeel::eColorID_captiontext },
1085 : { eCSSKeyword_graytext, LookAndFeel::eColorID_graytext },
1086 : { eCSSKeyword_highlight, LookAndFeel::eColorID_highlight },
1087 : { eCSSKeyword_highlighttext, LookAndFeel::eColorID_highlighttext },
1088 : { eCSSKeyword_inactiveborder, LookAndFeel::eColorID_inactiveborder },
1089 : { eCSSKeyword_inactivecaption, LookAndFeel::eColorID_inactivecaption },
1090 : { eCSSKeyword_inactivecaptiontext, LookAndFeel::eColorID_inactivecaptiontext },
1091 : { eCSSKeyword_infobackground, LookAndFeel::eColorID_infobackground },
1092 : { eCSSKeyword_infotext, LookAndFeel::eColorID_infotext },
1093 : { eCSSKeyword_menu, LookAndFeel::eColorID_menu },
1094 : { eCSSKeyword_menutext, LookAndFeel::eColorID_menutext },
1095 : { eCSSKeyword_scrollbar, LookAndFeel::eColorID_scrollbar },
1096 : { eCSSKeyword_threeddarkshadow, LookAndFeel::eColorID_threeddarkshadow },
1097 : { eCSSKeyword_threedface, LookAndFeel::eColorID_threedface },
1098 : { eCSSKeyword_threedhighlight, LookAndFeel::eColorID_threedhighlight },
1099 : { eCSSKeyword_threedlightshadow, LookAndFeel::eColorID_threedlightshadow },
1100 : { eCSSKeyword_threedshadow, LookAndFeel::eColorID_threedshadow },
1101 : { eCSSKeyword_window, LookAndFeel::eColorID_window },
1102 : { eCSSKeyword_windowframe, LookAndFeel::eColorID_windowframe },
1103 : { eCSSKeyword_windowtext, LookAndFeel::eColorID_windowtext },
1104 : { eCSSKeyword__moz_activehyperlinktext, NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT },
1105 : { eCSSKeyword__moz_buttondefault, LookAndFeel::eColorID__moz_buttondefault },
1106 : { eCSSKeyword__moz_buttonhoverface, LookAndFeel::eColorID__moz_buttonhoverface },
1107 : { eCSSKeyword__moz_buttonhovertext, LookAndFeel::eColorID__moz_buttonhovertext },
1108 : { eCSSKeyword__moz_cellhighlight, LookAndFeel::eColorID__moz_cellhighlight },
1109 : { eCSSKeyword__moz_cellhighlighttext, LookAndFeel::eColorID__moz_cellhighlighttext },
1110 : { eCSSKeyword__moz_eventreerow, LookAndFeel::eColorID__moz_eventreerow },
1111 : { eCSSKeyword__moz_field, LookAndFeel::eColorID__moz_field },
1112 : { eCSSKeyword__moz_fieldtext, LookAndFeel::eColorID__moz_fieldtext },
1113 : { eCSSKeyword__moz_default_background_color, NS_COLOR_MOZ_DEFAULT_BACKGROUND_COLOR },
1114 : { eCSSKeyword__moz_default_color, NS_COLOR_MOZ_DEFAULT_COLOR },
1115 : { eCSSKeyword__moz_dialog, LookAndFeel::eColorID__moz_dialog },
1116 : { eCSSKeyword__moz_dialogtext, LookAndFeel::eColorID__moz_dialogtext },
1117 : { eCSSKeyword__moz_dragtargetzone, LookAndFeel::eColorID__moz_dragtargetzone },
1118 : { eCSSKeyword__moz_gtk_info_bar_text, LookAndFeel::eColorID__moz_gtk_info_bar_text },
1119 : { eCSSKeyword__moz_hyperlinktext, NS_COLOR_MOZ_HYPERLINKTEXT },
1120 : { eCSSKeyword__moz_html_cellhighlight, LookAndFeel::eColorID__moz_html_cellhighlight },
1121 : { eCSSKeyword__moz_html_cellhighlighttext, LookAndFeel::eColorID__moz_html_cellhighlighttext },
1122 : { eCSSKeyword__moz_mac_buttonactivetext, LookAndFeel::eColorID__moz_mac_buttonactivetext },
1123 : { eCSSKeyword__moz_mac_chrome_active, LookAndFeel::eColorID__moz_mac_chrome_active },
1124 : { eCSSKeyword__moz_mac_chrome_inactive, LookAndFeel::eColorID__moz_mac_chrome_inactive },
1125 : { eCSSKeyword__moz_mac_defaultbuttontext, LookAndFeel::eColorID__moz_mac_defaultbuttontext },
1126 : { eCSSKeyword__moz_mac_focusring, LookAndFeel::eColorID__moz_mac_focusring },
1127 : { eCSSKeyword__moz_mac_menuselect, LookAndFeel::eColorID__moz_mac_menuselect },
1128 : { eCSSKeyword__moz_mac_menushadow, LookAndFeel::eColorID__moz_mac_menushadow },
1129 : { eCSSKeyword__moz_mac_menutextdisable, LookAndFeel::eColorID__moz_mac_menutextdisable },
1130 : { eCSSKeyword__moz_mac_menutextselect, LookAndFeel::eColorID__moz_mac_menutextselect },
1131 : { eCSSKeyword__moz_mac_disabledtoolbartext, LookAndFeel::eColorID__moz_mac_disabledtoolbartext },
1132 : { eCSSKeyword__moz_mac_secondaryhighlight, LookAndFeel::eColorID__moz_mac_secondaryhighlight },
1133 : { eCSSKeyword__moz_menuhover, LookAndFeel::eColorID__moz_menuhover },
1134 : { eCSSKeyword__moz_menuhovertext, LookAndFeel::eColorID__moz_menuhovertext },
1135 : { eCSSKeyword__moz_menubartext, LookAndFeel::eColorID__moz_menubartext },
1136 : { eCSSKeyword__moz_menubarhovertext, LookAndFeel::eColorID__moz_menubarhovertext },
1137 : { eCSSKeyword__moz_oddtreerow, LookAndFeel::eColorID__moz_oddtreerow },
1138 : { eCSSKeyword__moz_visitedhyperlinktext, NS_COLOR_MOZ_VISITEDHYPERLINKTEXT },
1139 : { eCSSKeyword_currentcolor, NS_COLOR_CURRENTCOLOR },
1140 : { eCSSKeyword__moz_win_accentcolor, LookAndFeel::eColorID__moz_win_accentcolor },
1141 : { eCSSKeyword__moz_win_accentcolortext, LookAndFeel::eColorID__moz_win_accentcolortext },
1142 : { eCSSKeyword__moz_win_mediatext, LookAndFeel::eColorID__moz_win_mediatext },
1143 : { eCSSKeyword__moz_win_communicationstext, LookAndFeel::eColorID__moz_win_communicationstext },
1144 : { eCSSKeyword__moz_nativehyperlinktext, LookAndFeel::eColorID__moz_nativehyperlinktext },
1145 : { eCSSKeyword__moz_comboboxtext, LookAndFeel::eColorID__moz_comboboxtext },
1146 : { eCSSKeyword__moz_combobox, LookAndFeel::eColorID__moz_combobox },
1147 : { eCSSKeyword_UNKNOWN, -1 }
1148 : };
1149 :
1150 : const KTableEntry nsCSSProps::kContentKTable[] = {
1151 : { eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE },
1152 : { eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE },
1153 : { eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE },
1154 : { eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE },
1155 : { eCSSKeyword__moz_alt_content, NS_STYLE_CONTENT_ALT_CONTENT },
1156 : { eCSSKeyword_UNKNOWN, -1 }
1157 : };
1158 :
1159 : const KTableEntry nsCSSProps::kControlCharacterVisibilityKTable[] = {
1160 : { eCSSKeyword_hidden, NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN },
1161 : { eCSSKeyword_visible, NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE },
1162 : { eCSSKeyword_UNKNOWN, -1 }
1163 : };
1164 :
1165 : const KTableEntry nsCSSProps::kCounterRangeKTable[] = {
1166 : { eCSSKeyword_infinite, NS_STYLE_COUNTER_RANGE_INFINITE },
1167 : { eCSSKeyword_UNKNOWN, -1 }
1168 : };
1169 :
1170 : const KTableEntry nsCSSProps::kCounterSpeakAsKTable[] = {
1171 : { eCSSKeyword_bullets, NS_STYLE_COUNTER_SPEAKAS_BULLETS },
1172 : { eCSSKeyword_numbers, NS_STYLE_COUNTER_SPEAKAS_NUMBERS },
1173 : { eCSSKeyword_words, NS_STYLE_COUNTER_SPEAKAS_WORDS },
1174 : { eCSSKeyword_spell_out, NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT },
1175 : { eCSSKeyword_UNKNOWN, -1 }
1176 : };
1177 :
1178 : const KTableEntry nsCSSProps::kCounterSymbolsSystemKTable[] = {
1179 : { eCSSKeyword_cyclic, NS_STYLE_COUNTER_SYSTEM_CYCLIC },
1180 : { eCSSKeyword_numeric, NS_STYLE_COUNTER_SYSTEM_NUMERIC },
1181 : { eCSSKeyword_alphabetic, NS_STYLE_COUNTER_SYSTEM_ALPHABETIC },
1182 : { eCSSKeyword_symbolic, NS_STYLE_COUNTER_SYSTEM_SYMBOLIC },
1183 : { eCSSKeyword_fixed, NS_STYLE_COUNTER_SYSTEM_FIXED },
1184 : { eCSSKeyword_UNKNOWN, -1 }
1185 : };
1186 :
1187 : const KTableEntry nsCSSProps::kCounterSystemKTable[] = {
1188 : { eCSSKeyword_cyclic, NS_STYLE_COUNTER_SYSTEM_CYCLIC },
1189 : { eCSSKeyword_numeric, NS_STYLE_COUNTER_SYSTEM_NUMERIC },
1190 : { eCSSKeyword_alphabetic, NS_STYLE_COUNTER_SYSTEM_ALPHABETIC },
1191 : { eCSSKeyword_symbolic, NS_STYLE_COUNTER_SYSTEM_SYMBOLIC },
1192 : { eCSSKeyword_additive, NS_STYLE_COUNTER_SYSTEM_ADDITIVE },
1193 : { eCSSKeyword_fixed, NS_STYLE_COUNTER_SYSTEM_FIXED },
1194 : { eCSSKeyword_extends, NS_STYLE_COUNTER_SYSTEM_EXTENDS },
1195 : { eCSSKeyword_UNKNOWN, -1 }
1196 : };
1197 :
1198 : const KTableEntry nsCSSProps::kCursorKTable[] = {
1199 : // CSS 2.0
1200 : { eCSSKeyword_auto, NS_STYLE_CURSOR_AUTO },
1201 : { eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR },
1202 : { eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT },
1203 : { eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER },
1204 : { eCSSKeyword_move, NS_STYLE_CURSOR_MOVE },
1205 : { eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE },
1206 : { eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE },
1207 : { eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE },
1208 : { eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE },
1209 : { eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE },
1210 : { eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE },
1211 : { eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE },
1212 : { eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE },
1213 : { eCSSKeyword_text, NS_STYLE_CURSOR_TEXT },
1214 : { eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT },
1215 : { eCSSKeyword_help, NS_STYLE_CURSOR_HELP },
1216 : // CSS 2.1
1217 : { eCSSKeyword_progress, NS_STYLE_CURSOR_SPINNING },
1218 : // CSS3 basic user interface module
1219 : { eCSSKeyword_copy, NS_STYLE_CURSOR_COPY },
1220 : { eCSSKeyword_alias, NS_STYLE_CURSOR_ALIAS },
1221 : { eCSSKeyword_context_menu, NS_STYLE_CURSOR_CONTEXT_MENU },
1222 : { eCSSKeyword_cell, NS_STYLE_CURSOR_CELL },
1223 : { eCSSKeyword_not_allowed, NS_STYLE_CURSOR_NOT_ALLOWED },
1224 : { eCSSKeyword_col_resize, NS_STYLE_CURSOR_COL_RESIZE },
1225 : { eCSSKeyword_row_resize, NS_STYLE_CURSOR_ROW_RESIZE },
1226 : { eCSSKeyword_no_drop, NS_STYLE_CURSOR_NO_DROP },
1227 : { eCSSKeyword_vertical_text, NS_STYLE_CURSOR_VERTICAL_TEXT },
1228 : { eCSSKeyword_all_scroll, NS_STYLE_CURSOR_ALL_SCROLL },
1229 : { eCSSKeyword_nesw_resize, NS_STYLE_CURSOR_NESW_RESIZE },
1230 : { eCSSKeyword_nwse_resize, NS_STYLE_CURSOR_NWSE_RESIZE },
1231 : { eCSSKeyword_ns_resize, NS_STYLE_CURSOR_NS_RESIZE },
1232 : { eCSSKeyword_ew_resize, NS_STYLE_CURSOR_EW_RESIZE },
1233 : { eCSSKeyword_none, NS_STYLE_CURSOR_NONE },
1234 : { eCSSKeyword_grab, NS_STYLE_CURSOR_GRAB },
1235 : { eCSSKeyword_grabbing, NS_STYLE_CURSOR_GRABBING },
1236 : { eCSSKeyword_zoom_in, NS_STYLE_CURSOR_ZOOM_IN },
1237 : { eCSSKeyword_zoom_out, NS_STYLE_CURSOR_ZOOM_OUT },
1238 : // -moz- prefixed vendor specific
1239 : { eCSSKeyword__moz_grab, NS_STYLE_CURSOR_GRAB },
1240 : { eCSSKeyword__moz_grabbing, NS_STYLE_CURSOR_GRABBING },
1241 : { eCSSKeyword__moz_zoom_in, NS_STYLE_CURSOR_ZOOM_IN },
1242 : { eCSSKeyword__moz_zoom_out, NS_STYLE_CURSOR_ZOOM_OUT },
1243 : { eCSSKeyword_UNKNOWN, -1 }
1244 : };
1245 :
1246 : const KTableEntry nsCSSProps::kDirectionKTable[] = {
1247 : { eCSSKeyword_ltr, NS_STYLE_DIRECTION_LTR },
1248 : { eCSSKeyword_rtl, NS_STYLE_DIRECTION_RTL },
1249 : { eCSSKeyword_UNKNOWN, -1 }
1250 : };
1251 :
1252 : KTableEntry nsCSSProps::kDisplayKTable[] = {
1253 : { eCSSKeyword_none, StyleDisplay::None },
1254 : { eCSSKeyword_inline, StyleDisplay::Inline },
1255 : { eCSSKeyword_block, StyleDisplay::Block },
1256 : { eCSSKeyword_inline_block, StyleDisplay::InlineBlock },
1257 : { eCSSKeyword_list_item, StyleDisplay::ListItem },
1258 : { eCSSKeyword_table, StyleDisplay::Table },
1259 : { eCSSKeyword_inline_table, StyleDisplay::InlineTable },
1260 : { eCSSKeyword_table_row_group, StyleDisplay::TableRowGroup },
1261 : { eCSSKeyword_table_header_group, StyleDisplay::TableHeaderGroup },
1262 : { eCSSKeyword_table_footer_group, StyleDisplay::TableFooterGroup },
1263 : { eCSSKeyword_table_row, StyleDisplay::TableRow },
1264 : { eCSSKeyword_table_column_group, StyleDisplay::TableColumnGroup },
1265 : { eCSSKeyword_table_column, StyleDisplay::TableColumn },
1266 : { eCSSKeyword_table_cell, StyleDisplay::TableCell },
1267 : { eCSSKeyword_table_caption, StyleDisplay::TableCaption },
1268 : // Make sure this is kept in sync with the code in
1269 : // nsCSSFrameConstructor::ConstructXULFrame
1270 : { eCSSKeyword__moz_box, StyleDisplay::MozBox },
1271 : { eCSSKeyword__moz_inline_box, StyleDisplay::MozInlineBox },
1272 : #ifdef MOZ_XUL
1273 : { eCSSKeyword__moz_grid, StyleDisplay::MozGrid },
1274 : { eCSSKeyword__moz_inline_grid, StyleDisplay::MozInlineGrid },
1275 : { eCSSKeyword__moz_grid_group, StyleDisplay::MozGridGroup },
1276 : { eCSSKeyword__moz_grid_line, StyleDisplay::MozGridLine },
1277 : { eCSSKeyword__moz_stack, StyleDisplay::MozStack },
1278 : { eCSSKeyword__moz_inline_stack, StyleDisplay::MozInlineStack },
1279 : { eCSSKeyword__moz_deck, StyleDisplay::MozDeck },
1280 : { eCSSKeyword__moz_popup, StyleDisplay::MozPopup },
1281 : { eCSSKeyword__moz_groupbox, StyleDisplay::MozGroupbox },
1282 : #endif
1283 : { eCSSKeyword_flex, StyleDisplay::Flex },
1284 : { eCSSKeyword_inline_flex, StyleDisplay::InlineFlex },
1285 : { eCSSKeyword_ruby, StyleDisplay::Ruby },
1286 : { eCSSKeyword_ruby_base, StyleDisplay::RubyBase },
1287 : { eCSSKeyword_ruby_base_container, StyleDisplay::RubyBaseContainer },
1288 : { eCSSKeyword_ruby_text, StyleDisplay::RubyText },
1289 : { eCSSKeyword_ruby_text_container, StyleDisplay::RubyTextContainer },
1290 : // The next two entries are controlled by the layout.css.grid.enabled pref.
1291 : { eCSSKeyword_grid, StyleDisplay::Grid },
1292 : { eCSSKeyword_inline_grid, StyleDisplay::InlineGrid },
1293 : // The next 4 entries are controlled by the layout.css.prefixes.webkit pref.
1294 : { eCSSKeyword__webkit_box, StyleDisplay::WebkitBox },
1295 : { eCSSKeyword__webkit_inline_box, StyleDisplay::WebkitInlineBox },
1296 : { eCSSKeyword__webkit_flex, StyleDisplay::Flex },
1297 : { eCSSKeyword__webkit_inline_flex, StyleDisplay::InlineFlex },
1298 : { eCSSKeyword_contents, StyleDisplay::Contents },
1299 : { eCSSKeyword_flow_root, StyleDisplay::FlowRoot },
1300 : { eCSSKeyword_UNKNOWN, -1 }
1301 : };
1302 :
1303 : const KTableEntry nsCSSProps::kEmptyCellsKTable[] = {
1304 : { eCSSKeyword_show, NS_STYLE_TABLE_EMPTY_CELLS_SHOW },
1305 : { eCSSKeyword_hide, NS_STYLE_TABLE_EMPTY_CELLS_HIDE },
1306 : { eCSSKeyword_UNKNOWN, -1 }
1307 : };
1308 :
1309 : const KTableEntry nsCSSProps::kAlignAllKeywords[] = {
1310 : { eCSSKeyword_auto, NS_STYLE_ALIGN_AUTO },
1311 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1312 : { eCSSKeyword_start, NS_STYLE_ALIGN_START },
1313 : { eCSSKeyword_end, NS_STYLE_ALIGN_END },
1314 : { eCSSKeyword_flex_start, NS_STYLE_ALIGN_FLEX_START },
1315 : { eCSSKeyword_flex_end, NS_STYLE_ALIGN_FLEX_END },
1316 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1317 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1318 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1319 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1320 : // Also "first/last baseline"; see nsCSSValue::AppendAlignJustifyValueToString
1321 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1322 : { eCSSKeyword_self_start, NS_STYLE_ALIGN_SELF_START },
1323 : { eCSSKeyword_self_end, NS_STYLE_ALIGN_SELF_END },
1324 : { eCSSKeyword_space_between, NS_STYLE_ALIGN_SPACE_BETWEEN },
1325 : { eCSSKeyword_space_around, NS_STYLE_ALIGN_SPACE_AROUND },
1326 : { eCSSKeyword_space_evenly, NS_STYLE_ALIGN_SPACE_EVENLY },
1327 : { eCSSKeyword_legacy, NS_STYLE_ALIGN_LEGACY },
1328 : { eCSSKeyword_safe, NS_STYLE_ALIGN_SAFE },
1329 : { eCSSKeyword_unsafe, NS_STYLE_ALIGN_UNSAFE },
1330 : { eCSSKeyword_UNKNOWN, -1 }
1331 : };
1332 :
1333 : const KTableEntry nsCSSProps::kAlignOverflowPosition[] = {
1334 : { eCSSKeyword_unsafe, NS_STYLE_ALIGN_UNSAFE },
1335 : { eCSSKeyword_safe, NS_STYLE_ALIGN_SAFE },
1336 : { eCSSKeyword_UNKNOWN, -1 }
1337 : };
1338 :
1339 : const KTableEntry nsCSSProps::kAlignSelfPosition[] = {
1340 : { eCSSKeyword_start, NS_STYLE_ALIGN_START },
1341 : { eCSSKeyword_end, NS_STYLE_ALIGN_END },
1342 : { eCSSKeyword_flex_start, NS_STYLE_ALIGN_FLEX_START },
1343 : { eCSSKeyword_flex_end, NS_STYLE_ALIGN_FLEX_END },
1344 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1345 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1346 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1347 : { eCSSKeyword_self_start, NS_STYLE_ALIGN_SELF_START },
1348 : { eCSSKeyword_self_end, NS_STYLE_ALIGN_SELF_END },
1349 : { eCSSKeyword_UNKNOWN, -1 }
1350 : };
1351 :
1352 : const KTableEntry nsCSSProps::kAlignLegacy[] = {
1353 : { eCSSKeyword_legacy, NS_STYLE_ALIGN_LEGACY },
1354 : { eCSSKeyword_UNKNOWN, -1 }
1355 : };
1356 :
1357 : const KTableEntry nsCSSProps::kAlignLegacyPosition[] = {
1358 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1359 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1360 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1361 : { eCSSKeyword_UNKNOWN, -1 }
1362 : };
1363 :
1364 : const KTableEntry nsCSSProps::kAlignAutoNormalStretchBaseline[] = {
1365 : { eCSSKeyword_auto, NS_STYLE_ALIGN_AUTO },
1366 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1367 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1368 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1369 : // Also "first baseline" & "last baseline"; see CSSParserImpl::ParseAlignEnum
1370 : { eCSSKeyword_UNKNOWN, -1 }
1371 : };
1372 :
1373 : const KTableEntry nsCSSProps::kAlignNormalStretchBaseline[] = {
1374 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1375 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1376 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1377 : // Also "first baseline" & "last baseline"; see CSSParserImpl::ParseAlignEnum
1378 : { eCSSKeyword_UNKNOWN, -1 }
1379 : };
1380 :
1381 : const KTableEntry nsCSSProps::kAlignNormalBaseline[] = {
1382 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1383 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1384 : // Also "first baseline" & "last baseline"; see CSSParserImpl::ParseAlignEnum
1385 : { eCSSKeyword_UNKNOWN, -1 }
1386 : };
1387 :
1388 : const KTableEntry nsCSSProps::kAlignContentDistribution[] = {
1389 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1390 : { eCSSKeyword_space_between, NS_STYLE_ALIGN_SPACE_BETWEEN },
1391 : { eCSSKeyword_space_around, NS_STYLE_ALIGN_SPACE_AROUND },
1392 : { eCSSKeyword_space_evenly, NS_STYLE_ALIGN_SPACE_EVENLY },
1393 : { eCSSKeyword_UNKNOWN, -1 }
1394 : };
1395 :
1396 : const KTableEntry nsCSSProps::kAlignContentPosition[] = {
1397 : { eCSSKeyword_start, NS_STYLE_ALIGN_START },
1398 : { eCSSKeyword_end, NS_STYLE_ALIGN_END },
1399 : { eCSSKeyword_flex_start, NS_STYLE_ALIGN_FLEX_START },
1400 : { eCSSKeyword_flex_end, NS_STYLE_ALIGN_FLEX_END },
1401 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1402 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1403 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1404 : { eCSSKeyword_UNKNOWN, -1 }
1405 : };
1406 :
1407 : // <NOTE> these are only used for auto-completion, not parsing:
1408 : const KTableEntry nsCSSProps::kAutoCompletionAlignJustifySelf[] = {
1409 : { eCSSKeyword_auto, NS_STYLE_ALIGN_AUTO },
1410 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1411 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1412 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1413 : { eCSSKeyword_last_baseline, NS_STYLE_ALIGN_LAST_BASELINE },
1414 : { eCSSKeyword_start, NS_STYLE_ALIGN_START },
1415 : { eCSSKeyword_end, NS_STYLE_ALIGN_END },
1416 : { eCSSKeyword_flex_start, NS_STYLE_ALIGN_FLEX_START },
1417 : { eCSSKeyword_flex_end, NS_STYLE_ALIGN_FLEX_END },
1418 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1419 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1420 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1421 : { eCSSKeyword_self_start, NS_STYLE_ALIGN_SELF_START },
1422 : { eCSSKeyword_self_end, NS_STYLE_ALIGN_SELF_END },
1423 : { eCSSKeyword_UNKNOWN, -1 }
1424 : };
1425 :
1426 : const KTableEntry nsCSSProps::kAutoCompletionAlignItems[] = {
1427 : // Intentionally no 'auto' here.
1428 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1429 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1430 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1431 : { eCSSKeyword_last_baseline, NS_STYLE_ALIGN_LAST_BASELINE },
1432 : { eCSSKeyword_start, NS_STYLE_ALIGN_START },
1433 : { eCSSKeyword_end, NS_STYLE_ALIGN_END },
1434 : { eCSSKeyword_flex_start, NS_STYLE_ALIGN_FLEX_START },
1435 : { eCSSKeyword_flex_end, NS_STYLE_ALIGN_FLEX_END },
1436 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1437 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1438 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1439 : { eCSSKeyword_self_start, NS_STYLE_ALIGN_SELF_START },
1440 : { eCSSKeyword_self_end, NS_STYLE_ALIGN_SELF_END },
1441 : { eCSSKeyword_UNKNOWN, -1 }
1442 : };
1443 :
1444 : const KTableEntry nsCSSProps::kAutoCompletionAlignJustifyContent[] = {
1445 : // Intentionally no 'auto' here.
1446 : { eCSSKeyword_normal, NS_STYLE_ALIGN_NORMAL },
1447 : { eCSSKeyword_baseline, NS_STYLE_ALIGN_BASELINE },
1448 : { eCSSKeyword_last_baseline, NS_STYLE_ALIGN_LAST_BASELINE },
1449 : { eCSSKeyword_stretch, NS_STYLE_ALIGN_STRETCH },
1450 : { eCSSKeyword_space_between, NS_STYLE_ALIGN_SPACE_BETWEEN },
1451 : { eCSSKeyword_space_around, NS_STYLE_ALIGN_SPACE_AROUND },
1452 : { eCSSKeyword_space_evenly, NS_STYLE_ALIGN_SPACE_EVENLY },
1453 : { eCSSKeyword_start, NS_STYLE_ALIGN_START },
1454 : { eCSSKeyword_end, NS_STYLE_ALIGN_END },
1455 : { eCSSKeyword_flex_start, NS_STYLE_ALIGN_FLEX_START },
1456 : { eCSSKeyword_flex_end, NS_STYLE_ALIGN_FLEX_END },
1457 : { eCSSKeyword_center, NS_STYLE_ALIGN_CENTER },
1458 : { eCSSKeyword_left, NS_STYLE_ALIGN_LEFT },
1459 : { eCSSKeyword_right, NS_STYLE_ALIGN_RIGHT },
1460 : { eCSSKeyword_UNKNOWN, -1 }
1461 : };
1462 : // </NOTE>
1463 :
1464 : const KTableEntry nsCSSProps::kFlexDirectionKTable[] = {
1465 : { eCSSKeyword_row, NS_STYLE_FLEX_DIRECTION_ROW },
1466 : { eCSSKeyword_row_reverse, NS_STYLE_FLEX_DIRECTION_ROW_REVERSE },
1467 : { eCSSKeyword_column, NS_STYLE_FLEX_DIRECTION_COLUMN },
1468 : { eCSSKeyword_column_reverse, NS_STYLE_FLEX_DIRECTION_COLUMN_REVERSE },
1469 : { eCSSKeyword_UNKNOWN, -1 }
1470 : };
1471 :
1472 : const KTableEntry nsCSSProps::kFlexWrapKTable[] = {
1473 : { eCSSKeyword_nowrap, NS_STYLE_FLEX_WRAP_NOWRAP },
1474 : { eCSSKeyword_wrap, NS_STYLE_FLEX_WRAP_WRAP },
1475 : { eCSSKeyword_wrap_reverse, NS_STYLE_FLEX_WRAP_WRAP_REVERSE },
1476 : { eCSSKeyword_UNKNOWN, -1 }
1477 : };
1478 :
1479 : const KTableEntry nsCSSProps::kHyphensKTable[] = {
1480 : { eCSSKeyword_none, StyleHyphens::None },
1481 : { eCSSKeyword_manual, StyleHyphens::Manual },
1482 : { eCSSKeyword_auto, StyleHyphens::Auto },
1483 : { eCSSKeyword_UNKNOWN, -1 }
1484 : };
1485 :
1486 : KTableEntry nsCSSProps::kFloatKTable[] = {
1487 : { eCSSKeyword_none, StyleFloat::None },
1488 : { eCSSKeyword_left, StyleFloat::Left },
1489 : { eCSSKeyword_right, StyleFloat::Right },
1490 : { eCSSKeyword_inline_start, StyleFloat::InlineStart },
1491 : { eCSSKeyword_inline_end, StyleFloat::InlineEnd },
1492 : { eCSSKeyword_UNKNOWN, -1 }
1493 : };
1494 :
1495 : const KTableEntry nsCSSProps::kFloatEdgeKTable[] = {
1496 : { eCSSKeyword_content_box, uint8_t(StyleFloatEdge::ContentBox) },
1497 : { eCSSKeyword_margin_box, uint8_t(StyleFloatEdge::MarginBox) },
1498 : { eCSSKeyword_UNKNOWN, -1 }
1499 : };
1500 :
1501 : const KTableEntry nsCSSProps::kFontDisplayKTable[] = {
1502 : { eCSSKeyword_auto, NS_FONT_DISPLAY_AUTO },
1503 : { eCSSKeyword_block, NS_FONT_DISPLAY_BLOCK },
1504 : { eCSSKeyword_swap, NS_FONT_DISPLAY_SWAP },
1505 : { eCSSKeyword_fallback, NS_FONT_DISPLAY_FALLBACK },
1506 : { eCSSKeyword_optional, NS_FONT_DISPLAY_OPTIONAL },
1507 : { eCSSKeyword_UNKNOWN, -1 }
1508 : };
1509 :
1510 : const KTableEntry nsCSSProps::kFontKTable[] = {
1511 : // CSS2.
1512 : { eCSSKeyword_caption, NS_STYLE_FONT_CAPTION },
1513 : { eCSSKeyword_icon, NS_STYLE_FONT_ICON },
1514 : { eCSSKeyword_menu, NS_STYLE_FONT_MENU },
1515 : { eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX },
1516 : { eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION },
1517 : { eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR },
1518 :
1519 : // Proposed for CSS3.
1520 : { eCSSKeyword__moz_window, NS_STYLE_FONT_WINDOW },
1521 : { eCSSKeyword__moz_document, NS_STYLE_FONT_DOCUMENT },
1522 : { eCSSKeyword__moz_workspace, NS_STYLE_FONT_WORKSPACE },
1523 : { eCSSKeyword__moz_desktop, NS_STYLE_FONT_DESKTOP },
1524 : { eCSSKeyword__moz_info, NS_STYLE_FONT_INFO },
1525 : { eCSSKeyword__moz_dialog, NS_STYLE_FONT_DIALOG },
1526 : { eCSSKeyword__moz_button, NS_STYLE_FONT_BUTTON },
1527 : { eCSSKeyword__moz_pull_down_menu, NS_STYLE_FONT_PULL_DOWN_MENU },
1528 : { eCSSKeyword__moz_list, NS_STYLE_FONT_LIST },
1529 : { eCSSKeyword__moz_field, NS_STYLE_FONT_FIELD },
1530 : { eCSSKeyword_UNKNOWN, -1 }
1531 : };
1532 :
1533 : const KTableEntry nsCSSProps::kFontKerningKTable[] = {
1534 : { eCSSKeyword_auto, NS_FONT_KERNING_AUTO },
1535 : { eCSSKeyword_none, NS_FONT_KERNING_NONE },
1536 : { eCSSKeyword_normal, NS_FONT_KERNING_NORMAL },
1537 : { eCSSKeyword_UNKNOWN, -1 }
1538 : };
1539 :
1540 : const KTableEntry nsCSSProps::kFontSizeKTable[] = {
1541 : { eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL },
1542 : { eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL },
1543 : { eCSSKeyword_small, NS_STYLE_FONT_SIZE_SMALL },
1544 : { eCSSKeyword_medium, NS_STYLE_FONT_SIZE_MEDIUM },
1545 : { eCSSKeyword_large, NS_STYLE_FONT_SIZE_LARGE },
1546 : { eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE },
1547 : { eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE },
1548 : { eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER },
1549 : { eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER },
1550 : { eCSSKeyword_UNKNOWN, -1 }
1551 : };
1552 :
1553 : const KTableEntry nsCSSProps::kFontSmoothingKTable[] = {
1554 : { eCSSKeyword_auto, NS_FONT_SMOOTHING_AUTO },
1555 : { eCSSKeyword_grayscale, NS_FONT_SMOOTHING_GRAYSCALE },
1556 : { eCSSKeyword_UNKNOWN, -1 }
1557 : };
1558 :
1559 : const KTableEntry nsCSSProps::kFontStretchKTable[] = {
1560 : { eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED },
1561 : { eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED },
1562 : { eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED },
1563 : { eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED },
1564 : { eCSSKeyword_normal, NS_STYLE_FONT_STRETCH_NORMAL },
1565 : { eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED },
1566 : { eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED },
1567 : { eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED },
1568 : { eCSSKeyword_ultra_expanded, NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED },
1569 : { eCSSKeyword_UNKNOWN, -1 }
1570 : };
1571 :
1572 : const KTableEntry nsCSSProps::kFontStyleKTable[] = {
1573 : { eCSSKeyword_normal, NS_STYLE_FONT_STYLE_NORMAL },
1574 : { eCSSKeyword_italic, NS_STYLE_FONT_STYLE_ITALIC },
1575 : { eCSSKeyword_oblique, NS_STYLE_FONT_STYLE_OBLIQUE },
1576 : { eCSSKeyword_UNKNOWN, -1 }
1577 : };
1578 :
1579 : const KTableEntry nsCSSProps::kFontSynthesisKTable[] = {
1580 : { eCSSKeyword_weight, NS_FONT_SYNTHESIS_WEIGHT },
1581 : { eCSSKeyword_style, NS_FONT_SYNTHESIS_STYLE },
1582 : { eCSSKeyword_UNKNOWN, -1 }
1583 : };
1584 :
1585 : const KTableEntry nsCSSProps::kFontVariantAlternatesKTable[] = {
1586 : { eCSSKeyword_historical_forms, NS_FONT_VARIANT_ALTERNATES_HISTORICAL },
1587 : { eCSSKeyword_UNKNOWN, -1 }
1588 : };
1589 :
1590 : const KTableEntry nsCSSProps::kFontVariantAlternatesFuncsKTable[] = {
1591 : { eCSSKeyword_stylistic, NS_FONT_VARIANT_ALTERNATES_STYLISTIC },
1592 : { eCSSKeyword_styleset, NS_FONT_VARIANT_ALTERNATES_STYLESET },
1593 : { eCSSKeyword_character_variant, NS_FONT_VARIANT_ALTERNATES_CHARACTER_VARIANT },
1594 : { eCSSKeyword_swash, NS_FONT_VARIANT_ALTERNATES_SWASH },
1595 : { eCSSKeyword_ornaments, NS_FONT_VARIANT_ALTERNATES_ORNAMENTS },
1596 : { eCSSKeyword_annotation, NS_FONT_VARIANT_ALTERNATES_ANNOTATION },
1597 : { eCSSKeyword_UNKNOWN, -1 }
1598 : };
1599 :
1600 : const KTableEntry nsCSSProps::kFontVariantCapsKTable[] = {
1601 : { eCSSKeyword_small_caps, NS_FONT_VARIANT_CAPS_SMALLCAPS },
1602 : { eCSSKeyword_all_small_caps, NS_FONT_VARIANT_CAPS_ALLSMALL },
1603 : { eCSSKeyword_petite_caps, NS_FONT_VARIANT_CAPS_PETITECAPS },
1604 : { eCSSKeyword_all_petite_caps, NS_FONT_VARIANT_CAPS_ALLPETITE },
1605 : { eCSSKeyword_titling_caps, NS_FONT_VARIANT_CAPS_TITLING },
1606 : { eCSSKeyword_unicase, NS_FONT_VARIANT_CAPS_UNICASE },
1607 : { eCSSKeyword_UNKNOWN, -1 }
1608 : };
1609 :
1610 : const KTableEntry nsCSSProps::kFontVariantEastAsianKTable[] = {
1611 : { eCSSKeyword_jis78, NS_FONT_VARIANT_EAST_ASIAN_JIS78 },
1612 : { eCSSKeyword_jis83, NS_FONT_VARIANT_EAST_ASIAN_JIS83 },
1613 : { eCSSKeyword_jis90, NS_FONT_VARIANT_EAST_ASIAN_JIS90 },
1614 : { eCSSKeyword_jis04, NS_FONT_VARIANT_EAST_ASIAN_JIS04 },
1615 : { eCSSKeyword_simplified, NS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED },
1616 : { eCSSKeyword_traditional, NS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL },
1617 : { eCSSKeyword_full_width, NS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH },
1618 : { eCSSKeyword_proportional_width, NS_FONT_VARIANT_EAST_ASIAN_PROP_WIDTH },
1619 : { eCSSKeyword_ruby, NS_FONT_VARIANT_EAST_ASIAN_RUBY },
1620 : { eCSSKeyword_UNKNOWN, -1 }
1621 : };
1622 :
1623 : const KTableEntry nsCSSProps::kFontVariantLigaturesKTable[] = {
1624 : { eCSSKeyword_common_ligatures, NS_FONT_VARIANT_LIGATURES_COMMON },
1625 : { eCSSKeyword_no_common_ligatures, NS_FONT_VARIANT_LIGATURES_NO_COMMON },
1626 : { eCSSKeyword_discretionary_ligatures, NS_FONT_VARIANT_LIGATURES_DISCRETIONARY },
1627 : { eCSSKeyword_no_discretionary_ligatures, NS_FONT_VARIANT_LIGATURES_NO_DISCRETIONARY },
1628 : { eCSSKeyword_historical_ligatures, NS_FONT_VARIANT_LIGATURES_HISTORICAL },
1629 : { eCSSKeyword_no_historical_ligatures, NS_FONT_VARIANT_LIGATURES_NO_HISTORICAL },
1630 : { eCSSKeyword_contextual, NS_FONT_VARIANT_LIGATURES_CONTEXTUAL },
1631 : { eCSSKeyword_no_contextual, NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL },
1632 : { eCSSKeyword_UNKNOWN, -1 }
1633 : };
1634 :
1635 : const KTableEntry nsCSSProps::kFontVariantNumericKTable[] = {
1636 : { eCSSKeyword_lining_nums, NS_FONT_VARIANT_NUMERIC_LINING },
1637 : { eCSSKeyword_oldstyle_nums, NS_FONT_VARIANT_NUMERIC_OLDSTYLE },
1638 : { eCSSKeyword_proportional_nums, NS_FONT_VARIANT_NUMERIC_PROPORTIONAL },
1639 : { eCSSKeyword_tabular_nums, NS_FONT_VARIANT_NUMERIC_TABULAR },
1640 : { eCSSKeyword_diagonal_fractions, NS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS },
1641 : { eCSSKeyword_stacked_fractions, NS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS },
1642 : { eCSSKeyword_slashed_zero, NS_FONT_VARIANT_NUMERIC_SLASHZERO },
1643 : { eCSSKeyword_ordinal, NS_FONT_VARIANT_NUMERIC_ORDINAL },
1644 : { eCSSKeyword_UNKNOWN, -1 }
1645 : };
1646 :
1647 : const KTableEntry nsCSSProps::kFontVariantPositionKTable[] = {
1648 : { eCSSKeyword_super, NS_FONT_VARIANT_POSITION_SUPER },
1649 : { eCSSKeyword_sub, NS_FONT_VARIANT_POSITION_SUB },
1650 : { eCSSKeyword_UNKNOWN, -1 }
1651 : };
1652 :
1653 : const KTableEntry nsCSSProps::kFontWeightKTable[] = {
1654 : { eCSSKeyword_normal, NS_STYLE_FONT_WEIGHT_NORMAL },
1655 : { eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD },
1656 : { eCSSKeyword_bolder, NS_STYLE_FONT_WEIGHT_BOLDER },
1657 : { eCSSKeyword_lighter, NS_STYLE_FONT_WEIGHT_LIGHTER },
1658 : { eCSSKeyword_UNKNOWN, -1 }
1659 : };
1660 :
1661 : const KTableEntry nsCSSProps::kGridAutoFlowKTable[] = {
1662 : { eCSSKeyword_row, NS_STYLE_GRID_AUTO_FLOW_ROW },
1663 : { eCSSKeyword_column, NS_STYLE_GRID_AUTO_FLOW_COLUMN },
1664 : { eCSSKeyword_dense, NS_STYLE_GRID_AUTO_FLOW_DENSE },
1665 : { eCSSKeyword_UNKNOWN, -1 }
1666 : };
1667 :
1668 : const KTableEntry nsCSSProps::kGridTrackBreadthKTable[] = {
1669 : { eCSSKeyword_min_content, StyleGridTrackBreadth::MinContent },
1670 : { eCSSKeyword_max_content, StyleGridTrackBreadth::MaxContent },
1671 : { eCSSKeyword_UNKNOWN, -1 }
1672 : };
1673 :
1674 : const KTableEntry nsCSSProps::kImageOrientationKTable[] = {
1675 : { eCSSKeyword_flip, NS_STYLE_IMAGE_ORIENTATION_FLIP },
1676 : { eCSSKeyword_from_image, NS_STYLE_IMAGE_ORIENTATION_FROM_IMAGE },
1677 : { eCSSKeyword_UNKNOWN, -1 }
1678 : };
1679 :
1680 : const KTableEntry nsCSSProps::kImageOrientationFlipKTable[] = {
1681 : { eCSSKeyword_flip, NS_STYLE_IMAGE_ORIENTATION_FLIP },
1682 : { eCSSKeyword_UNKNOWN, -1 }
1683 : };
1684 :
1685 : const KTableEntry nsCSSProps::kIsolationKTable[] = {
1686 : { eCSSKeyword_auto, NS_STYLE_ISOLATION_AUTO },
1687 : { eCSSKeyword_isolate, NS_STYLE_ISOLATION_ISOLATE },
1688 : { eCSSKeyword_UNKNOWN, -1 }
1689 : };
1690 :
1691 : const KTableEntry nsCSSProps::kIMEModeKTable[] = {
1692 : { eCSSKeyword_normal, NS_STYLE_IME_MODE_NORMAL },
1693 : { eCSSKeyword_auto, NS_STYLE_IME_MODE_AUTO },
1694 : { eCSSKeyword_active, NS_STYLE_IME_MODE_ACTIVE },
1695 : { eCSSKeyword_disabled, NS_STYLE_IME_MODE_DISABLED },
1696 : { eCSSKeyword_inactive, NS_STYLE_IME_MODE_INACTIVE },
1697 : { eCSSKeyword_UNKNOWN, -1 }
1698 : };
1699 :
1700 : const KTableEntry nsCSSProps::kLineHeightKTable[] = {
1701 : // -moz- prefixed, intended for internal use for single-line controls
1702 : { eCSSKeyword__moz_block_height, NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT },
1703 : { eCSSKeyword_UNKNOWN, -1 }
1704 : };
1705 :
1706 : const KTableEntry nsCSSProps::kListStylePositionKTable[] = {
1707 : { eCSSKeyword_inside, NS_STYLE_LIST_STYLE_POSITION_INSIDE },
1708 : { eCSSKeyword_outside, NS_STYLE_LIST_STYLE_POSITION_OUTSIDE },
1709 : { eCSSKeyword_UNKNOWN, -1 }
1710 : };
1711 :
1712 : const KTableEntry nsCSSProps::kListStyleKTable[] = {
1713 : // none and decimal are not redefinable, so they should not be moved.
1714 : { eCSSKeyword_none, NS_STYLE_LIST_STYLE_NONE },
1715 : { eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL },
1716 : // the following graphic styles are processed in a different way.
1717 : { eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC },
1718 : { eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE },
1719 : { eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE },
1720 : { eCSSKeyword_disclosure_closed, NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED },
1721 : { eCSSKeyword_disclosure_open, NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN },
1722 : // the following counter styles require specific algorithms to generate.
1723 : { eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW },
1724 : { eCSSKeyword_japanese_informal, NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL },
1725 : { eCSSKeyword_japanese_formal, NS_STYLE_LIST_STYLE_JAPANESE_FORMAL },
1726 : { eCSSKeyword_korean_hangul_formal, NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL },
1727 : { eCSSKeyword_korean_hanja_informal, NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL },
1728 : { eCSSKeyword_korean_hanja_formal, NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL },
1729 : { eCSSKeyword_simp_chinese_informal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL },
1730 : { eCSSKeyword_simp_chinese_formal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL },
1731 : { eCSSKeyword_trad_chinese_informal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL },
1732 : { eCSSKeyword_trad_chinese_formal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL },
1733 : { eCSSKeyword_ethiopic_numeric, NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC },
1734 : { eCSSKeyword_UNKNOWN, -1 }
1735 : };
1736 :
1737 : const KTableEntry nsCSSProps::kMathVariantKTable[] = {
1738 : { eCSSKeyword_none, NS_MATHML_MATHVARIANT_NONE },
1739 : { eCSSKeyword_normal, NS_MATHML_MATHVARIANT_NORMAL },
1740 : { eCSSKeyword_bold, NS_MATHML_MATHVARIANT_BOLD },
1741 : { eCSSKeyword_italic, NS_MATHML_MATHVARIANT_ITALIC },
1742 : { eCSSKeyword_bold_italic, NS_MATHML_MATHVARIANT_BOLD_ITALIC },
1743 : { eCSSKeyword_script, NS_MATHML_MATHVARIANT_SCRIPT },
1744 : { eCSSKeyword_bold_script, NS_MATHML_MATHVARIANT_BOLD_SCRIPT },
1745 : { eCSSKeyword_fraktur, NS_MATHML_MATHVARIANT_FRAKTUR },
1746 : { eCSSKeyword_double_struck, NS_MATHML_MATHVARIANT_DOUBLE_STRUCK },
1747 : { eCSSKeyword_bold_fraktur, NS_MATHML_MATHVARIANT_BOLD_FRAKTUR },
1748 : { eCSSKeyword_sans_serif, NS_MATHML_MATHVARIANT_SANS_SERIF },
1749 : { eCSSKeyword_bold_sans_serif, NS_MATHML_MATHVARIANT_BOLD_SANS_SERIF },
1750 : { eCSSKeyword_sans_serif_italic, NS_MATHML_MATHVARIANT_SANS_SERIF_ITALIC },
1751 : { eCSSKeyword_sans_serif_bold_italic, NS_MATHML_MATHVARIANT_SANS_SERIF_BOLD_ITALIC },
1752 : { eCSSKeyword_monospace, NS_MATHML_MATHVARIANT_MONOSPACE },
1753 : { eCSSKeyword_initial, NS_MATHML_MATHVARIANT_INITIAL },
1754 : { eCSSKeyword_tailed, NS_MATHML_MATHVARIANT_TAILED },
1755 : { eCSSKeyword_looped, NS_MATHML_MATHVARIANT_LOOPED },
1756 : { eCSSKeyword_stretched, NS_MATHML_MATHVARIANT_STRETCHED },
1757 : { eCSSKeyword_UNKNOWN, -1 }
1758 : };
1759 :
1760 : const KTableEntry nsCSSProps::kMathDisplayKTable[] = {
1761 : { eCSSKeyword_inline, NS_MATHML_DISPLAYSTYLE_INLINE },
1762 : { eCSSKeyword_block, NS_MATHML_DISPLAYSTYLE_BLOCK },
1763 : { eCSSKeyword_UNKNOWN, -1 }
1764 : };
1765 :
1766 : const KTableEntry nsCSSProps::kContainKTable[] = {
1767 : { eCSSKeyword_none, NS_STYLE_CONTAIN_NONE },
1768 : { eCSSKeyword_strict, NS_STYLE_CONTAIN_STRICT },
1769 : { eCSSKeyword_layout, NS_STYLE_CONTAIN_LAYOUT },
1770 : { eCSSKeyword_style, NS_STYLE_CONTAIN_STYLE },
1771 : { eCSSKeyword_paint, NS_STYLE_CONTAIN_PAINT },
1772 : { eCSSKeyword_UNKNOWN, -1 }
1773 : };
1774 :
1775 : const KTableEntry nsCSSProps::kContextOpacityKTable[] = {
1776 : { eCSSKeyword_context_fill_opacity, NS_STYLE_CONTEXT_FILL_OPACITY },
1777 : { eCSSKeyword_context_stroke_opacity, NS_STYLE_CONTEXT_STROKE_OPACITY },
1778 : { eCSSKeyword_UNKNOWN, -1 }
1779 : };
1780 :
1781 : const KTableEntry nsCSSProps::kContextPatternKTable[] = {
1782 : { eCSSKeyword_context_fill, NS_COLOR_CONTEXT_FILL },
1783 : { eCSSKeyword_context_stroke, NS_COLOR_CONTEXT_STROKE },
1784 : { eCSSKeyword_UNKNOWN, -1 }
1785 : };
1786 :
1787 : const KTableEntry nsCSSProps::kObjectFitKTable[] = {
1788 : { eCSSKeyword_fill, NS_STYLE_OBJECT_FIT_FILL },
1789 : { eCSSKeyword_contain, NS_STYLE_OBJECT_FIT_CONTAIN },
1790 : { eCSSKeyword_cover, NS_STYLE_OBJECT_FIT_COVER },
1791 : { eCSSKeyword_none, NS_STYLE_OBJECT_FIT_NONE },
1792 : { eCSSKeyword_scale_down, NS_STYLE_OBJECT_FIT_SCALE_DOWN },
1793 : { eCSSKeyword_UNKNOWN, -1 }
1794 : };
1795 :
1796 : const KTableEntry nsCSSProps::kOrientKTable[] = {
1797 : { eCSSKeyword_inline, StyleOrient::Inline },
1798 : { eCSSKeyword_block, StyleOrient::Block },
1799 : { eCSSKeyword_horizontal, StyleOrient::Horizontal },
1800 : { eCSSKeyword_vertical, StyleOrient::Vertical },
1801 : { eCSSKeyword_UNKNOWN, -1 }
1802 : };
1803 :
1804 : // Same as kBorderStyleKTable except 'hidden'.
1805 : const KTableEntry nsCSSProps::kOutlineStyleKTable[] = {
1806 : { eCSSKeyword_none, NS_STYLE_BORDER_STYLE_NONE },
1807 : { eCSSKeyword_auto, NS_STYLE_BORDER_STYLE_AUTO },
1808 : { eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED },
1809 : { eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED },
1810 : { eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID },
1811 : { eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE },
1812 : { eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE },
1813 : { eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE },
1814 : { eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET },
1815 : { eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET },
1816 : { eCSSKeyword_UNKNOWN, -1 }
1817 : };
1818 :
1819 : const KTableEntry nsCSSProps::kOverflowKTable[] = {
1820 : { eCSSKeyword_auto, NS_STYLE_OVERFLOW_AUTO },
1821 : { eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE },
1822 : { eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN },
1823 : { eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL },
1824 : // Deprecated:
1825 : { eCSSKeyword__moz_scrollbars_none, NS_STYLE_OVERFLOW_HIDDEN },
1826 : { eCSSKeyword__moz_scrollbars_horizontal, NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL },
1827 : { eCSSKeyword__moz_scrollbars_vertical, NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL },
1828 : { eCSSKeyword__moz_hidden_unscrollable, NS_STYLE_OVERFLOW_CLIP },
1829 : { eCSSKeyword_UNKNOWN, -1 }
1830 : };
1831 :
1832 : const KTableEntry nsCSSProps::kOverflowClipBoxKTable[] = {
1833 : { eCSSKeyword_padding_box, NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX },
1834 : { eCSSKeyword_content_box, NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX },
1835 : { eCSSKeyword_UNKNOWN, -1 }
1836 : };
1837 :
1838 : const KTableEntry nsCSSProps::kOverflowSubKTable[] = {
1839 : { eCSSKeyword_auto, NS_STYLE_OVERFLOW_AUTO },
1840 : { eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE },
1841 : { eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN },
1842 : { eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL },
1843 : // Deprecated:
1844 : { eCSSKeyword__moz_hidden_unscrollable, NS_STYLE_OVERFLOW_CLIP },
1845 : { eCSSKeyword_UNKNOWN, -1 }
1846 : };
1847 :
1848 : const KTableEntry nsCSSProps::kPageBreakKTable[] = {
1849 : { eCSSKeyword_auto, NS_STYLE_PAGE_BREAK_AUTO },
1850 : { eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS },
1851 : { eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID },
1852 : { eCSSKeyword_left, NS_STYLE_PAGE_BREAK_LEFT },
1853 : { eCSSKeyword_right, NS_STYLE_PAGE_BREAK_RIGHT },
1854 : { eCSSKeyword_UNKNOWN, -1 }
1855 : };
1856 :
1857 : const KTableEntry nsCSSProps::kPageBreakInsideKTable[] = {
1858 : { eCSSKeyword_auto, NS_STYLE_PAGE_BREAK_AUTO },
1859 : { eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID },
1860 : { eCSSKeyword_UNKNOWN, -1 }
1861 : };
1862 :
1863 : const KTableEntry nsCSSProps::kPageMarksKTable[] = {
1864 : { eCSSKeyword_none, NS_STYLE_PAGE_MARKS_NONE },
1865 : { eCSSKeyword_crop, NS_STYLE_PAGE_MARKS_CROP },
1866 : { eCSSKeyword_cross, NS_STYLE_PAGE_MARKS_REGISTER },
1867 : { eCSSKeyword_UNKNOWN, -1 }
1868 : };
1869 :
1870 : const KTableEntry nsCSSProps::kPageSizeKTable[] = {
1871 : { eCSSKeyword_landscape, NS_STYLE_PAGE_SIZE_LANDSCAPE },
1872 : { eCSSKeyword_portrait, NS_STYLE_PAGE_SIZE_PORTRAIT },
1873 : { eCSSKeyword_UNKNOWN, -1 }
1874 : };
1875 :
1876 : const KTableEntry nsCSSProps::kPointerEventsKTable[] = {
1877 : { eCSSKeyword_none, NS_STYLE_POINTER_EVENTS_NONE },
1878 : { eCSSKeyword_visiblepainted, NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED },
1879 : { eCSSKeyword_visiblefill, NS_STYLE_POINTER_EVENTS_VISIBLEFILL },
1880 : { eCSSKeyword_visiblestroke, NS_STYLE_POINTER_EVENTS_VISIBLESTROKE },
1881 : { eCSSKeyword_visible, NS_STYLE_POINTER_EVENTS_VISIBLE },
1882 : { eCSSKeyword_painted, NS_STYLE_POINTER_EVENTS_PAINTED },
1883 : { eCSSKeyword_fill, NS_STYLE_POINTER_EVENTS_FILL },
1884 : { eCSSKeyword_stroke, NS_STYLE_POINTER_EVENTS_STROKE },
1885 : { eCSSKeyword_all, NS_STYLE_POINTER_EVENTS_ALL },
1886 : { eCSSKeyword_auto, NS_STYLE_POINTER_EVENTS_AUTO },
1887 : { eCSSKeyword_UNKNOWN, -1 }
1888 : };
1889 :
1890 : const KTableEntry nsCSSProps::kPositionKTable[] = {
1891 : { eCSSKeyword_static, NS_STYLE_POSITION_STATIC },
1892 : { eCSSKeyword_relative, NS_STYLE_POSITION_RELATIVE },
1893 : { eCSSKeyword_absolute, NS_STYLE_POSITION_ABSOLUTE },
1894 : { eCSSKeyword_fixed, NS_STYLE_POSITION_FIXED },
1895 : { eCSSKeyword_sticky, NS_STYLE_POSITION_STICKY },
1896 : { eCSSKeyword_UNKNOWN, -1 }
1897 : };
1898 :
1899 : const KTableEntry nsCSSProps::kRadialGradientShapeKTable[] = {
1900 : { eCSSKeyword_circle, NS_STYLE_GRADIENT_SHAPE_CIRCULAR },
1901 : { eCSSKeyword_ellipse, NS_STYLE_GRADIENT_SHAPE_ELLIPTICAL },
1902 : { eCSSKeyword_UNKNOWN, -1 }
1903 : };
1904 :
1905 : const KTableEntry nsCSSProps::kRadialGradientSizeKTable[] = {
1906 : { eCSSKeyword_closest_side, NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE },
1907 : { eCSSKeyword_closest_corner, NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER },
1908 : { eCSSKeyword_farthest_side, NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE },
1909 : { eCSSKeyword_farthest_corner, NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER },
1910 : { eCSSKeyword_UNKNOWN, -1 }
1911 : };
1912 :
1913 : const KTableEntry nsCSSProps::kRadialGradientLegacySizeKTable[] = {
1914 : { eCSSKeyword_closest_side, NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE },
1915 : { eCSSKeyword_closest_corner, NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER },
1916 : { eCSSKeyword_farthest_side, NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE },
1917 : { eCSSKeyword_farthest_corner, NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER },
1918 : // synonyms
1919 : { eCSSKeyword_contain, NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE },
1920 : { eCSSKeyword_cover, NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER },
1921 : { eCSSKeyword_UNKNOWN, -1 }
1922 : };
1923 :
1924 : const KTableEntry nsCSSProps::kResizeKTable[] = {
1925 : { eCSSKeyword_none, NS_STYLE_RESIZE_NONE },
1926 : { eCSSKeyword_both, NS_STYLE_RESIZE_BOTH },
1927 : { eCSSKeyword_horizontal, NS_STYLE_RESIZE_HORIZONTAL },
1928 : { eCSSKeyword_vertical, NS_STYLE_RESIZE_VERTICAL },
1929 : { eCSSKeyword_UNKNOWN, -1 }
1930 : };
1931 :
1932 : const KTableEntry nsCSSProps::kRubyAlignKTable[] = {
1933 : { eCSSKeyword_start, NS_STYLE_RUBY_ALIGN_START },
1934 : { eCSSKeyword_center, NS_STYLE_RUBY_ALIGN_CENTER },
1935 : { eCSSKeyword_space_between, NS_STYLE_RUBY_ALIGN_SPACE_BETWEEN },
1936 : { eCSSKeyword_space_around, NS_STYLE_RUBY_ALIGN_SPACE_AROUND },
1937 : { eCSSKeyword_UNKNOWN, -1 }
1938 : };
1939 :
1940 : const KTableEntry nsCSSProps::kRubyPositionKTable[] = {
1941 : { eCSSKeyword_over, NS_STYLE_RUBY_POSITION_OVER },
1942 : { eCSSKeyword_under, NS_STYLE_RUBY_POSITION_UNDER },
1943 : // bug 1055672 for 'inter-character' support
1944 : // { eCSSKeyword_inter_character, NS_STYLE_RUBY_POSITION_INTER_CHARACTER },
1945 : { eCSSKeyword_UNKNOWN, -1 }
1946 : };
1947 :
1948 : const KTableEntry nsCSSProps::kScrollBehaviorKTable[] = {
1949 : { eCSSKeyword_auto, NS_STYLE_SCROLL_BEHAVIOR_AUTO },
1950 : { eCSSKeyword_smooth, NS_STYLE_SCROLL_BEHAVIOR_SMOOTH },
1951 : { eCSSKeyword_UNKNOWN, -1 }
1952 : };
1953 :
1954 : const KTableEntry nsCSSProps::kScrollSnapTypeKTable[] = {
1955 : { eCSSKeyword_none, NS_STYLE_SCROLL_SNAP_TYPE_NONE },
1956 : { eCSSKeyword_mandatory, NS_STYLE_SCROLL_SNAP_TYPE_MANDATORY },
1957 : { eCSSKeyword_proximity, NS_STYLE_SCROLL_SNAP_TYPE_PROXIMITY },
1958 : { eCSSKeyword_UNKNOWN, -1 }
1959 : };
1960 :
1961 : const KTableEntry nsCSSProps::kStackSizingKTable[] = {
1962 : { eCSSKeyword_ignore, StyleStackSizing::Ignore },
1963 : { eCSSKeyword_stretch_to_fit, StyleStackSizing::StretchToFit },
1964 : { eCSSKeyword_ignore_horizontal, StyleStackSizing::IgnoreHorizontal },
1965 : { eCSSKeyword_ignore_vertical, StyleStackSizing::IgnoreVertical },
1966 : { eCSSKeyword_UNKNOWN, -1 }
1967 : };
1968 :
1969 : const KTableEntry nsCSSProps::kTableLayoutKTable[] = {
1970 : { eCSSKeyword_auto, NS_STYLE_TABLE_LAYOUT_AUTO },
1971 : { eCSSKeyword_fixed, NS_STYLE_TABLE_LAYOUT_FIXED },
1972 : { eCSSKeyword_UNKNOWN, -1 }
1973 : };
1974 :
1975 : KTableEntry nsCSSProps::kTextAlignKTable[] = {
1976 : { eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT },
1977 : { eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT },
1978 : { eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER },
1979 : { eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY },
1980 : { eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER },
1981 : { eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT },
1982 : { eCSSKeyword__moz_left, NS_STYLE_TEXT_ALIGN_MOZ_LEFT },
1983 : { eCSSKeyword_start, NS_STYLE_TEXT_ALIGN_START },
1984 : { eCSSKeyword_end, NS_STYLE_TEXT_ALIGN_END },
1985 : { eCSSKeyword_unsafe, NS_STYLE_TEXT_ALIGN_UNSAFE },
1986 : { eCSSKeyword_match_parent, NS_STYLE_TEXT_ALIGN_MATCH_PARENT },
1987 : { eCSSKeyword_UNKNOWN, -1 }
1988 : };
1989 :
1990 : KTableEntry nsCSSProps::kTextAlignLastKTable[] = {
1991 : { eCSSKeyword_auto, NS_STYLE_TEXT_ALIGN_AUTO },
1992 : { eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT },
1993 : { eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT },
1994 : { eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER },
1995 : { eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY },
1996 : { eCSSKeyword_start, NS_STYLE_TEXT_ALIGN_START },
1997 : { eCSSKeyword_end, NS_STYLE_TEXT_ALIGN_END },
1998 : { eCSSKeyword_unsafe, NS_STYLE_TEXT_ALIGN_UNSAFE },
1999 : { eCSSKeyword_UNKNOWN, -1 }
2000 : };
2001 :
2002 : const KTableEntry nsCSSProps::kTextJustifyKTable[] = {
2003 : { eCSSKeyword_none, StyleTextJustify::None },
2004 : { eCSSKeyword_auto, StyleTextJustify::Auto },
2005 : { eCSSKeyword_inter_word, StyleTextJustify::InterWord },
2006 : { eCSSKeyword_inter_character, StyleTextJustify::InterCharacter },
2007 : // For legacy reasons, UAs must also support the keyword "distribute" with
2008 : // the exact same meaning and behavior as "inter-character".
2009 : { eCSSKeyword_distribute, StyleTextJustify::InterCharacter },
2010 : { eCSSKeyword_UNKNOWN, -1 }
2011 : };
2012 :
2013 : const KTableEntry nsCSSProps::kTextCombineUprightKTable[] = {
2014 : { eCSSKeyword_none, NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE },
2015 : { eCSSKeyword_all, NS_STYLE_TEXT_COMBINE_UPRIGHT_ALL },
2016 : { eCSSKeyword_digits, NS_STYLE_TEXT_COMBINE_UPRIGHT_DIGITS_2 }, // w/o number ==> 2
2017 : { eCSSKeyword_UNKNOWN, -1 }
2018 : };
2019 :
2020 : const KTableEntry nsCSSProps::kTextDecorationLineKTable[] = {
2021 : { eCSSKeyword_none, NS_STYLE_TEXT_DECORATION_LINE_NONE },
2022 : { eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE },
2023 : { eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_LINE_OVERLINE },
2024 : { eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH },
2025 : { eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_LINE_BLINK },
2026 : { eCSSKeyword_UNKNOWN, -1 }
2027 : };
2028 :
2029 : const KTableEntry nsCSSProps::kTextDecorationStyleKTable[] = {
2030 : { eCSSKeyword__moz_none, NS_STYLE_TEXT_DECORATION_STYLE_NONE },
2031 : { eCSSKeyword_solid, NS_STYLE_TEXT_DECORATION_STYLE_SOLID },
2032 : { eCSSKeyword_double, NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE },
2033 : { eCSSKeyword_dotted, NS_STYLE_TEXT_DECORATION_STYLE_DOTTED },
2034 : { eCSSKeyword_dashed, NS_STYLE_TEXT_DECORATION_STYLE_DASHED },
2035 : { eCSSKeyword_wavy, NS_STYLE_TEXT_DECORATION_STYLE_WAVY },
2036 : { eCSSKeyword_UNKNOWN, -1 }
2037 : };
2038 :
2039 : const KTableEntry nsCSSProps::kTextOrientationKTable[] = {
2040 : { eCSSKeyword_mixed, NS_STYLE_TEXT_ORIENTATION_MIXED },
2041 : { eCSSKeyword_upright, NS_STYLE_TEXT_ORIENTATION_UPRIGHT },
2042 : { eCSSKeyword_sideways, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS },
2043 : { eCSSKeyword_sideways_right, NS_STYLE_TEXT_ORIENTATION_SIDEWAYS },
2044 : { eCSSKeyword_UNKNOWN, -1 }
2045 : };
2046 :
2047 : const KTableEntry nsCSSProps::kTextEmphasisPositionKTable[] = {
2048 : { eCSSKeyword_over, NS_STYLE_TEXT_EMPHASIS_POSITION_OVER },
2049 : { eCSSKeyword_under, NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER },
2050 : { eCSSKeyword_left, NS_STYLE_TEXT_EMPHASIS_POSITION_LEFT },
2051 : { eCSSKeyword_right, NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT },
2052 : { eCSSKeyword_UNKNOWN, -1 }
2053 : };
2054 :
2055 : const KTableEntry nsCSSProps::kTextEmphasisStyleFillKTable[] = {
2056 : { eCSSKeyword_filled, NS_STYLE_TEXT_EMPHASIS_STYLE_FILLED },
2057 : { eCSSKeyword_open, NS_STYLE_TEXT_EMPHASIS_STYLE_OPEN },
2058 : { eCSSKeyword_UNKNOWN, -1 }
2059 : };
2060 :
2061 : const KTableEntry nsCSSProps::kTextEmphasisStyleShapeKTable[] = {
2062 : { eCSSKeyword_dot, NS_STYLE_TEXT_EMPHASIS_STYLE_DOT },
2063 : { eCSSKeyword_circle, NS_STYLE_TEXT_EMPHASIS_STYLE_CIRCLE },
2064 : { eCSSKeyword_double_circle, NS_STYLE_TEXT_EMPHASIS_STYLE_DOUBLE_CIRCLE },
2065 : { eCSSKeyword_triangle, NS_STYLE_TEXT_EMPHASIS_STYLE_TRIANGLE },
2066 : { eCSSKeyword_sesame, NS_STYLE_TEXT_EMPHASIS_STYLE_SESAME} ,
2067 : { eCSSKeyword_UNKNOWN, -1 }
2068 : };
2069 :
2070 : const KTableEntry nsCSSProps::kTextOverflowKTable[] = {
2071 : { eCSSKeyword_clip, NS_STYLE_TEXT_OVERFLOW_CLIP },
2072 : { eCSSKeyword_ellipsis, NS_STYLE_TEXT_OVERFLOW_ELLIPSIS },
2073 : { eCSSKeyword_UNKNOWN, -1 }
2074 : };
2075 :
2076 : const KTableEntry nsCSSProps::kTextSizeAdjustKTable[] = {
2077 : { eCSSKeyword_none, NS_STYLE_TEXT_SIZE_ADJUST_NONE },
2078 : { eCSSKeyword_auto, NS_STYLE_TEXT_SIZE_ADJUST_AUTO },
2079 : { eCSSKeyword_UNKNOWN, -1 }
2080 : };
2081 :
2082 : const KTableEntry nsCSSProps::kTextTransformKTable[] = {
2083 : { eCSSKeyword_none, NS_STYLE_TEXT_TRANSFORM_NONE },
2084 : { eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE },
2085 : { eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE },
2086 : { eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE },
2087 : { eCSSKeyword_full_width, NS_STYLE_TEXT_TRANSFORM_FULL_WIDTH },
2088 : { eCSSKeyword_UNKNOWN, -1 }
2089 : };
2090 :
2091 : const KTableEntry nsCSSProps::kTouchActionKTable[] = {
2092 : { eCSSKeyword_none, NS_STYLE_TOUCH_ACTION_NONE },
2093 : { eCSSKeyword_auto, NS_STYLE_TOUCH_ACTION_AUTO },
2094 : { eCSSKeyword_pan_x, NS_STYLE_TOUCH_ACTION_PAN_X },
2095 : { eCSSKeyword_pan_y, NS_STYLE_TOUCH_ACTION_PAN_Y },
2096 : { eCSSKeyword_manipulation, NS_STYLE_TOUCH_ACTION_MANIPULATION },
2097 : { eCSSKeyword_UNKNOWN, -1 }
2098 : };
2099 :
2100 : const KTableEntry nsCSSProps::kTopLayerKTable[] = {
2101 : { eCSSKeyword_none, NS_STYLE_TOP_LAYER_NONE },
2102 : { eCSSKeyword_top, NS_STYLE_TOP_LAYER_TOP },
2103 : { eCSSKeyword_UNKNOWN, -1 }
2104 : };
2105 :
2106 : const KTableEntry nsCSSProps::kTransformBoxKTable[] = {
2107 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
2108 : { eCSSKeyword_fill_box, StyleGeometryBox::FillBox },
2109 : { eCSSKeyword_view_box, StyleGeometryBox::ViewBox },
2110 : { eCSSKeyword_UNKNOWN, -1 }
2111 : };
2112 :
2113 : const KTableEntry nsCSSProps::kTransitionTimingFunctionKTable[] = {
2114 : { eCSSKeyword_ease, NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE },
2115 : { eCSSKeyword_linear, NS_STYLE_TRANSITION_TIMING_FUNCTION_LINEAR },
2116 : { eCSSKeyword_ease_in, NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_IN },
2117 : { eCSSKeyword_ease_out, NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_OUT },
2118 : { eCSSKeyword_ease_in_out, NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_IN_OUT },
2119 : { eCSSKeyword_step_start, NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_START },
2120 : { eCSSKeyword_step_end, NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_END },
2121 : { eCSSKeyword_UNKNOWN, -1 }
2122 : };
2123 :
2124 : const KTableEntry nsCSSProps::kUnicodeBidiKTable[] = {
2125 : { eCSSKeyword_normal, NS_STYLE_UNICODE_BIDI_NORMAL },
2126 : { eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED },
2127 : { eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_BIDI_OVERRIDE },
2128 : { eCSSKeyword_isolate, NS_STYLE_UNICODE_BIDI_ISOLATE },
2129 : { eCSSKeyword_isolate_override, NS_STYLE_UNICODE_BIDI_ISOLATE_OVERRIDE },
2130 : { eCSSKeyword_plaintext, NS_STYLE_UNICODE_BIDI_PLAINTEXT },
2131 : { eCSSKeyword_UNKNOWN, -1 }
2132 : };
2133 :
2134 : const KTableEntry nsCSSProps::kUserFocusKTable[] = {
2135 : { eCSSKeyword_none, uint8_t(StyleUserFocus::None) },
2136 : { eCSSKeyword_normal, uint8_t(StyleUserFocus::Normal) },
2137 : { eCSSKeyword_ignore, uint8_t(StyleUserFocus::Ignore) },
2138 : { eCSSKeyword_select_all, uint8_t(StyleUserFocus::SelectAll) },
2139 : { eCSSKeyword_select_before, uint8_t(StyleUserFocus::SelectBefore) },
2140 : { eCSSKeyword_select_after, uint8_t(StyleUserFocus::SelectAfter) },
2141 : { eCSSKeyword_select_same, uint8_t(StyleUserFocus::SelectSame) },
2142 : { eCSSKeyword_select_menu, uint8_t(StyleUserFocus::SelectMenu) },
2143 : { eCSSKeyword_UNKNOWN, -1 }
2144 : };
2145 :
2146 : const KTableEntry nsCSSProps::kUserInputKTable[] = {
2147 : { eCSSKeyword_none, StyleUserInput::None },
2148 : { eCSSKeyword_enabled, StyleUserInput::Enabled },
2149 : { eCSSKeyword_disabled, StyleUserInput::Disabled },
2150 : { eCSSKeyword_auto, StyleUserInput::Auto },
2151 : { eCSSKeyword_UNKNOWN, -1 }
2152 : };
2153 :
2154 : const KTableEntry nsCSSProps::kUserModifyKTable[] = {
2155 : { eCSSKeyword_read_only, StyleUserModify::ReadOnly },
2156 : { eCSSKeyword_read_write, StyleUserModify::ReadWrite },
2157 : { eCSSKeyword_write_only, StyleUserModify::WriteOnly },
2158 : { eCSSKeyword_UNKNOWN, -1 }
2159 : };
2160 :
2161 : const KTableEntry nsCSSProps::kUserSelectKTable[] = {
2162 : { eCSSKeyword_none, StyleUserSelect::None },
2163 : { eCSSKeyword_auto, StyleUserSelect::Auto },
2164 : { eCSSKeyword_text, StyleUserSelect::Text },
2165 : { eCSSKeyword_element, StyleUserSelect::Element },
2166 : { eCSSKeyword_elements, StyleUserSelect::Elements },
2167 : { eCSSKeyword_all, StyleUserSelect::All },
2168 : { eCSSKeyword_toggle, StyleUserSelect::Toggle },
2169 : { eCSSKeyword_tri_state, StyleUserSelect::TriState },
2170 : { eCSSKeyword__moz_all, StyleUserSelect::MozAll },
2171 : { eCSSKeyword__moz_none, StyleUserSelect::None },
2172 : { eCSSKeyword__moz_text, StyleUserSelect::MozText },
2173 : { eCSSKeyword_UNKNOWN, -1 }
2174 : };
2175 :
2176 : const KTableEntry nsCSSProps::kVerticalAlignKTable[] = {
2177 : { eCSSKeyword_baseline, NS_STYLE_VERTICAL_ALIGN_BASELINE },
2178 : { eCSSKeyword_sub, NS_STYLE_VERTICAL_ALIGN_SUB },
2179 : { eCSSKeyword_super, NS_STYLE_VERTICAL_ALIGN_SUPER },
2180 : { eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP },
2181 : { eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },
2182 : { eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE },
2183 : { eCSSKeyword__moz_middle_with_baseline, NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
2184 : { eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM },
2185 : { eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM },
2186 : { eCSSKeyword_UNKNOWN, -1 }
2187 : };
2188 :
2189 : const KTableEntry nsCSSProps::kVisibilityKTable[] = {
2190 : { eCSSKeyword_visible, NS_STYLE_VISIBILITY_VISIBLE },
2191 : { eCSSKeyword_hidden, NS_STYLE_VISIBILITY_HIDDEN },
2192 : { eCSSKeyword_collapse, NS_STYLE_VISIBILITY_COLLAPSE },
2193 : { eCSSKeyword_UNKNOWN, -1 }
2194 : };
2195 :
2196 : const KTableEntry nsCSSProps::kWhitespaceKTable[] = {
2197 : { eCSSKeyword_normal, StyleWhiteSpace::Normal },
2198 : { eCSSKeyword_pre, StyleWhiteSpace::Pre },
2199 : { eCSSKeyword_nowrap, StyleWhiteSpace::Nowrap },
2200 : { eCSSKeyword_pre_wrap, StyleWhiteSpace::PreWrap },
2201 : { eCSSKeyword_pre_line, StyleWhiteSpace::PreLine },
2202 : { eCSSKeyword__moz_pre_space, StyleWhiteSpace::PreSpace },
2203 : { eCSSKeyword_UNKNOWN, -1 }
2204 : };
2205 :
2206 : const KTableEntry nsCSSProps::kWidthKTable[] = {
2207 : { eCSSKeyword__moz_max_content, NS_STYLE_WIDTH_MAX_CONTENT },
2208 : { eCSSKeyword__moz_min_content, NS_STYLE_WIDTH_MIN_CONTENT },
2209 : { eCSSKeyword__moz_fit_content, NS_STYLE_WIDTH_FIT_CONTENT },
2210 : { eCSSKeyword__moz_available, NS_STYLE_WIDTH_AVAILABLE },
2211 : { eCSSKeyword_UNKNOWN, -1 }
2212 : };
2213 :
2214 : const KTableEntry nsCSSProps::kWindowDraggingKTable[] = {
2215 : { eCSSKeyword_default, StyleWindowDragging::Default },
2216 : { eCSSKeyword_drag, StyleWindowDragging::Drag },
2217 : { eCSSKeyword_no_drag, StyleWindowDragging::NoDrag },
2218 : { eCSSKeyword_UNKNOWN, -1 }
2219 : };
2220 :
2221 : const KTableEntry nsCSSProps::kWindowShadowKTable[] = {
2222 : { eCSSKeyword_none, NS_STYLE_WINDOW_SHADOW_NONE },
2223 : { eCSSKeyword_default, NS_STYLE_WINDOW_SHADOW_DEFAULT },
2224 : { eCSSKeyword_menu, NS_STYLE_WINDOW_SHADOW_MENU },
2225 : { eCSSKeyword_tooltip, NS_STYLE_WINDOW_SHADOW_TOOLTIP },
2226 : { eCSSKeyword_sheet, NS_STYLE_WINDOW_SHADOW_SHEET },
2227 : { eCSSKeyword_UNKNOWN, -1 }
2228 : };
2229 :
2230 : const KTableEntry nsCSSProps::kWordBreakKTable[] = {
2231 : { eCSSKeyword_normal, NS_STYLE_WORDBREAK_NORMAL },
2232 : { eCSSKeyword_break_all, NS_STYLE_WORDBREAK_BREAK_ALL },
2233 : { eCSSKeyword_keep_all, NS_STYLE_WORDBREAK_KEEP_ALL },
2234 : { eCSSKeyword_UNKNOWN, -1 }
2235 : };
2236 :
2237 : const KTableEntry nsCSSProps::kOverflowWrapKTable[] = {
2238 : { eCSSKeyword_normal, NS_STYLE_OVERFLOWWRAP_NORMAL },
2239 : { eCSSKeyword_break_word, NS_STYLE_OVERFLOWWRAP_BREAK_WORD },
2240 : { eCSSKeyword_UNKNOWN, -1 }
2241 : };
2242 :
2243 : const KTableEntry nsCSSProps::kWritingModeKTable[] = {
2244 : { eCSSKeyword_horizontal_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB },
2245 : { eCSSKeyword_vertical_lr, NS_STYLE_WRITING_MODE_VERTICAL_LR },
2246 : { eCSSKeyword_vertical_rl, NS_STYLE_WRITING_MODE_VERTICAL_RL },
2247 : { eCSSKeyword_sideways_lr, NS_STYLE_WRITING_MODE_SIDEWAYS_LR },
2248 : { eCSSKeyword_sideways_rl, NS_STYLE_WRITING_MODE_SIDEWAYS_RL },
2249 : { eCSSKeyword_lr, NS_STYLE_WRITING_MODE_HORIZONTAL_TB },
2250 : { eCSSKeyword_lr_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB },
2251 : { eCSSKeyword_rl, NS_STYLE_WRITING_MODE_HORIZONTAL_TB },
2252 : { eCSSKeyword_rl_tb, NS_STYLE_WRITING_MODE_HORIZONTAL_TB },
2253 : { eCSSKeyword_tb, NS_STYLE_WRITING_MODE_VERTICAL_RL },
2254 : { eCSSKeyword_tb_rl, NS_STYLE_WRITING_MODE_VERTICAL_RL },
2255 : { eCSSKeyword_UNKNOWN, -1 }
2256 : };
2257 :
2258 : // Specific keyword tables for XUL.properties
2259 : const KTableEntry nsCSSProps::kBoxAlignKTable[] = {
2260 : { eCSSKeyword_stretch, StyleBoxAlign::Stretch },
2261 : { eCSSKeyword_start, StyleBoxAlign::Start },
2262 : { eCSSKeyword_center, StyleBoxAlign::Center },
2263 : { eCSSKeyword_baseline, StyleBoxAlign::Baseline },
2264 : { eCSSKeyword_end, StyleBoxAlign::End },
2265 : { eCSSKeyword_UNKNOWN, -1 }
2266 : };
2267 :
2268 : const KTableEntry nsCSSProps::kBoxDirectionKTable[] = {
2269 : { eCSSKeyword_normal, StyleBoxDirection::Normal },
2270 : { eCSSKeyword_reverse, StyleBoxDirection::Reverse },
2271 : { eCSSKeyword_UNKNOWN, -1 }
2272 : };
2273 :
2274 : const KTableEntry nsCSSProps::kBoxOrientKTable[] = {
2275 : { eCSSKeyword_horizontal, StyleBoxOrient::Horizontal },
2276 : { eCSSKeyword_vertical, StyleBoxOrient::Vertical },
2277 : { eCSSKeyword_inline_axis, StyleBoxOrient::Horizontal },
2278 : { eCSSKeyword_block_axis, StyleBoxOrient::Vertical },
2279 : { eCSSKeyword_UNKNOWN, -1 }
2280 : };
2281 :
2282 : const KTableEntry nsCSSProps::kBoxPackKTable[] = {
2283 : { eCSSKeyword_start, StyleBoxPack::Start },
2284 : { eCSSKeyword_center, StyleBoxPack::Center },
2285 : { eCSSKeyword_end, StyleBoxPack::End },
2286 : { eCSSKeyword_justify, StyleBoxPack::Justify },
2287 : { eCSSKeyword_UNKNOWN, -1 }
2288 : };
2289 :
2290 : // keyword tables for SVG properties
2291 :
2292 : const KTableEntry nsCSSProps::kDominantBaselineKTable[] = {
2293 : { eCSSKeyword_auto, NS_STYLE_DOMINANT_BASELINE_AUTO },
2294 : { eCSSKeyword_use_script, NS_STYLE_DOMINANT_BASELINE_USE_SCRIPT },
2295 : { eCSSKeyword_no_change, NS_STYLE_DOMINANT_BASELINE_NO_CHANGE },
2296 : { eCSSKeyword_reset_size, NS_STYLE_DOMINANT_BASELINE_RESET_SIZE },
2297 : { eCSSKeyword_alphabetic, NS_STYLE_DOMINANT_BASELINE_ALPHABETIC },
2298 : { eCSSKeyword_hanging, NS_STYLE_DOMINANT_BASELINE_HANGING },
2299 : { eCSSKeyword_ideographic, NS_STYLE_DOMINANT_BASELINE_IDEOGRAPHIC },
2300 : { eCSSKeyword_mathematical, NS_STYLE_DOMINANT_BASELINE_MATHEMATICAL },
2301 : { eCSSKeyword_central, NS_STYLE_DOMINANT_BASELINE_CENTRAL },
2302 : { eCSSKeyword_middle, NS_STYLE_DOMINANT_BASELINE_MIDDLE },
2303 : { eCSSKeyword_text_after_edge, NS_STYLE_DOMINANT_BASELINE_TEXT_AFTER_EDGE },
2304 : { eCSSKeyword_text_before_edge, NS_STYLE_DOMINANT_BASELINE_TEXT_BEFORE_EDGE },
2305 : { eCSSKeyword_UNKNOWN, -1 }
2306 : };
2307 :
2308 : const KTableEntry nsCSSProps::kFillRuleKTable[] = {
2309 : { eCSSKeyword_nonzero, StyleFillRule::Nonzero },
2310 : { eCSSKeyword_evenodd, StyleFillRule::Evenodd },
2311 : { eCSSKeyword_UNKNOWN, -1 }
2312 : };
2313 :
2314 : const KTableEntry nsCSSProps::kClipPathGeometryBoxKTable[] = {
2315 : { eCSSKeyword_content_box, StyleGeometryBox::ContentBox },
2316 : { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox },
2317 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
2318 : { eCSSKeyword_margin_box, StyleGeometryBox::MarginBox },
2319 : { eCSSKeyword_fill_box, StyleGeometryBox::FillBox },
2320 : { eCSSKeyword_stroke_box, StyleGeometryBox::StrokeBox },
2321 : { eCSSKeyword_view_box, StyleGeometryBox::ViewBox },
2322 : { eCSSKeyword_UNKNOWN, -1 }
2323 : };
2324 :
2325 : const KTableEntry nsCSSProps::kShapeRadiusKTable[] = {
2326 : { eCSSKeyword_closest_side, StyleShapeRadius::ClosestSide },
2327 : { eCSSKeyword_farthest_side, StyleShapeRadius::FarthestSide },
2328 : { eCSSKeyword_UNKNOWN, -1 }
2329 : };
2330 :
2331 : const KTableEntry nsCSSProps::kFilterFunctionKTable[] = {
2332 : { eCSSKeyword_blur, NS_STYLE_FILTER_BLUR },
2333 : { eCSSKeyword_brightness, NS_STYLE_FILTER_BRIGHTNESS },
2334 : { eCSSKeyword_contrast, NS_STYLE_FILTER_CONTRAST },
2335 : { eCSSKeyword_grayscale, NS_STYLE_FILTER_GRAYSCALE },
2336 : { eCSSKeyword_invert, NS_STYLE_FILTER_INVERT },
2337 : { eCSSKeyword_opacity, NS_STYLE_FILTER_OPACITY },
2338 : { eCSSKeyword_saturate, NS_STYLE_FILTER_SATURATE },
2339 : { eCSSKeyword_sepia, NS_STYLE_FILTER_SEPIA },
2340 : { eCSSKeyword_hue_rotate, NS_STYLE_FILTER_HUE_ROTATE },
2341 : { eCSSKeyword_drop_shadow, NS_STYLE_FILTER_DROP_SHADOW },
2342 : { eCSSKeyword_UNKNOWN, -1 }
2343 : };
2344 :
2345 : const KTableEntry nsCSSProps::kImageRenderingKTable[] = {
2346 : { eCSSKeyword_auto, NS_STYLE_IMAGE_RENDERING_AUTO },
2347 : { eCSSKeyword_optimizespeed, NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED },
2348 : { eCSSKeyword_optimizequality, NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY },
2349 : { eCSSKeyword__moz_crisp_edges, NS_STYLE_IMAGE_RENDERING_CRISPEDGES },
2350 : { eCSSKeyword_UNKNOWN, -1 }
2351 : };
2352 :
2353 : const KTableEntry nsCSSProps::kMaskTypeKTable[] = {
2354 : { eCSSKeyword_luminance, NS_STYLE_MASK_TYPE_LUMINANCE },
2355 : { eCSSKeyword_alpha, NS_STYLE_MASK_TYPE_ALPHA },
2356 : { eCSSKeyword_UNKNOWN, -1 }
2357 : };
2358 :
2359 : const KTableEntry nsCSSProps::kShapeOutsideShapeBoxKTable[] = {
2360 : { eCSSKeyword_content_box, StyleGeometryBox::ContentBox },
2361 : { eCSSKeyword_padding_box, StyleGeometryBox::PaddingBox },
2362 : { eCSSKeyword_border_box, StyleGeometryBox::BorderBox },
2363 : { eCSSKeyword_margin_box, StyleGeometryBox::MarginBox },
2364 : { eCSSKeyword_UNKNOWN, -1 }
2365 : };
2366 :
2367 : const KTableEntry nsCSSProps::kShapeRenderingKTable[] = {
2368 : { eCSSKeyword_auto, NS_STYLE_SHAPE_RENDERING_AUTO },
2369 : { eCSSKeyword_optimizespeed, NS_STYLE_SHAPE_RENDERING_OPTIMIZESPEED },
2370 : { eCSSKeyword_crispedges, NS_STYLE_SHAPE_RENDERING_CRISPEDGES },
2371 : { eCSSKeyword_geometricprecision, NS_STYLE_SHAPE_RENDERING_GEOMETRICPRECISION },
2372 : { eCSSKeyword_UNKNOWN, -1 }
2373 : };
2374 :
2375 : const KTableEntry nsCSSProps::kStrokeLinecapKTable[] = {
2376 : { eCSSKeyword_butt, NS_STYLE_STROKE_LINECAP_BUTT },
2377 : { eCSSKeyword_round, NS_STYLE_STROKE_LINECAP_ROUND },
2378 : { eCSSKeyword_square, NS_STYLE_STROKE_LINECAP_SQUARE },
2379 : { eCSSKeyword_UNKNOWN, -1 }
2380 : };
2381 :
2382 : const KTableEntry nsCSSProps::kStrokeLinejoinKTable[] = {
2383 : { eCSSKeyword_miter, NS_STYLE_STROKE_LINEJOIN_MITER },
2384 : { eCSSKeyword_round, NS_STYLE_STROKE_LINEJOIN_ROUND },
2385 : { eCSSKeyword_bevel, NS_STYLE_STROKE_LINEJOIN_BEVEL },
2386 : { eCSSKeyword_UNKNOWN, -1 }
2387 : };
2388 :
2389 : // Lookup table to store the sole objectValue keyword to let SVG glyphs inherit
2390 : // certain stroke-* properties from the outer text object
2391 : const KTableEntry nsCSSProps::kStrokeContextValueKTable[] = {
2392 : { eCSSKeyword_context_value, NS_STYLE_STROKE_PROP_CONTEXT_VALUE },
2393 : { eCSSKeyword_UNKNOWN, -1 }
2394 : };
2395 :
2396 : const KTableEntry nsCSSProps::kTextAnchorKTable[] = {
2397 : { eCSSKeyword_start, NS_STYLE_TEXT_ANCHOR_START },
2398 : { eCSSKeyword_middle, NS_STYLE_TEXT_ANCHOR_MIDDLE },
2399 : { eCSSKeyword_end, NS_STYLE_TEXT_ANCHOR_END },
2400 : { eCSSKeyword_UNKNOWN, -1 }
2401 : };
2402 :
2403 : const KTableEntry nsCSSProps::kTextRenderingKTable[] = {
2404 : { eCSSKeyword_auto, NS_STYLE_TEXT_RENDERING_AUTO },
2405 : { eCSSKeyword_optimizespeed, NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED },
2406 : { eCSSKeyword_optimizelegibility, NS_STYLE_TEXT_RENDERING_OPTIMIZELEGIBILITY },
2407 : { eCSSKeyword_geometricprecision, NS_STYLE_TEXT_RENDERING_GEOMETRICPRECISION },
2408 : { eCSSKeyword_UNKNOWN, -1 }
2409 : };
2410 :
2411 : const KTableEntry nsCSSProps::kVectorEffectKTable[] = {
2412 : { eCSSKeyword_none, NS_STYLE_VECTOR_EFFECT_NONE },
2413 : { eCSSKeyword_non_scaling_stroke, NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE },
2414 : { eCSSKeyword_UNKNOWN, -1 }
2415 : };
2416 :
2417 : const KTableEntry nsCSSProps::kColorAdjustKTable[] = {
2418 : { eCSSKeyword_economy, NS_STYLE_COLOR_ADJUST_ECONOMY },
2419 : { eCSSKeyword_exact, NS_STYLE_COLOR_ADJUST_EXACT },
2420 : { eCSSKeyword_UNKNOWN, -1 }
2421 : };
2422 :
2423 : const KTableEntry nsCSSProps::kColorInterpolationKTable[] = {
2424 : { eCSSKeyword_auto, NS_STYLE_COLOR_INTERPOLATION_AUTO },
2425 : { eCSSKeyword_srgb, NS_STYLE_COLOR_INTERPOLATION_SRGB },
2426 : { eCSSKeyword_linearrgb, NS_STYLE_COLOR_INTERPOLATION_LINEARRGB },
2427 : { eCSSKeyword_UNKNOWN, -1 }
2428 : };
2429 :
2430 : const KTableEntry nsCSSProps::kColumnFillKTable[] = {
2431 : { eCSSKeyword_auto, NS_STYLE_COLUMN_FILL_AUTO },
2432 : { eCSSKeyword_balance, NS_STYLE_COLUMN_FILL_BALANCE },
2433 : { eCSSKeyword_UNKNOWN, -1 }
2434 : };
2435 :
2436 : const KTableEntry nsCSSProps::kColumnSpanKTable[] = {
2437 : { eCSSKeyword_all, NS_STYLE_COLUMN_SPAN_ALL },
2438 : { eCSSKeyword_none, NS_STYLE_COLUMN_SPAN_NONE },
2439 : { eCSSKeyword_UNKNOWN, -1 }
2440 : };
2441 :
2442 : static inline bool
2443 26503 : IsKeyValSentinel(const KTableEntry& aTableEntry)
2444 : {
2445 26780 : return aTableEntry.mKeyword == eCSSKeyword_UNKNOWN &&
2446 26780 : aTableEntry.mValue == -1;
2447 : }
2448 :
2449 : int32_t
2450 3328 : nsCSSProps::FindIndexOfKeyword(nsCSSKeyword aKeyword,
2451 : const KTableEntry aTable[])
2452 : {
2453 3328 : if (eCSSKeyword_UNKNOWN == aKeyword) {
2454 : // NOTE: we can have keyword tables where eCSSKeyword_UNKNOWN is used
2455 : // not only for the sentinel, but also in the middle of the table to
2456 : // knock out values that have been disabled by prefs, e.g. kDisplayKTable.
2457 : // So we deal with eCSSKeyword_UNKNOWN up front to avoid returning a valid
2458 : // index in the loop below.
2459 54 : return -1;
2460 : }
2461 26474 : for (int32_t i = 0; ; ++i) {
2462 26474 : const KTableEntry& entry = aTable[i];
2463 26474 : if (::IsKeyValSentinel(entry)) {
2464 271 : break;
2465 : }
2466 26203 : if (aKeyword == entry.mKeyword) {
2467 3003 : return i;
2468 : }
2469 23200 : }
2470 271 : return -1;
2471 : }
2472 :
2473 : bool
2474 3292 : nsCSSProps::FindKeyword(nsCSSKeyword aKeyword, const KTableEntry aTable[],
2475 : int32_t& aResult)
2476 : {
2477 3292 : int32_t index = FindIndexOfKeyword(aKeyword, aTable);
2478 3292 : if (index >= 0) {
2479 2967 : aResult = aTable[index].mValue;
2480 2967 : return true;
2481 : }
2482 325 : return false;
2483 : }
2484 :
2485 : nsCSSKeyword
2486 10 : nsCSSProps::ValueToKeywordEnum(int32_t aValue, const KTableEntry aTable[])
2487 : {
2488 : #ifdef DEBUG
2489 : typedef decltype(aTable[0].mValue) table_value_type;
2490 10 : NS_ASSERTION(table_value_type(aValue) == aValue, "Value out of range");
2491 : #endif
2492 29 : for (int32_t i = 0; ; ++i) {
2493 29 : const KTableEntry& entry = aTable[i];
2494 29 : if (::IsKeyValSentinel(entry)) {
2495 0 : break;
2496 : }
2497 29 : if (aValue == entry.mValue) {
2498 10 : return entry.mKeyword;
2499 : }
2500 19 : }
2501 0 : return eCSSKeyword_UNKNOWN;
2502 : }
2503 :
2504 : const nsCString&
2505 0 : nsCSSProps::ValueToKeyword(int32_t aValue, const KTableEntry aTable[])
2506 : {
2507 0 : nsCSSKeyword keyword = ValueToKeywordEnum(aValue, aTable);
2508 0 : if (keyword == eCSSKeyword_UNKNOWN) {
2509 0 : static nsDependentCString sNullStr("");
2510 0 : return sNullStr;
2511 : } else {
2512 0 : return nsCSSKeywords::GetStringValue(keyword);
2513 : }
2514 : }
2515 :
2516 : /* static */ const KTableEntry* const
2517 : nsCSSProps::kKeywordTableTable[eCSSProperty_COUNT_no_shorthands] = {
2518 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
2519 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
2520 : kwtable_,
2521 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
2522 : #include "nsCSSPropList.h"
2523 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
2524 : #undef CSS_PROP
2525 : };
2526 :
2527 : const nsCString&
2528 0 : nsCSSProps::LookupPropertyValue(nsCSSPropertyID aProp, int32_t aValue)
2529 : {
2530 0 : MOZ_ASSERT(aProp >= 0 && aProp < eCSSProperty_COUNT,
2531 : "property out of range");
2532 : #ifdef DEBUG
2533 : typedef decltype(KTableEntry::mValue) table_value_type;
2534 0 : NS_ASSERTION(table_value_type(aValue) == aValue, "Value out of range");
2535 : #endif
2536 :
2537 0 : const KTableEntry* kwtable = nullptr;
2538 0 : if (aProp < eCSSProperty_COUNT_no_shorthands)
2539 0 : kwtable = kKeywordTableTable[aProp];
2540 :
2541 0 : if (kwtable)
2542 0 : return ValueToKeyword(aValue, kwtable);
2543 :
2544 0 : static nsDependentCString sNullStr("");
2545 0 : return sNullStr;
2546 : }
2547 :
2548 0 : bool nsCSSProps::GetColorName(int32_t aPropValue, nsCString &aStr)
2549 : {
2550 0 : bool rv = false;
2551 :
2552 : // first get the keyword corresponding to the property Value from the color table
2553 0 : nsCSSKeyword keyword = ValueToKeywordEnum(aPropValue, kColorKTable);
2554 :
2555 : // next get the name as a string from the keywords table
2556 0 : if (keyword != eCSSKeyword_UNKNOWN) {
2557 0 : nsCSSKeywords::AddRefTable();
2558 0 : aStr = nsCSSKeywords::GetStringValue(keyword);
2559 0 : nsCSSKeywords::ReleaseTable();
2560 0 : rv = true;
2561 : }
2562 0 : return rv;
2563 : }
2564 :
2565 : const nsStyleStructID nsCSSProps::kSIDTable[eCSSProperty_COUNT_no_shorthands] = {
2566 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
2567 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
2568 : eStyleStruct_##stylestruct_,
2569 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
2570 :
2571 : #include "nsCSSPropList.h"
2572 :
2573 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
2574 : #undef CSS_PROP
2575 : };
2576 :
2577 : const nsStyleAnimType
2578 : nsCSSProps::kAnimTypeTable[eCSSProperty_COUNT_no_shorthands] = {
2579 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
2580 : stylestruct_, stylestructoffset_, animtype_) \
2581 : animtype_,
2582 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
2583 : #include "nsCSSPropList.h"
2584 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
2585 : #undef CSS_PROP
2586 : };
2587 :
2588 : const ptrdiff_t
2589 : nsCSSProps::kStyleStructOffsetTable[eCSSProperty_COUNT_no_shorthands] = {
2590 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
2591 : stylestruct_, stylestructoffset_, animtype_) \
2592 : stylestructoffset_,
2593 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
2594 : #include "nsCSSPropList.h"
2595 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
2596 : #undef CSS_PROP
2597 : };
2598 :
2599 : const uint32_t nsCSSProps::kFlagsTable[eCSSProperty_COUNT] = {
2600 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
2601 : stylestruct_, stylestructoffset_, animtype_) \
2602 : flags_,
2603 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
2604 : #include "nsCSSPropList.h"
2605 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
2606 : #undef CSS_PROP
2607 : #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) flags_,
2608 : #include "nsCSSPropList.h"
2609 : #undef CSS_PROP_SHORTHAND
2610 : };
2611 :
2612 : static const nsCSSPropertyID gAllSubpropTable[] = {
2613 : #define CSS_PROP_LIST_ONLY_COMPONENTS_OF_ALL_SHORTHAND
2614 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
2615 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
2616 : stylestruct_, stylestructoffset_, animtype_) \
2617 : eCSSProperty_##id_,
2618 : #include "nsCSSPropList.h"
2619 : #undef CSS_PROP
2620 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
2621 : #undef CSS_PROP_LIST_ONLY_COMPONENTS_OF_ALL_SHORTHAND
2622 : eCSSProperty_UNKNOWN
2623 : };
2624 :
2625 : static const nsCSSPropertyID gAnimationSubpropTable[] = {
2626 : eCSSProperty_animation_duration,
2627 : eCSSProperty_animation_timing_function,
2628 : eCSSProperty_animation_delay,
2629 : eCSSProperty_animation_direction,
2630 : eCSSProperty_animation_fill_mode,
2631 : eCSSProperty_animation_iteration_count,
2632 : eCSSProperty_animation_play_state,
2633 : // List animation-name last so we serialize it last, in case it has
2634 : // a value that conflicts with one of the other properties. (See
2635 : // how Declaration::GetValue serializes 'animation'.
2636 : eCSSProperty_animation_name,
2637 : eCSSProperty_UNKNOWN
2638 : };
2639 :
2640 : static const nsCSSPropertyID gBorderRadiusSubpropTable[] = {
2641 : // Code relies on these being in topleft-topright-bottomright-bottomleft
2642 : // order.
2643 : eCSSProperty_border_top_left_radius,
2644 : eCSSProperty_border_top_right_radius,
2645 : eCSSProperty_border_bottom_right_radius,
2646 : eCSSProperty_border_bottom_left_radius,
2647 : eCSSProperty_UNKNOWN
2648 : };
2649 :
2650 : static const nsCSSPropertyID gOutlineRadiusSubpropTable[] = {
2651 : // Code relies on these being in topleft-topright-bottomright-bottomleft
2652 : // order.
2653 : eCSSProperty__moz_outline_radius_topleft,
2654 : eCSSProperty__moz_outline_radius_topright,
2655 : eCSSProperty__moz_outline_radius_bottomright,
2656 : eCSSProperty__moz_outline_radius_bottomleft,
2657 : eCSSProperty_UNKNOWN
2658 : };
2659 :
2660 : static const nsCSSPropertyID gBackgroundSubpropTable[] = {
2661 : eCSSProperty_background_color,
2662 : eCSSProperty_background_image,
2663 : eCSSProperty_background_repeat,
2664 : eCSSProperty_background_attachment,
2665 : eCSSProperty_background_clip,
2666 : eCSSProperty_background_origin,
2667 : eCSSProperty_background_position_x,
2668 : eCSSProperty_background_position_y,
2669 : eCSSProperty_background_size,
2670 : eCSSProperty_UNKNOWN
2671 : };
2672 :
2673 : static const nsCSSPropertyID gBackgroundPositionSubpropTable[] = {
2674 : eCSSProperty_background_position_x,
2675 : eCSSProperty_background_position_y,
2676 : eCSSProperty_UNKNOWN
2677 : };
2678 :
2679 : static const nsCSSPropertyID gBorderSubpropTable[] = {
2680 : eCSSProperty_border_top_width,
2681 : eCSSProperty_border_right_width,
2682 : eCSSProperty_border_bottom_width,
2683 : eCSSProperty_border_left_width,
2684 : eCSSProperty_border_top_style,
2685 : eCSSProperty_border_right_style,
2686 : eCSSProperty_border_bottom_style,
2687 : eCSSProperty_border_left_style,
2688 : eCSSProperty_border_top_color,
2689 : eCSSProperty_border_right_color,
2690 : eCSSProperty_border_bottom_color,
2691 : eCSSProperty_border_left_color,
2692 : eCSSProperty__moz_border_top_colors,
2693 : eCSSProperty__moz_border_right_colors,
2694 : eCSSProperty__moz_border_bottom_colors,
2695 : eCSSProperty__moz_border_left_colors,
2696 : eCSSProperty_border_image_source,
2697 : eCSSProperty_border_image_slice,
2698 : eCSSProperty_border_image_width,
2699 : eCSSProperty_border_image_outset,
2700 : eCSSProperty_border_image_repeat,
2701 : eCSSProperty_UNKNOWN
2702 : };
2703 :
2704 : static const nsCSSPropertyID gBorderBlockEndSubpropTable[] = {
2705 : // Declaration.cpp outputs the subproperties in this order.
2706 : // It also depends on the color being third.
2707 : eCSSProperty_border_block_end_width,
2708 : eCSSProperty_border_block_end_style,
2709 : eCSSProperty_border_block_end_color,
2710 : eCSSProperty_UNKNOWN
2711 : };
2712 :
2713 : static const nsCSSPropertyID gBorderBlockStartSubpropTable[] = {
2714 : // Declaration.cpp outputs the subproperties in this order.
2715 : // It also depends on the color being third.
2716 : eCSSProperty_border_block_start_width,
2717 : eCSSProperty_border_block_start_style,
2718 : eCSSProperty_border_block_start_color,
2719 : eCSSProperty_UNKNOWN
2720 : };
2721 :
2722 : static const nsCSSPropertyID gBorderBottomSubpropTable[] = {
2723 : // Declaration.cpp outputs the subproperties in this order.
2724 : // It also depends on the color being third.
2725 : eCSSProperty_border_bottom_width,
2726 : eCSSProperty_border_bottom_style,
2727 : eCSSProperty_border_bottom_color,
2728 : eCSSProperty_UNKNOWN
2729 : };
2730 :
2731 : static_assert(eSideTop == 0 && eSideRight == 1 &&
2732 : eSideBottom == 2 && eSideLeft == 3,
2733 : "box side constants not top/right/bottom/left == 0/1/2/3");
2734 : static const nsCSSPropertyID gBorderColorSubpropTable[] = {
2735 : // Code relies on these being in top-right-bottom-left order.
2736 : // Code relies on these matching the enum Side constants.
2737 : eCSSProperty_border_top_color,
2738 : eCSSProperty_border_right_color,
2739 : eCSSProperty_border_bottom_color,
2740 : eCSSProperty_border_left_color,
2741 : eCSSProperty_UNKNOWN
2742 : };
2743 :
2744 : static const nsCSSPropertyID gBorderInlineEndSubpropTable[] = {
2745 : // Declaration.cpp output the subproperties in this order.
2746 : // It also depends on the color being third.
2747 : eCSSProperty_border_inline_end_width,
2748 : eCSSProperty_border_inline_end_style,
2749 : eCSSProperty_border_inline_end_color,
2750 : eCSSProperty_UNKNOWN
2751 : };
2752 :
2753 : static const nsCSSPropertyID gBorderLeftSubpropTable[] = {
2754 : // Declaration.cpp outputs the subproperties in this order.
2755 : // It also depends on the color being third.
2756 : eCSSProperty_border_left_width,
2757 : eCSSProperty_border_left_style,
2758 : eCSSProperty_border_left_color,
2759 : eCSSProperty_UNKNOWN
2760 : };
2761 :
2762 : static const nsCSSPropertyID gBorderRightSubpropTable[] = {
2763 : // Declaration.cpp outputs the subproperties in this order.
2764 : // It also depends on the color being third.
2765 : eCSSProperty_border_right_width,
2766 : eCSSProperty_border_right_style,
2767 : eCSSProperty_border_right_color,
2768 : eCSSProperty_UNKNOWN
2769 : };
2770 :
2771 : static const nsCSSPropertyID gBorderInlineStartSubpropTable[] = {
2772 : // Declaration.cpp outputs the subproperties in this order.
2773 : // It also depends on the color being third.
2774 : eCSSProperty_border_inline_start_width,
2775 : eCSSProperty_border_inline_start_style,
2776 : eCSSProperty_border_inline_start_color,
2777 : eCSSProperty_UNKNOWN
2778 : };
2779 :
2780 : static const nsCSSPropertyID gBorderStyleSubpropTable[] = {
2781 : // Code relies on these being in top-right-bottom-left order.
2782 : eCSSProperty_border_top_style,
2783 : eCSSProperty_border_right_style,
2784 : eCSSProperty_border_bottom_style,
2785 : eCSSProperty_border_left_style,
2786 : eCSSProperty_UNKNOWN
2787 : };
2788 :
2789 : static const nsCSSPropertyID gBorderTopSubpropTable[] = {
2790 : // Declaration.cpp outputs the subproperties in this order.
2791 : // It also depends on the color being third.
2792 : eCSSProperty_border_top_width,
2793 : eCSSProperty_border_top_style,
2794 : eCSSProperty_border_top_color,
2795 : eCSSProperty_UNKNOWN
2796 : };
2797 :
2798 : static const nsCSSPropertyID gBorderWidthSubpropTable[] = {
2799 : // Code relies on these being in top-right-bottom-left order.
2800 : eCSSProperty_border_top_width,
2801 : eCSSProperty_border_right_width,
2802 : eCSSProperty_border_bottom_width,
2803 : eCSSProperty_border_left_width,
2804 : eCSSProperty_UNKNOWN
2805 : };
2806 :
2807 : static const nsCSSPropertyID gFontSubpropTable[] = {
2808 : eCSSProperty_font_family,
2809 : eCSSProperty_font_style,
2810 : eCSSProperty_font_weight,
2811 : eCSSProperty_font_size,
2812 : eCSSProperty_line_height,
2813 : eCSSProperty_font_size_adjust,
2814 : eCSSProperty_font_stretch,
2815 : eCSSProperty__x_system_font,
2816 : eCSSProperty_font_feature_settings,
2817 : eCSSProperty_font_language_override,
2818 : eCSSProperty_font_kerning,
2819 : eCSSProperty_font_variant_alternates,
2820 : eCSSProperty_font_variant_caps,
2821 : eCSSProperty_font_variant_east_asian,
2822 : eCSSProperty_font_variant_ligatures,
2823 : eCSSProperty_font_variant_numeric,
2824 : eCSSProperty_font_variant_position,
2825 : eCSSProperty_UNKNOWN
2826 : };
2827 :
2828 : static const nsCSSPropertyID gFontVariantSubpropTable[] = {
2829 : eCSSProperty_font_variant_alternates,
2830 : eCSSProperty_font_variant_caps,
2831 : eCSSProperty_font_variant_east_asian,
2832 : eCSSProperty_font_variant_ligatures,
2833 : eCSSProperty_font_variant_numeric,
2834 : eCSSProperty_font_variant_position,
2835 : eCSSProperty_UNKNOWN
2836 : };
2837 :
2838 : static const nsCSSPropertyID gListStyleSubpropTable[] = {
2839 : eCSSProperty_list_style_type,
2840 : eCSSProperty_list_style_image,
2841 : eCSSProperty_list_style_position,
2842 : eCSSProperty_UNKNOWN
2843 : };
2844 :
2845 : static const nsCSSPropertyID gMarginSubpropTable[] = {
2846 : // Code relies on these being in top-right-bottom-left order.
2847 : eCSSProperty_margin_top,
2848 : eCSSProperty_margin_right,
2849 : eCSSProperty_margin_bottom,
2850 : eCSSProperty_margin_left,
2851 : eCSSProperty_UNKNOWN
2852 : };
2853 :
2854 :
2855 : static const nsCSSPropertyID gOutlineSubpropTable[] = {
2856 : // nsCSSDeclaration.cpp outputs the subproperties in this order.
2857 : // It also depends on the color being third.
2858 : eCSSProperty_outline_width,
2859 : eCSSProperty_outline_style,
2860 : eCSSProperty_outline_color,
2861 : eCSSProperty_UNKNOWN
2862 : };
2863 :
2864 : static const nsCSSPropertyID gColumnsSubpropTable[] = {
2865 : eCSSProperty_column_count,
2866 : eCSSProperty_column_width,
2867 : eCSSProperty_UNKNOWN
2868 : };
2869 :
2870 : static const nsCSSPropertyID gColumnRuleSubpropTable[] = {
2871 : // nsCSSDeclaration.cpp outputs the subproperties in this order.
2872 : // It also depends on the color being third.
2873 : eCSSProperty_column_rule_width,
2874 : eCSSProperty_column_rule_style,
2875 : eCSSProperty_column_rule_color,
2876 : eCSSProperty_UNKNOWN
2877 : };
2878 :
2879 : static const nsCSSPropertyID gFlexSubpropTable[] = {
2880 : eCSSProperty_flex_grow,
2881 : eCSSProperty_flex_shrink,
2882 : eCSSProperty_flex_basis,
2883 : eCSSProperty_UNKNOWN
2884 : };
2885 :
2886 : static const nsCSSPropertyID gFlexFlowSubpropTable[] = {
2887 : eCSSProperty_flex_direction,
2888 : eCSSProperty_flex_wrap,
2889 : eCSSProperty_UNKNOWN
2890 : };
2891 :
2892 : static const nsCSSPropertyID gGridTemplateSubpropTable[] = {
2893 : eCSSProperty_grid_template_areas,
2894 : eCSSProperty_grid_template_rows,
2895 : eCSSProperty_grid_template_columns,
2896 : eCSSProperty_UNKNOWN
2897 : };
2898 :
2899 : static const nsCSSPropertyID gGridSubpropTable[] = {
2900 : eCSSProperty_grid_template_areas,
2901 : eCSSProperty_grid_template_rows,
2902 : eCSSProperty_grid_template_columns,
2903 : eCSSProperty_grid_auto_flow,
2904 : eCSSProperty_grid_auto_rows,
2905 : eCSSProperty_grid_auto_columns,
2906 : eCSSProperty_grid_row_gap, // can only be reset, not get/set
2907 : eCSSProperty_grid_column_gap, // can only be reset, not get/set
2908 : eCSSProperty_UNKNOWN
2909 : };
2910 :
2911 : static const nsCSSPropertyID gGridColumnSubpropTable[] = {
2912 : eCSSProperty_grid_column_start,
2913 : eCSSProperty_grid_column_end,
2914 : eCSSProperty_UNKNOWN
2915 : };
2916 :
2917 : static const nsCSSPropertyID gGridRowSubpropTable[] = {
2918 : eCSSProperty_grid_row_start,
2919 : eCSSProperty_grid_row_end,
2920 : eCSSProperty_UNKNOWN
2921 : };
2922 :
2923 : static const nsCSSPropertyID gGridAreaSubpropTable[] = {
2924 : eCSSProperty_grid_row_start,
2925 : eCSSProperty_grid_column_start,
2926 : eCSSProperty_grid_row_end,
2927 : eCSSProperty_grid_column_end,
2928 : eCSSProperty_UNKNOWN
2929 : };
2930 :
2931 : static const nsCSSPropertyID gGridGapSubpropTable[] = {
2932 : eCSSProperty_grid_row_gap,
2933 : eCSSProperty_grid_column_gap,
2934 : eCSSProperty_UNKNOWN
2935 : };
2936 :
2937 : static const nsCSSPropertyID gOverflowSubpropTable[] = {
2938 : eCSSProperty_overflow_x,
2939 : eCSSProperty_overflow_y,
2940 : eCSSProperty_UNKNOWN
2941 : };
2942 :
2943 : static const nsCSSPropertyID gPaddingSubpropTable[] = {
2944 : // Code relies on these being in top-right-bottom-left order.
2945 : eCSSProperty_padding_top,
2946 : eCSSProperty_padding_right,
2947 : eCSSProperty_padding_bottom,
2948 : eCSSProperty_padding_left,
2949 : eCSSProperty_UNKNOWN
2950 : };
2951 :
2952 : static const nsCSSPropertyID gTextDecorationSubpropTable[] = {
2953 : eCSSProperty_text_decoration_color,
2954 : eCSSProperty_text_decoration_line,
2955 : eCSSProperty_text_decoration_style,
2956 : eCSSProperty_UNKNOWN
2957 : };
2958 :
2959 : static const nsCSSPropertyID gTextEmphasisSubpropTable[] = {
2960 : eCSSProperty_text_emphasis_style,
2961 : eCSSProperty_text_emphasis_color,
2962 : eCSSProperty_UNKNOWN
2963 : };
2964 :
2965 : static const nsCSSPropertyID gWebkitTextStrokeSubpropTable[] = {
2966 : eCSSProperty__webkit_text_stroke_width,
2967 : eCSSProperty__webkit_text_stroke_color,
2968 : eCSSProperty_UNKNOWN
2969 : };
2970 :
2971 : static const nsCSSPropertyID gTransitionSubpropTable[] = {
2972 : eCSSProperty_transition_property,
2973 : eCSSProperty_transition_duration,
2974 : eCSSProperty_transition_timing_function,
2975 : eCSSProperty_transition_delay,
2976 : eCSSProperty_UNKNOWN
2977 : };
2978 :
2979 : static const nsCSSPropertyID gBorderImageSubpropTable[] = {
2980 : eCSSProperty_border_image_source,
2981 : eCSSProperty_border_image_slice,
2982 : eCSSProperty_border_image_width,
2983 : eCSSProperty_border_image_outset,
2984 : eCSSProperty_border_image_repeat,
2985 : eCSSProperty_UNKNOWN
2986 : };
2987 :
2988 : static const nsCSSPropertyID gMarkerSubpropTable[] = {
2989 : eCSSProperty_marker_start,
2990 : eCSSProperty_marker_mid,
2991 : eCSSProperty_marker_end,
2992 : eCSSProperty_UNKNOWN
2993 : };
2994 :
2995 : static const nsCSSPropertyID gPlaceContentSubpropTable[] = {
2996 : eCSSProperty_align_content,
2997 : eCSSProperty_justify_content,
2998 : eCSSProperty_UNKNOWN
2999 : };
3000 :
3001 : static const nsCSSPropertyID gPlaceItemsSubpropTable[] = {
3002 : eCSSProperty_align_items,
3003 : eCSSProperty_justify_items,
3004 : eCSSProperty_UNKNOWN
3005 : };
3006 :
3007 : static const nsCSSPropertyID gPlaceSelfSubpropTable[] = {
3008 : eCSSProperty_align_self,
3009 : eCSSProperty_justify_self,
3010 : eCSSProperty_UNKNOWN
3011 : };
3012 :
3013 : // Subproperty tables for shorthands that are just aliases with
3014 : // different parsing rules.
3015 : static const nsCSSPropertyID gMozTransformSubpropTable[] = {
3016 : eCSSProperty_transform,
3017 : eCSSProperty_UNKNOWN
3018 : };
3019 :
3020 : static const nsCSSPropertyID gScrollSnapTypeSubpropTable[] = {
3021 : eCSSProperty_scroll_snap_type_x,
3022 : eCSSProperty_scroll_snap_type_y,
3023 : eCSSProperty_UNKNOWN
3024 : };
3025 : #ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
3026 : static const nsCSSPropertyID gMaskSubpropTable[] = {
3027 : eCSSProperty_mask_image,
3028 : eCSSProperty_mask_repeat,
3029 : eCSSProperty_mask_position_x,
3030 : eCSSProperty_mask_position_y,
3031 : eCSSProperty_mask_clip,
3032 : eCSSProperty_mask_origin,
3033 : eCSSProperty_mask_size,
3034 : eCSSProperty_mask_composite,
3035 : eCSSProperty_mask_mode,
3036 : eCSSProperty_UNKNOWN
3037 : };
3038 : static const nsCSSPropertyID gMaskPositionSubpropTable[] = {
3039 : eCSSProperty_mask_position_x,
3040 : eCSSProperty_mask_position_y,
3041 : eCSSProperty_UNKNOWN
3042 : };
3043 : #endif
3044 : // FIXME: mask-border tables should be added when we implement
3045 : // mask-border properties.
3046 :
3047 : const nsCSSPropertyID *const
3048 : nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands] = {
3049 : #define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
3050 : // Need an extra level of macro nesting to force expansion of method_
3051 : // params before they get pasted.
3052 : #define NSCSSPROPS_INNER_MACRO(method_) g##method_##SubpropTable,
3053 : #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
3054 : NSCSSPROPS_INNER_MACRO(method_)
3055 : #include "nsCSSPropList.h"
3056 : #undef CSS_PROP_SHORTHAND
3057 : #undef NSCSSPROPS_INNER_MACRO
3058 : #undef CSS_PROP_PUBLIC_OR_PRIVATE
3059 : };
3060 :
3061 :
3062 : static const nsCSSPropertyID gOffsetLogicalGroupTable[] = {
3063 : eCSSProperty_top,
3064 : eCSSProperty_right,
3065 : eCSSProperty_bottom,
3066 : eCSSProperty_left,
3067 : eCSSProperty_UNKNOWN
3068 : };
3069 :
3070 : static const nsCSSPropertyID gMaxSizeLogicalGroupTable[] = {
3071 : eCSSProperty_max_height,
3072 : eCSSProperty_max_width,
3073 : eCSSProperty_UNKNOWN
3074 : };
3075 :
3076 : static const nsCSSPropertyID gMinSizeLogicalGroupTable[] = {
3077 : eCSSProperty_min_height,
3078 : eCSSProperty_min_width,
3079 : eCSSProperty_UNKNOWN
3080 : };
3081 :
3082 : static const nsCSSPropertyID gSizeLogicalGroupTable[] = {
3083 : eCSSProperty_height,
3084 : eCSSProperty_width,
3085 : eCSSProperty_UNKNOWN
3086 : };
3087 :
3088 : const nsCSSPropertyID* const
3089 : nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = {
3090 : #define CSS_PROP_LOGICAL_GROUP_SHORTHAND(id_) g##id_##SubpropTable,
3091 : #define CSS_PROP_LOGICAL_GROUP_AXIS(name_) g##name_##LogicalGroupTable,
3092 : #define CSS_PROP_LOGICAL_GROUP_BOX(name_) g##name_##LogicalGroupTable,
3093 : #include "nsCSSPropLogicalGroupList.h"
3094 : #undef CSS_PROP_LOGICAL_GROUP_BOX
3095 : #undef CSS_PROP_LOGICAL_GROUP_AXIS
3096 : #undef CSS_PROP_LOGICAL_GROUP_SHORTHAND
3097 : };
3098 :
3099 : // Mapping of logical longhand properties to their logical group (which
3100 : // represents the physical longhands the logical properties an correspond
3101 : // to). The format is pairs of values, where the first is the logical
3102 : // longhand property (an nsCSSPropertyID) and the second is the logical group
3103 : // (an nsCSSPropertyLogicalGroup), stored in a flat array (like KTableEntry
3104 : // arrays).
3105 : static const int gLogicalGroupMappingTable[] = {
3106 : #define CSS_PROP_LOGICAL(name_, id_, method_, flags_, pref_, parsevariant_, \
3107 : kwtable_, group_, stylestruct_, \
3108 : stylestructoffset_, animtype_) \
3109 : eCSSProperty_##id_, eCSSPropertyLogicalGroup_##group_,
3110 : #include "nsCSSPropList.h"
3111 : #undef CSS_PROP_LOGICAL
3112 : };
3113 :
3114 : /* static */ const nsCSSPropertyID*
3115 202 : nsCSSProps::LogicalGroup(nsCSSPropertyID aProperty)
3116 : {
3117 202 : MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands,
3118 : "out of range");
3119 202 : MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_LOGICAL),
3120 : "aProperty must be a logical longhand property");
3121 :
3122 3901 : for (size_t i = 0; i < ArrayLength(gLogicalGroupMappingTable); i += 2) {
3123 3901 : if (gLogicalGroupMappingTable[i] == aProperty) {
3124 202 : return kLogicalGroupTable[gLogicalGroupMappingTable[i + 1]];
3125 : }
3126 : }
3127 :
3128 0 : MOZ_ASSERT(false, "missing gLogicalGroupMappingTable entry");
3129 : return nullptr;
3130 : }
3131 :
3132 :
3133 : #define ENUM_DATA_FOR_PROPERTY(name_, id_, method_, flags_, pref_, \
3134 : parsevariant_, kwtable_, stylestructoffset_, \
3135 : animtype_) \
3136 : ePropertyIndex_for_##id_,
3137 :
3138 : // The order of these enums must match the g*Flags arrays in nsRuleNode.cpp.
3139 :
3140 : enum FontCheckCounter {
3141 : #define CSS_PROP_FONT ENUM_DATA_FOR_PROPERTY
3142 : #include "nsCSSPropList.h"
3143 : #undef CSS_PROP_FONT
3144 : ePropertyCount_for_Font
3145 : };
3146 :
3147 : enum DisplayCheckCounter {
3148 : #define CSS_PROP_DISPLAY ENUM_DATA_FOR_PROPERTY
3149 : #include "nsCSSPropList.h"
3150 : #undef CSS_PROP_DISPLAY
3151 : ePropertyCount_for_Display
3152 : };
3153 :
3154 : enum VisibilityCheckCounter {
3155 : #define CSS_PROP_VISIBILITY ENUM_DATA_FOR_PROPERTY
3156 : #include "nsCSSPropList.h"
3157 : #undef CSS_PROP_VISIBILITY
3158 : ePropertyCount_for_Visibility
3159 : };
3160 :
3161 : enum MarginCheckCounter {
3162 : #define CSS_PROP_MARGIN ENUM_DATA_FOR_PROPERTY
3163 : #include "nsCSSPropList.h"
3164 : #undef CSS_PROP_MARGIN
3165 : ePropertyCount_for_Margin
3166 : };
3167 :
3168 : enum BorderCheckCounter {
3169 : #define CSS_PROP_BORDER ENUM_DATA_FOR_PROPERTY
3170 : #include "nsCSSPropList.h"
3171 : #undef CSS_PROP_BORDER
3172 : ePropertyCount_for_Border
3173 : };
3174 :
3175 : enum PaddingCheckCounter {
3176 : #define CSS_PROP_PADDING ENUM_DATA_FOR_PROPERTY
3177 : #include "nsCSSPropList.h"
3178 : #undef CSS_PROP_PADDING
3179 : ePropertyCount_for_Padding
3180 : };
3181 :
3182 : enum OutlineCheckCounter {
3183 : #define CSS_PROP_OUTLINE ENUM_DATA_FOR_PROPERTY
3184 : #include "nsCSSPropList.h"
3185 : #undef CSS_PROP_OUTLINE
3186 : ePropertyCount_for_Outline
3187 : };
3188 :
3189 : enum ListCheckCounter {
3190 : #define CSS_PROP_LIST ENUM_DATA_FOR_PROPERTY
3191 : #include "nsCSSPropList.h"
3192 : #undef CSS_PROP_LIST
3193 : ePropertyCount_for_List
3194 : };
3195 :
3196 : enum ColorCheckCounter {
3197 : #define CSS_PROP_COLOR ENUM_DATA_FOR_PROPERTY
3198 : #include "nsCSSPropList.h"
3199 : #undef CSS_PROP_COLOR
3200 : ePropertyCount_for_Color
3201 : };
3202 :
3203 : enum BackgroundCheckCounter {
3204 : #define CSS_PROP_BACKGROUND ENUM_DATA_FOR_PROPERTY
3205 : #include "nsCSSPropList.h"
3206 : #undef CSS_PROP_BACKGROUND
3207 : ePropertyCount_for_Background
3208 : };
3209 :
3210 : enum PositionCheckCounter {
3211 : #define CSS_PROP_POSITION ENUM_DATA_FOR_PROPERTY
3212 : #include "nsCSSPropList.h"
3213 : #undef CSS_PROP_POSITION
3214 : ePropertyCount_for_Position
3215 : };
3216 :
3217 : enum TableCheckCounter {
3218 : #define CSS_PROP_TABLE ENUM_DATA_FOR_PROPERTY
3219 : #include "nsCSSPropList.h"
3220 : #undef CSS_PROP_TABLE
3221 : ePropertyCount_for_Table
3222 : };
3223 :
3224 : enum TableBorderCheckCounter {
3225 : #define CSS_PROP_TABLEBORDER ENUM_DATA_FOR_PROPERTY
3226 : #include "nsCSSPropList.h"
3227 : #undef CSS_PROP_TABLEBORDER
3228 : ePropertyCount_for_TableBorder
3229 : };
3230 :
3231 : enum ContentCheckCounter {
3232 : #define CSS_PROP_CONTENT ENUM_DATA_FOR_PROPERTY
3233 : #include "nsCSSPropList.h"
3234 : #undef CSS_PROP_CONTENT
3235 : ePropertyCount_for_Content
3236 : };
3237 :
3238 : enum TextCheckCounter {
3239 : #define CSS_PROP_TEXT ENUM_DATA_FOR_PROPERTY
3240 : #include "nsCSSPropList.h"
3241 : #undef CSS_PROP_TEXT
3242 : ePropertyCount_for_Text
3243 : };
3244 :
3245 : enum TextResetCheckCounter {
3246 : #define CSS_PROP_TEXTRESET ENUM_DATA_FOR_PROPERTY
3247 : #include "nsCSSPropList.h"
3248 : #undef CSS_PROP_TEXTRESET
3249 : ePropertyCount_for_TextReset
3250 : };
3251 :
3252 : enum UserInterfaceCheckCounter {
3253 : #define CSS_PROP_USERINTERFACE ENUM_DATA_FOR_PROPERTY
3254 : #include "nsCSSPropList.h"
3255 : #undef CSS_PROP_USERINTERFACE
3256 : ePropertyCount_for_UserInterface
3257 : };
3258 :
3259 : enum UIResetCheckCounter {
3260 : #define CSS_PROP_UIRESET ENUM_DATA_FOR_PROPERTY
3261 : #include "nsCSSPropList.h"
3262 : #undef CSS_PROP_UIRESET
3263 : ePropertyCount_for_UIReset
3264 : };
3265 :
3266 : enum XULCheckCounter {
3267 : #define CSS_PROP_XUL ENUM_DATA_FOR_PROPERTY
3268 : #include "nsCSSPropList.h"
3269 : #undef CSS_PROP_XUL
3270 : ePropertyCount_for_XUL
3271 : };
3272 :
3273 : enum SVGCheckCounter {
3274 : #define CSS_PROP_SVG ENUM_DATA_FOR_PROPERTY
3275 : #include "nsCSSPropList.h"
3276 : #undef CSS_PROP_SVG
3277 : ePropertyCount_for_SVG
3278 : };
3279 :
3280 : enum SVGResetCheckCounter {
3281 : #define CSS_PROP_SVGRESET ENUM_DATA_FOR_PROPERTY
3282 : #include "nsCSSPropList.h"
3283 : #undef CSS_PROP_SVGRESET
3284 : ePropertyCount_for_SVGReset
3285 : };
3286 :
3287 : enum ColumnCheckCounter {
3288 : #define CSS_PROP_COLUMN ENUM_DATA_FOR_PROPERTY
3289 : #include "nsCSSPropList.h"
3290 : #undef CSS_PROP_COLUMN
3291 : ePropertyCount_for_Column
3292 : };
3293 :
3294 : enum VariablesCheckCounter {
3295 : #define CSS_PROP_VARIABLES ENUM_DATA_FOR_PROPERTY
3296 : #include "nsCSSPropList.h"
3297 : #undef CSS_PROP_VARIABLES
3298 : ePropertyCount_for_Variables
3299 : };
3300 :
3301 : enum EffectsCheckCounter {
3302 : #define CSS_PROP_EFFECTS ENUM_DATA_FOR_PROPERTY
3303 : #include "nsCSSPropList.h"
3304 : #undef CSS_PROP_EFFECTS
3305 : ePropertyCount_for_Effects
3306 : };
3307 :
3308 : #undef ENUM_DATA_FOR_PROPERTY
3309 :
3310 : /* static */ const size_t
3311 : nsCSSProps::gPropertyCountInStruct[nsStyleStructID_Length] = {
3312 : #define STYLE_STRUCT(name, checkdata_cb) \
3313 : ePropertyCount_for_##name,
3314 : #include "nsStyleStructList.h"
3315 : #undef STYLE_STRUCT
3316 : };
3317 :
3318 : /* static */ const size_t
3319 : nsCSSProps::gPropertyIndexInStruct[eCSSProperty_COUNT_no_shorthands] = {
3320 :
3321 : #define CSS_PROP_LOGICAL(name_, id_, method_, flags_, pref_, parsevariant_, \
3322 : kwtable_, group_, stylestruct_, \
3323 : stylestructoffset_, animtype_) \
3324 : size_t(-1),
3325 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
3326 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
3327 : ePropertyIndex_for_##id_,
3328 : #include "nsCSSPropList.h"
3329 : #undef CSS_PROP
3330 : #undef CSS_PROP_LOGICAL
3331 :
3332 : };
3333 :
3334 : /* static */ bool
3335 : nsCSSProps::gPropertyEnabled[eCSSProperty_COUNT_with_aliases] = {
3336 : // If the property has any "ENABLED_IN" flag set, it is disabled by
3337 : // default. Note that, if a property has pref, whatever its default
3338 : // value is, it will later be changed in nsCSSProps::AddRefTable().
3339 : // If the property has "ENABLED_IN" flags but doesn't have a pref,
3340 : // it is an internal property which is disabled elsewhere.
3341 : #define IS_ENABLED_BY_DEFAULT(flags_) \
3342 : (!((flags_) & CSS_PROPERTY_ENABLED_MASK))
3343 :
3344 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
3345 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
3346 : IS_ENABLED_BY_DEFAULT(flags_),
3347 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
3348 : #include "nsCSSPropList.h"
3349 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
3350 : #undef CSS_PROP
3351 :
3352 : #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
3353 : IS_ENABLED_BY_DEFAULT(flags_),
3354 : #include "nsCSSPropList.h"
3355 : #undef CSS_PROP_SHORTHAND
3356 :
3357 : #define CSS_PROP_ALIAS(aliasname_, propid_, aliasmethod_, pref_) \
3358 : true,
3359 : #include "nsCSSPropAliasList.h"
3360 : #undef CSS_PROP_ALIAS
3361 :
3362 : #undef IS_ENABLED_BY_DEFAULT
3363 : };
3364 :
3365 : #include "../../dom/base/PropertyUseCounterMap.inc"
3366 :
3367 : /* static */ const UseCounter
3368 : nsCSSProps::gPropertyUseCounter[eCSSProperty_COUNT_no_shorthands] = {
3369 : #define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
3370 : #define CSS_PROP_LIST_INCLUDE_LOGICAL
3371 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
3372 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
3373 : static_cast<UseCounter>(USE_COUNTER_FOR_CSS_PROPERTY_##method_),
3374 : #include "nsCSSPropList.h"
3375 : #undef CSS_PROP
3376 : #undef CSS_PROP_LIST_INCLUDE_LOGICAL
3377 : #undef CSS_PROP_PUBLIC_OR_PRIVATE
3378 : };
3379 :
3380 : // Check that all logical property flags are used appropriately.
3381 : #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
3382 : kwtable_, stylestruct_, stylestructoffset_, animtype_) \
3383 : static_assert(!((flags_) & CSS_PROPERTY_LOGICAL), \
3384 : "only properties defined with CSS_PROP_LOGICAL can use " \
3385 : "the CSS_PROPERTY_LOGICAL flag"); \
3386 : static_assert(!((flags_) & CSS_PROPERTY_LOGICAL_AXIS), \
3387 : "only properties defined with CSS_PROP_LOGICAL can use " \
3388 : "the CSS_PROPERTY_LOGICAL_AXIS flag"); \
3389 : static_assert(!((flags_) & CSS_PROPERTY_LOGICAL_BLOCK_AXIS), \
3390 : "only properties defined with CSS_PROP_LOGICAL can use " \
3391 : "the CSS_PROPERTY_LOGICAL_BLOCK_AXIS flag"); \
3392 : static_assert(!((flags_) & CSS_PROPERTY_LOGICAL_END_EDGE), \
3393 : "only properties defined with CSS_PROP_LOGICAL can use " \
3394 : "the CSS_PROPERTY_LOGICAL_END_EDGE flag");
3395 : #define CSS_PROP_LOGICAL(name_, id_, method_, flags_, pref_, parsevariant_, \
3396 : kwtable_, group_, stylestruct_, \
3397 : stylestructoffset_, animtype_) \
3398 : static_assert((flags_) & CSS_PROPERTY_LOGICAL, \
3399 : "properties defined with CSS_PROP_LOGICAL must also use " \
3400 : "the CSS_PROPERTY_LOGICAL flag"); \
3401 : static_assert(!((flags_) & CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED), \
3402 : "CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED has no effect " \
3403 : "on logical properties"); \
3404 : static_assert(!(((flags_) & CSS_PROPERTY_LOGICAL_AXIS) && \
3405 : ((flags_) & CSS_PROPERTY_LOGICAL_END_EDGE)), \
3406 : "CSS_PROPERTY_LOGICAL_END_EDGE makes no sense when used " \
3407 : "with CSS_PROPERTY_LOGICAL_AXIS");
3408 : #include "nsCSSPropList.h"
3409 : #undef CSS_PROP_LOGICAL
3410 : #undef CSS_PROP
3411 :
3412 : #include "nsCSSPropsGenerated.inc"
|