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