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