tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsStyleConsts.h (10673B)


      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 #include "gfxFontConstants.h"
     16 #include "mozilla/ServoStyleConsts.h"
     17 
     18 // XXX fold this into ComputedStyle and group by nsStyleXXX struct
     19 
     20 namespace mozilla {
     21 
     22 // box-align
     23 enum class StyleBoxAlign : uint8_t {
     24  Stretch,
     25  Start,
     26  Center,
     27  Baseline,
     28  End,
     29 };
     30 
     31 // box-decoration-break
     32 enum class StyleBoxDecorationBreak : uint8_t {
     33  Slice,
     34  Clone,
     35 };
     36 
     37 // box-direction
     38 enum class StyleBoxDirection : uint8_t {
     39  Normal,
     40  Reverse,
     41 };
     42 
     43 // box-orient
     44 enum class StyleBoxOrient : uint8_t {
     45  Horizontal,
     46  Vertical,
     47 };
     48 
     49 // box-pack
     50 enum class StyleBoxPack : uint8_t {
     51  Start,
     52  Center,
     53  End,
     54  Justify,
     55 };
     56 
     57 // box-sizing
     58 enum class StyleBoxSizing : uint8_t { Content, Border };
     59 
     60 // box-shadow
     61 enum class StyleBoxShadowType : uint8_t {
     62  Inset,
     63 };
     64 
     65 enum class StyleColumnFill : uint8_t {
     66  Balance,
     67  Auto,
     68 };
     69 
     70 enum class StyleColumnSpan : uint8_t {
     71  None,
     72  All,
     73 };
     74 
     75 // Define geometry box for clip-path's reference-box, background-clip,
     76 // background-origin, mask-clip, mask-origin, shape-box and transform-box.
     77 enum class StyleGeometryBox : uint8_t {
     78  ContentBox,  // Used by everything, except transform-box.
     79  PaddingBox,  // Used by everything, except transform-box.
     80  BorderBox,
     81  MarginBox,  // XXX Bug 1260094 comment 9.
     82              // Although margin-box is required by mask-origin and mask-clip,
     83              // we do not implement that due to lack of support in other
     84              // browsers. clip-path reference-box only.
     85  FillBox,    // Used by everything, except shape-box.
     86  StrokeBox,  // mask-clip, mask-origin and clip-path reference-box only.
     87  ViewBox,    // Used by everything, except shape-box.
     88  NoClip,     // mask-clip only.
     89  Text,       // background-clip only.
     90  NoBox,      // Depending on which kind of element this style value applied on,
     91              // the default value of a reference-box can be different.
     92              // For an HTML element, the default value of reference-box is
     93              // border-box; for an SVG element, the default value is fill-box.
     94              // Since we can not determine the default value at parsing time,
     95              // set it as NoBox so that we make a decision later.
     96              // clip-path reference-box only.
     97  MozAlmostPadding = 127  // A magic value that we use for our "pretend that
     98                          // background-clip is 'padding' when we have a solid
     99                          // border" optimization.  This isn't actually equal
    100                          // to StyleGeometryBox::Padding because using that
    101                          // causes antialiasing seams between the background
    102                          // and border.
    103                          // background-clip only.
    104 };
    105 
    106 // float-edge
    107 enum class StyleFloatEdge : uint8_t {
    108  ContentBox,
    109  MarginBox,
    110 };
    111 
    112 // Hyphens
    113 enum class StyleHyphens : uint8_t {
    114  None,
    115  Manual,
    116  Auto,
    117 };
    118 
    119 // image-orientation
    120 enum class StyleImageOrientation : uint8_t {
    121  None,
    122  FromImage,
    123 };
    124 
    125 // scrollbar-width
    126 enum class StyleScrollbarWidth : uint8_t {
    127  Auto,
    128  Thin,
    129  None,
    130 };
    131 
    132 // field-sizing
    133 enum class StyleFieldSizing : bool {
    134  Fixed,
    135  Content,
    136 };
    137 
    138 // Shape source type
    139 enum class StyleShapeSourceType : uint8_t {
    140  None,
    141  Image,  // shape-outside / clip-path only, and clip-path only uses it for
    142          // <url>s
    143  Shape,
    144  Box,
    145  Path,  // SVG path function
    146 };
    147 
    148 // -moz-window-dragging
    149 enum class StyleWindowDragging : uint8_t {
    150  Default,
    151  Drag,
    152  NoDrag,
    153 };
    154 
    155 // orient
    156 enum class StyleOrient : uint8_t {
    157  Inline,
    158  Block,
    159  Horizontal,
    160  Vertical,
    161 };
    162 
    163 // See nsStyleImageLayers
    164 enum class StyleImageLayerAttachment : uint8_t { Scroll, Fixed, Local };
    165 
    166 // See nsStyleImageLayers
    167 enum class StyleImageLayerRepeat : uint8_t {
    168  NoRepeat = 0x00,
    169  RepeatX,
    170  RepeatY,
    171  Repeat,
    172  Space,
    173  Round
    174 };
    175 
    176 // Mask mode
    177 enum class StyleMaskMode : uint8_t { Alpha = 0, Luminance, MatchSource };
    178 
    179 // See nsStyleTable
    180 enum class StyleBorderCollapse : uint8_t { Collapse, Separate };
    181 
    182 // See nsStyleVisibility
    183 enum class StyleDirection : uint8_t { Ltr, Rtl };
    184 
    185 // See nsStyleVisibility
    186 // NOTE: WritingModes.h depends on the particular values used here.
    187 
    188 // Single-bit flag, used in combination with VerticalLR and RL to specify
    189 // the corresponding Sideways* modes.
    190 // (To avoid ambiguity, this bit must be high enough such that no other
    191 // values here accidentally use it in their binary representation.)
    192 static constexpr uint8_t kWritingModeSidewaysMask = 4;
    193 
    194 // See nsStylePosition
    195 enum class StyleFlexDirection : uint8_t {
    196  Row,
    197  RowReverse,
    198  Column,
    199  ColumnReverse,
    200 };
    201 
    202 // See nsStylePosition
    203 enum class StyleFlexWrap : uint8_t {
    204  Nowrap,
    205  Wrap,
    206  WrapReverse,
    207 };
    208 
    209 // CSS Grid <track-breadth> keywords
    210 enum class StyleGridTrackBreadth : uint8_t {
    211  MaxContent = 1,
    212  MinContent = 2,
    213 };
    214 
    215 // defaults per MathML spec
    216 static constexpr float kMathMLDefaultScriptSizeMultiplier{0.71f};
    217 static constexpr float kMathMLDefaultScriptMinSizePt{8.f};
    218 
    219 // See nsStyleFont
    220 enum class StyleMathVariant : uint8_t {
    221  None = 0,
    222  Normal = 1,
    223  Bold = 2,
    224  Italic = 3,
    225  BoldItalic = 4,
    226  Script = 5,
    227  BoldScript = 6,
    228  Fraktur = 7,
    229  DoubleStruck = 8,
    230  BoldFraktur = 9,
    231  SansSerif = 10,
    232  BoldSansSerif = 11,
    233  SansSerifItalic = 12,
    234  SansSerifBoldItalic = 13,
    235  Monospace = 14,
    236  Initial = 15,
    237  Tailed = 16,
    238  Looped = 17,
    239  Stretched = 18,
    240 };
    241 
    242 // See nsStyleFont::mMathStyle
    243 enum class StyleMathStyle : uint8_t { Compact = 0, Normal = 1 };
    244 
    245 // See nsStyleFont::mMathShift
    246 enum class StyleMathShift : uint8_t { Compact = 0, Normal = 1 };
    247 
    248 enum class FrameBorderProperty : uint8_t { Yes, No, One, Zero };
    249 
    250 enum class ScrollingAttribute : uint8_t {
    251  Yes,
    252  No,
    253  On,
    254  Off,
    255  Scroll,
    256  Noscroll,
    257  Auto
    258 };
    259 
    260 // See nsStyleList
    261 enum class ListStyle : uint8_t {
    262  Custom = 255,  // for @counter-style
    263  None = 0,
    264  Decimal,
    265  Disc,
    266  Circle,
    267  Square,
    268  DisclosureClosed,
    269  DisclosureOpen,
    270  Hebrew,
    271  JapaneseInformal,
    272  JapaneseFormal,
    273  KoreanHangulFormal,
    274  KoreanHanjaInformal,
    275  KoreanHanjaFormal,
    276  SimpChineseInformal,
    277  SimpChineseFormal,
    278  TradChineseInformal,
    279  TradChineseFormal,
    280  EthiopicNumeric,
    281  // These styles are handled as custom styles defined in counterstyles.css.
    282  // They are preserved here only for html attribute map.
    283  LowerRoman = 100,
    284  UpperRoman,
    285  LowerAlpha,
    286  UpperAlpha
    287 };
    288 
    289 // See nsStyleList
    290 enum class StyleListStylePosition : uint8_t { Inside, Outside };
    291 
    292 enum class StyleIsolation : uint8_t {
    293  Auto,
    294  Isolate,
    295 };
    296 
    297 // See nsStylePosition.mObjectFit
    298 enum class StyleObjectFit : uint8_t {
    299  Fill,
    300  Contain,
    301  Cover,
    302  None,
    303  ScaleDown,
    304 };
    305 
    306 // See nsStyleText
    307 enum class StyleTextDecorationStyle : uint8_t {
    308  None,  // not in CSS spec, mapped to -moz-none
    309  Dotted,
    310  Dashed,
    311  Solid,
    312  Double,
    313  Wavy,
    314  Sentinel = Wavy
    315 };
    316 
    317 // See nsStyleText
    318 enum class StyleTextSecurity : uint8_t {
    319  None,
    320  Circle,
    321  Disc,
    322  Square,
    323 };
    324 
    325 // See nsStyleDisplay
    326 enum class StyleTopLayer : uint8_t {
    327  None,
    328  Auto,
    329 };
    330 
    331 // See nsStyleVisibility
    332 enum class StyleVisibility : uint8_t {
    333  Hidden,
    334  Visible,
    335  Collapse,
    336 };
    337 
    338 // See nsStyleText
    339 enum class StyleWhiteSpaceCollapse : uint8_t {
    340  Collapse = 0,
    341  // TODO: Discard not yet supported
    342  Preserve,
    343  PreserveBreaks,
    344  PreserveSpaces,
    345  BreakSpaces,
    346 };
    347 
    348 // See nsStyleText
    349 enum class StyleTextWrapMode : uint8_t {
    350  Wrap = 0,
    351  Nowrap,
    352 };
    353 
    354 // See nsStyleText
    355 // TODO: this will become StyleTextWrapStyle when we turn text-wrap
    356 // (see https://bugzilla.mozilla.org/show_bug.cgi?id=1758391) and
    357 // white-space (https://bugzilla.mozilla.org/show_bug.cgi?id=1852478)
    358 // into shorthands.
    359 enum class StyleTextWrapStyle : uint8_t {
    360  Auto = 0,
    361  Stable,
    362  Balance,
    363 };
    364 
    365 // ruby-align, see nsStyleText
    366 enum class StyleRubyAlign : uint8_t {
    367  Start,
    368  Center,
    369  SpaceBetween,
    370  SpaceAround,
    371 };
    372 
    373 // See nsStyleText
    374 enum class StyleTextSizeAdjust : uint8_t {
    375  None,
    376  Auto,
    377 };
    378 
    379 // See nsStyleVisibility
    380 enum class StyleTextOrientation : uint8_t {
    381  Mixed,
    382  Upright,
    383  Sideways,
    384 };
    385 
    386 // Whether flexbox visibility: collapse items use legacy -moz-box behavior or
    387 // not.
    388 enum class StyleMozBoxCollapse : uint8_t {
    389  Flex,
    390  Legacy,
    391 };
    392 
    393 // See nsStyleText
    394 enum class StyleTextCombineUpright : uint8_t {
    395  None,
    396  All,
    397 };
    398 
    399 // See nsStyleText
    400 enum class StyleUnicodeBidi : uint8_t {
    401  Normal,
    402  Embed,
    403  Isolate,
    404  BidiOverride,
    405  IsolateOverride,
    406  Plaintext
    407 };
    408 
    409 enum class StyleTableLayout : uint8_t {
    410  Auto,
    411  Fixed,
    412 };
    413 
    414 enum class StyleEmptyCells : uint8_t {
    415  Hide,
    416  Show,
    417 };
    418 
    419 // See nsStyleUIReset
    420 enum class StyleImeMode : uint8_t {
    421  Auto,
    422  Normal,
    423  Active,
    424  Disabled,
    425  Inactive,
    426 };
    427 
    428 // See nsStyleSVG
    429 
    430 // -moz-window-shadow
    431 enum class StyleWindowShadow : uint8_t {
    432  Auto,
    433  None,
    434 };
    435 
    436 // dominant-baseline
    437 enum class StyleDominantBaseline : uint8_t {
    438  Auto,
    439  Ideographic,
    440  Alphabetic,
    441  Hanging,
    442  Mathematical,
    443  Central,
    444  Middle,
    445  TextAfterEdge,
    446  TextBeforeEdge,
    447 };
    448 
    449 // mask-type
    450 enum class StyleMaskType : uint8_t {
    451  Luminance,
    452  Alpha,
    453 };
    454 
    455 // shape-rendering
    456 enum class StyleShapeRendering : uint8_t {
    457  Auto,
    458  Optimizespeed,
    459  Crispedges,
    460  Geometricprecision,
    461 };
    462 
    463 // stroke-linecap
    464 enum class StyleStrokeLinecap : uint8_t {
    465  Butt,
    466  Round,
    467  Square,
    468 };
    469 
    470 // stroke-linejoin
    471 enum class StyleStrokeLinejoin : uint8_t {
    472  Miter,
    473  Round,
    474  Bevel,
    475 };
    476 
    477 // text-anchor
    478 enum class StyleTextAnchor : uint8_t {
    479  Start,
    480  Middle,
    481  End,
    482 };
    483 
    484 // text-rendering
    485 enum class StyleTextRendering : uint8_t {
    486  Auto,
    487  Optimizespeed,
    488  Optimizelegibility,
    489  Geometricprecision,
    490 };
    491 
    492 // color-interpolation and color-interpolation-filters
    493 enum class StyleColorInterpolation : uint8_t {
    494  Auto = 0,
    495  Srgb = 1,
    496  Linearrgb = 2,
    497 };
    498 
    499 // 3d Transforms - Backface visibility
    500 enum class StyleBackfaceVisibility : uint8_t { Hidden = 0, Visible = 1 };
    501 
    502 // blending
    503 enum class StyleBlend : uint8_t {
    504  Normal = 0,
    505  Multiply,
    506  Screen,
    507  Overlay,
    508  Darken,
    509  Lighten,
    510  ColorDodge,
    511  ColorBurn,
    512  HardLight,
    513  SoftLight,
    514  Difference,
    515  Exclusion,
    516  Hue,
    517  Saturation,
    518  Color,
    519  Luminosity,
    520  PlusLighter,
    521 };
    522 
    523 // composite
    524 enum class StyleMaskComposite : uint8_t {
    525  Add = 0,
    526  Subtract,
    527  Intersect,
    528  Exclude
    529 };
    530 
    531 // scroll-behavior
    532 enum class StyleScrollBehavior : uint8_t {
    533  Auto,
    534  Smooth,
    535 };
    536 
    537 }  // namespace mozilla
    538 
    539 #endif /* nsStyleConsts_h___ */