nsCSSProps.cpp 136 KB

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