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