1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 /* constants used in the style struct data provided by ComputedStyle */
8 
9 #ifndef nsStyleConsts_h___
10 #define nsStyleConsts_h___
11 
12 #include <inttypes.h>
13 
14 #include "X11UndefineNone.h"
15 
16 #include "gfxFontConstants.h"
17 #include "mozilla/ServoStyleConsts.h"
18 
19 // XXX fold this into ComputedStyle and group by nsStyleXXX struct
20 
21 namespace mozilla {
22 
23 static constexpr uint16_t STYLE_DISPLAY_LIST_ITEM_BIT = 0x8000;
24 static constexpr uint8_t STYLE_DISPLAY_OUTSIDE_BITS = 7;
25 static constexpr uint8_t STYLE_DISPLAY_INSIDE_BITS = 8;
26 
27 // The `display` longhand.
StyleDisplayFrom(StyleDisplayOutside aOuter,StyleDisplayInside aInner)28 uint16_t constexpr StyleDisplayFrom(StyleDisplayOutside aOuter,
29                                     StyleDisplayInside aInner) {
30   return uint16_t(uint16_t(aOuter) << STYLE_DISPLAY_INSIDE_BITS) |
31          uint16_t(aInner);
32 }
33 
34 enum class StyleDisplay : uint16_t {
35   // These MUST be in sync with the Rust enum values in
36   // servo/components/style/values/specified/box.rs
37   /// https://drafts.csswg.org/css-display/#the-display-properties
38   None = StyleDisplayFrom(StyleDisplayOutside::None, StyleDisplayInside::None),
39   Contents =
40       StyleDisplayFrom(StyleDisplayOutside::None, StyleDisplayInside::Contents),
41   Inline =
42       StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::Flow),
43   Block =
44       StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::Flow),
45   FlowRoot = StyleDisplayFrom(StyleDisplayOutside::Block,
46                               StyleDisplayInside::FlowRoot),
47   Flex = StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::Flex),
48   Grid = StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::Grid),
49   Table =
50       StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::Table),
51   InlineTable =
52       StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::Table),
53   TableCaption = StyleDisplayFrom(StyleDisplayOutside::TableCaption,
54                                   StyleDisplayInside::Flow),
55   Ruby =
56       StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::Ruby),
57   WebkitBox = StyleDisplayFrom(StyleDisplayOutside::Block,
58                                StyleDisplayInside::WebkitBox),
59   WebkitInlineBox = StyleDisplayFrom(StyleDisplayOutside::Inline,
60                                      StyleDisplayInside::WebkitBox),
61   ListItem = Block | STYLE_DISPLAY_LIST_ITEM_BIT,
62 
63   /// Internal table boxes.
64   TableRowGroup = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
65                                    StyleDisplayInside::TableRowGroup),
66   TableHeaderGroup = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
67                                       StyleDisplayInside::TableHeaderGroup),
68   TableFooterGroup = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
69                                       StyleDisplayInside::TableFooterGroup),
70   TableColumn = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
71                                  StyleDisplayInside::TableColumn),
72   TableColumnGroup = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
73                                       StyleDisplayInside::TableColumnGroup),
74   TableRow = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
75                               StyleDisplayInside::TableRow),
76   TableCell = StyleDisplayFrom(StyleDisplayOutside::InternalTable,
77                                StyleDisplayInside::TableCell),
78 
79   /// Internal ruby boxes.
80   RubyBase = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
81                               StyleDisplayInside::RubyBase),
82   RubyBaseContainer = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
83                                        StyleDisplayInside::RubyBaseContainer),
84   RubyText = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
85                               StyleDisplayInside::RubyText),
86   RubyTextContainer = StyleDisplayFrom(StyleDisplayOutside::InternalRuby,
87                                        StyleDisplayInside::RubyTextContainer),
88 
89   /// XUL boxes.
90   MozBox =
91       StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::MozBox),
92   MozInlineBox =
93       StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::MozBox),
94   MozGrid =
95       StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozGrid),
96   MozGridGroup = StyleDisplayFrom(StyleDisplayOutside::XUL,
97                                   StyleDisplayInside::MozGridGroup),
98   MozGridLine = StyleDisplayFrom(StyleDisplayOutside::XUL,
99                                  StyleDisplayInside::MozGridLine),
100   MozStack =
101       StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozStack),
102   MozDeck =
103       StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozDeck),
104   MozPopup =
105       StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozPopup),
106 };
107 // The order of the StyleDisplay values isn't meaningful.
108 bool operator<(const StyleDisplay&, const StyleDisplay&) = delete;
109 bool operator<=(const StyleDisplay&, const StyleDisplay&) = delete;
110 bool operator>(const StyleDisplay&, const StyleDisplay&) = delete;
111 bool operator>=(const StyleDisplay&, const StyleDisplay&) = delete;
112 
113 // Basic shapes
114 enum class StyleBasicShapeType : uint8_t {
115   Polygon,
116   Circle,
117   Ellipse,
118   Inset,
119 };
120 
121 // box-align
122 enum class StyleBoxAlign : uint8_t {
123   Stretch,
124   Start,
125   Center,
126   Baseline,
127   End,
128 };
129 
130 // box-decoration-break
131 enum class StyleBoxDecorationBreak : uint8_t {
132   Slice,
133   Clone,
134 };
135 
136 // box-direction
137 enum class StyleBoxDirection : uint8_t {
138   Normal,
139   Reverse,
140 };
141 
142 // box-orient
143 enum class StyleBoxOrient : uint8_t {
144   Horizontal,
145   Vertical,
146 };
147 
148 // box-pack
149 enum class StyleBoxPack : uint8_t {
150   Start,
151   Center,
152   End,
153   Justify,
154 };
155 
156 // box-sizing
157 enum class StyleBoxSizing : uint8_t { Content, Border };
158 
159 // box-shadow
160 enum class StyleBoxShadowType : uint8_t {
161   Inset,
162 };
163 
164 // clear
165 enum class StyleClear : uint8_t {
166   None = 0,
167   Left,
168   Right,
169   Both,
170   // StyleClear::Line can be added to one of the other values in layout
171   // so it needs to use a bit value that none of the other values can have.
172   //
173   // FIXME(emilio): Doesn't look like we do that anymore, so probably can be
174   // made a single value instead, and Max removed.
175   Line = 8,
176   Max = 13  // Max = (Both | Line)
177 };
178 
179 enum class StyleColumnFill : uint8_t {
180   Balance,
181   Auto,
182 };
183 
184 enum class StyleColumnSpan : uint8_t {
185   None,
186   All,
187 };
188 
189 // Define geometry box for clip-path's reference-box, background-clip,
190 // background-origin, mask-clip, mask-origin, shape-box and transform-box.
191 enum class StyleGeometryBox : uint8_t {
192   ContentBox,  // Used by everything, except transform-box.
193   PaddingBox,  // Used by everything, except transform-box.
194   BorderBox,
195   MarginBox,  // XXX Bug 1260094 comment 9.
196               // Although margin-box is required by mask-origin and mask-clip,
197               // we do not implement that due to lack of support in other
198               // browsers. clip-path reference-box only.
199   FillBox,    // Used by everything, except shape-box.
200   StrokeBox,  // mask-clip, mask-origin and clip-path reference-box only.
201   ViewBox,    // Used by everything, except shape-box.
202   NoClip,     // mask-clip only.
203   Text,       // background-clip only.
204   NoBox,      // Depending on which kind of element this style value applied on,
205               // the default value of a reference-box can be different.
206               // For an HTML element, the default value of reference-box is
207               // border-box; for an SVG element, the default value is fill-box.
208               // Since we can not determine the default value at parsing time,
209               // set it as NoBox so that we make a decision later.
210               // clip-path reference-box only.
211   MozAlmostPadding = 127  // A magic value that we use for our "pretend that
212                           // background-clip is 'padding' when we have a solid
213                           // border" optimization.  This isn't actually equal
214                           // to StyleGeometryBox::Padding because using that
215                           // causes antialiasing seams between the background
216                           // and border.
217                           // background-clip only.
218 };
219 
220 // float-edge
221 enum class StyleFloatEdge : uint8_t {
222   ContentBox,
223   MarginBox,
224 };
225 
226 // Hyphens
227 enum class StyleHyphens : uint8_t {
228   None,
229   Manual,
230   Auto,
231 };
232 
233 // image-orientation
234 enum class StyleImageOrientation : uint8_t {
235   None,
236   FromImage,
237 };
238 
239 // scrollbar-width
240 enum class StyleScrollbarWidth : uint8_t {
241   Auto,
242   Thin,
243   None,
244 };
245 
246 // Shape source type
247 enum class StyleShapeSourceType : uint8_t {
248   None,
249   Image,  // shape-outside / clip-path only, and clip-path only uses it for
250           // <url>s
251   Shape,
252   Box,
253   Path,  // SVG path function
254 };
255 
256 // text-justify
257 enum class StyleTextJustify : uint8_t {
258   None,
259   Auto,
260   InterWord,
261   InterCharacter,
262 };
263 
264 // user-focus
265 enum class StyleUserFocus : uint8_t {
266   None,
267   Ignore,
268   Normal,
269   SelectAll,
270   SelectBefore,
271   SelectAfter,
272   SelectSame,
273   SelectMenu,
274 };
275 
276 // user-input
277 enum class StyleUserInput : uint8_t {
278   None,
279   Auto,
280 };
281 
282 // user-modify
283 enum class StyleUserModify : uint8_t {
284   ReadOnly,
285   ReadWrite,
286   WriteOnly,
287 };
288 
289 // -moz-window-dragging
290 enum class StyleWindowDragging : uint8_t {
291   Default,
292   Drag,
293   NoDrag,
294 };
295 
296 // orient
297 enum class StyleOrient : uint8_t {
298   Inline,
299   Block,
300   Horizontal,
301   Vertical,
302 };
303 
304 // See AnimationEffect.webidl
305 // and mozilla/dom/AnimationEffectBinding.h
306 namespace dom {
307 enum class PlaybackDirection : uint8_t;
308 enum class FillMode : uint8_t;
309 }  // namespace dom
310 
311 // Animation play state
312 enum class StyleAnimationPlayState : uint8_t { Running, Paused };
313 
314 // See nsStyleImageLayers
315 enum class StyleImageLayerAttachment : uint8_t { Scroll, Fixed, Local };
316 
317 // See nsStyleImageLayers
318 enum class StyleImageLayerRepeat : uint8_t {
319   NoRepeat = 0x00,
320   RepeatX,
321   RepeatY,
322   Repeat,
323   Space,
324   Round
325 };
326 
327 // Mask mode
328 enum class StyleMaskMode : uint8_t { Alpha = 0, Luminance, MatchSource };
329 
330 // See nsStyleTable
331 enum class StyleBorderCollapse : uint8_t { Collapse, Separate };
332 
333 // border-image-repeat
334 enum class StyleBorderImageRepeat : uint8_t { Stretch, Repeat, Round, Space };
335 
336 // See nsStyleVisibility
337 enum class StyleDirection : uint8_t { Ltr, Rtl };
338 
339 // See nsStyleVisibility
340 // NOTE: WritingModes.h depends on the particular values used here.
341 #define NS_STYLE_WRITING_MODE_HORIZONTAL_TB 0
342 #define NS_STYLE_WRITING_MODE_VERTICAL_RL 1
343 // #define NS_STYLE_WRITING_MODE_HORIZONTAL_BT  2  // hypothetical
344 #define NS_STYLE_WRITING_MODE_VERTICAL_LR 3
345 
346 // Single-bit flag, used in combination with VERTICAL_LR and _RL to specify
347 // the corresponding SIDEWAYS_* modes.
348 // (To avoid ambiguity, this bit must be high enough such that no other
349 // values here accidentally use it in their binary representation.)
350 #define NS_STYLE_WRITING_MODE_SIDEWAYS_MASK 4
351 
352 #define NS_STYLE_WRITING_MODE_SIDEWAYS_RL \
353   (NS_STYLE_WRITING_MODE_VERTICAL_RL | NS_STYLE_WRITING_MODE_SIDEWAYS_MASK)
354 #define NS_STYLE_WRITING_MODE_SIDEWAYS_LR \
355   (NS_STYLE_WRITING_MODE_VERTICAL_LR | NS_STYLE_WRITING_MODE_SIDEWAYS_MASK)
356 
357 // See nsStylePosition
358 enum class StyleFlexDirection : uint8_t {
359   Row,
360   RowReverse,
361   Column,
362   ColumnReverse,
363 };
364 
365 // See nsStylePosition
366 enum class StyleFlexWrap : uint8_t {
367   Nowrap,
368   Wrap,
369   WrapReverse,
370 };
371 
372 // See nsStylePosition
373 // NOTE: This is the initial value of the integer-valued 'order' property
374 // (rather than an internal numerical representation of some keyword).
375 #define NS_STYLE_ORDER_INITIAL 0
376 
377 // See nsStyleFont
378 enum class StyleFontSize : uint8_t {
379   Xxsmall = 0,
380   Xsmall,
381   Small,
382   Medium,
383   Large,
384   Xlarge,
385   Xxlarge,
386   Xxxlarge,
387   Larger,
388   Smaller,
389   NoKeyword  // Used by Servo to track the "no keyword" case
390 };
391 
392 #define NS_STYLE_MASONRY_PLACEMENT_PACK (1 << 0)
393 #define NS_STYLE_MASONRY_ORDER_DEFINITE_FIRST (1 << 1)
394 #define NS_STYLE_MASONRY_AUTO_FLOW_INITIAL_VALUE \
395   (NS_STYLE_MASONRY_PLACEMENT_PACK | NS_STYLE_MASONRY_ORDER_DEFINITE_FIRST)
396 
397 // 'subgrid' keyword in grid-template-{columns,rows}
398 #define NS_STYLE_GRID_TEMPLATE_SUBGRID 0
399 
400 // CSS Grid <track-breadth> keywords
401 // Should not overlap with NS_STYLE_GRID_TEMPLATE_SUBGRID
402 enum class StyleGridTrackBreadth : uint8_t {
403   MaxContent = 1,
404   MinContent = 2,
405 };
406 
407 // defaults per MathML spec
408 #define NS_MATHML_DEFAULT_SCRIPT_SIZE_MULTIPLIER 0.71f
409 #define NS_MATHML_DEFAULT_SCRIPT_MIN_SIZE_PT 8
410 
411 // See nsStyleFont
412 #define NS_MATHML_MATHVARIANT_NONE 0
413 #define NS_MATHML_MATHVARIANT_NORMAL 1
414 #define NS_MATHML_MATHVARIANT_BOLD 2
415 #define NS_MATHML_MATHVARIANT_ITALIC 3
416 #define NS_MATHML_MATHVARIANT_BOLD_ITALIC 4
417 #define NS_MATHML_MATHVARIANT_SCRIPT 5
418 #define NS_MATHML_MATHVARIANT_BOLD_SCRIPT 6
419 #define NS_MATHML_MATHVARIANT_FRAKTUR 7
420 #define NS_MATHML_MATHVARIANT_DOUBLE_STRUCK 8
421 #define NS_MATHML_MATHVARIANT_BOLD_FRAKTUR 9
422 #define NS_MATHML_MATHVARIANT_SANS_SERIF 10
423 #define NS_MATHML_MATHVARIANT_BOLD_SANS_SERIF 11
424 #define NS_MATHML_MATHVARIANT_SANS_SERIF_ITALIC 12
425 #define NS_MATHML_MATHVARIANT_SANS_SERIF_BOLD_ITALIC 13
426 #define NS_MATHML_MATHVARIANT_MONOSPACE 14
427 #define NS_MATHML_MATHVARIANT_INITIAL 15
428 #define NS_MATHML_MATHVARIANT_TAILED 16
429 #define NS_MATHML_MATHVARIANT_LOOPED 17
430 #define NS_MATHML_MATHVARIANT_STRETCHED 18
431 
432 // See nsStyleFont::mMathDisplay
433 #define NS_MATHML_DISPLAYSTYLE_INLINE 0
434 #define NS_MATHML_DISPLAYSTYLE_BLOCK 1
435 
436 // See nsStyleDisplay.mPosition
437 enum class StylePositionProperty : uint8_t {
438   Static,
439   Relative,
440   Absolute,
441   Fixed,
442   Sticky,
443 };
444 
445 // See nsStyleEffects.mClip, mClipFlags
446 #define NS_STYLE_CLIP_AUTO 0x00
447 #define NS_STYLE_CLIP_RECT 0x01
448 #define NS_STYLE_CLIP_TYPE_MASK 0x0F
449 #define NS_STYLE_CLIP_LEFT_AUTO 0x10
450 #define NS_STYLE_CLIP_TOP_AUTO 0x20
451 #define NS_STYLE_CLIP_RIGHT_AUTO 0x40
452 #define NS_STYLE_CLIP_BOTTOM_AUTO 0x80
453 
454 // FRAME/FRAMESET/IFRAME specific values including backward compatibility.
455 // Boolean values with the same meaning (e.g. 1 & yes) may need to be
456 // distinguished for correct mode processing
457 #define NS_STYLE_FRAME_YES 0
458 #define NS_STYLE_FRAME_NO 1
459 #define NS_STYLE_FRAME_0 2
460 #define NS_STYLE_FRAME_1 3
461 #define NS_STYLE_FRAME_ON 4
462 #define NS_STYLE_FRAME_OFF 5
463 #define NS_STYLE_FRAME_AUTO 6
464 #define NS_STYLE_FRAME_SCROLL 7
465 #define NS_STYLE_FRAME_NOSCROLL 8
466 
467 // See nsStyleList
468 #define NS_STYLE_LIST_STYLE_CUSTOM -1  // for @counter-style
469 #define NS_STYLE_LIST_STYLE_NONE 0
470 #define NS_STYLE_LIST_STYLE_DECIMAL 1
471 #define NS_STYLE_LIST_STYLE_DISC 2
472 #define NS_STYLE_LIST_STYLE_CIRCLE 3
473 #define NS_STYLE_LIST_STYLE_SQUARE 4
474 #define NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED 5
475 #define NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN 6
476 #define NS_STYLE_LIST_STYLE_HEBREW 7
477 #define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL 8
478 #define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL 9
479 #define NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL 10
480 #define NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL 11
481 #define NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL 12
482 #define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 13
483 #define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL 14
484 #define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 15
485 #define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL 16
486 #define NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC 17
487 // These styles are handled as custom styles defined in counterstyles.css.
488 // They are preserved here only for html attribute map.
489 #define NS_STYLE_LIST_STYLE_LOWER_ROMAN 100
490 #define NS_STYLE_LIST_STYLE_UPPER_ROMAN 101
491 #define NS_STYLE_LIST_STYLE_LOWER_ALPHA 102
492 #define NS_STYLE_LIST_STYLE_UPPER_ALPHA 103
493 
494 // See nsStyleList
495 #define NS_STYLE_LIST_STYLE_POSITION_INSIDE 0
496 #define NS_STYLE_LIST_STYLE_POSITION_OUTSIDE 1
497 
498 // See nsStyleVisibility
499 enum class StylePointerEvents : uint8_t {
500   None,
501   Visiblepainted,
502   Visiblefill,
503   Visiblestroke,
504   Visible,
505   Painted,
506   Fill,
507   Stroke,
508   All,
509   Auto,
510 };
511 
512 enum class StyleIsolation : uint8_t {
513   Auto,
514   Isolate,
515 };
516 
517 // See nsStylePosition.mObjectFit
518 enum class StyleObjectFit : uint8_t {
519   Fill,
520   Contain,
521   Cover,
522   None,
523   ScaleDown,
524 };
525 
526 // See nsStyleText
527 #define NS_STYLE_TEXT_DECORATION_STYLE_NONE \
528   0  // not in CSS spec, mapped to -moz-none
529 #define NS_STYLE_TEXT_DECORATION_STYLE_DOTTED 1
530 #define NS_STYLE_TEXT_DECORATION_STYLE_DASHED 2
531 #define NS_STYLE_TEXT_DECORATION_STYLE_SOLID 3
532 #define NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE 4
533 #define NS_STYLE_TEXT_DECORATION_STYLE_WAVY 5
534 #define NS_STYLE_TEXT_DECORATION_STYLE_MAX NS_STYLE_TEXT_DECORATION_STYLE_WAVY
535 
536 // See nsStyleText
537 #define NS_STYLE_TEXT_TRANSFORM_NONE 0
538 #define NS_STYLE_TEXT_TRANSFORM_CAPITALIZE 1
539 #define NS_STYLE_TEXT_TRANSFORM_LOWERCASE 2
540 #define NS_STYLE_TEXT_TRANSFORM_UPPERCASE 3
541 #define NS_STYLE_TEXT_TRANSFORM_FULL_WIDTH 4
542 #define NS_STYLE_TEXT_TRANSFORM_FULL_SIZE_KANA 5
543 
544 // See nsStyleDisplay
545 enum class StyleTopLayer : uint8_t {
546   None,
547   Top,
548 };
549 
550 // See nsStyleVisibility
551 enum class StyleVisibility : uint8_t {
552   Hidden,
553   Visible,
554   Collapse,
555 };
556 
557 // See nsStyleText
558 #define NS_STYLE_TABSIZE_INITIAL 8
559 
560 // See nsStyleText
561 enum class StyleWhiteSpace : uint8_t {
562   Normal = 0,
563   Pre,
564   Nowrap,
565   PreWrap,
566   PreLine,
567   PreSpace,
568   BreakSpaces,
569 };
570 
571 // ruby-align, see nsStyleText
572 enum class StyleRubyAlign : uint8_t {
573   Start,
574   Center,
575   SpaceBetween,
576   SpaceAround,
577 };
578 
579 // ruby-position, see nsStyleText
580 enum class StyleRubyPosition : uint8_t {
581   Over,
582   Under,
583 };
584 
585 // See nsStyleText
586 enum class StyleTextSizeAdjust : uint8_t {
587   None,
588   Auto,
589 };
590 
591 // See nsStyleText
592 enum class StyleTextOrientation : uint8_t {
593   Mixed,
594   Upright,
595   Sideways,
596 };
597 
598 // See nsStyleText
599 #define NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE 0
600 #define NS_STYLE_TEXT_COMBINE_UPRIGHT_ALL 1
601 
602 // See nsStyleText
603 #define NS_STYLE_UNICODE_BIDI_NORMAL 0x0
604 #define NS_STYLE_UNICODE_BIDI_EMBED 0x1
605 #define NS_STYLE_UNICODE_BIDI_ISOLATE 0x2
606 #define NS_STYLE_UNICODE_BIDI_BIDI_OVERRIDE 0x4
607 #define NS_STYLE_UNICODE_BIDI_ISOLATE_OVERRIDE 0x6
608 #define NS_STYLE_UNICODE_BIDI_PLAINTEXT 0x8
609 
610 enum class StyleTableLayout : uint8_t {
611   Auto,
612   Fixed,
613 };
614 
615 enum class StyleEmptyCells : uint8_t {
616   Hide,
617   Show,
618 };
619 
620 // Constants for the caption-side property. Note that despite having "physical"
621 // names, these are actually interpreted according to the table's writing-mode:
622 // TOP and BOTTOM are treated as block-start and -end respectively, and LEFT
623 // and RIGHT are treated as line-left and -right.
624 #define NS_STYLE_CAPTION_SIDE_TOP 0
625 #define NS_STYLE_CAPTION_SIDE_RIGHT 1
626 #define NS_STYLE_CAPTION_SIDE_BOTTOM 2
627 #define NS_STYLE_CAPTION_SIDE_LEFT 3
628 #define NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE 4
629 #define NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE 5
630 
631 // constants for cell "scope" attribute
632 #define NS_STYLE_CELL_SCOPE_ROW 0
633 #define NS_STYLE_CELL_SCOPE_COL 1
634 #define NS_STYLE_CELL_SCOPE_ROWGROUP 2
635 #define NS_STYLE_CELL_SCOPE_COLGROUP 3
636 
637 // See nsStylePage
638 #define NS_STYLE_PAGE_MARKS_NONE 0x00
639 #define NS_STYLE_PAGE_MARKS_CROP 0x01
640 #define NS_STYLE_PAGE_MARKS_REGISTER 0x02
641 
642 // See nsStylePage
643 #define NS_STYLE_PAGE_SIZE_AUTO 0
644 #define NS_STYLE_PAGE_SIZE_PORTRAIT 1
645 #define NS_STYLE_PAGE_SIZE_LANDSCAPE 2
646 
647 // See nsStyleBreaks
648 #define NS_STYLE_PAGE_BREAK_AUTO 0
649 #define NS_STYLE_PAGE_BREAK_ALWAYS 1
650 #define NS_STYLE_PAGE_BREAK_AVOID 2
651 #define NS_STYLE_PAGE_BREAK_LEFT 3
652 #define NS_STYLE_PAGE_BREAK_RIGHT 4
653 
654 // See nsStyleUIReset
655 enum class StyleImeMode : uint8_t {
656   Auto,
657   Normal,
658   Active,
659   Disabled,
660   Inactive,
661 };
662 
663 // See nsStyleSVG
664 
665 /*
666  * -moz-window-shadow
667  * Also used in widget code
668  */
669 enum class StyleWindowShadow : uint8_t {
670   None,
671   Default,
672   Menu,
673   Tooltip,
674   Sheet,
675 };
676 
677 // dominant-baseline
678 enum class StyleDominantBaseline : uint8_t {
679   Auto,
680   Ideographic,
681   Alphabetic,
682   Hanging,
683   Mathematical,
684   Central,
685   Middle,
686   TextAfterEdge,
687   TextBeforeEdge,
688 };
689 
690 // image-rendering
691 enum class StyleImageRendering : uint8_t {
692   Auto,
693   Optimizespeed,
694   Optimizequality,
695   CrispEdges,
696 };
697 
698 // mask-type
699 enum class StyleMaskType : uint8_t {
700   Luminance,
701   Alpha,
702 };
703 
704 // shape-rendering
705 enum class StyleShapeRendering : uint8_t {
706   Auto,
707   Optimizespeed,
708   Crispedges,
709   Geometricprecision,
710 };
711 
712 // stroke-linecap
713 enum class StyleStrokeLinecap : uint8_t {
714   Butt,
715   Round,
716   Square,
717 };
718 
719 // stroke-linejoin
720 enum class StyleStrokeLinejoin : uint8_t {
721   Miter,
722   Round,
723   Bevel,
724 };
725 
726 // text-anchor
727 enum class StyleTextAnchor : uint8_t {
728   Start,
729   Middle,
730   End,
731 };
732 
733 // text-emphasis-position
734 #define NS_STYLE_TEXT_EMPHASIS_POSITION_OVER (1 << 0)
735 #define NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER (1 << 1)
736 #define NS_STYLE_TEXT_EMPHASIS_POSITION_LEFT (1 << 2)
737 #define NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT (1 << 3)
738 #define NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT \
739   (NS_STYLE_TEXT_EMPHASIS_POSITION_OVER | NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT)
740 #define NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH \
741   (NS_STYLE_TEXT_EMPHASIS_POSITION_UNDER |         \
742    NS_STYLE_TEXT_EMPHASIS_POSITION_RIGHT)
743 
744 // text-rendering
745 enum class StyleTextRendering : uint8_t {
746   Auto,
747   Optimizespeed,
748   Optimizelegibility,
749   Geometricprecision,
750 };
751 
752 // color-adjust
753 enum class StyleColorAdjust : uint8_t {
754   Economy = 0,
755   Exact = 1,
756 };
757 
758 // color-interpolation and color-interpolation-filters
759 enum class StyleColorInterpolation : uint8_t {
760   Auto = 0,
761   Srgb = 1,
762   Linearrgb = 2,
763 };
764 
765 // vector-effect
766 enum class StyleVectorEffect : uint8_t { None = 0, NonScalingStroke = 1 };
767 
768 // 3d Transforms - Backface visibility
769 enum class StyleBackfaceVisibility : uint8_t { Hidden = 0, Visible = 1 };
770 
771 // blending
772 enum class StyleBlend : uint8_t {
773   Normal = 0,
774   Multiply,
775   Screen,
776   Overlay,
777   Darken,
778   Lighten,
779   ColorDodge,
780   ColorBurn,
781   HardLight,
782   SoftLight,
783   Difference,
784   Exclusion,
785   Hue,
786   Saturation,
787   Color,
788   Luminosity,
789 };
790 
791 // composite
792 enum class StyleMaskComposite : uint8_t {
793   Add = 0,
794   Subtract,
795   Intersect,
796   Exclude
797 };
798 
799 // See nsStyleText::mControlCharacterVisibility
800 enum class StyleControlCharacterVisibility : uint8_t { Hidden = 0, Visible };
801 
802 // scroll-behavior
803 enum class StyleScrollBehavior : uint8_t {
804   Auto,
805   Smooth,
806 };
807 
808 }  // namespace mozilla
809 
810 #endif /* nsStyleConsts_h___ */
811