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