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/)
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.
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.
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.
28 #include <initializer_list>
36 static const size_t PrintColorAdjustBits = 1;
37 enum PrintColorAdjust {
38 PrintColorAdjustEconomy,
42 // The difference between two styles. The following values are used:
43 // - StyleDifferenceEqual - The two styles are identical
44 // - StyleDifferenceRecompositeLayer - The layer needs its position and transform updated, but no repaint
45 // - StyleDifferenceRepaint - The object just needs to be repainted.
46 // - StyleDifferenceRepaintIfTextOrBorderOrOutline - The object needs to be repainted if it contains text or a border or outline.
47 // - StyleDifferenceRepaintLayer - The layer and its descendant layers needs to be repainted.
48 // - StyleDifferenceLayoutPositionedMovementOnly - Only the position of this positioned object has been updated
49 // - StyleDifferenceSimplifiedLayout - Only overflow needs to be recomputed
50 // - StyleDifferenceSimplifiedLayoutAndPositionedMovement - Both positioned movement and simplified layout updates are required.
51 // - StyleDifferenceLayout - A full layout is required.
52 enum StyleDifference {
54 StyleDifferenceRecompositeLayer,
55 StyleDifferenceRepaint,
56 StyleDifferenceRepaintIfTextOrBorderOrOutline,
57 StyleDifferenceRepaintLayer,
58 StyleDifferenceLayoutPositionedMovementOnly,
59 StyleDifferenceSimplifiedLayout,
60 StyleDifferenceSimplifiedLayoutAndPositionedMovement,
61 StyleDifferenceLayout,
62 StyleDifferenceNewStyle
65 // When some style properties change, different amounts of work have to be done depending on
66 // context (e.g. whether the property is changing on an element which has a compositing layer).
67 // A simple StyleDifference does not provide enough information so we return a bit mask of
68 // StyleDifferenceContextSensitiveProperties from RenderStyle::diff() too.
69 enum StyleDifferenceContextSensitiveProperty {
70 ContextSensitivePropertyNone = 0,
71 ContextSensitivePropertyTransform = 1 << 0,
72 ContextSensitivePropertyOpacity = 1 << 1,
73 ContextSensitivePropertyFilter = 1 << 2,
74 ContextSensitivePropertyClipRect = 1 << 3,
75 ContextSensitivePropertyClipPath = 1 << 4,
76 ContextSensitivePropertyWillChange = 1 << 5,
79 // Static pseudo styles. Dynamic ones are produced on the fly.
80 enum PseudoId : unsigned char {
81 // The order must be NOP ID, public IDs, and then internal IDs.
82 NOPSEUDO, FIRST_LINE, FIRST_LETTER, MARKER, BEFORE, AFTER, SELECTION, SCROLLBAR,
83 // Internal IDs follow:
84 SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
85 AFTER_LAST_INTERNAL_PSEUDOID,
86 FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
87 FIRST_INTERNAL_PSEUDOID = SCROLLBAR_THUMB,
88 PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
98 PseudoIdSet(std::initializer_list<PseudoId> initializerList)
101 for (PseudoId pseudoId : initializerList)
105 static PseudoIdSet fromMask(unsigned rawPseudoIdSet)
107 return PseudoIdSet(rawPseudoIdSet);
110 bool has(PseudoId pseudoId) const
112 ASSERT((sizeof(m_data) * 8) > pseudoId);
113 return m_data & (1U << pseudoId);
116 void add(PseudoId pseudoId)
118 ASSERT((sizeof(m_data) * 8) > pseudoId);
119 m_data |= (1U << pseudoId);
122 void merge(PseudoIdSet source)
124 m_data |= source.m_data;
127 PseudoIdSet operator &(const PseudoIdSet& pseudoIdSet) const
129 return PseudoIdSet(m_data & pseudoIdSet.m_data);
132 PseudoIdSet operator |(const PseudoIdSet& pseudoIdSet) const
134 return PseudoIdSet(m_data | pseudoIdSet.m_data);
137 explicit operator bool() const
142 unsigned data() const { return m_data; }
144 static ptrdiff_t dataMemoryOffset() { return OBJECT_OFFSETOF(PseudoIdSet, m_data); }
147 explicit PseudoIdSet(unsigned rawPseudoIdSet)
148 : m_data(rawPseudoIdSet)
155 enum ColumnFill { ColumnFillBalance, ColumnFillAuto };
157 enum ColumnSpan { ColumnSpanNone = 0, ColumnSpanAll };
159 enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 };
161 // These have been defined in the order of their precedence for border-collapsing. Do
162 // not change this order! This order also must match the order in CSSValueKeywords.in.
163 enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, OUTSET, RIDGE, DOTTED, DASHED, SOLID, DOUBLE };
165 enum EBorderPrecedence { BOFF, BTABLE, BCOLGROUP, BCOL, BROWGROUP, BROW, BCELL };
167 enum OutlineIsAuto { AUTO_OFF = 0, AUTO_ON };
171 RelativePosition = 1,
172 AbsolutePosition = 2,
174 // This value is required to pack our bits efficiently in RenderObject.
179 NoFloat, LeftFloat, RightFloat
182 enum EMarginCollapse { MCOLLAPSE, MSEPARATE, MDISCARD };
184 // Box decoration attributes. Not inherited.
186 enum EBoxDecorationBreak { DSLICE, DCLONE };
188 // Box attributes. Not inherited.
190 enum EBoxSizing { CONTENT_BOX, BORDER_BOX };
192 // Random visual rendering model attributes. Not inherited.
195 OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OPAGEDX, OPAGEDY
198 enum EVerticalAlign {
199 BASELINE, MIDDLE, SUB, SUPER, TEXT_TOP,
200 TEXT_BOTTOM, TOP, BOTTOM, BASELINE_MIDDLE, LENGTH
204 CNONE = 0, CLEFT = 1, CRIGHT = 2, CBOTH = 3
212 TextCombineNone, TextCombineHorizontal
215 enum EFillAttachment {
216 ScrollBackgroundAttachment, LocalBackgroundAttachment, FixedBackgroundAttachment
220 BorderFillBox, PaddingFillBox, ContentFillBox, TextFillBox
224 RepeatFill, NoRepeatFill, RoundFill, SpaceFill
227 enum EFillLayerType {
228 BackgroundFillLayer, MaskFillLayer
231 // CSS3 Background Values
232 enum EFillSizeType { Contain, Cover, SizeLength, SizeNone };
235 enum class Edge { Top, Right, Bottom, Left };
237 // CSS3 Mask Source Types
238 enum EMaskSourceType { MaskAlpha, MaskLuminance };
240 // CSS3 Marquee Properties
242 enum EMarqueeBehavior { MNONE, MSCROLL, MSLIDE, MALTERNATE };
243 enum EMarqueeDirection { MAUTO = 0, MLEFT = 1, MRIGHT = -1, MUP = 2, MDOWN = -2, MFORWARD = 3, MBACKWARD = -3 };
245 // Deprecated Flexible Box Properties
247 enum EBoxPack { Start, Center, End, Justify };
248 enum EBoxAlignment { BSTRETCH, BSTART, BCENTER, BEND, BBASELINE };
249 enum EBoxOrient { HORIZONTAL, VERTICAL };
250 enum EBoxLines { SINGLE, MULTIPLE };
251 enum EBoxDirection { BNORMAL, BREVERSE };
253 // CSS3 Flexbox Properties
255 enum EAlignContent { AlignContentFlexStart, AlignContentFlexEnd, AlignContentCenter, AlignContentSpaceBetween, AlignContentSpaceAround, AlignContentStretch };
256 enum EFlexDirection { FlowRow, FlowRowReverse, FlowColumn, FlowColumnReverse };
257 enum EFlexWrap { FlexNoWrap, FlexWrap, FlexWrapReverse };
258 enum ItemPosition { ItemPositionAuto, ItemPositionNormal, ItemPositionStretch, ItemPositionBaseline, ItemPositionLastBaseline, ItemPositionCenter, ItemPositionStart, ItemPositionEnd, ItemPositionSelfStart, ItemPositionSelfEnd, ItemPositionFlexStart, ItemPositionFlexEnd, ItemPositionLeft, ItemPositionRight };
259 enum OverflowAlignment { OverflowAlignmentDefault, OverflowAlignmentUnsafe, OverflowAlignmentSafe };
260 enum ItemPositionType { NonLegacyPosition, LegacyPosition };
261 enum ContentPosition { ContentPositionNormal, ContentPositionBaseline, ContentPositionLastBaseline, ContentPositionCenter, ContentPositionStart, ContentPositionEnd, ContentPositionFlexStart, ContentPositionFlexEnd, ContentPositionLeft, ContentPositionRight };
262 enum ContentDistributionType { ContentDistributionDefault, ContentDistributionSpaceBetween, ContentDistributionSpaceAround, ContentDistributionSpaceEvenly, ContentDistributionStretch };
265 TSNONE, TSDISC, TSCIRCLE, TSSQUARE
268 // CSS3 User Modify Properties
271 READ_ONLY, READ_WRITE, READ_WRITE_PLAINTEXT_ONLY
274 // CSS3 User Drag Values
277 DRAG_AUTO, DRAG_NONE, DRAG_ELEMENT
280 // CSS3 User Select Values
283 SELECT_NONE, SELECT_TEXT, SELECT_ALL
288 ObjectFitFill, ObjectFitContain, ObjectFitCover, ObjectFitNone, ObjectFitScaleDown
291 enum AspectRatioType {
292 AspectRatioAuto, AspectRatioFromIntrinsic, AspectRatioFromDimensions, AspectRatioSpecified
296 NormalWordBreak, BreakAllWordBreak, KeepAllWordBreak, BreakWordBreak
300 NormalOverflowWrap, BreakOverflowWrap
308 LineBreakAuto, LineBreakLoose, LineBreakNormal, LineBreakStrict, LineBreakAfterWhiteSpace
312 RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL
315 // The order of this enum must match the order of the list style types in CSSValueKeywords.in.
316 enum EListStyleType {
352 EthiopicHalehameAaEt,
353 EthiopicHalehameAaEr,
355 EthiopicHalehameAmEt,
368 EthiopicHalehameOmEt,
370 EthiopicHalehameSidEt,
372 EthiopicHalehameSoEt,
376 EthiopicHalehameTiEr,
380 EthiopicHalehameTiEt,
401 OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE
404 enum EBorderFit { BorderFitBorder, BorderFitLines };
406 enum EAnimationFillMode { AnimationFillModeNone, AnimationFillModeForwards, AnimationFillModeBackwards, AnimationFillModeBoth };
408 enum EAnimPlayState {
409 AnimPlayStatePlaying = 0x0,
410 AnimPlayStatePaused = 0x1
414 NORMAL, PRE, PRE_WRAP, PRE_LINE, NOWRAP, KHTML_NOWRAP
417 // The order of this enum must match the order of the text align values in CSSValueKeywords.in.
419 LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
422 enum ETextTransform {
423 CAPITALIZE, UPPERCASE, LOWERCASE, TTNONE
426 #if ENABLE(LETTERPRESS)
427 static const size_t TextDecorationBits = 5;
429 static const size_t TextDecorationBits = 4;
431 enum TextDecoration {
432 TextDecorationNone = 0x0,
433 TextDecorationUnderline = 0x1,
434 TextDecorationOverline = 0x2,
435 TextDecorationLineThrough = 0x4,
436 TextDecorationBlink = 0x8,
437 #if ENABLE(LETTERPRESS)
438 TextDecorationLetterpress = 0x10,
441 inline TextDecoration operator| (TextDecoration a, TextDecoration b) { return TextDecoration(int(a) | int(b)); }
442 inline TextDecoration& operator|= (TextDecoration& a, TextDecoration b) { return a = a | b; }
444 enum TextDecorationStyle {
445 TextDecorationStyleSolid,
446 TextDecorationStyleDouble,
447 TextDecorationStyleDotted,
448 TextDecorationStyleDashed,
449 TextDecorationStyleWavy
452 #if ENABLE(CSS3_TEXT)
454 TextAlignLastAuto, TextAlignLastStart, TextAlignLastEnd, TextAlignLastLeft, TextAlignLastRight, TextAlignLastCenter, TextAlignLastJustify
458 TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyDistribute
462 enum TextDecorationSkipItems {
463 TextDecorationSkipNone = 0,
464 TextDecorationSkipInk = 1 << 0,
465 TextDecorationSkipObjects = 1 << 1,
466 TextDecorationSkipAuto = 1 << 2
468 typedef unsigned TextDecorationSkip;
470 enum TextUnderlinePosition {
471 // FIXME: Implement support for 'under left' and 'under right' values.
472 TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4
476 TextZoomNormal, TextZoomReset
480 AutoBreakBetween, AvoidBreakBetween, AvoidColumnBreakBetween, AvoidPageBreakBetween, AvoidRegionBreakBetween, ColumnBreakBetween, RegionBreakBetween, PageBreakBetween, LeftPageBreakBetween, RightPageBreakBetween, RectoPageBreakBetween, VersoPageBreakBetween
482 bool alwaysPageBreak(BreakBetween);
485 AutoBreakInside, AvoidBreakInside, AvoidColumnBreakInside, AvoidPageBreakInside, AvoidRegionBreakInside
488 enum HangingPunctuation {
489 NoHangingPunctuation = 0,
490 FirstHangingPunctuation = 1 << 0,
491 LastHangingPunctuation = 1 << 1,
492 AllowEndHangingPunctuation = 1 << 2,
493 ForceEndHangingPunctuation = 1 << 3
495 inline HangingPunctuation operator| (HangingPunctuation a, HangingPunctuation b) { return HangingPunctuation(int(a) | int(b)); }
496 inline HangingPunctuation& operator|= (HangingPunctuation& a, HangingPunctuation b) { return a = a | b; }
503 CAPTOP, CAPBOTTOM, CAPLEFT, CAPRIGHT
506 enum EListStylePosition { OUTSIDE, INSIDE };
508 enum EVisibility { VISIBLE, HIDDEN, COLLAPSE };
511 // The following must match the order in CSSValueKeywords.in.
549 // The following are handled as exceptions so don't need to match.
554 #if ENABLE(CURSOR_VISIBILITY)
555 enum CursorVisibility {
556 CursorVisibilityAuto,
557 CursorVisibilityAutoHide,
561 // The order of this enum must match the order of the display values in CSSValueKeywords.in.
563 INLINE, BLOCK, LIST_ITEM, COMPACT, INLINE_BLOCK,
564 TABLE, INLINE_TABLE, TABLE_ROW_GROUP,
565 TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW,
566 TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,
567 TABLE_CAPTION, BOX, INLINE_BOX,
568 FLEX, WEBKIT_FLEX, INLINE_FLEX, WEBKIT_INLINE_FLEX,
569 CONTENTS, GRID, INLINE_GRID, NONE
573 NotInsideLink, InsideUnvisitedLink, InsideVisitedLink
576 enum EPointerEvents {
577 PE_NONE, PE_AUTO, PE_STROKE, PE_FILL, PE_PAINTED, PE_VISIBLE,
578 PE_VISIBLE_STROKE, PE_VISIBLE_FILL, PE_VISIBLE_PAINTED, PE_ALL
581 enum ETransformStyle3D {
582 TransformStyle3DFlat, TransformStyle3DPreserve3D
585 enum EBackfaceVisibility {
586 BackfaceVisibilityVisible, BackfaceVisibilityHidden
589 enum class TransformBox {
595 enum ELineClampType { LineClampLineCount, LineClampPercentage };
597 enum Hyphens { HyphensNone, HyphensManual, HyphensAuto };
599 enum ESpeak { SpeakNone, SpeakNormal, SpeakSpellOut, SpeakDigits, SpeakLiteralPunctuation, SpeakNoPunctuation };
601 enum TextEmphasisFill { TextEmphasisFillFilled, TextEmphasisFillOpen };
603 enum TextEmphasisMark { TextEmphasisMarkNone, TextEmphasisMarkAuto, TextEmphasisMarkDot, TextEmphasisMarkCircle, TextEmphasisMarkDoubleCircle, TextEmphasisMarkTriangle, TextEmphasisMarkSesame, TextEmphasisMarkCustom };
605 enum TextEmphasisPositions {
606 TextEmphasisPositionOver = 1 << 0,
607 TextEmphasisPositionUnder = 1 << 1,
608 TextEmphasisPositionLeft = 1 << 2,
609 TextEmphasisPositionRight = 1 << 3
611 typedef unsigned TextEmphasisPosition;
613 enum class TextOrientation { Mixed, Upright, Sideways };
615 enum TextOverflow { TextOverflowClip = 0, TextOverflowEllipsis };
617 enum EImageRendering {
618 ImageRenderingAuto = 0,
619 ImageRenderingOptimizeSpeed,
620 ImageRenderingOptimizeQuality,
621 ImageRenderingCrispEdges,
622 ImageRenderingPixelated
625 enum ImageResolutionSource { ImageResolutionSpecified = 0, ImageResolutionFromImage };
627 enum ImageResolutionSnap { ImageResolutionNoSnap = 0, ImageResolutionSnapPixels };
629 enum Order { LogicalOrder = 0, VisualOrder };
631 enum RegionFragment { AutoRegionFragment, BreakRegionFragment };
633 enum ColumnAxis { HorizontalColumnAxis, VerticalColumnAxis, AutoColumnAxis };
635 enum ColumnProgression { NormalColumnProgression, ReverseColumnProgression };
637 enum LineSnap { LineSnapNone, LineSnapBaseline, LineSnapContain };
639 enum LineAlign { LineAlignNone, LineAlignEdges };
641 enum RubyPosition { RubyPositionBefore, RubyPositionAfter, RubyPositionInterCharacter };
643 static const size_t GridAutoFlowBits = 4;
644 enum InternalGridAutoFlowAlgorithm {
645 InternalAutoFlowAlgorithmSparse = 0x1,
646 InternalAutoFlowAlgorithmDense = 0x2,
649 enum InternalGridAutoFlowDirection {
650 InternalAutoFlowDirectionRow = 0x4,
651 InternalAutoFlowDirectionColumn = 0x8
655 AutoFlowRow = InternalAutoFlowAlgorithmSparse | InternalAutoFlowDirectionRow,
656 AutoFlowColumn = InternalAutoFlowAlgorithmSparse | InternalAutoFlowDirectionColumn,
657 AutoFlowRowDense = InternalAutoFlowAlgorithmDense | InternalAutoFlowDirectionRow,
658 AutoFlowColumnDense = InternalAutoFlowAlgorithmDense | InternalAutoFlowDirectionColumn
661 enum AutoRepeatType {
667 // Reasonable maximum to prevent insane font sizes from causing crashes on some platforms (such as Windows).
668 static const float maximumAllowedFontSize = 1000000.0f;
670 #if ENABLE(CSS3_TEXT)
671 enum TextIndentLine { TextIndentFirstLine, TextIndentEachLine };
672 enum TextIndentType { TextIndentNormal, TextIndentHanging };
675 enum Isolation { IsolationAuto, IsolationIsolate };
677 // Fill, Stroke, ViewBox are just used for SVG.
678 enum CSSBoxType { BoxMissing = 0, MarginBox, BorderBox, PaddingBox, ContentBox, Fill, Stroke, ViewBox };
680 #if ENABLE(TOUCH_EVENTS)
681 enum class TouchAction {
687 #if ENABLE(CSS_SCROLL_SNAP)
688 enum class ScrollSnapStrictness {
694 enum class ScrollSnapAxis {
702 enum class ScrollSnapAxisAlignType {
710 #if ENABLE(CSS_TRAILING_WORD)
711 enum class TrailingWord {
717 #if ENABLE(APPLE_PAY)
718 enum class ApplePayButtonStyle {
724 enum class ApplePayButtonType {
732 WTF::TextStream& operator<<(WTF::TextStream&, EFillSizeType);
733 WTF::TextStream& operator<<(WTF::TextStream&, EFillAttachment);
734 WTF::TextStream& operator<<(WTF::TextStream&, EFillBox);
735 WTF::TextStream& operator<<(WTF::TextStream&, EFillRepeat);
736 WTF::TextStream& operator<<(WTF::TextStream&, EMaskSourceType);
737 WTF::TextStream& operator<<(WTF::TextStream&, Edge);
739 // These are all minimized combinations of paint-order.
740 enum class PaintOrder {
750 enum class PaintType {
756 enum class FontLoadingBehavior {
757 Auto, Block, Swap, Fallback, Optional
760 extern const float defaultMiterLimit;
762 } // namespace WebCore