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