Home | History | Annotate | Download | only in style
      1 /*
      2  * Copyright (C) 2000 Lars Knoll (knoll (at) kde.org)
      3  *           (C) 2000 Antti Koivisto (koivisto (at) kde.org)
      4  *           (C) 2000 Dirk Mueller (mueller (at) kde.org)
      5  * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
      6  * Copyright (C) 2006 Graham Dennis (graham.dennis (at) gmail.com)
      7  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
      8  *
      9  * This library is free software; you can redistribute it and/or
     10  * modify it under the terms of the GNU Library General Public
     11  * License as published by the Free Software Foundation; either
     12  * version 2 of the License, or (at your option) any later version.
     13  *
     14  * This library is distributed in the hope that it will be useful,
     15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     17  * Library General Public License for more details.
     18  *
     19  * You should have received a copy of the GNU Library General Public License
     20  * along with this library; see the file COPYING.LIB.  If not, write to
     21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     22  * Boston, MA 02110-1301, USA.
     23  *
     24  */
     25 
     26 #ifndef RenderStyleConstants_h
     27 #define RenderStyleConstants_h
     28 
     29 namespace blink {
     30 
     31 // Sides used when drawing borders and outlines. The values should run clockwise from top.
     32 enum BoxSide {
     33     BSTop,
     34     BSRight,
     35     BSBottom,
     36     BSLeft
     37 };
     38 
     39 enum StyleRecalcChange {
     40     NoChange,
     41     NoInherit,
     42     UpdatePseudoElements,
     43     Inherit,
     44     Force,
     45     Reattach,
     46     ReattachNoRenderer
     47 };
     48 
     49 static const size_t PrintColorAdjustBits = 1;
     50 enum PrintColorAdjust {
     51     PrintColorAdjustEconomy,
     52     PrintColorAdjustExact
     53 };
     54 
     55 // Static pseudo styles. Dynamic ones are produced on the fly.
     56 enum PseudoId {
     57     // The order must be NOP ID, public IDs, and then internal IDs.
     58     // If you add or remove a public ID, you must update _pseudoBits in RenderStyle.
     59     NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, BACKDROP, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR,
     60     // Internal IDs follow:
     61     SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, INPUT_LIST_BUTTON,
     62     // Special values follow:
     63     AFTER_LAST_INTERNAL_PSEUDOID,
     64     FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
     65     FIRST_INTERNAL_PSEUDOID = SCROLLBAR_THUMB,
     66     PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1),
     67     PSEUDO_ELEMENT_MASK = (1 << (BEFORE - 1)) | (1 << (AFTER - 1)) | (1 << (BACKDROP - 1))
     68 };
     69 
     70 enum ColumnFill { ColumnFillBalance, ColumnFillAuto };
     71 
     72 enum ColumnSpan { ColumnSpanNone = 0, ColumnSpanAll };
     73 
     74 enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 };
     75 
     76 // These have been defined in the order of their precedence for border-collapsing. Do
     77 // not change this order! This order also must match the order in CSSValueKeywords.in.
     78 enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, OUTSET, RIDGE, DOTTED, DASHED, SOLID, DOUBLE };
     79 
     80 enum EBorderPrecedence { BOFF, BTABLE, BCOLGROUP, BCOL, BROWGROUP, BROW, BCELL };
     81 
     82 enum OutlineIsAuto { AUTO_OFF = 0, AUTO_ON };
     83 
     84 enum EPosition {
     85     StaticPosition = 0,
     86     RelativePosition = 1,
     87     AbsolutePosition = 2,
     88     // This value is required to pack our bits efficiently in RenderObject.
     89     // FIXME: Is this still true now that we've remove position: sticky.
     90     FixedPosition = 6
     91 };
     92 
     93 enum EFloat {
     94     NoFloat, LeftFloat, RightFloat
     95 };
     96 
     97 enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD };
     98 
     99 // Box decoration attributes. Not inherited.
    100 
    101 enum EBoxDecorationBreak { DSLICE, DCLONE };
    102 
    103 // Box attributes. Not inherited.
    104 
    105 enum EBoxSizing { CONTENT_BOX, BORDER_BOX };
    106 
    107 // Random visual rendering model attributes. Not inherited.
    108 
    109 enum EOverflow {
    110     OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OPAGEDX, OPAGEDY
    111 };
    112 
    113 enum EVerticalAlign {
    114     BASELINE, MIDDLE, SUB, SUPER, TEXT_TOP,
    115     TEXT_BOTTOM, TOP, BOTTOM, BASELINE_MIDDLE, LENGTH
    116 };
    117 
    118 enum EClear {
    119     CNONE = 0, CLEFT = 1, CRIGHT = 2, CBOTH = 3
    120 };
    121 
    122 enum ETableLayout {
    123     TAUTO, TFIXED
    124 };
    125 
    126 enum TextCombine {
    127     TextCombineNone, TextCombineHorizontal
    128 };
    129 
    130 enum EFillAttachment {
    131     ScrollBackgroundAttachment, LocalBackgroundAttachment, FixedBackgroundAttachment
    132 };
    133 
    134 enum EFillBox {
    135     BorderFillBox, PaddingFillBox, ContentFillBox, TextFillBox
    136 };
    137 
    138 enum EFillRepeat {
    139     RepeatFill, NoRepeatFill, RoundFill, SpaceFill
    140 };
    141 
    142 enum EFillLayerType {
    143     BackgroundFillLayer, MaskFillLayer
    144 };
    145 
    146 // CSS3 Background Values
    147 enum EFillSizeType { Contain, Cover, SizeLength, SizeNone };
    148 
    149 // CSS3 Background Position
    150 enum BackgroundEdgeOrigin { TopEdge, RightEdge, BottomEdge, LeftEdge };
    151 
    152 // CSS Mask Source Types
    153 enum EMaskSourceType { MaskAlpha, MaskLuminance };
    154 
    155 // CSS3 Marquee Properties
    156 
    157 enum EMarqueeBehavior { MNONE, MSCROLL, MSLIDE, MALTERNATE };
    158 enum EMarqueeDirection { MAUTO = 0, MLEFT = 1, MRIGHT = -1, MUP = 2, MDOWN = -2, MFORWARD = 3, MBACKWARD = -3 };
    159 
    160 // Deprecated Flexible Box Properties
    161 
    162 enum EBoxPack { Start, Center, End, Justify };
    163 enum EBoxAlignment { BSTRETCH, BSTART, BCENTER, BEND, BBASELINE };
    164 enum EBoxOrient { HORIZONTAL, VERTICAL };
    165 enum EBoxLines { SINGLE, MULTIPLE };
    166 enum EBoxDirection { BNORMAL, BREVERSE };
    167 
    168 // CSS3 Flexbox Properties
    169 
    170 enum EAlignContent { AlignContentFlexStart, AlignContentFlexEnd, AlignContentCenter, AlignContentSpaceBetween, AlignContentSpaceAround, AlignContentStretch };
    171 enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse };
    172 enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse };
    173 enum EJustifyContent { JustifyFlexStart, JustifyFlexEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround };
    174 
    175 enum ETextSecurity {
    176     TSNONE, TSDISC, TSCIRCLE, TSSQUARE
    177 };
    178 
    179 // CSS3 User Modify Properties
    180 
    181 enum EUserModify {
    182     READ_ONLY, READ_WRITE, READ_WRITE_PLAINTEXT_ONLY
    183 };
    184 
    185 // CSS3 User Drag Values
    186 
    187 enum EUserDrag {
    188     DRAG_AUTO, DRAG_NONE, DRAG_ELEMENT
    189 };
    190 
    191 // CSS3 User Select Values
    192 
    193 enum EUserSelect {
    194     SELECT_NONE, SELECT_TEXT, SELECT_ALL
    195 };
    196 
    197 // CSS3 Image Values
    198 enum ObjectFit { ObjectFitFill, ObjectFitContain, ObjectFitCover, ObjectFitNone, ObjectFitScaleDown };
    199 
    200 // Word Break Values. Matches WinIE, rather than CSS3
    201 
    202 enum EWordBreak {
    203     NormalWordBreak, BreakAllWordBreak, BreakWordBreak
    204 };
    205 
    206 enum EOverflowWrap {
    207     NormalOverflowWrap, BreakOverflowWrap
    208 };
    209 
    210 enum LineBreak {
    211     LineBreakAuto, LineBreakLoose, LineBreakNormal, LineBreakStrict, LineBreakAfterWhiteSpace
    212 };
    213 
    214 enum EResize {
    215     RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL
    216 };
    217 
    218 // The order of this enum must match the order of the list style types in CSSValueKeywords.in.
    219 enum EListStyleType {
    220     Disc,
    221     Circle,
    222     Square,
    223     DecimalListStyle,
    224     DecimalLeadingZero,
    225     ArabicIndic,
    226     BinaryListStyle,
    227     Bengali,
    228     Cambodian,
    229     Khmer,
    230     Devanagari,
    231     Gujarati,
    232     Gurmukhi,
    233     Kannada,
    234     LowerHexadecimal,
    235     Lao,
    236     Malayalam,
    237     Mongolian,
    238     Myanmar,
    239     Octal,
    240     Oriya,
    241     Persian,
    242     Urdu,
    243     Telugu,
    244     Tibetan,
    245     Thai,
    246     UpperHexadecimal,
    247     LowerRoman,
    248     UpperRoman,
    249     LowerGreek,
    250     LowerAlpha,
    251     LowerLatin,
    252     UpperAlpha,
    253     UpperLatin,
    254     Afar,
    255     EthiopicHalehameAaEt,
    256     EthiopicHalehameAaEr,
    257     Amharic,
    258     EthiopicHalehameAmEt,
    259     AmharicAbegede,
    260     EthiopicAbegedeAmEt,
    261     CjkEarthlyBranch,
    262     CjkHeavenlyStem,
    263     Ethiopic,
    264     EthiopicHalehameGez,
    265     EthiopicAbegede,
    266     EthiopicAbegedeGez,
    267     HangulConsonant,
    268     Hangul,
    269     LowerNorwegian,
    270     Oromo,
    271     EthiopicHalehameOmEt,
    272     Sidama,
    273     EthiopicHalehameSidEt,
    274     Somali,
    275     EthiopicHalehameSoEt,
    276     Tigre,
    277     EthiopicHalehameTig,
    278     TigrinyaEr,
    279     EthiopicHalehameTiEr,
    280     TigrinyaErAbegede,
    281     EthiopicAbegedeTiEr,
    282     TigrinyaEt,
    283     EthiopicHalehameTiEt,
    284     TigrinyaEtAbegede,
    285     EthiopicAbegedeTiEt,
    286     UpperGreek,
    287     UpperNorwegian,
    288     Asterisks,
    289     Footnotes,
    290     Hebrew,
    291     Armenian,
    292     LowerArmenian,
    293     UpperArmenian,
    294     Georgian,
    295     CJKIdeographic,
    296     Hiragana,
    297     Katakana,
    298     HiraganaIroha,
    299     KatakanaIroha,
    300     NoneListStyle
    301 };
    302 
    303 enum QuoteType {
    304     OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE
    305 };
    306 
    307 enum EBorderFit { BorderFitBorder, BorderFitLines };
    308 
    309 enum EAnimPlayState {
    310     AnimPlayStatePlaying,
    311     AnimPlayStatePaused
    312 };
    313 
    314 enum EWhiteSpace {
    315     NORMAL, PRE, PRE_WRAP, PRE_LINE, NOWRAP, KHTML_NOWRAP
    316 };
    317 
    318 // The order of this enum must match the order of the text align values in CSSValueKeywords.in.
    319 enum ETextAlign {
    320     LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
    321 };
    322 
    323 enum ETextTransform {
    324     CAPITALIZE, UPPERCASE, LOWERCASE, TTNONE
    325 };
    326 
    327 static const size_t TextDecorationBits = 4;
    328 enum TextDecoration {
    329     TextDecorationNone = 0x0,
    330     TextDecorationUnderline = 0x1,
    331     TextDecorationOverline = 0x2,
    332     TextDecorationLineThrough = 0x4,
    333     TextDecorationBlink = 0x8
    334 };
    335 inline TextDecoration operator| (TextDecoration a, TextDecoration b) { return TextDecoration(int(a) | int(b)); }
    336 inline TextDecoration& operator|= (TextDecoration& a, TextDecoration b) { return a = a | b; }
    337 
    338 enum TextDecorationStyle {
    339     TextDecorationStyleSolid,
    340     TextDecorationStyleDouble,
    341     TextDecorationStyleDotted,
    342     TextDecorationStyleDashed,
    343     TextDecorationStyleWavy
    344 };
    345 
    346 enum TextAlignLast {
    347     TextAlignLastAuto, TextAlignLastStart, TextAlignLastEnd, TextAlignLastLeft, TextAlignLastRight, TextAlignLastCenter, TextAlignLastJustify
    348 };
    349 
    350 enum TextJustify {
    351     TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyDistribute
    352 };
    353 
    354 enum TextUnderlinePosition {
    355     // FIXME: Implement support for 'under left' and 'under right' values.
    356     TextUnderlinePositionAuto,
    357     TextUnderlinePositionUnder
    358 };
    359 
    360 enum EPageBreak {
    361     PBAUTO, PBALWAYS, PBAVOID
    362 };
    363 
    364 enum EEmptyCell {
    365     SHOW, HIDE
    366 };
    367 
    368 enum ECaptionSide {
    369     CAPTOP, CAPBOTTOM, CAPLEFT, CAPRIGHT
    370 };
    371 
    372 enum EListStylePosition { OUTSIDE, INSIDE };
    373 
    374 enum EVisibility { VISIBLE, HIDDEN, COLLAPSE };
    375 
    376 enum ECursor {
    377     // The following must match the order in CSSValueKeywords.in.
    378     CURSOR_AUTO,
    379     CURSOR_CROSS,
    380     CURSOR_DEFAULT,
    381     CURSOR_POINTER,
    382     CURSOR_MOVE,
    383     CURSOR_VERTICAL_TEXT,
    384     CURSOR_CELL,
    385     CURSOR_CONTEXT_MENU,
    386     CURSOR_ALIAS,
    387     CURSOR_PROGRESS,
    388     CURSOR_NO_DROP,
    389     CURSOR_NOT_ALLOWED,
    390     CURSOR_ZOOM_IN,
    391     CURSOR_ZOOM_OUT,
    392     CURSOR_E_RESIZE,
    393     CURSOR_NE_RESIZE,
    394     CURSOR_NW_RESIZE,
    395     CURSOR_N_RESIZE,
    396     CURSOR_SE_RESIZE,
    397     CURSOR_SW_RESIZE,
    398     CURSOR_S_RESIZE,
    399     CURSOR_W_RESIZE,
    400     CURSOR_EW_RESIZE,
    401     CURSOR_NS_RESIZE,
    402     CURSOR_NESW_RESIZE,
    403     CURSOR_NWSE_RESIZE,
    404     CURSOR_COL_RESIZE,
    405     CURSOR_ROW_RESIZE,
    406     CURSOR_TEXT,
    407     CURSOR_WAIT,
    408     CURSOR_HELP,
    409     CURSOR_ALL_SCROLL,
    410     CURSOR_WEBKIT_GRAB,
    411     CURSOR_WEBKIT_GRABBING,
    412 
    413     // The following are handled as exceptions so don't need to match.
    414     CURSOR_COPY,
    415     CURSOR_NONE
    416 };
    417 
    418 // The order of this enum must match the order of the display values in CSSValueKeywords.in.
    419 enum EDisplay {
    420     INLINE, BLOCK, LIST_ITEM, INLINE_BLOCK,
    421     TABLE, INLINE_TABLE, TABLE_ROW_GROUP,
    422     TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,
    423     TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,
    424     TABLE_CAPTION, BOX, INLINE_BOX,
    425     FLEX, INLINE_FLEX,
    426     GRID, INLINE_GRID,
    427     NONE,
    428     FIRST_TABLE_DISPLAY = TABLE,
    429     LAST_TABLE_DISPLAY = TABLE_CAPTION
    430 };
    431 
    432 enum EInsideLink {
    433     NotInsideLink, InsideUnvisitedLink, InsideVisitedLink
    434 };
    435 
    436 enum EPointerEvents {
    437     PE_NONE, PE_AUTO, PE_STROKE, PE_FILL, PE_PAINTED, PE_VISIBLE,
    438     PE_VISIBLE_STROKE, PE_VISIBLE_FILL, PE_VISIBLE_PAINTED, PE_BOUNDINGBOX,
    439     PE_ALL
    440 };
    441 
    442 enum ETransformStyle3D {
    443     TransformStyle3DFlat, TransformStyle3DPreserve3D
    444 };
    445 
    446 enum EBackfaceVisibility {
    447     BackfaceVisibilityVisible, BackfaceVisibilityHidden
    448 };
    449 
    450 enum ELineClampType { LineClampLineCount, LineClampPercentage };
    451 
    452 enum Hyphens { HyphensNone, HyphensManual, HyphensAuto };
    453 
    454 enum ESpeak { SpeakNone, SpeakNormal, SpeakSpellOut, SpeakDigits, SpeakLiteralPunctuation, SpeakNoPunctuation };
    455 
    456 enum TextEmphasisFill { TextEmphasisFillFilled, TextEmphasisFillOpen };
    457 
    458 enum TextEmphasisMark { TextEmphasisMarkNone, TextEmphasisMarkAuto, TextEmphasisMarkDot, TextEmphasisMarkCircle, TextEmphasisMarkDoubleCircle, TextEmphasisMarkTriangle, TextEmphasisMarkSesame, TextEmphasisMarkCustom };
    459 
    460 enum TextEmphasisPosition { TextEmphasisPositionOver, TextEmphasisPositionUnder };
    461 
    462 enum TextOrientation { TextOrientationVerticalRight, TextOrientationUpright, TextOrientationSideways, TextOrientationSidewaysRight };
    463 
    464 enum TextOverflow { TextOverflowClip = 0, TextOverflowEllipsis };
    465 
    466 enum EImageRendering { ImageRenderingAuto, ImageRenderingOptimizeSpeed, ImageRenderingOptimizeQuality, ImageRenderingOptimizeContrast, ImageRenderingPixelated };
    467 
    468 enum ImageResolutionSource { ImageResolutionSpecified = 0, ImageResolutionFromImage };
    469 
    470 enum ImageResolutionSnap { ImageResolutionNoSnap = 0, ImageResolutionSnapPixels };
    471 
    472 enum Order { LogicalOrder = 0, VisualOrder };
    473 
    474 enum WrapFlow { WrapFlowAuto, WrapFlowBoth, WrapFlowStart, WrapFlowEnd, WrapFlowMaximum, WrapFlowClear };
    475 
    476 enum WrapThrough { WrapThroughWrap, WrapThroughNone };
    477 
    478 enum RubyPosition { RubyPositionBefore, RubyPositionAfter };
    479 
    480 static const size_t GridAutoFlowBits = 5;
    481 enum InternalGridAutoFlowAlgorithm {
    482     InternalAutoFlowAlgorithmSparse = 0x1,
    483     InternalAutoFlowAlgorithmDense = 0x2,
    484     InternalAutoFlowAlgorithmStack = 0x4
    485 };
    486 
    487 enum InternalGridAutoFlowDirection {
    488     InternalAutoFlowDirectionRow = 0x8,
    489     InternalAutoFlowDirectionColumn = 0x10
    490 };
    491 
    492 enum GridAutoFlow {
    493     AutoFlowRow = InternalAutoFlowAlgorithmSparse | InternalAutoFlowDirectionRow,
    494     AutoFlowColumn = InternalAutoFlowAlgorithmSparse | InternalAutoFlowDirectionColumn,
    495     AutoFlowRowDense = InternalAutoFlowAlgorithmDense | InternalAutoFlowDirectionRow,
    496     AutoFlowColumnDense = InternalAutoFlowAlgorithmDense | InternalAutoFlowDirectionColumn,
    497     AutoFlowStackRow = InternalAutoFlowAlgorithmStack | InternalAutoFlowDirectionRow,
    498     AutoFlowStackColumn = InternalAutoFlowAlgorithmStack | InternalAutoFlowDirectionColumn
    499 };
    500 
    501 enum DraggableRegionMode { DraggableRegionNone, DraggableRegionDrag, DraggableRegionNoDrag };
    502 
    503 static const size_t TouchActionBits = 4;
    504 enum TouchAction {
    505     TouchActionAuto = 0x0,
    506     TouchActionNone = 0x1,
    507     TouchActionPanX = 0x2,
    508     TouchActionPanY = 0x4,
    509     TouchActionPinchZoom = 0x8,
    510 };
    511 inline TouchAction operator| (TouchAction a, TouchAction b) { return TouchAction(int(a) | int(b)); }
    512 inline TouchAction& operator|= (TouchAction& a, TouchAction b) { return a = a | b; }
    513 inline TouchAction operator& (TouchAction a, TouchAction b) { return TouchAction(int(a) & int(b)); }
    514 inline TouchAction& operator&= (TouchAction& a, TouchAction b) { return a = a & b; }
    515 
    516 enum EIsolation { IsolationAuto, IsolationIsolate };
    517 
    518 enum TouchActionDelay { TouchActionDelayNone, TouchActionDelayScript };
    519 
    520 enum ItemPosition {
    521     ItemPositionAuto,
    522     ItemPositionStretch,
    523     ItemPositionBaseline,
    524     ItemPositionLastBaseline,
    525     ItemPositionCenter,
    526     ItemPositionStart,
    527     ItemPositionEnd,
    528     ItemPositionSelfStart,
    529     ItemPositionSelfEnd,
    530     ItemPositionFlexStart,
    531     ItemPositionFlexEnd,
    532     ItemPositionLeft,
    533     ItemPositionRight
    534 };
    535 
    536 enum OverflowAlignment {
    537     OverflowAlignmentDefault,
    538     OverflowAlignmentTrue,
    539     OverflowAlignmentSafe
    540 };
    541 
    542 enum ItemPositionType {
    543     NonLegacyPosition,
    544     LegacyPosition
    545 };
    546 
    547 // Reasonable maximum to prevent insane font sizes from causing crashes on some platforms (such as Windows).
    548 static const float maximumAllowedFontSize = 1000000.0f;
    549 
    550 enum TextIndentLine { TextIndentFirstLine, TextIndentEachLine };
    551 enum TextIndentType { TextIndentNormal, TextIndentHanging };
    552 
    553 enum CSSBoxType { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox };
    554 
    555 } // namespace blink
    556 
    557 #endif // RenderStyleConstants_h
    558