2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
3 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef CSSPrimitiveValueMappings_h
28 #define CSSPrimitiveValueMappings_h
30 #include "CSSPrimitiveValue.h"
31 #include "CSSValueKeywords.h"
32 #include "RenderStyle.h"
36 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e
)
41 m_value
.ident
= CSSValueNone
;
44 m_value
.ident
= CSSValueHidden
;
47 m_value
.ident
= CSSValueInset
;
50 m_value
.ident
= CSSValueGroove
;
53 m_value
.ident
= CSSValueRidge
;
56 m_value
.ident
= CSSValueOutset
;
59 m_value
.ident
= CSSValueDotted
;
62 m_value
.ident
= CSSValueDashed
;
65 m_value
.ident
= CSSValueSolid
;
68 m_value
.ident
= CSSValueDouble
;
73 template<> inline CSSPrimitiveValue::operator EBorderStyle() const
75 return (EBorderStyle
)(m_value
.ident
- CSSValueNone
);
78 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e
)
83 m_value
.ident
= CSSValueClear
;
86 m_value
.ident
= CSSValueCopy
;
88 case CompositeSourceOver
:
89 m_value
.ident
= CSSValueSourceOver
;
91 case CompositeSourceIn
:
92 m_value
.ident
= CSSValueSourceIn
;
94 case CompositeSourceOut
:
95 m_value
.ident
= CSSValueSourceOut
;
97 case CompositeSourceAtop
:
98 m_value
.ident
= CSSValueSourceAtop
;
100 case CompositeDestinationOver
:
101 m_value
.ident
= CSSValueDestinationOver
;
103 case CompositeDestinationIn
:
104 m_value
.ident
= CSSValueDestinationIn
;
106 case CompositeDestinationOut
:
107 m_value
.ident
= CSSValueDestinationOut
;
109 case CompositeDestinationAtop
:
110 m_value
.ident
= CSSValueDestinationAtop
;
113 m_value
.ident
= CSSValueXor
;
115 case CompositePlusDarker
:
116 m_value
.ident
= CSSValuePlusDarker
;
118 case CompositeHighlight
:
119 m_value
.ident
= CSSValueHighlight
;
121 case CompositePlusLighter
:
122 m_value
.ident
= CSSValuePlusLighter
;
127 template<> inline CSSPrimitiveValue::operator CompositeOperator() const
129 switch (m_value
.ident
) {
131 return CompositeClear
;
133 return CompositeCopy
;
134 case CSSValueSourceOver
:
135 return CompositeSourceOver
;
136 case CSSValueSourceIn
:
137 return CompositeSourceIn
;
138 case CSSValueSourceOut
:
139 return CompositeSourceOut
;
140 case CSSValueSourceAtop
:
141 return CompositeSourceAtop
;
142 case CSSValueDestinationOver
:
143 return CompositeDestinationOver
;
144 case CSSValueDestinationIn
:
145 return CompositeDestinationIn
;
146 case CSSValueDestinationOut
:
147 return CompositeDestinationOut
;
148 case CSSValueDestinationAtop
:
149 return CompositeDestinationAtop
;
152 case CSSValuePlusDarker
:
153 return CompositePlusDarker
;
154 case CSSValueHighlight
:
155 return CompositeHighlight
;
156 case CSSValuePlusLighter
:
157 return CompositePlusLighter
;
159 ASSERT_NOT_REACHED();
160 return CompositeClear
;
164 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e
)
169 m_value
.ident
= CSSValueNone
;
172 m_value
.ident
= CSSValueCheckbox
;
175 m_value
.ident
= CSSValueRadio
;
178 m_value
.ident
= CSSValuePushButton
;
180 case SquareButtonPart
:
181 m_value
.ident
= CSSValueSquareButton
;
184 m_value
.ident
= CSSValueButton
;
186 case ButtonBevelPart
:
187 m_value
.ident
= CSSValueButtonBevel
;
189 case DefaultButtonPart
:
190 m_value
.ident
= CSSValueDefaultButton
;
193 m_value
.ident
= CSSValueListbox
;
196 m_value
.ident
= CSSValueListitem
;
198 case MediaFullscreenButtonPart
:
199 m_value
.ident
= CSSValueMediaFullscreenButton
;
201 case MediaPlayButtonPart
:
202 m_value
.ident
= CSSValueMediaPlayButton
;
204 case MediaMuteButtonPart
:
205 m_value
.ident
= CSSValueMediaMuteButton
;
207 case MediaSeekBackButtonPart
:
208 m_value
.ident
= CSSValueMediaSeekBackButton
;
210 case MediaSeekForwardButtonPart
:
211 m_value
.ident
= CSSValueMediaSeekForwardButton
;
213 case MediaSliderPart
:
214 m_value
.ident
= CSSValueMediaSlider
;
216 case MediaSliderThumbPart
:
217 m_value
.ident
= CSSValueMediaSliderthumb
;
220 m_value
.ident
= CSSValueMenulist
;
222 case MenulistButtonPart
:
223 m_value
.ident
= CSSValueMenulistButton
;
225 case MenulistTextPart
:
226 m_value
.ident
= CSSValueMenulistText
;
228 case MenulistTextFieldPart
:
229 m_value
.ident
= CSSValueMenulistTextfield
;
231 case SliderHorizontalPart
:
232 m_value
.ident
= CSSValueSliderHorizontal
;
234 case SliderVerticalPart
:
235 m_value
.ident
= CSSValueSliderVertical
;
237 case SliderThumbHorizontalPart
:
238 m_value
.ident
= CSSValueSliderthumbHorizontal
;
240 case SliderThumbVerticalPart
:
241 m_value
.ident
= CSSValueSliderthumbVertical
;
244 m_value
.ident
= CSSValueCaret
;
246 case SearchFieldPart
:
247 m_value
.ident
= CSSValueSearchfield
;
249 case SearchFieldDecorationPart
:
250 m_value
.ident
= CSSValueSearchfieldDecoration
;
252 case SearchFieldResultsDecorationPart
:
253 m_value
.ident
= CSSValueSearchfieldResultsDecoration
;
255 case SearchFieldResultsButtonPart
:
256 m_value
.ident
= CSSValueSearchfieldResultsButton
;
258 case SearchFieldCancelButtonPart
:
259 m_value
.ident
= CSSValueSearchfieldCancelButton
;
262 m_value
.ident
= CSSValueTextfield
;
265 m_value
.ident
= CSSValueTextarea
;
267 case CapsLockIndicatorPart
:
268 m_value
.ident
= CSSValueCapsLockIndicator
;
273 template<> inline CSSPrimitiveValue::operator ControlPart() const
275 if (m_value
.ident
== CSSValueNone
)
276 return NoControlPart
;
278 return ControlPart(m_value
.ident
- CSSValueCheckbox
+ 1);
281 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e
)
286 m_value
.ident
= CSSValueBorder
;
289 m_value
.ident
= CSSValuePadding
;
292 m_value
.ident
= CSSValueContent
;
295 m_value
.ident
= CSSValueText
;
300 template<> inline CSSPrimitiveValue::operator EFillBox() const
302 switch (m_value
.ident
) {
304 return BorderFillBox
;
305 case CSSValuePadding
:
306 return PaddingFillBox
;
307 case CSSValueContent
:
308 return ContentFillBox
;
312 ASSERT_NOT_REACHED();
313 return BorderFillBox
;
317 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e
)
322 m_value
.ident
= CSSValueRepeat
;
325 m_value
.ident
= CSSValueRepeatX
;
328 m_value
.ident
= CSSValueRepeatY
;
331 m_value
.ident
= CSSValueNoRepeat
;
336 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
338 switch (m_value
.ident
) {
341 case CSSValueRepeatX
:
343 case CSSValueRepeatY
:
345 case CSSValueNoRepeat
:
348 ASSERT_NOT_REACHED();
353 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e
)
358 m_value
.ident
= CSSValueStretch
;
361 m_value
.ident
= CSSValueStart
;
364 m_value
.ident
= CSSValueCenter
;
367 m_value
.ident
= CSSValueEnd
;
370 m_value
.ident
= CSSValueBaseline
;
373 m_value
.ident
= CSSValueJustify
;
378 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
380 switch (m_value
.ident
) {
381 case CSSValueStretch
:
389 case CSSValueBaseline
:
391 case CSSValueJustify
:
394 ASSERT_NOT_REACHED();
399 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e
)
404 m_value
.ident
= CSSValueNormal
;
407 m_value
.ident
= CSSValueReverse
;
412 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
414 switch (m_value
.ident
) {
417 case CSSValueReverse
:
420 ASSERT_NOT_REACHED();
425 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e
)
430 m_value
.ident
= CSSValueSingle
;
433 m_value
.ident
= CSSValueMultiple
;
438 template<> inline CSSPrimitiveValue::operator EBoxLines() const
440 switch (m_value
.ident
) {
443 case CSSValueMultiple
:
446 ASSERT_NOT_REACHED();
451 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e
)
456 m_value
.ident
= CSSValueHorizontal
;
459 m_value
.ident
= CSSValueVertical
;
464 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
466 switch (m_value
.ident
) {
467 case CSSValueHorizontal
:
468 case CSSValueInlineAxis
:
470 case CSSValueVertical
:
473 ASSERT_NOT_REACHED();
478 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e
)
483 m_value
.ident
= CSSValueLeft
;
486 m_value
.ident
= CSSValueRight
;
489 m_value
.ident
= CSSValueTop
;
492 m_value
.ident
= CSSValueBottom
;
497 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
499 switch (m_value
.ident
) {
509 ASSERT_NOT_REACHED();
514 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e
)
519 m_value
.ident
= CSSValueNone
;
522 m_value
.ident
= CSSValueLeft
;
525 m_value
.ident
= CSSValueRight
;
528 m_value
.ident
= CSSValueBoth
;
533 template<> inline CSSPrimitiveValue::operator EClear() const
535 switch (m_value
.ident
) {
545 ASSERT_NOT_REACHED();
550 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e
)
555 m_value
.ident
= CSSValueAuto
;
558 m_value
.ident
= CSSValueCrosshair
;
561 m_value
.ident
= CSSValueDefault
;
564 m_value
.ident
= CSSValuePointer
;
567 m_value
.ident
= CSSValueMove
;
570 m_value
.ident
= CSSValueCell
;
572 case CURSOR_VERTICAL_TEXT
:
573 m_value
.ident
= CSSValueVerticalText
;
575 case CURSOR_CONTEXT_MENU
:
576 m_value
.ident
= CSSValueContextMenu
;
579 m_value
.ident
= CSSValueAlias
;
582 m_value
.ident
= CSSValueCopy
;
585 m_value
.ident
= CSSValueNone
;
587 case CURSOR_PROGRESS
:
588 m_value
.ident
= CSSValueProgress
;
591 m_value
.ident
= CSSValueNoDrop
;
593 case CURSOR_NOT_ALLOWED
:
594 m_value
.ident
= CSSValueNotAllowed
;
596 case CURSOR_WEBKIT_ZOOM_IN
:
597 m_value
.ident
= CSSValueWebkitZoomIn
;
599 case CURSOR_WEBKIT_ZOOM_OUT
:
600 m_value
.ident
= CSSValueWebkitZoomOut
;
602 case CURSOR_E_RESIZE
:
603 m_value
.ident
= CSSValueEResize
;
605 case CURSOR_NE_RESIZE
:
606 m_value
.ident
= CSSValueNeResize
;
608 case CURSOR_NW_RESIZE
:
609 m_value
.ident
= CSSValueNwResize
;
611 case CURSOR_N_RESIZE
:
612 m_value
.ident
= CSSValueNResize
;
614 case CURSOR_SE_RESIZE
:
615 m_value
.ident
= CSSValueSeResize
;
617 case CURSOR_SW_RESIZE
:
618 m_value
.ident
= CSSValueSwResize
;
620 case CURSOR_S_RESIZE
:
621 m_value
.ident
= CSSValueSResize
;
623 case CURSOR_W_RESIZE
:
624 m_value
.ident
= CSSValueWResize
;
626 case CURSOR_EW_RESIZE
:
627 m_value
.ident
= CSSValueEwResize
;
629 case CURSOR_NS_RESIZE
:
630 m_value
.ident
= CSSValueNsResize
;
632 case CURSOR_NESW_RESIZE
:
633 m_value
.ident
= CSSValueNeswResize
;
635 case CURSOR_NWSE_RESIZE
:
636 m_value
.ident
= CSSValueNwseResize
;
638 case CURSOR_COL_RESIZE
:
639 m_value
.ident
= CSSValueColResize
;
641 case CURSOR_ROW_RESIZE
:
642 m_value
.ident
= CSSValueRowResize
;
645 m_value
.ident
= CSSValueText
;
648 m_value
.ident
= CSSValueWait
;
651 m_value
.ident
= CSSValueHelp
;
653 case CURSOR_ALL_SCROLL
:
654 m_value
.ident
= CSSValueAllScroll
;
656 case CURSOR_WEBKIT_GRAB
:
657 m_value
.ident
= CSSValueWebkitGrab
;
659 case CURSOR_WEBKIT_GRABBING
:
660 m_value
.ident
= CSSValueWebkitGrabbing
;
665 template<> inline CSSPrimitiveValue::operator ECursor() const
667 if (m_value
.ident
== CSSValueCopy
)
669 if (m_value
.ident
== CSSValueNone
)
671 return static_cast<ECursor
>(m_value
.ident
- CSSValueAuto
);
674 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e
)
679 m_value
.ident
= CSSValueInline
;
682 m_value
.ident
= CSSValueBlock
;
685 m_value
.ident
= CSSValueListItem
;
688 m_value
.ident
= CSSValueRunIn
;
691 m_value
.ident
= CSSValueCompact
;
694 m_value
.ident
= CSSValueInlineBlock
;
697 m_value
.ident
= CSSValueTable
;
700 m_value
.ident
= CSSValueInlineTable
;
702 case TABLE_ROW_GROUP
:
703 m_value
.ident
= CSSValueTableRowGroup
;
705 case TABLE_HEADER_GROUP
:
706 m_value
.ident
= CSSValueTableHeaderGroup
;
708 case TABLE_FOOTER_GROUP
:
709 m_value
.ident
= CSSValueTableFooterGroup
;
712 m_value
.ident
= CSSValueTableRow
;
714 case TABLE_COLUMN_GROUP
:
715 m_value
.ident
= CSSValueTableColumnGroup
;
718 m_value
.ident
= CSSValueTableColumn
;
721 m_value
.ident
= CSSValueTableCell
;
724 m_value
.ident
= CSSValueTableCaption
;
727 m_value
.ident
= CSSValueWebkitBox
;
730 m_value
.ident
= CSSValueWebkitInlineBox
;
733 m_value
.ident
= CSSValueNone
;
738 template<> inline CSSPrimitiveValue::operator EDisplay() const
740 if (m_value
.ident
== CSSValueNone
)
742 return static_cast<EDisplay
>(m_value
.ident
- CSSValueInline
);
745 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e
)
750 m_value
.ident
= CSSValueShow
;
753 m_value
.ident
= CSSValueHide
;
758 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
760 switch (m_value
.ident
) {
766 ASSERT_NOT_REACHED();
771 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e
)
776 m_value
.ident
= CSSValueNone
;
779 m_value
.ident
= CSSValueLeft
;
782 m_value
.ident
= CSSValueRight
;
787 template<> inline CSSPrimitiveValue::operator EFloat() const
789 switch (m_value
.ident
) {
795 case CSSValueCenter
: // Non-standard CSS value
798 ASSERT_NOT_REACHED();
803 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e
)
808 m_value
.ident
= CSSValueNormal
;
810 case AFTER_WHITE_SPACE
:
811 m_value
.ident
= CSSValueAfterWhiteSpace
;
816 template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
818 switch (m_value
.ident
) {
819 case CSSValueAfterWhiteSpace
:
820 return AFTER_WHITE_SPACE
;
824 ASSERT_NOT_REACHED();
829 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e
)
834 m_value
.ident
= CSSValueOutside
;
837 m_value
.ident
= CSSValueInside
;
842 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
844 return (EListStylePosition
)(m_value
.ident
- CSSValueOutside
);
847 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e
)
852 m_value
.ident
= CSSValueNone
;
855 m_value
.ident
= CSSValueDisc
;
858 m_value
.ident
= CSSValueCircle
;
861 m_value
.ident
= CSSValueSquare
;
864 m_value
.ident
= CSSValueDecimal
;
866 case DECIMAL_LEADING_ZERO
:
867 m_value
.ident
= CSSValueDecimalLeadingZero
;
870 m_value
.ident
= CSSValueLowerRoman
;
873 m_value
.ident
= CSSValueUpperRoman
;
876 m_value
.ident
= CSSValueLowerGreek
;
879 m_value
.ident
= CSSValueLowerAlpha
;
882 m_value
.ident
= CSSValueLowerLatin
;
885 m_value
.ident
= CSSValueUpperAlpha
;
888 m_value
.ident
= CSSValueUpperLatin
;
891 m_value
.ident
= CSSValueHebrew
;
894 m_value
.ident
= CSSValueArmenian
;
897 m_value
.ident
= CSSValueGeorgian
;
899 case CJK_IDEOGRAPHIC
:
900 m_value
.ident
= CSSValueCjkIdeographic
;
903 m_value
.ident
= CSSValueHiragana
;
906 m_value
.ident
= CSSValueKatakana
;
909 m_value
.ident
= CSSValueHiraganaIroha
;
912 m_value
.ident
= CSSValueKatakanaIroha
;
917 template<> inline CSSPrimitiveValue::operator EListStyleType() const
919 switch (m_value
.ident
) {
923 return static_cast<EListStyleType
>(m_value
.ident
- CSSValueDisc
);
927 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e
)
932 m_value
.ident
= CSSValueCollapse
;
935 m_value
.ident
= CSSValueSeparate
;
938 m_value
.ident
= CSSValueDiscard
;
943 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
945 switch (m_value
.ident
) {
946 case CSSValueCollapse
:
948 case CSSValueSeparate
:
950 case CSSValueDiscard
:
953 ASSERT_NOT_REACHED();
958 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e
)
963 m_value
.ident
= CSSValueNone
;
966 m_value
.ident
= CSSValueScroll
;
969 m_value
.ident
= CSSValueSlide
;
972 m_value
.ident
= CSSValueAlternate
;
977 template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
979 switch (m_value
.ident
) {
986 case CSSValueAlternate
:
989 ASSERT_NOT_REACHED();
994 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e
)
999 m_value
.ident
= CSSValueForwards
;
1002 m_value
.ident
= CSSValueBackwards
;
1005 m_value
.ident
= CSSValueAuto
;
1008 m_value
.ident
= CSSValueUp
;
1011 m_value
.ident
= CSSValueDown
;
1014 m_value
.ident
= CSSValueLeft
;
1017 m_value
.ident
= CSSValueRight
;
1022 template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
1024 switch (m_value
.ident
) {
1025 case CSSValueForwards
:
1027 case CSSValueBackwards
:
1032 case CSSValueUp
: // We don't support vertical languages, so AHEAD just maps to UP.
1034 case CSSValueReverse
:
1035 case CSSValueDown
: // REVERSE just maps to DOWN, since we don't do vertical text.
1042 ASSERT_NOT_REACHED();
1047 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e
)
1052 m_value
.ident
= CSSValueNormal
;
1055 m_value
.ident
= CSSValueMatch
;
1060 template<> inline CSSPrimitiveValue::operator EMatchNearestMailBlockquoteColor() const
1062 switch (m_value
.ident
) {
1063 case CSSValueNormal
:
1068 ASSERT_NOT_REACHED();
1073 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e
)
1078 m_value
.ident
= CSSValueNormal
;
1081 m_value
.ident
= CSSValueSpace
;
1086 template<> inline CSSPrimitiveValue::operator ENBSPMode() const
1088 switch (m_value
.ident
) {
1091 case CSSValueNormal
:
1094 ASSERT_NOT_REACHED();
1099 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e
)
1104 m_value
.ident
= CSSValueVisible
;
1107 m_value
.ident
= CSSValueHidden
;
1110 m_value
.ident
= CSSValueScroll
;
1113 m_value
.ident
= CSSValueAuto
;
1116 m_value
.ident
= CSSValueWebkitMarquee
;
1119 m_value
.ident
= CSSValueOverlay
;
1124 template<> inline CSSPrimitiveValue::operator EOverflow() const
1126 switch (m_value
.ident
) {
1127 case CSSValueVisible
:
1129 case CSSValueHidden
:
1131 case CSSValueScroll
:
1135 case CSSValueWebkitMarquee
:
1137 case CSSValueOverlay
:
1140 ASSERT_NOT_REACHED();
1145 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e
)
1150 m_value
.ident
= CSSValueAuto
;
1153 m_value
.ident
= CSSValueAlways
;
1156 m_value
.ident
= CSSValueAvoid
;
1161 template<> inline CSSPrimitiveValue::operator EPageBreak() const
1163 switch (m_value
.ident
) {
1168 case CSSValueAlways
:
1169 return PBALWAYS
; // CSS2.1: "Conforming user agents may map left/right to always."
1173 ASSERT_NOT_REACHED();
1178 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e
)
1182 case StaticPosition
:
1183 m_value
.ident
= CSSValueStatic
;
1185 case RelativePosition
:
1186 m_value
.ident
= CSSValueRelative
;
1188 case AbsolutePosition
:
1189 m_value
.ident
= CSSValueAbsolute
;
1192 m_value
.ident
= CSSValueFixed
;
1197 template<> inline CSSPrimitiveValue::operator EPosition() const
1199 switch (m_value
.ident
) {
1200 case CSSValueStatic
:
1201 return StaticPosition
;
1202 case CSSValueRelative
:
1203 return RelativePosition
;
1204 case CSSValueAbsolute
:
1205 return AbsolutePosition
;
1207 return FixedPosition
;
1209 ASSERT_NOT_REACHED();
1210 return StaticPosition
;
1214 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e
)
1219 m_value
.ident
= CSSValueBoth
;
1221 case RESIZE_HORIZONTAL
:
1222 m_value
.ident
= CSSValueHorizontal
;
1224 case RESIZE_VERTICAL
:
1225 m_value
.ident
= CSSValueVertical
;
1228 m_value
.ident
= CSSValueNone
;
1233 template<> inline CSSPrimitiveValue::operator EResize() const
1235 switch (m_value
.ident
) {
1238 case CSSValueHorizontal
:
1239 return RESIZE_HORIZONTAL
;
1240 case CSSValueVertical
:
1241 return RESIZE_VERTICAL
;
1243 ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
1248 ASSERT_NOT_REACHED();
1253 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e
)
1258 m_value
.ident
= CSSValueAuto
;
1261 m_value
.ident
= CSSValueFixed
;
1266 template<> inline CSSPrimitiveValue::operator ETableLayout() const
1268 switch (m_value
.ident
) {
1274 ASSERT_NOT_REACHED();
1279 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e
)
1284 m_value
.ident
= CSSValueAuto
;
1287 m_value
.ident
= CSSValueLeft
;
1290 m_value
.ident
= CSSValueRight
;
1293 m_value
.ident
= CSSValueCenter
;
1296 m_value
.ident
= CSSValueJustify
;
1299 m_value
.ident
= CSSValueWebkitLeft
;
1302 m_value
.ident
= CSSValueWebkitRight
;
1305 m_value
.ident
= CSSValueWebkitCenter
;
1310 template<> inline CSSPrimitiveValue::operator ETextAlign() const
1312 switch (m_value
.ident
) {
1315 ASSERT_NOT_REACHED(); // Depends on direction, thus should be handled by the caller.
1318 return static_cast<ETextAlign
>(m_value
.ident
- CSSValueWebkitAuto
);
1322 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e
)
1327 m_value
.ident
= CSSValueNone
;
1330 m_value
.ident
= CSSValueDisc
;
1333 m_value
.ident
= CSSValueCircle
;
1336 m_value
.ident
= CSSValueSquare
;
1341 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
1343 switch (m_value
.ident
) {
1348 case CSSValueCircle
:
1350 case CSSValueSquare
:
1353 ASSERT_NOT_REACHED();
1358 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e
)
1363 m_value
.ident
= CSSValueCapitalize
;
1366 m_value
.ident
= CSSValueUppercase
;
1369 m_value
.ident
= CSSValueLowercase
;
1372 m_value
.ident
= CSSValueNone
;
1377 template<> inline CSSPrimitiveValue::operator ETextTransform() const
1379 switch (m_value
.ident
) {
1380 case CSSValueCapitalize
:
1382 case CSSValueUppercase
:
1384 case CSSValueLowercase
:
1389 ASSERT_NOT_REACHED();
1394 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e
)
1399 m_value
.ident
= CSSValueNormal
;
1402 m_value
.ident
= CSSValueEmbed
;
1405 m_value
.ident
= CSSValueBidiOverride
;
1410 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
1412 switch (m_value
.ident
) {
1413 case CSSValueNormal
:
1417 case CSSValueBidiOverride
:
1420 ASSERT_NOT_REACHED();
1425 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e
)
1430 m_value
.ident
= CSSValueAuto
;
1433 m_value
.ident
= CSSValueNone
;
1436 m_value
.ident
= CSSValueElement
;
1441 template<> inline CSSPrimitiveValue::operator EUserDrag() const
1443 switch (m_value
.ident
) {
1448 case CSSValueElement
:
1449 return DRAG_ELEMENT
;
1451 ASSERT_NOT_REACHED();
1456 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e
)
1461 m_value
.ident
= CSSValueReadOnly
;
1464 m_value
.ident
= CSSValueReadWrite
;
1466 case READ_WRITE_PLAINTEXT_ONLY
:
1467 m_value
.ident
= CSSValueReadWritePlaintextOnly
;
1472 template<> inline CSSPrimitiveValue::operator EUserModify() const
1474 return static_cast<EUserModify
>(m_value
.ident
- CSSValueReadOnly
);
1477 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e
)
1482 m_value
.ident
= CSSValueNone
;
1485 m_value
.ident
= CSSValueText
;
1490 template<> inline CSSPrimitiveValue::operator EUserSelect() const
1492 switch (m_value
.ident
) {
1500 ASSERT_NOT_REACHED();
1505 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e
)
1510 m_value
.ident
= CSSValueVisible
;
1513 m_value
.ident
= CSSValueHidden
;
1516 m_value
.ident
= CSSValueCollapse
;
1521 template<> inline CSSPrimitiveValue::operator EVisibility() const
1523 switch (m_value
.ident
) {
1524 case CSSValueHidden
:
1526 case CSSValueVisible
:
1528 case CSSValueCollapse
:
1531 ASSERT_NOT_REACHED();
1536 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e
)
1541 m_value
.ident
= CSSValueNormal
;
1544 m_value
.ident
= CSSValuePre
;
1547 m_value
.ident
= CSSValuePreWrap
;
1550 m_value
.ident
= CSSValuePreLine
;
1553 m_value
.ident
= CSSValueNowrap
;
1556 m_value
.ident
= CSSValueWebkitNowrap
;
1561 template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
1563 switch (m_value
.ident
) {
1564 case CSSValueWebkitNowrap
:
1565 return KHTML_NOWRAP
;
1566 case CSSValueNowrap
:
1570 case CSSValuePreWrap
:
1572 case CSSValuePreLine
:
1574 case CSSValueNormal
:
1577 ASSERT_NOT_REACHED();
1582 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e
)
1586 case NormalWordBreak
:
1587 m_value
.ident
= CSSValueNormal
;
1589 case BreakAllWordBreak
:
1590 m_value
.ident
= CSSValueBreakAll
;
1592 case BreakWordBreak
:
1593 m_value
.ident
= CSSValueBreakWord
;
1598 template<> inline CSSPrimitiveValue::operator EWordBreak() const
1600 switch (m_value
.ident
) {
1601 case CSSValueBreakAll
:
1602 return BreakAllWordBreak
;
1603 case CSSValueBreakWord
:
1604 return BreakWordBreak
;
1605 case CSSValueNormal
:
1606 return NormalWordBreak
;
1608 ASSERT_NOT_REACHED();
1609 return NormalWordBreak
;
1613 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e
)
1617 case NormalWordWrap
:
1618 m_value
.ident
= CSSValueNormal
;
1621 m_value
.ident
= CSSValueBreakWord
;
1626 template<> inline CSSPrimitiveValue::operator EWordWrap() const
1628 switch (m_value
.ident
) {
1629 case CSSValueBreakWord
:
1630 return BreakWordWrap
;
1631 case CSSValueNormal
:
1632 return NormalWordWrap
;
1634 ASSERT_NOT_REACHED();
1635 return NormalWordWrap
;
1639 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e
)
1644 m_value
.ident
= CSSValueLtr
;
1647 m_value
.ident
= CSSValueRtl
;
1652 template<> inline CSSPrimitiveValue::operator TextDirection() const
1654 switch (m_value
.ident
) {
1660 ASSERT_NOT_REACHED();
1667 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e
)
1672 m_value
.ident
= CSSValueButt
;
1675 m_value
.ident
= CSSValueRound
;
1678 m_value
.ident
= CSSValueSquare
;
1683 template<> inline CSSPrimitiveValue::operator LineCap() const
1685 switch (m_value
.ident
) {
1690 case CSSValueSquare
:
1693 ASSERT_NOT_REACHED();
1698 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e
)
1703 m_value
.ident
= CSSValueMiter
;
1706 m_value
.ident
= CSSValueRound
;
1709 m_value
.ident
= CSSValueBevel
;
1714 template<> inline CSSPrimitiveValue::operator LineJoin() const
1716 switch (m_value
.ident
) {
1724 ASSERT_NOT_REACHED();
1729 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e
)
1734 m_value
.ident
= CSSValueNonzero
;
1737 m_value
.ident
= CSSValueEvenodd
;
1742 template<> inline CSSPrimitiveValue::operator WindRule() const
1744 switch (m_value
.ident
) {
1745 case CSSValueNonzero
:
1746 return RULE_NONZERO
;
1747 case CSSValueEvenodd
:
1748 return RULE_EVENODD
;
1750 ASSERT_NOT_REACHED();
1751 return RULE_NONZERO
;
1756 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e
)
1761 m_value
.ident
= CSSValueAuto
;
1764 m_value
.ident
= CSSValueBaseline
;
1766 case AB_BEFORE_EDGE
:
1767 m_value
.ident
= CSSValueBeforeEdge
;
1769 case AB_TEXT_BEFORE_EDGE
:
1770 m_value
.ident
= CSSValueTextBeforeEdge
;
1773 m_value
.ident
= CSSValueMiddle
;
1776 m_value
.ident
= CSSValueCentral
;
1779 m_value
.ident
= CSSValueAfterEdge
;
1781 case AB_TEXT_AFTER_EDGE
:
1782 m_value
.ident
= CSSValueTextAfterEdge
;
1784 case AB_IDEOGRAPHIC
:
1785 m_value
.ident
= CSSValueIdeographic
;
1788 m_value
.ident
= CSSValueAlphabetic
;
1791 m_value
.ident
= CSSValueHanging
;
1793 case AB_MATHEMATICAL
:
1794 m_value
.ident
= CSSValueMathematical
;
1799 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
1801 switch (m_value
.ident
) {
1804 case CSSValueBaseline
:
1806 case CSSValueBeforeEdge
:
1807 return AB_BEFORE_EDGE
;
1808 case CSSValueTextBeforeEdge
:
1809 return AB_TEXT_BEFORE_EDGE
;
1810 case CSSValueMiddle
:
1812 case CSSValueCentral
:
1814 case CSSValueAfterEdge
:
1815 return AB_AFTER_EDGE
;
1816 case CSSValueTextAfterEdge
:
1817 return AB_TEXT_AFTER_EDGE
;
1818 case CSSValueIdeographic
:
1819 return AB_IDEOGRAPHIC
;
1820 case CSSValueAlphabetic
:
1821 return AB_ALPHABETIC
;
1822 case CSSValueHanging
:
1824 case CSSValueMathematical
:
1825 return AB_MATHEMATICAL
;
1827 ASSERT_NOT_REACHED();
1832 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e
)
1837 m_value
.ident
= CSSValueAuto
;
1840 m_value
.ident
= CSSValueSrgb
;
1843 m_value
.ident
= CSSValueLinearrgb
;
1848 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
1850 switch (m_value
.ident
) {
1853 case CSSValueLinearrgb
:
1854 return CI_LINEARRGB
;
1858 ASSERT_NOT_REACHED();
1863 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e
)
1868 m_value
.ident
= CSSValueAuto
;
1870 case CR_OPTIMIZESPEED
:
1871 m_value
.ident
= CSSValueOptimizespeed
;
1873 case CR_OPTIMIZEQUALITY
:
1874 m_value
.ident
= CSSValueOptimizequality
;
1879 template<> inline CSSPrimitiveValue::operator EColorRendering() const
1881 switch (m_value
.ident
) {
1882 case CSSValueOptimizespeed
:
1883 return CR_OPTIMIZESPEED
;
1884 case CSSValueOptimizequality
:
1885 return CR_OPTIMIZEQUALITY
;
1889 ASSERT_NOT_REACHED();
1894 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e
)
1899 m_value
.ident
= CSSValueAuto
;
1902 m_value
.ident
= CSSValueUseScript
;
1905 m_value
.ident
= CSSValueNoChange
;
1908 m_value
.ident
= CSSValueResetSize
;
1911 m_value
.ident
= CSSValueCentral
;
1914 m_value
.ident
= CSSValueMiddle
;
1916 case DB_TEXT_BEFORE_EDGE
:
1917 m_value
.ident
= CSSValueTextBeforeEdge
;
1919 case DB_TEXT_AFTER_EDGE
:
1920 m_value
.ident
= CSSValueTextAfterEdge
;
1922 case DB_IDEOGRAPHIC
:
1923 m_value
.ident
= CSSValueIdeographic
;
1926 m_value
.ident
= CSSValueAlphabetic
;
1929 m_value
.ident
= CSSValueHanging
;
1931 case DB_MATHEMATICAL
:
1932 m_value
.ident
= CSSValueMathematical
;
1937 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
1939 switch (m_value
.ident
) {
1942 case CSSValueUseScript
:
1943 return DB_USE_SCRIPT
;
1944 case CSSValueNoChange
:
1945 return DB_NO_CHANGE
;
1946 case CSSValueResetSize
:
1947 return DB_RESET_SIZE
;
1948 case CSSValueIdeographic
:
1949 return DB_IDEOGRAPHIC
;
1950 case CSSValueAlphabetic
:
1951 return DB_ALPHABETIC
;
1952 case CSSValueHanging
:
1954 case CSSValueMathematical
:
1955 return DB_MATHEMATICAL
;
1956 case CSSValueCentral
:
1958 case CSSValueMiddle
:
1960 case CSSValueTextAfterEdge
:
1961 return DB_TEXT_AFTER_EDGE
;
1962 case CSSValueTextBeforeEdge
:
1963 return DB_TEXT_BEFORE_EDGE
;
1965 ASSERT_NOT_REACHED();
1970 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e
)
1975 m_value
.ident
= CSSValueAuto
;
1977 case IR_OPTIMIZESPEED
:
1978 m_value
.ident
= CSSValueOptimizespeed
;
1980 case IR_OPTIMIZEQUALITY
:
1981 m_value
.ident
= CSSValueOptimizequality
;
1986 template<> inline CSSPrimitiveValue::operator EImageRendering() const
1988 switch (m_value
.ident
) {
1991 case CSSValueOptimizespeed
:
1992 return IR_OPTIMIZESPEED
;
1993 case CSSValueOptimizequality
:
1994 return IR_OPTIMIZEQUALITY
;
1996 ASSERT_NOT_REACHED();
2001 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e
)
2006 m_value
.ident
= CSSValueNone
;
2009 m_value
.ident
= CSSValueStroke
;
2012 m_value
.ident
= CSSValueFill
;
2015 m_value
.ident
= CSSValuePainted
;
2018 m_value
.ident
= CSSValueVisible
;
2020 case PE_VISIBLE_STROKE
:
2021 m_value
.ident
= CSSValueVisiblestroke
;
2023 case PE_VISIBLE_FILL
:
2024 m_value
.ident
= CSSValueVisiblefill
;
2026 case PE_VISIBLE_PAINTED
:
2027 m_value
.ident
= CSSValueVisiblepainted
;
2030 m_value
.ident
= CSSValueAll
;
2035 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
2037 switch (m_value
.ident
) {
2042 case CSSValueVisiblepainted
:
2043 return PE_VISIBLE_PAINTED
;
2044 case CSSValueVisiblefill
:
2045 return PE_VISIBLE_FILL
;
2046 case CSSValueVisiblestroke
:
2047 return PE_VISIBLE_STROKE
;
2048 case CSSValueVisible
:
2050 case CSSValuePainted
:
2054 case CSSValueStroke
:
2057 ASSERT_NOT_REACHED();
2062 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e
)
2067 m_value
.ident
= CSSValueAuto
;
2069 case IR_OPTIMIZESPEED
:
2070 m_value
.ident
= CSSValueOptimizespeed
;
2073 m_value
.ident
= CSSValueCrispedges
;
2075 case SR_GEOMETRICPRECISION
:
2076 m_value
.ident
= CSSValueGeometricprecision
;
2081 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
2083 switch (m_value
.ident
) {
2086 case CSSValueOptimizespeed
:
2087 return SR_OPTIMIZESPEED
;
2088 case CSSValueCrispedges
:
2089 return SR_CRISPEDGES
;
2090 case CSSValueGeometricprecision
:
2091 return SR_GEOMETRICPRECISION
;
2093 ASSERT_NOT_REACHED();
2098 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e
)
2103 m_value
.ident
= CSSValueStart
;
2106 m_value
.ident
= CSSValueMiddle
;
2109 m_value
.ident
= CSSValueEnd
;
2114 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
2116 switch (m_value
.ident
) {
2119 case CSSValueMiddle
:
2124 ASSERT_NOT_REACHED();
2129 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextRendering e
)
2134 m_value
.ident
= CSSValueAuto
;
2136 case TR_OPTIMIZESPEED
:
2137 m_value
.ident
= CSSValueOptimizespeed
;
2139 case TR_OPTIMIZELEGIBILITY
:
2140 m_value
.ident
= CSSValueOptimizelegibility
;
2142 case TR_GEOMETRICPRECISION
:
2143 m_value
.ident
= CSSValueGeometricprecision
;
2148 template<> inline CSSPrimitiveValue::operator ETextRendering() const
2150 switch (m_value
.ident
) {
2153 case CSSValueOptimizespeed
:
2154 return TR_OPTIMIZESPEED
;
2155 case CSSValueOptimizelegibility
:
2156 return TR_OPTIMIZELEGIBILITY
;
2157 case CSSValueGeometricprecision
:
2158 return TR_GEOMETRICPRECISION
;
2160 ASSERT_NOT_REACHED();
2165 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWritingMode e
)
2170 m_value
.ident
= CSSValueLrTb
;
2173 m_value
.ident
= CSSValueLr
;
2176 m_value
.ident
= CSSValueRlTb
;
2179 m_value
.ident
= CSSValueRl
;
2182 m_value
.ident
= CSSValueTbRl
;
2185 m_value
.ident
= CSSValueTb
;
2190 template<> inline CSSPrimitiveValue::operator EWritingMode() const
2192 return static_cast<EWritingMode
>(m_value
.ident
- CSSValueLrTb
);