Bug 1883861 - Part 1: Move visitMemoryBarrier into the common CodeGenerator file...
[gecko.git] / layout / style / nsStyleConsts.h
blob99433c9027309d2b89b747cb5816f59b73032b3f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* constants used in the style struct data provided by ComputedStyle */
9 #ifndef nsStyleConsts_h___
10 #define nsStyleConsts_h___
12 #include <inttypes.h>
14 #include "X11UndefineNone.h"
16 #include "gfxFontConstants.h"
17 #include "mozilla/ServoStyleConsts.h"
19 // XXX fold this into ComputedStyle and group by nsStyleXXX struct
21 namespace mozilla {
23 // box-align
24 enum class StyleBoxAlign : uint8_t {
25 Stretch,
26 Start,
27 Center,
28 Baseline,
29 End,
32 // box-decoration-break
33 enum class StyleBoxDecorationBreak : uint8_t {
34 Slice,
35 Clone,
38 // box-direction
39 enum class StyleBoxDirection : uint8_t {
40 Normal,
41 Reverse,
44 // box-orient
45 enum class StyleBoxOrient : uint8_t {
46 Horizontal,
47 Vertical,
50 // box-pack
51 enum class StyleBoxPack : uint8_t {
52 Start,
53 Center,
54 End,
55 Justify,
58 // box-sizing
59 enum class StyleBoxSizing : uint8_t { Content, Border };
61 // box-shadow
62 enum class StyleBoxShadowType : uint8_t {
63 Inset,
66 enum class StyleColumnFill : uint8_t {
67 Balance,
68 Auto,
71 enum class StyleColumnSpan : uint8_t {
72 None,
73 All,
76 // Define geometry box for clip-path's reference-box, background-clip,
77 // background-origin, mask-clip, mask-origin, shape-box and transform-box.
78 enum class StyleGeometryBox : uint8_t {
79 ContentBox, // Used by everything, except transform-box.
80 PaddingBox, // Used by everything, except transform-box.
81 BorderBox,
82 MarginBox, // XXX Bug 1260094 comment 9.
83 // Although margin-box is required by mask-origin and mask-clip,
84 // we do not implement that due to lack of support in other
85 // browsers. clip-path reference-box only.
86 FillBox, // Used by everything, except shape-box.
87 StrokeBox, // mask-clip, mask-origin and clip-path reference-box only.
88 ViewBox, // Used by everything, except shape-box.
89 NoClip, // mask-clip only.
90 Text, // background-clip only.
91 NoBox, // Depending on which kind of element this style value applied on,
92 // the default value of a reference-box can be different.
93 // For an HTML element, the default value of reference-box is
94 // border-box; for an SVG element, the default value is fill-box.
95 // Since we can not determine the default value at parsing time,
96 // set it as NoBox so that we make a decision later.
97 // clip-path reference-box only.
98 MozAlmostPadding = 127 // A magic value that we use for our "pretend that
99 // background-clip is 'padding' when we have a solid
100 // border" optimization. This isn't actually equal
101 // to StyleGeometryBox::Padding because using that
102 // causes antialiasing seams between the background
103 // and border.
104 // background-clip only.
107 // float-edge
108 enum class StyleFloatEdge : uint8_t {
109 ContentBox,
110 MarginBox,
113 // Hyphens
114 enum class StyleHyphens : uint8_t {
115 None,
116 Manual,
117 Auto,
120 // image-orientation
121 enum class StyleImageOrientation : uint8_t {
122 None,
123 FromImage,
126 // scrollbar-width
127 enum class StyleScrollbarWidth : uint8_t {
128 Auto,
129 Thin,
130 None,
133 // Shape source type
134 enum class StyleShapeSourceType : uint8_t {
135 None,
136 Image, // shape-outside / clip-path only, and clip-path only uses it for
137 // <url>s
138 Shape,
139 Box,
140 Path, // SVG path function
143 // user-focus
144 enum class StyleUserFocus : uint8_t {
145 None,
146 Ignore,
147 Normal,
150 // user-input
151 enum class StyleUserInput : uint8_t {
152 None,
153 Auto,
156 // user-modify
157 enum class StyleUserModify : uint8_t {
158 ReadOnly,
159 ReadWrite,
160 WriteOnly,
163 // -moz-inert
164 enum class StyleInert : uint8_t {
165 None,
166 Inert,
169 // -moz-window-dragging
170 enum class StyleWindowDragging : uint8_t {
171 Default,
172 Drag,
173 NoDrag,
176 // orient
177 enum class StyleOrient : uint8_t {
178 Inline,
179 Block,
180 Horizontal,
181 Vertical,
184 // See nsStyleImageLayers
185 enum class StyleImageLayerAttachment : uint8_t { Scroll, Fixed, Local };
187 // See nsStyleImageLayers
188 enum class StyleImageLayerRepeat : uint8_t {
189 NoRepeat = 0x00,
190 RepeatX,
191 RepeatY,
192 Repeat,
193 Space,
194 Round
197 // Mask mode
198 enum class StyleMaskMode : uint8_t { Alpha = 0, Luminance, MatchSource };
200 // See nsStyleTable
201 enum class StyleBorderCollapse : uint8_t { Collapse, Separate };
203 // border-image-repeat
204 enum class StyleBorderImageRepeat : uint8_t { Stretch, Repeat, Round, Space };
206 // See nsStyleVisibility
207 enum class StyleDirection : uint8_t { Ltr, Rtl };
209 // See nsStyleVisibility
210 // NOTE: WritingModes.h depends on the particular values used here.
212 // Single-bit flag, used in combination with VerticalLR and RL to specify
213 // the corresponding Sideways* modes.
214 // (To avoid ambiguity, this bit must be high enough such that no other
215 // values here accidentally use it in their binary representation.)
216 static constexpr uint8_t kWritingModeSidewaysMask = 4;
218 enum class StyleWritingModeProperty : uint8_t {
219 HorizontalTb = 0,
220 VerticalRl = 1,
221 // HorizontalBT = 2, // hypothetical
222 VerticalLr = 3,
223 SidewaysRl = VerticalRl | kWritingModeSidewaysMask,
224 SidewaysLr = VerticalLr | kWritingModeSidewaysMask,
227 // See nsStylePosition
228 enum class StyleFlexDirection : uint8_t {
229 Row,
230 RowReverse,
231 Column,
232 ColumnReverse,
235 // See nsStylePosition
236 enum class StyleFlexWrap : uint8_t {
237 Nowrap,
238 Wrap,
239 WrapReverse,
242 // CSS Grid <track-breadth> keywords
243 enum class StyleGridTrackBreadth : uint8_t {
244 MaxContent = 1,
245 MinContent = 2,
248 // defaults per MathML spec
249 static constexpr float kMathMLDefaultScriptSizeMultiplier{0.71f};
250 static constexpr float kMathMLDefaultScriptMinSizePt{8.f};
252 // See nsStyleFont
253 enum class StyleMathVariant : uint8_t {
254 None = 0,
255 Normal = 1,
256 Bold = 2,
257 Italic = 3,
258 BoldItalic = 4,
259 Script = 5,
260 BoldScript = 6,
261 Fraktur = 7,
262 DoubleStruck = 8,
263 BoldFraktur = 9,
264 SansSerif = 10,
265 BoldSansSerif = 11,
266 SansSerifItalic = 12,
267 SansSerifBoldItalic = 13,
268 Monospace = 14,
269 Initial = 15,
270 Tailed = 16,
271 Looped = 17,
272 Stretched = 18,
275 // See nsStyleFont::mMathStyle
276 enum class StyleMathStyle : uint8_t { Compact = 0, Normal = 1 };
278 // See nsStyleDisplay.mPosition
279 enum class StylePositionProperty : uint8_t {
280 Static,
281 Relative,
282 Absolute,
283 Fixed,
284 Sticky,
287 enum class FrameBorderProperty : uint8_t { Yes, No, One, Zero };
289 enum class ScrollingAttribute : uint8_t {
290 Yes,
293 Off,
294 Scroll,
295 Noscroll,
296 Auto
299 // See nsStyleList
300 enum class ListStyle : uint8_t {
301 Custom = 255, // for @counter-style
302 None = 0,
303 Decimal,
304 Disc,
305 Circle,
306 Square,
307 DisclosureClosed,
308 DisclosureOpen,
309 Hebrew,
310 JapaneseInformal,
311 JapaneseFormal,
312 KoreanHangulFormal,
313 KoreanHanjaInformal,
314 KoreanHanjaFormal,
315 SimpChineseInformal,
316 SimpChineseFormal,
317 TradChineseInformal,
318 TradChineseFormal,
319 EthiopicNumeric,
320 // These styles are handled as custom styles defined in counterstyles.css.
321 // They are preserved here only for html attribute map.
322 LowerRoman = 100,
323 UpperRoman,
324 LowerAlpha,
325 UpperAlpha
328 // See nsStyleList
329 enum class StyleListStylePosition : uint8_t { Inside, Outside };
331 // See nsStyleVisibility
332 enum class StylePointerEvents : uint8_t {
333 None,
334 Visiblepainted,
335 Visiblefill,
336 Visiblestroke,
337 Visible,
338 Painted,
339 Fill,
340 Stroke,
341 All,
342 Auto,
345 enum class StyleIsolation : uint8_t {
346 Auto,
347 Isolate,
350 // See nsStylePosition.mObjectFit
351 enum class StyleObjectFit : uint8_t {
352 Fill,
353 Contain,
354 Cover,
355 None,
356 ScaleDown,
359 // See nsStyleText
360 enum class StyleTextDecorationStyle : uint8_t {
361 None, // not in CSS spec, mapped to -moz-none
362 Dotted,
363 Dashed,
364 Solid,
365 Double,
366 Wavy,
367 Sentinel = Wavy
370 // See nsStyleText
371 enum class StyleTextSecurity : uint8_t {
372 None,
373 Circle,
374 Disc,
375 Square,
378 // See nsStyleDisplay
379 enum class StyleTopLayer : uint8_t {
380 None,
381 Top,
384 // See nsStyleVisibility
385 enum class StyleVisibility : uint8_t {
386 Hidden,
387 Visible,
388 Collapse,
391 // See nsStyleText
392 enum class StyleWhiteSpaceCollapse : uint8_t {
393 Collapse = 0,
394 // TODO: Discard not yet supported
395 Preserve,
396 PreserveBreaks,
397 PreserveSpaces,
398 BreakSpaces,
401 // See nsStyleText
402 enum class StyleTextWrapMode : uint8_t {
403 Wrap = 0,
404 Nowrap,
407 // See nsStyleText
408 // TODO: this will become StyleTextWrapStyle when we turn text-wrap
409 // (see https://bugzilla.mozilla.org/show_bug.cgi?id=1758391) and
410 // white-space (https://bugzilla.mozilla.org/show_bug.cgi?id=1852478)
411 // into shorthands.
412 enum class StyleTextWrapStyle : uint8_t {
413 Auto = 0,
414 Stable,
415 Balance,
418 // ruby-align, see nsStyleText
419 enum class StyleRubyAlign : uint8_t {
420 Start,
421 Center,
422 SpaceBetween,
423 SpaceAround,
426 // See nsStyleText
427 enum class StyleTextSizeAdjust : uint8_t {
428 None,
429 Auto,
432 // See nsStyleVisibility
433 enum class StyleTextOrientation : uint8_t {
434 Mixed,
435 Upright,
436 Sideways,
439 // Whether flexbox visibility: collapse items use legacy -moz-box behavior or
440 // not.
441 enum class StyleMozBoxCollapse : uint8_t {
442 Flex,
443 Legacy,
446 // See nsStyleText
447 enum class StyleTextCombineUpright : uint8_t {
448 None,
449 All,
452 // See nsStyleText
453 enum class StyleUnicodeBidi : uint8_t {
454 Normal,
455 Embed,
456 Isolate,
457 BidiOverride,
458 IsolateOverride,
459 Plaintext
462 enum class StyleTableLayout : uint8_t {
463 Auto,
464 Fixed,
467 enum class StyleEmptyCells : uint8_t {
468 Hide,
469 Show,
472 // See nsStyleUIReset
473 enum class StyleImeMode : uint8_t {
474 Auto,
475 Normal,
476 Active,
477 Disabled,
478 Inactive,
481 // See nsStyleSVG
483 // -moz-window-shadow
484 enum class StyleWindowShadow : uint8_t {
485 Auto,
486 None,
489 // dominant-baseline
490 enum class StyleDominantBaseline : uint8_t {
491 Auto,
492 Ideographic,
493 Alphabetic,
494 Hanging,
495 Mathematical,
496 Central,
497 Middle,
498 TextAfterEdge,
499 TextBeforeEdge,
502 // mask-type
503 enum class StyleMaskType : uint8_t {
504 Luminance,
505 Alpha,
508 // shape-rendering
509 enum class StyleShapeRendering : uint8_t {
510 Auto,
511 Optimizespeed,
512 Crispedges,
513 Geometricprecision,
516 // stroke-linecap
517 enum class StyleStrokeLinecap : uint8_t {
518 Butt,
519 Round,
520 Square,
523 // stroke-linejoin
524 enum class StyleStrokeLinejoin : uint8_t {
525 Miter,
526 Round,
527 Bevel,
530 // text-anchor
531 enum class StyleTextAnchor : uint8_t {
532 Start,
533 Middle,
534 End,
537 // text-rendering
538 enum class StyleTextRendering : uint8_t {
539 Auto,
540 Optimizespeed,
541 Optimizelegibility,
542 Geometricprecision,
545 // color-interpolation and color-interpolation-filters
546 enum class StyleColorInterpolation : uint8_t {
547 Auto = 0,
548 Srgb = 1,
549 Linearrgb = 2,
552 // vector-effect
553 enum class StyleVectorEffect : uint8_t { None = 0, NonScalingStroke = 1 };
555 // 3d Transforms - Backface visibility
556 enum class StyleBackfaceVisibility : uint8_t { Hidden = 0, Visible = 1 };
558 // blending
559 enum class StyleBlend : uint8_t {
560 Normal = 0,
561 Multiply,
562 Screen,
563 Overlay,
564 Darken,
565 Lighten,
566 ColorDodge,
567 ColorBurn,
568 HardLight,
569 SoftLight,
570 Difference,
571 Exclusion,
572 Hue,
573 Saturation,
574 Color,
575 Luminosity,
576 PlusLighter,
579 // composite
580 enum class StyleMaskComposite : uint8_t {
581 Add = 0,
582 Subtract,
583 Intersect,
584 Exclude
587 // scroll-behavior
588 enum class StyleScrollBehavior : uint8_t {
589 Auto,
590 Smooth,
593 } // namespace mozilla
595 #endif /* nsStyleConsts_h___ */