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___
14 #include "X11UndefineNone.h"
16 #include "gfxFontConstants.h"
17 #include "mozilla/ServoStyleConsts.h"
19 // XXX fold this into ComputedStyle and group by nsStyleXXX struct
24 enum class StyleBoxAlign
: uint8_t {
32 // box-decoration-break
33 enum class StyleBoxDecorationBreak
: uint8_t {
39 enum class StyleBoxDirection
: uint8_t {
45 enum class StyleBoxOrient
: uint8_t {
51 enum class StyleBoxPack
: uint8_t {
59 enum class StyleBoxSizing
: uint8_t { Content
, Border
};
62 enum class StyleBoxShadowType
: uint8_t {
66 enum class StyleColumnFill
: uint8_t {
71 enum class StyleColumnSpan
: uint8_t {
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.
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
104 // background-clip only.
108 enum class StyleFloatEdge
: uint8_t {
114 enum class StyleHyphens
: uint8_t {
121 enum class StyleImageOrientation
: uint8_t {
127 enum class StyleScrollbarWidth
: uint8_t {
134 enum class StyleShapeSourceType
: uint8_t {
136 Image
, // shape-outside / clip-path only, and clip-path only uses it for
140 Path
, // SVG path function
144 enum class StyleUserFocus
: uint8_t {
151 enum class StyleUserInput
: uint8_t {
157 enum class StyleUserModify
: uint8_t {
164 enum class StyleInert
: uint8_t {
169 // -moz-window-dragging
170 enum class StyleWindowDragging
: uint8_t {
177 enum class StyleOrient
: uint8_t {
184 // See nsStyleImageLayers
185 enum class StyleImageLayerAttachment
: uint8_t { Scroll
, Fixed
, Local
};
187 // See nsStyleImageLayers
188 enum class StyleImageLayerRepeat
: uint8_t {
198 enum class StyleMaskMode
: uint8_t { Alpha
= 0, Luminance
, MatchSource
};
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 {
221 // HorizontalBT = 2, // hypothetical
223 SidewaysRl
= VerticalRl
| kWritingModeSidewaysMask
,
224 SidewaysLr
= VerticalLr
| kWritingModeSidewaysMask
,
227 // See nsStylePosition
228 enum class StyleFlexDirection
: uint8_t {
235 // See nsStylePosition
236 enum class StyleFlexWrap
: uint8_t {
242 // CSS Grid <track-breadth> keywords
243 enum class StyleGridTrackBreadth
: uint8_t {
248 // defaults per MathML spec
249 static constexpr float kMathMLDefaultScriptSizeMultiplier
{0.71f
};
250 static constexpr float kMathMLDefaultScriptMinSizePt
{8.f
};
253 enum class StyleMathVariant
: uint8_t {
266 SansSerifItalic
= 12,
267 SansSerifBoldItalic
= 13,
275 // See nsStyleFont::mMathStyle
276 enum class StyleMathStyle
: uint8_t { Compact
= 0, Normal
= 1 };
278 // See nsStyleDisplay.mPosition
279 enum class StylePositionProperty
: uint8_t {
287 enum class FrameBorderProperty
: uint8_t { Yes
, No
, One
, Zero
};
289 enum class ScrollingAttribute
: uint8_t {
300 enum class ListStyle
: uint8_t {
301 Custom
= 255, // for @counter-style
320 // These styles are handled as custom styles defined in counterstyles.css.
321 // They are preserved here only for html attribute map.
329 enum class StyleListStylePosition
: uint8_t { Inside
, Outside
};
331 // See nsStyleVisibility
332 enum class StylePointerEvents
: uint8_t {
345 enum class StyleIsolation
: uint8_t {
350 // See nsStylePosition.mObjectFit
351 enum class StyleObjectFit
: uint8_t {
360 enum class StyleTextDecorationStyle
: uint8_t {
361 None
, // not in CSS spec, mapped to -moz-none
371 enum class StyleTextSecurity
: uint8_t {
378 // See nsStyleDisplay
379 enum class StyleTopLayer
: uint8_t {
384 // See nsStyleVisibility
385 enum class StyleVisibility
: uint8_t {
392 enum class StyleWhiteSpaceCollapse
: uint8_t {
394 // TODO: Discard not yet supported
402 enum class StyleTextWrapMode
: uint8_t {
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)
412 enum class StyleTextWrapStyle
: uint8_t {
418 // ruby-align, see nsStyleText
419 enum class StyleRubyAlign
: uint8_t {
427 enum class StyleTextSizeAdjust
: uint8_t {
432 // See nsStyleVisibility
433 enum class StyleTextOrientation
: uint8_t {
439 // Whether flexbox visibility: collapse items use legacy -moz-box behavior or
441 enum class StyleMozBoxCollapse
: uint8_t {
447 enum class StyleTextCombineUpright
: uint8_t {
453 enum class StyleUnicodeBidi
: uint8_t {
462 enum class StyleTableLayout
: uint8_t {
467 enum class StyleEmptyCells
: uint8_t {
472 // See nsStyleUIReset
473 enum class StyleImeMode
: uint8_t {
483 // -moz-window-shadow
484 enum class StyleWindowShadow
: uint8_t {
490 enum class StyleDominantBaseline
: uint8_t {
503 enum class StyleMaskType
: uint8_t {
509 enum class StyleShapeRendering
: uint8_t {
517 enum class StyleStrokeLinecap
: uint8_t {
524 enum class StyleStrokeLinejoin
: uint8_t {
531 enum class StyleTextAnchor
: uint8_t {
538 enum class StyleTextRendering
: uint8_t {
545 // color-interpolation and color-interpolation-filters
546 enum class StyleColorInterpolation
: uint8_t {
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 };
559 enum class StyleBlend
: uint8_t {
580 enum class StyleMaskComposite
: uint8_t {
588 enum class StyleScrollBehavior
: uint8_t {
593 } // namespace mozilla
595 #endif /* nsStyleConsts_h___ */