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
;
219 case MediaTimelineContainerPart
:
220 m_value
.ident
= CSSValueMediaTimelineContainer
;
222 case MediaCurrentTimePart
:
223 m_value
.ident
= CSSValueMediaCurrentTimeDisplay
;
225 case MediaTimeRemainingPart
:
226 m_value
.ident
= CSSValueMediaTimeRemainingDisplay
;
229 m_value
.ident
= CSSValueMenulist
;
231 case MenulistButtonPart
:
232 m_value
.ident
= CSSValueMenulistButton
;
234 case MenulistTextPart
:
235 m_value
.ident
= CSSValueMenulistText
;
237 case MenulistTextFieldPart
:
238 m_value
.ident
= CSSValueMenulistTextfield
;
240 case SliderHorizontalPart
:
241 m_value
.ident
= CSSValueSliderHorizontal
;
243 case SliderVerticalPart
:
244 m_value
.ident
= CSSValueSliderVertical
;
246 case SliderThumbHorizontalPart
:
247 m_value
.ident
= CSSValueSliderthumbHorizontal
;
249 case SliderThumbVerticalPart
:
250 m_value
.ident
= CSSValueSliderthumbVertical
;
253 m_value
.ident
= CSSValueCaret
;
255 case SearchFieldPart
:
256 m_value
.ident
= CSSValueSearchfield
;
258 case SearchFieldDecorationPart
:
259 m_value
.ident
= CSSValueSearchfieldDecoration
;
261 case SearchFieldResultsDecorationPart
:
262 m_value
.ident
= CSSValueSearchfieldResultsDecoration
;
264 case SearchFieldResultsButtonPart
:
265 m_value
.ident
= CSSValueSearchfieldResultsButton
;
267 case SearchFieldCancelButtonPart
:
268 m_value
.ident
= CSSValueSearchfieldCancelButton
;
271 m_value
.ident
= CSSValueTextfield
;
274 m_value
.ident
= CSSValueTextarea
;
276 case CapsLockIndicatorPart
:
277 m_value
.ident
= CSSValueCapsLockIndicator
;
282 template<> inline CSSPrimitiveValue::operator ControlPart() const
284 if (m_value
.ident
== CSSValueNone
)
285 return NoControlPart
;
287 return ControlPart(m_value
.ident
- CSSValueCheckbox
+ 1);
290 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e
)
295 m_value
.ident
= CSSValueBorder
;
298 m_value
.ident
= CSSValuePadding
;
301 m_value
.ident
= CSSValueContent
;
304 m_value
.ident
= CSSValueText
;
309 template<> inline CSSPrimitiveValue::operator EFillBox() const
311 switch (m_value
.ident
) {
313 return BorderFillBox
;
314 case CSSValuePadding
:
315 return PaddingFillBox
;
316 case CSSValueContent
:
317 return ContentFillBox
;
321 ASSERT_NOT_REACHED();
322 return BorderFillBox
;
326 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e
)
331 m_value
.ident
= CSSValueRepeat
;
334 m_value
.ident
= CSSValueRepeatX
;
337 m_value
.ident
= CSSValueRepeatY
;
340 m_value
.ident
= CSSValueNoRepeat
;
345 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
347 switch (m_value
.ident
) {
350 case CSSValueRepeatX
:
352 case CSSValueRepeatY
:
354 case CSSValueNoRepeat
:
357 ASSERT_NOT_REACHED();
362 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e
)
367 m_value
.ident
= CSSValueStretch
;
370 m_value
.ident
= CSSValueStart
;
373 m_value
.ident
= CSSValueCenter
;
376 m_value
.ident
= CSSValueEnd
;
379 m_value
.ident
= CSSValueBaseline
;
382 m_value
.ident
= CSSValueJustify
;
387 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
389 switch (m_value
.ident
) {
390 case CSSValueStretch
:
398 case CSSValueBaseline
:
400 case CSSValueJustify
:
403 ASSERT_NOT_REACHED();
408 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e
)
413 m_value
.ident
= CSSValueNormal
;
416 m_value
.ident
= CSSValueReverse
;
421 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
423 switch (m_value
.ident
) {
426 case CSSValueReverse
:
429 ASSERT_NOT_REACHED();
434 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e
)
439 m_value
.ident
= CSSValueSingle
;
442 m_value
.ident
= CSSValueMultiple
;
447 template<> inline CSSPrimitiveValue::operator EBoxLines() const
449 switch (m_value
.ident
) {
452 case CSSValueMultiple
:
455 ASSERT_NOT_REACHED();
460 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e
)
465 m_value
.ident
= CSSValueHorizontal
;
468 m_value
.ident
= CSSValueVertical
;
473 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
475 switch (m_value
.ident
) {
476 case CSSValueHorizontal
:
477 case CSSValueInlineAxis
:
479 case CSSValueVertical
:
482 ASSERT_NOT_REACHED();
487 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e
)
492 m_value
.ident
= CSSValueLeft
;
495 m_value
.ident
= CSSValueRight
;
498 m_value
.ident
= CSSValueTop
;
501 m_value
.ident
= CSSValueBottom
;
506 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
508 switch (m_value
.ident
) {
518 ASSERT_NOT_REACHED();
523 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e
)
528 m_value
.ident
= CSSValueNone
;
531 m_value
.ident
= CSSValueLeft
;
534 m_value
.ident
= CSSValueRight
;
537 m_value
.ident
= CSSValueBoth
;
542 template<> inline CSSPrimitiveValue::operator EClear() const
544 switch (m_value
.ident
) {
554 ASSERT_NOT_REACHED();
559 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e
)
564 m_value
.ident
= CSSValueAuto
;
567 m_value
.ident
= CSSValueCrosshair
;
570 m_value
.ident
= CSSValueDefault
;
573 m_value
.ident
= CSSValuePointer
;
576 m_value
.ident
= CSSValueMove
;
579 m_value
.ident
= CSSValueCell
;
581 case CURSOR_VERTICAL_TEXT
:
582 m_value
.ident
= CSSValueVerticalText
;
584 case CURSOR_CONTEXT_MENU
:
585 m_value
.ident
= CSSValueContextMenu
;
588 m_value
.ident
= CSSValueAlias
;
591 m_value
.ident
= CSSValueCopy
;
594 m_value
.ident
= CSSValueNone
;
596 case CURSOR_PROGRESS
:
597 m_value
.ident
= CSSValueProgress
;
600 m_value
.ident
= CSSValueNoDrop
;
602 case CURSOR_NOT_ALLOWED
:
603 m_value
.ident
= CSSValueNotAllowed
;
605 case CURSOR_WEBKIT_ZOOM_IN
:
606 m_value
.ident
= CSSValueWebkitZoomIn
;
608 case CURSOR_WEBKIT_ZOOM_OUT
:
609 m_value
.ident
= CSSValueWebkitZoomOut
;
611 case CURSOR_E_RESIZE
:
612 m_value
.ident
= CSSValueEResize
;
614 case CURSOR_NE_RESIZE
:
615 m_value
.ident
= CSSValueNeResize
;
617 case CURSOR_NW_RESIZE
:
618 m_value
.ident
= CSSValueNwResize
;
620 case CURSOR_N_RESIZE
:
621 m_value
.ident
= CSSValueNResize
;
623 case CURSOR_SE_RESIZE
:
624 m_value
.ident
= CSSValueSeResize
;
626 case CURSOR_SW_RESIZE
:
627 m_value
.ident
= CSSValueSwResize
;
629 case CURSOR_S_RESIZE
:
630 m_value
.ident
= CSSValueSResize
;
632 case CURSOR_W_RESIZE
:
633 m_value
.ident
= CSSValueWResize
;
635 case CURSOR_EW_RESIZE
:
636 m_value
.ident
= CSSValueEwResize
;
638 case CURSOR_NS_RESIZE
:
639 m_value
.ident
= CSSValueNsResize
;
641 case CURSOR_NESW_RESIZE
:
642 m_value
.ident
= CSSValueNeswResize
;
644 case CURSOR_NWSE_RESIZE
:
645 m_value
.ident
= CSSValueNwseResize
;
647 case CURSOR_COL_RESIZE
:
648 m_value
.ident
= CSSValueColResize
;
650 case CURSOR_ROW_RESIZE
:
651 m_value
.ident
= CSSValueRowResize
;
654 m_value
.ident
= CSSValueText
;
657 m_value
.ident
= CSSValueWait
;
660 m_value
.ident
= CSSValueHelp
;
662 case CURSOR_ALL_SCROLL
:
663 m_value
.ident
= CSSValueAllScroll
;
665 case CURSOR_WEBKIT_GRAB
:
666 m_value
.ident
= CSSValueWebkitGrab
;
668 case CURSOR_WEBKIT_GRABBING
:
669 m_value
.ident
= CSSValueWebkitGrabbing
;
674 template<> inline CSSPrimitiveValue::operator ECursor() const
676 if (m_value
.ident
== CSSValueCopy
)
678 if (m_value
.ident
== CSSValueNone
)
680 return static_cast<ECursor
>(m_value
.ident
- CSSValueAuto
);
683 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e
)
688 m_value
.ident
= CSSValueInline
;
691 m_value
.ident
= CSSValueBlock
;
694 m_value
.ident
= CSSValueListItem
;
697 m_value
.ident
= CSSValueRunIn
;
700 m_value
.ident
= CSSValueCompact
;
703 m_value
.ident
= CSSValueInlineBlock
;
706 m_value
.ident
= CSSValueTable
;
709 m_value
.ident
= CSSValueInlineTable
;
711 case TABLE_ROW_GROUP
:
712 m_value
.ident
= CSSValueTableRowGroup
;
714 case TABLE_HEADER_GROUP
:
715 m_value
.ident
= CSSValueTableHeaderGroup
;
717 case TABLE_FOOTER_GROUP
:
718 m_value
.ident
= CSSValueTableFooterGroup
;
721 m_value
.ident
= CSSValueTableRow
;
723 case TABLE_COLUMN_GROUP
:
724 m_value
.ident
= CSSValueTableColumnGroup
;
727 m_value
.ident
= CSSValueTableColumn
;
730 m_value
.ident
= CSSValueTableCell
;
733 m_value
.ident
= CSSValueTableCaption
;
736 m_value
.ident
= CSSValueWebkitBox
;
739 m_value
.ident
= CSSValueWebkitInlineBox
;
742 m_value
.ident
= CSSValueNone
;
747 template<> inline CSSPrimitiveValue::operator EDisplay() const
749 if (m_value
.ident
== CSSValueNone
)
751 return static_cast<EDisplay
>(m_value
.ident
- CSSValueInline
);
754 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e
)
759 m_value
.ident
= CSSValueShow
;
762 m_value
.ident
= CSSValueHide
;
767 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
769 switch (m_value
.ident
) {
775 ASSERT_NOT_REACHED();
780 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e
)
785 m_value
.ident
= CSSValueNone
;
788 m_value
.ident
= CSSValueLeft
;
791 m_value
.ident
= CSSValueRight
;
796 template<> inline CSSPrimitiveValue::operator EFloat() const
798 switch (m_value
.ident
) {
804 case CSSValueCenter
: // Non-standard CSS value
807 ASSERT_NOT_REACHED();
812 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e
)
817 m_value
.ident
= CSSValueNormal
;
819 case AFTER_WHITE_SPACE
:
820 m_value
.ident
= CSSValueAfterWhiteSpace
;
825 template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
827 switch (m_value
.ident
) {
828 case CSSValueAfterWhiteSpace
:
829 return AFTER_WHITE_SPACE
;
833 ASSERT_NOT_REACHED();
838 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e
)
843 m_value
.ident
= CSSValueOutside
;
846 m_value
.ident
= CSSValueInside
;
851 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
853 return (EListStylePosition
)(m_value
.ident
- CSSValueOutside
);
856 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e
)
861 m_value
.ident
= CSSValueNone
;
864 m_value
.ident
= CSSValueDisc
;
867 m_value
.ident
= CSSValueCircle
;
870 m_value
.ident
= CSSValueSquare
;
873 m_value
.ident
= CSSValueDecimal
;
875 case DECIMAL_LEADING_ZERO
:
876 m_value
.ident
= CSSValueDecimalLeadingZero
;
879 m_value
.ident
= CSSValueLowerRoman
;
882 m_value
.ident
= CSSValueUpperRoman
;
885 m_value
.ident
= CSSValueLowerGreek
;
888 m_value
.ident
= CSSValueLowerAlpha
;
891 m_value
.ident
= CSSValueLowerLatin
;
894 m_value
.ident
= CSSValueUpperAlpha
;
897 m_value
.ident
= CSSValueUpperLatin
;
900 m_value
.ident
= CSSValueHebrew
;
903 m_value
.ident
= CSSValueArmenian
;
906 m_value
.ident
= CSSValueGeorgian
;
908 case CJK_IDEOGRAPHIC
:
909 m_value
.ident
= CSSValueCjkIdeographic
;
912 m_value
.ident
= CSSValueHiragana
;
915 m_value
.ident
= CSSValueKatakana
;
918 m_value
.ident
= CSSValueHiraganaIroha
;
921 m_value
.ident
= CSSValueKatakanaIroha
;
926 template<> inline CSSPrimitiveValue::operator EListStyleType() const
928 switch (m_value
.ident
) {
932 return static_cast<EListStyleType
>(m_value
.ident
- CSSValueDisc
);
936 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e
)
941 m_value
.ident
= CSSValueCollapse
;
944 m_value
.ident
= CSSValueSeparate
;
947 m_value
.ident
= CSSValueDiscard
;
952 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
954 switch (m_value
.ident
) {
955 case CSSValueCollapse
:
957 case CSSValueSeparate
:
959 case CSSValueDiscard
:
962 ASSERT_NOT_REACHED();
967 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e
)
972 m_value
.ident
= CSSValueNone
;
975 m_value
.ident
= CSSValueScroll
;
978 m_value
.ident
= CSSValueSlide
;
981 m_value
.ident
= CSSValueAlternate
;
986 template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
988 switch (m_value
.ident
) {
995 case CSSValueAlternate
:
998 ASSERT_NOT_REACHED();
1003 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e
)
1008 m_value
.ident
= CSSValueForwards
;
1011 m_value
.ident
= CSSValueBackwards
;
1014 m_value
.ident
= CSSValueAuto
;
1017 m_value
.ident
= CSSValueUp
;
1020 m_value
.ident
= CSSValueDown
;
1023 m_value
.ident
= CSSValueLeft
;
1026 m_value
.ident
= CSSValueRight
;
1031 template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
1033 switch (m_value
.ident
) {
1034 case CSSValueForwards
:
1036 case CSSValueBackwards
:
1041 case CSSValueUp
: // We don't support vertical languages, so AHEAD just maps to UP.
1043 case CSSValueReverse
:
1044 case CSSValueDown
: // REVERSE just maps to DOWN, since we don't do vertical text.
1051 ASSERT_NOT_REACHED();
1056 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e
)
1061 m_value
.ident
= CSSValueNormal
;
1064 m_value
.ident
= CSSValueMatch
;
1069 template<> inline CSSPrimitiveValue::operator EMatchNearestMailBlockquoteColor() const
1071 switch (m_value
.ident
) {
1072 case CSSValueNormal
:
1077 ASSERT_NOT_REACHED();
1082 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e
)
1087 m_value
.ident
= CSSValueNormal
;
1090 m_value
.ident
= CSSValueSpace
;
1095 template<> inline CSSPrimitiveValue::operator ENBSPMode() const
1097 switch (m_value
.ident
) {
1100 case CSSValueNormal
:
1103 ASSERT_NOT_REACHED();
1108 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e
)
1113 m_value
.ident
= CSSValueVisible
;
1116 m_value
.ident
= CSSValueHidden
;
1119 m_value
.ident
= CSSValueScroll
;
1122 m_value
.ident
= CSSValueAuto
;
1125 m_value
.ident
= CSSValueWebkitMarquee
;
1128 m_value
.ident
= CSSValueOverlay
;
1133 template<> inline CSSPrimitiveValue::operator EOverflow() const
1135 switch (m_value
.ident
) {
1136 case CSSValueVisible
:
1138 case CSSValueHidden
:
1140 case CSSValueScroll
:
1144 case CSSValueWebkitMarquee
:
1146 case CSSValueOverlay
:
1149 ASSERT_NOT_REACHED();
1154 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e
)
1159 m_value
.ident
= CSSValueAuto
;
1162 m_value
.ident
= CSSValueAlways
;
1165 m_value
.ident
= CSSValueAvoid
;
1170 template<> inline CSSPrimitiveValue::operator EPageBreak() const
1172 switch (m_value
.ident
) {
1177 case CSSValueAlways
:
1178 return PBALWAYS
; // CSS2.1: "Conforming user agents may map left/right to always."
1182 ASSERT_NOT_REACHED();
1187 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e
)
1191 case StaticPosition
:
1192 m_value
.ident
= CSSValueStatic
;
1194 case RelativePosition
:
1195 m_value
.ident
= CSSValueRelative
;
1197 case AbsolutePosition
:
1198 m_value
.ident
= CSSValueAbsolute
;
1201 m_value
.ident
= CSSValueFixed
;
1206 template<> inline CSSPrimitiveValue::operator EPosition() const
1208 switch (m_value
.ident
) {
1209 case CSSValueStatic
:
1210 return StaticPosition
;
1211 case CSSValueRelative
:
1212 return RelativePosition
;
1213 case CSSValueAbsolute
:
1214 return AbsolutePosition
;
1216 return FixedPosition
;
1218 ASSERT_NOT_REACHED();
1219 return StaticPosition
;
1223 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e
)
1228 m_value
.ident
= CSSValueBoth
;
1230 case RESIZE_HORIZONTAL
:
1231 m_value
.ident
= CSSValueHorizontal
;
1233 case RESIZE_VERTICAL
:
1234 m_value
.ident
= CSSValueVertical
;
1237 m_value
.ident
= CSSValueNone
;
1242 template<> inline CSSPrimitiveValue::operator EResize() const
1244 switch (m_value
.ident
) {
1247 case CSSValueHorizontal
:
1248 return RESIZE_HORIZONTAL
;
1249 case CSSValueVertical
:
1250 return RESIZE_VERTICAL
;
1252 ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
1257 ASSERT_NOT_REACHED();
1262 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e
)
1267 m_value
.ident
= CSSValueAuto
;
1270 m_value
.ident
= CSSValueFixed
;
1275 template<> inline CSSPrimitiveValue::operator ETableLayout() const
1277 switch (m_value
.ident
) {
1283 ASSERT_NOT_REACHED();
1288 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e
)
1293 m_value
.ident
= CSSValueAuto
;
1296 m_value
.ident
= CSSValueLeft
;
1299 m_value
.ident
= CSSValueRight
;
1302 m_value
.ident
= CSSValueCenter
;
1305 m_value
.ident
= CSSValueJustify
;
1308 m_value
.ident
= CSSValueWebkitLeft
;
1311 m_value
.ident
= CSSValueWebkitRight
;
1314 m_value
.ident
= CSSValueWebkitCenter
;
1319 template<> inline CSSPrimitiveValue::operator ETextAlign() const
1321 switch (m_value
.ident
) {
1324 ASSERT_NOT_REACHED(); // Depends on direction, thus should be handled by the caller.
1327 return static_cast<ETextAlign
>(m_value
.ident
- CSSValueWebkitAuto
);
1331 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e
)
1336 m_value
.ident
= CSSValueNone
;
1339 m_value
.ident
= CSSValueDisc
;
1342 m_value
.ident
= CSSValueCircle
;
1345 m_value
.ident
= CSSValueSquare
;
1350 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
1352 switch (m_value
.ident
) {
1357 case CSSValueCircle
:
1359 case CSSValueSquare
:
1362 ASSERT_NOT_REACHED();
1367 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e
)
1372 m_value
.ident
= CSSValueCapitalize
;
1375 m_value
.ident
= CSSValueUppercase
;
1378 m_value
.ident
= CSSValueLowercase
;
1381 m_value
.ident
= CSSValueNone
;
1386 template<> inline CSSPrimitiveValue::operator ETextTransform() const
1388 switch (m_value
.ident
) {
1389 case CSSValueCapitalize
:
1391 case CSSValueUppercase
:
1393 case CSSValueLowercase
:
1398 ASSERT_NOT_REACHED();
1403 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e
)
1408 m_value
.ident
= CSSValueNormal
;
1411 m_value
.ident
= CSSValueEmbed
;
1414 m_value
.ident
= CSSValueBidiOverride
;
1419 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
1421 switch (m_value
.ident
) {
1422 case CSSValueNormal
:
1426 case CSSValueBidiOverride
:
1429 ASSERT_NOT_REACHED();
1434 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e
)
1439 m_value
.ident
= CSSValueAuto
;
1442 m_value
.ident
= CSSValueNone
;
1445 m_value
.ident
= CSSValueElement
;
1450 template<> inline CSSPrimitiveValue::operator EUserDrag() const
1452 switch (m_value
.ident
) {
1457 case CSSValueElement
:
1458 return DRAG_ELEMENT
;
1460 ASSERT_NOT_REACHED();
1465 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e
)
1470 m_value
.ident
= CSSValueReadOnly
;
1473 m_value
.ident
= CSSValueReadWrite
;
1475 case READ_WRITE_PLAINTEXT_ONLY
:
1476 m_value
.ident
= CSSValueReadWritePlaintextOnly
;
1481 template<> inline CSSPrimitiveValue::operator EUserModify() const
1483 return static_cast<EUserModify
>(m_value
.ident
- CSSValueReadOnly
);
1486 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e
)
1491 m_value
.ident
= CSSValueNone
;
1494 m_value
.ident
= CSSValueText
;
1499 template<> inline CSSPrimitiveValue::operator EUserSelect() const
1501 switch (m_value
.ident
) {
1509 ASSERT_NOT_REACHED();
1514 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e
)
1519 m_value
.ident
= CSSValueVisible
;
1522 m_value
.ident
= CSSValueHidden
;
1525 m_value
.ident
= CSSValueCollapse
;
1530 template<> inline CSSPrimitiveValue::operator EVisibility() const
1532 switch (m_value
.ident
) {
1533 case CSSValueHidden
:
1535 case CSSValueVisible
:
1537 case CSSValueCollapse
:
1540 ASSERT_NOT_REACHED();
1545 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e
)
1550 m_value
.ident
= CSSValueNormal
;
1553 m_value
.ident
= CSSValuePre
;
1556 m_value
.ident
= CSSValuePreWrap
;
1559 m_value
.ident
= CSSValuePreLine
;
1562 m_value
.ident
= CSSValueNowrap
;
1565 m_value
.ident
= CSSValueWebkitNowrap
;
1570 template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
1572 switch (m_value
.ident
) {
1573 case CSSValueWebkitNowrap
:
1574 return KHTML_NOWRAP
;
1575 case CSSValueNowrap
:
1579 case CSSValuePreWrap
:
1581 case CSSValuePreLine
:
1583 case CSSValueNormal
:
1586 ASSERT_NOT_REACHED();
1591 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e
)
1595 case NormalWordBreak
:
1596 m_value
.ident
= CSSValueNormal
;
1598 case BreakAllWordBreak
:
1599 m_value
.ident
= CSSValueBreakAll
;
1601 case BreakWordBreak
:
1602 m_value
.ident
= CSSValueBreakWord
;
1607 template<> inline CSSPrimitiveValue::operator EWordBreak() const
1609 switch (m_value
.ident
) {
1610 case CSSValueBreakAll
:
1611 return BreakAllWordBreak
;
1612 case CSSValueBreakWord
:
1613 return BreakWordBreak
;
1614 case CSSValueNormal
:
1615 return NormalWordBreak
;
1617 ASSERT_NOT_REACHED();
1618 return NormalWordBreak
;
1622 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e
)
1626 case NormalWordWrap
:
1627 m_value
.ident
= CSSValueNormal
;
1630 m_value
.ident
= CSSValueBreakWord
;
1635 template<> inline CSSPrimitiveValue::operator EWordWrap() const
1637 switch (m_value
.ident
) {
1638 case CSSValueBreakWord
:
1639 return BreakWordWrap
;
1640 case CSSValueNormal
:
1641 return NormalWordWrap
;
1643 ASSERT_NOT_REACHED();
1644 return NormalWordWrap
;
1648 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e
)
1653 m_value
.ident
= CSSValueLtr
;
1656 m_value
.ident
= CSSValueRtl
;
1661 template<> inline CSSPrimitiveValue::operator TextDirection() const
1663 switch (m_value
.ident
) {
1669 ASSERT_NOT_REACHED();
1674 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e
)
1679 m_value
.ident
= CSSValueNone
;
1682 m_value
.ident
= CSSValueStroke
;
1685 m_value
.ident
= CSSValueFill
;
1688 m_value
.ident
= CSSValuePainted
;
1691 m_value
.ident
= CSSValueVisible
;
1693 case PE_VISIBLE_STROKE
:
1694 m_value
.ident
= CSSValueVisiblestroke
;
1696 case PE_VISIBLE_FILL
:
1697 m_value
.ident
= CSSValueVisiblefill
;
1699 case PE_VISIBLE_PAINTED
:
1700 m_value
.ident
= CSSValueVisiblepainted
;
1703 m_value
.ident
= CSSValueAuto
;
1706 m_value
.ident
= CSSValueAll
;
1711 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
1713 switch (m_value
.ident
) {
1720 case CSSValueVisiblepainted
:
1721 return PE_VISIBLE_PAINTED
;
1722 case CSSValueVisiblefill
:
1723 return PE_VISIBLE_FILL
;
1724 case CSSValueVisiblestroke
:
1725 return PE_VISIBLE_STROKE
;
1726 case CSSValueVisible
:
1728 case CSSValuePainted
:
1732 case CSSValueStroke
:
1735 ASSERT_NOT_REACHED();
1740 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageLoadingBorder e
)
1744 case IMAGE_LOADING_BORDER_NONE
:
1745 m_value
.ident
= CSSValueNone
;
1747 case IMAGE_LOADING_BORDER_OUTLINE
:
1748 m_value
.ident
= CSSValueWebkitLoadingOutline
;
1753 template<> inline CSSPrimitiveValue::operator EImageLoadingBorder() const
1755 switch (m_value
.ident
) {
1757 return IMAGE_LOADING_BORDER_NONE
;
1758 case CSSValueWebkitLoadingOutline
:
1759 return IMAGE_LOADING_BORDER_OUTLINE
;
1761 ASSERT_NOT_REACHED();
1762 return IMAGE_LOADING_BORDER_NONE
;
1768 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e
)
1773 m_value
.ident
= CSSValueButt
;
1776 m_value
.ident
= CSSValueRound
;
1779 m_value
.ident
= CSSValueSquare
;
1784 template<> inline CSSPrimitiveValue::operator LineCap() const
1786 switch (m_value
.ident
) {
1791 case CSSValueSquare
:
1794 ASSERT_NOT_REACHED();
1799 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e
)
1804 m_value
.ident
= CSSValueMiter
;
1807 m_value
.ident
= CSSValueRound
;
1810 m_value
.ident
= CSSValueBevel
;
1815 template<> inline CSSPrimitiveValue::operator LineJoin() const
1817 switch (m_value
.ident
) {
1825 ASSERT_NOT_REACHED();
1830 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e
)
1835 m_value
.ident
= CSSValueNonzero
;
1838 m_value
.ident
= CSSValueEvenodd
;
1843 template<> inline CSSPrimitiveValue::operator WindRule() const
1845 switch (m_value
.ident
) {
1846 case CSSValueNonzero
:
1847 return RULE_NONZERO
;
1848 case CSSValueEvenodd
:
1849 return RULE_EVENODD
;
1851 ASSERT_NOT_REACHED();
1852 return RULE_NONZERO
;
1857 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e
)
1862 m_value
.ident
= CSSValueAuto
;
1865 m_value
.ident
= CSSValueBaseline
;
1867 case AB_BEFORE_EDGE
:
1868 m_value
.ident
= CSSValueBeforeEdge
;
1870 case AB_TEXT_BEFORE_EDGE
:
1871 m_value
.ident
= CSSValueTextBeforeEdge
;
1874 m_value
.ident
= CSSValueMiddle
;
1877 m_value
.ident
= CSSValueCentral
;
1880 m_value
.ident
= CSSValueAfterEdge
;
1882 case AB_TEXT_AFTER_EDGE
:
1883 m_value
.ident
= CSSValueTextAfterEdge
;
1885 case AB_IDEOGRAPHIC
:
1886 m_value
.ident
= CSSValueIdeographic
;
1889 m_value
.ident
= CSSValueAlphabetic
;
1892 m_value
.ident
= CSSValueHanging
;
1894 case AB_MATHEMATICAL
:
1895 m_value
.ident
= CSSValueMathematical
;
1900 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
1902 switch (m_value
.ident
) {
1905 case CSSValueBaseline
:
1907 case CSSValueBeforeEdge
:
1908 return AB_BEFORE_EDGE
;
1909 case CSSValueTextBeforeEdge
:
1910 return AB_TEXT_BEFORE_EDGE
;
1911 case CSSValueMiddle
:
1913 case CSSValueCentral
:
1915 case CSSValueAfterEdge
:
1916 return AB_AFTER_EDGE
;
1917 case CSSValueTextAfterEdge
:
1918 return AB_TEXT_AFTER_EDGE
;
1919 case CSSValueIdeographic
:
1920 return AB_IDEOGRAPHIC
;
1921 case CSSValueAlphabetic
:
1922 return AB_ALPHABETIC
;
1923 case CSSValueHanging
:
1925 case CSSValueMathematical
:
1926 return AB_MATHEMATICAL
;
1928 ASSERT_NOT_REACHED();
1933 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e
)
1938 m_value
.ident
= CSSValueAuto
;
1941 m_value
.ident
= CSSValueSrgb
;
1944 m_value
.ident
= CSSValueLinearrgb
;
1949 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
1951 switch (m_value
.ident
) {
1954 case CSSValueLinearrgb
:
1955 return CI_LINEARRGB
;
1959 ASSERT_NOT_REACHED();
1964 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e
)
1969 m_value
.ident
= CSSValueAuto
;
1971 case CR_OPTIMIZESPEED
:
1972 m_value
.ident
= CSSValueOptimizespeed
;
1974 case CR_OPTIMIZEQUALITY
:
1975 m_value
.ident
= CSSValueOptimizequality
;
1980 template<> inline CSSPrimitiveValue::operator EColorRendering() const
1982 switch (m_value
.ident
) {
1983 case CSSValueOptimizespeed
:
1984 return CR_OPTIMIZESPEED
;
1985 case CSSValueOptimizequality
:
1986 return CR_OPTIMIZEQUALITY
;
1990 ASSERT_NOT_REACHED();
1995 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e
)
2000 m_value
.ident
= CSSValueAuto
;
2003 m_value
.ident
= CSSValueUseScript
;
2006 m_value
.ident
= CSSValueNoChange
;
2009 m_value
.ident
= CSSValueResetSize
;
2012 m_value
.ident
= CSSValueCentral
;
2015 m_value
.ident
= CSSValueMiddle
;
2017 case DB_TEXT_BEFORE_EDGE
:
2018 m_value
.ident
= CSSValueTextBeforeEdge
;
2020 case DB_TEXT_AFTER_EDGE
:
2021 m_value
.ident
= CSSValueTextAfterEdge
;
2023 case DB_IDEOGRAPHIC
:
2024 m_value
.ident
= CSSValueIdeographic
;
2027 m_value
.ident
= CSSValueAlphabetic
;
2030 m_value
.ident
= CSSValueHanging
;
2032 case DB_MATHEMATICAL
:
2033 m_value
.ident
= CSSValueMathematical
;
2038 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
2040 switch (m_value
.ident
) {
2043 case CSSValueUseScript
:
2044 return DB_USE_SCRIPT
;
2045 case CSSValueNoChange
:
2046 return DB_NO_CHANGE
;
2047 case CSSValueResetSize
:
2048 return DB_RESET_SIZE
;
2049 case CSSValueIdeographic
:
2050 return DB_IDEOGRAPHIC
;
2051 case CSSValueAlphabetic
:
2052 return DB_ALPHABETIC
;
2053 case CSSValueHanging
:
2055 case CSSValueMathematical
:
2056 return DB_MATHEMATICAL
;
2057 case CSSValueCentral
:
2059 case CSSValueMiddle
:
2061 case CSSValueTextAfterEdge
:
2062 return DB_TEXT_AFTER_EDGE
;
2063 case CSSValueTextBeforeEdge
:
2064 return DB_TEXT_BEFORE_EDGE
;
2066 ASSERT_NOT_REACHED();
2071 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e
)
2076 m_value
.ident
= CSSValueAuto
;
2078 case IR_OPTIMIZESPEED
:
2079 m_value
.ident
= CSSValueOptimizespeed
;
2081 case IR_OPTIMIZEQUALITY
:
2082 m_value
.ident
= CSSValueOptimizequality
;
2087 template<> inline CSSPrimitiveValue::operator EImageRendering() const
2089 switch (m_value
.ident
) {
2092 case CSSValueOptimizespeed
:
2093 return IR_OPTIMIZESPEED
;
2094 case CSSValueOptimizequality
:
2095 return IR_OPTIMIZEQUALITY
;
2097 ASSERT_NOT_REACHED();
2102 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e
)
2107 m_value
.ident
= CSSValueAuto
;
2109 case IR_OPTIMIZESPEED
:
2110 m_value
.ident
= CSSValueOptimizespeed
;
2113 m_value
.ident
= CSSValueCrispedges
;
2115 case SR_GEOMETRICPRECISION
:
2116 m_value
.ident
= CSSValueGeometricprecision
;
2121 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
2123 switch (m_value
.ident
) {
2126 case CSSValueOptimizespeed
:
2127 return SR_OPTIMIZESPEED
;
2128 case CSSValueCrispedges
:
2129 return SR_CRISPEDGES
;
2130 case CSSValueGeometricprecision
:
2131 return SR_GEOMETRICPRECISION
;
2133 ASSERT_NOT_REACHED();
2138 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e
)
2143 m_value
.ident
= CSSValueStart
;
2146 m_value
.ident
= CSSValueMiddle
;
2149 m_value
.ident
= CSSValueEnd
;
2154 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
2156 switch (m_value
.ident
) {
2159 case CSSValueMiddle
:
2164 ASSERT_NOT_REACHED();
2169 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextRendering e
)
2174 m_value
.ident
= CSSValueAuto
;
2176 case TR_OPTIMIZESPEED
:
2177 m_value
.ident
= CSSValueOptimizespeed
;
2179 case TR_OPTIMIZELEGIBILITY
:
2180 m_value
.ident
= CSSValueOptimizelegibility
;
2182 case TR_GEOMETRICPRECISION
:
2183 m_value
.ident
= CSSValueGeometricprecision
;
2188 template<> inline CSSPrimitiveValue::operator ETextRendering() const
2190 switch (m_value
.ident
) {
2193 case CSSValueOptimizespeed
:
2194 return TR_OPTIMIZESPEED
;
2195 case CSSValueOptimizelegibility
:
2196 return TR_OPTIMIZELEGIBILITY
;
2197 case CSSValueGeometricprecision
:
2198 return TR_GEOMETRICPRECISION
;
2200 ASSERT_NOT_REACHED();
2205 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWritingMode e
)
2210 m_value
.ident
= CSSValueLrTb
;
2213 m_value
.ident
= CSSValueLr
;
2216 m_value
.ident
= CSSValueRlTb
;
2219 m_value
.ident
= CSSValueRl
;
2222 m_value
.ident
= CSSValueTbRl
;
2225 m_value
.ident
= CSSValueTb
;
2230 template<> inline CSSPrimitiveValue::operator EWritingMode() const
2232 return static_cast<EWritingMode
>(m_value
.ident
- CSSValueLrTb
);