tizen beta release
[profile/ivi/webkit-efl.git] / Source / WebCore / css / CSSPrimitiveValueMappings.h
1 /*
2  * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
3  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
5  * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
6  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef CSSPrimitiveValueMappings_h
31 #define CSSPrimitiveValueMappings_h
32
33 #include "ColorSpace.h"
34 #include "CSSPrimitiveValue.h"
35 #include "CSSValueKeywords.h"
36 #include "FontDescription.h"
37 #include "FontSmoothingMode.h"
38 #include "GraphicsTypes.h"
39 #include "Path.h"
40 #include "RenderStyleConstants.h"
41 #include "SVGRenderStyleDefs.h"
42 #include "TextDirection.h"
43 #include "TextOrientation.h"
44 #include "TextRenderingMode.h"
45 #include "ThemeTypes.h"
46 #include "UnicodeBidi.h"
47
48 #if ENABLE(CSS_SHADERS)
49 #include "CustomFilterOperation.h"
50 #endif
51
52 #include <wtf/MathExtras.h>
53
54 namespace WebCore {
55
56 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i)
57     : CSSValue(PrimitiveClass)
58 {
59     m_primitiveUnitType = CSS_NUMBER;
60     m_value.num = static_cast<double>(i);
61 }
62
63 template<> inline CSSPrimitiveValue::operator short() const
64 {
65     if (m_primitiveUnitType == CSS_NUMBER)
66         return clampTo<short>(m_value.num);
67
68     ASSERT_NOT_REACHED();
69     return 0;
70 }
71
72 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(unsigned short i)
73     : CSSValue(PrimitiveClass)
74 {
75     m_primitiveUnitType = CSS_NUMBER;
76     m_value.num = static_cast<double>(i);
77 }
78
79 template<> inline CSSPrimitiveValue::operator unsigned short() const
80 {
81     if (m_primitiveUnitType == CSS_NUMBER)
82         return clampTo<unsigned short>(m_value.num);
83
84     ASSERT_NOT_REACHED();
85     return 0;
86 }
87
88 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(int i)
89     : CSSValue(PrimitiveClass)
90 {
91     m_primitiveUnitType = CSS_NUMBER;
92     m_value.num = static_cast<double>(i);
93 }
94
95 template<> inline CSSPrimitiveValue::operator int() const
96 {
97     if (m_primitiveUnitType == CSS_NUMBER)
98         return clampTo<int>(m_value.num);
99
100     ASSERT_NOT_REACHED();
101     return 0;
102 }
103
104 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(unsigned i)
105     : CSSValue(PrimitiveClass)
106 {
107     m_primitiveUnitType = CSS_NUMBER;
108     m_value.num = static_cast<double>(i);
109 }
110
111 template<> inline CSSPrimitiveValue::operator unsigned() const
112 {
113     if (m_primitiveUnitType == CSS_NUMBER)
114         return clampTo<unsigned>(m_value.num);
115
116     ASSERT_NOT_REACHED();
117     return 0;
118 }
119
120
121 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(float i)
122     : CSSValue(PrimitiveClass)
123 {
124     m_primitiveUnitType = CSS_NUMBER;
125     m_value.num = static_cast<double>(i);
126 }
127
128 template<> inline CSSPrimitiveValue::operator float() const
129 {
130     if (m_primitiveUnitType == CSS_NUMBER)
131         return clampTo<float>(m_value.num);
132
133     ASSERT_NOT_REACHED();
134     return 0.0f;
135 }
136
137 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
138     : CSSValue(PrimitiveClass)
139 {
140     switch (columnSpan) {
141     case ColumnSpanAll:
142         m_primitiveUnitType = CSS_IDENT;
143         m_value.ident = CSSValueAll;
144         break;
145     case ColumnSpanOne:
146         m_primitiveUnitType = CSS_NUMBER;
147         m_value.num = 1;
148         break;
149     }
150 }
151
152 template<> inline CSSPrimitiveValue::operator ColumnSpan() const
153 {
154     if (m_primitiveUnitType == CSS_IDENT && m_value.ident == CSSValueAll)
155         return ColumnSpanAll;
156     if (m_primitiveUnitType == CSS_NUMBER && m_value.num == 1)
157         return ColumnSpanOne;
158     ASSERT_NOT_REACHED();
159     return ColumnSpanOne;
160 }
161
162
163 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PrintColorAdjust value)
164     : CSSValue(PrimitiveClass)
165 {
166     m_primitiveUnitType = CSS_IDENT;
167     switch (value) {
168     case PrintColorAdjustExact:
169         m_value.ident = CSSValueExact;
170         break;
171     case PrintColorAdjustEconomy:
172         m_value.ident = CSSValueEconomy;
173         break;
174     }
175 }
176
177 template<> inline CSSPrimitiveValue::operator PrintColorAdjust() const
178 {
179     switch (m_value.ident) {
180     case CSSValueEconomy:
181         return PrintColorAdjustEconomy;
182     case CSSValueExact:
183         return PrintColorAdjustExact;
184     default:
185         ASSERT_NOT_REACHED();
186         return PrintColorAdjustEconomy;
187     }
188 }
189
190
191 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
192     : CSSValue(PrimitiveClass)
193 {
194     m_primitiveUnitType = CSS_IDENT;
195     switch (e) {
196         case BNONE:
197             m_value.ident = CSSValueNone;
198             break;
199         case BHIDDEN:
200             m_value.ident = CSSValueHidden;
201             break;
202         case INSET:
203             m_value.ident = CSSValueInset;
204             break;
205         case GROOVE:
206             m_value.ident = CSSValueGroove;
207             break;
208         case RIDGE:
209             m_value.ident = CSSValueRidge;
210             break;
211         case OUTSET:
212             m_value.ident = CSSValueOutset;
213             break;
214         case DOTTED:
215             m_value.ident = CSSValueDotted;
216             break;
217         case DASHED:
218             m_value.ident = CSSValueDashed;
219             break;
220         case SOLID:
221             m_value.ident = CSSValueSolid;
222             break;
223         case DOUBLE:
224             m_value.ident = CSSValueDouble;
225             break;
226     }
227 }
228
229 template<> inline CSSPrimitiveValue::operator EBorderStyle() const
230 {
231     if (m_value.ident == CSSValueAuto) // Valid for CSS outline-style
232         return DOTTED;
233     return (EBorderStyle)(m_value.ident - CSSValueNone);
234 }
235
236 template<> inline CSSPrimitiveValue::operator OutlineIsAuto() const
237 {
238     if (m_value.ident == CSSValueAuto)
239         return AUTO_ON;
240     return AUTO_OFF;
241 }
242
243 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
244     : CSSValue(PrimitiveClass)
245 {
246     m_primitiveUnitType = CSS_IDENT;
247     switch (e) {
248         case CompositeClear:
249             m_value.ident = CSSValueClear;
250             break;
251         case CompositeCopy:
252             m_value.ident = CSSValueCopy;
253             break;
254         case CompositeSourceOver:
255             m_value.ident = CSSValueSourceOver;
256             break;
257         case CompositeSourceIn:
258             m_value.ident = CSSValueSourceIn;
259             break;
260         case CompositeSourceOut:
261             m_value.ident = CSSValueSourceOut;
262             break;
263         case CompositeSourceAtop:
264             m_value.ident = CSSValueSourceAtop;
265             break;
266         case CompositeDestinationOver:
267             m_value.ident = CSSValueDestinationOver;
268             break;
269         case CompositeDestinationIn:
270             m_value.ident = CSSValueDestinationIn;
271             break;
272         case CompositeDestinationOut:
273             m_value.ident = CSSValueDestinationOut;
274             break;
275         case CompositeDestinationAtop:
276             m_value.ident = CSSValueDestinationAtop;
277             break;
278         case CompositeXOR:
279             m_value.ident = CSSValueXor;
280             break;
281         case CompositePlusDarker:
282             m_value.ident = CSSValuePlusDarker;
283             break;
284         case CompositePlusLighter:
285             m_value.ident = CSSValuePlusLighter;
286             break;
287     }
288 }
289
290 template<> inline CSSPrimitiveValue::operator CompositeOperator() const
291 {
292     switch (m_value.ident) {
293         case CSSValueClear:
294             return CompositeClear;
295         case CSSValueCopy:
296             return CompositeCopy;
297         case CSSValueSourceOver:
298             return CompositeSourceOver;
299         case CSSValueSourceIn:
300             return CompositeSourceIn;
301         case CSSValueSourceOut:
302             return CompositeSourceOut;
303         case CSSValueSourceAtop:
304             return CompositeSourceAtop;
305         case CSSValueDestinationOver:
306             return CompositeDestinationOver;
307         case CSSValueDestinationIn:
308             return CompositeDestinationIn;
309         case CSSValueDestinationOut:
310             return CompositeDestinationOut;
311         case CSSValueDestinationAtop:
312             return CompositeDestinationAtop;
313         case CSSValueXor:
314             return CompositeXOR;
315         case CSSValuePlusDarker:
316             return CompositePlusDarker;
317         case CSSValuePlusLighter:
318             return CompositePlusLighter;
319         default:
320             ASSERT_NOT_REACHED();
321             return CompositeClear;
322     }
323 }
324
325 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
326     : CSSValue(PrimitiveClass)
327 {
328     m_primitiveUnitType = CSS_IDENT;
329     switch (e) {
330         case NoControlPart:
331             m_value.ident = CSSValueNone;
332             break;
333         case CheckboxPart:
334             m_value.ident = CSSValueCheckbox;
335             break;
336         case RadioPart:
337             m_value.ident = CSSValueRadio;
338             break;
339         case PushButtonPart:
340             m_value.ident = CSSValuePushButton;
341             break;
342         case SquareButtonPart:
343             m_value.ident = CSSValueSquareButton;
344             break;
345         case ButtonPart:
346             m_value.ident = CSSValueButton;
347             break;
348         case ButtonBevelPart:
349             m_value.ident = CSSValueButtonBevel;
350             break;
351         case DefaultButtonPart:
352             m_value.ident = CSSValueDefaultButton;
353             break;
354         case InnerSpinButtonPart:
355             m_value.ident = CSSValueInnerSpinButton;
356             break;
357         case ListboxPart:
358             m_value.ident = CSSValueListbox;
359             break;
360         case ListButtonPart:
361 #if ENABLE(DATALIST)
362             m_value.ident = CSSValueListButton;
363 #endif
364             break;
365         case ListItemPart:
366             m_value.ident = CSSValueListitem;
367             break;
368         case MediaFullscreenButtonPart:
369             m_value.ident = CSSValueMediaFullscreenButton;
370             break;
371         case MediaPlayButtonPart:
372             m_value.ident = CSSValueMediaPlayButton;
373             break;
374         case MediaMuteButtonPart:
375             m_value.ident = CSSValueMediaMuteButton;
376             break;
377         case MediaSeekBackButtonPart:
378             m_value.ident = CSSValueMediaSeekBackButton;
379             break;
380         case MediaSeekForwardButtonPart:
381             m_value.ident = CSSValueMediaSeekForwardButton;
382             break;
383         case MediaRewindButtonPart:
384             m_value.ident = CSSValueMediaRewindButton;
385             break;
386         case MediaReturnToRealtimeButtonPart:
387             m_value.ident = CSSValueMediaReturnToRealtimeButton;
388             break;
389         case MediaToggleClosedCaptionsButtonPart:
390             m_value.ident = CSSValueMediaToggleClosedCaptionsButton;
391             break;
392         case MediaSliderPart:
393             m_value.ident = CSSValueMediaSlider;
394             break;
395         case MediaSliderThumbPart:
396             m_value.ident = CSSValueMediaSliderthumb;
397             break;
398         case MediaVolumeSliderContainerPart:
399             m_value.ident = CSSValueMediaVolumeSliderContainer;
400             break;
401         case MediaVolumeSliderPart:
402             m_value.ident = CSSValueMediaVolumeSlider;
403             break;
404         case MediaVolumeSliderMuteButtonPart:
405             m_value.ident = CSSValueMediaVolumeSliderMuteButton;
406             break;
407         case MediaVolumeSliderThumbPart:
408             m_value.ident = CSSValueMediaVolumeSliderthumb;
409             break;
410         case MediaControlsBackgroundPart:
411             m_value.ident = CSSValueMediaControlsBackground;
412             break;
413         case MediaControlsFullscreenBackgroundPart:
414             m_value.ident = CSSValueMediaControlsFullscreenBackground;
415             break;
416         case MediaCurrentTimePart:
417             m_value.ident = CSSValueMediaCurrentTimeDisplay;
418             break;
419         case MediaTimeRemainingPart:
420             m_value.ident = CSSValueMediaTimeRemainingDisplay;
421             break;
422         case MenulistPart:
423             m_value.ident = CSSValueMenulist;
424             break;
425         case MenulistButtonPart:
426             m_value.ident = CSSValueMenulistButton;
427             break;
428         case MenulistTextPart:
429             m_value.ident = CSSValueMenulistText;
430             break;
431         case MenulistTextFieldPart:
432             m_value.ident = CSSValueMenulistTextfield;
433             break;
434         case MeterPart:
435             m_value.ident = CSSValueMeter;
436             break;
437         case RelevancyLevelIndicatorPart:
438             m_value.ident = CSSValueRelevancyLevelIndicator;
439             break;
440         case ContinuousCapacityLevelIndicatorPart:
441             m_value.ident = CSSValueContinuousCapacityLevelIndicator;
442             break;
443         case DiscreteCapacityLevelIndicatorPart:
444             m_value.ident = CSSValueDiscreteCapacityLevelIndicator;
445             break;
446         case RatingLevelIndicatorPart:
447             m_value.ident = CSSValueRatingLevelIndicator;
448             break;
449         case ProgressBarPart:
450 #if ENABLE(PROGRESS_TAG)
451             m_value.ident = CSSValueProgressBar;
452 #endif
453             break;
454         case ProgressBarValuePart:
455 #if ENABLE(PROGRESS_TAG)
456             m_value.ident = CSSValueProgressBarValue;
457 #endif
458             break;
459         case SliderHorizontalPart:
460             m_value.ident = CSSValueSliderHorizontal;
461             break;
462         case SliderVerticalPart:
463             m_value.ident = CSSValueSliderVertical;
464             break;
465         case SliderThumbHorizontalPart:
466             m_value.ident = CSSValueSliderthumbHorizontal;
467             break;
468         case SliderThumbVerticalPart:
469             m_value.ident = CSSValueSliderthumbVertical;
470             break;
471         case CaretPart:
472             m_value.ident = CSSValueCaret;
473             break;
474         case SearchFieldPart:
475             m_value.ident = CSSValueSearchfield;
476             break;
477         case SearchFieldDecorationPart:
478             m_value.ident = CSSValueSearchfieldDecoration;
479             break;
480         case SearchFieldResultsDecorationPart:
481             m_value.ident = CSSValueSearchfieldResultsDecoration;
482             break;
483         case SearchFieldResultsButtonPart:
484             m_value.ident = CSSValueSearchfieldResultsButton;
485             break;
486         case SearchFieldCancelButtonPart:
487             m_value.ident = CSSValueSearchfieldCancelButton;
488             break;
489         case TextFieldPart:
490             m_value.ident = CSSValueTextfield;
491             break;
492 #if ENABLE(TIZEN_INPUT_TAG_DATE)
493         case DateFieldPart:
494             m_value.ident = CSSValueDatefield;
495             break;
496 #endif
497         case TextAreaPart:
498             m_value.ident = CSSValueTextarea;
499             break;
500         case CapsLockIndicatorPart:
501             m_value.ident = CSSValueCapsLockIndicator;
502             break;
503         case InputSpeechButtonPart:
504 #if ENABLE(INPUT_SPEECH)
505             m_value.ident = CSSValueWebkitInputSpeechButton;
506 #endif
507             break;
508     }
509 }
510
511 template<> inline CSSPrimitiveValue::operator ControlPart() const
512 {
513     if (m_value.ident == CSSValueNone)
514         return NoControlPart;
515     else
516         return ControlPart(m_value.ident - CSSValueCheckbox + 1);
517 }
518
519 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBackfaceVisibility e)
520     : CSSValue(PrimitiveClass)
521 {
522     m_primitiveUnitType = CSS_IDENT;
523     switch (e) {
524     case BackfaceVisibilityVisible:
525         m_value.ident = CSSValueVisible;
526         break;
527     case BackfaceVisibilityHidden:
528         m_value.ident = CSSValueHidden;
529         break;
530     }
531 }
532
533 template<> inline CSSPrimitiveValue::operator EBackfaceVisibility() const
534 {
535     switch (m_value.ident) {
536     case CSSValueVisible:
537         return BackfaceVisibilityVisible;
538     case CSSValueHidden:
539         return BackfaceVisibilityHidden;
540     default:
541         ASSERT_NOT_REACHED();
542         return BackfaceVisibilityHidden;
543     }
544 }
545
546
547 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e)
548     : CSSValue(PrimitiveClass)
549 {
550     m_primitiveUnitType = CSS_IDENT;
551     switch (e) {
552         case ScrollBackgroundAttachment:
553             m_value.ident = CSSValueScroll;
554             break;
555         case LocalBackgroundAttachment:
556             m_value.ident = CSSValueLocal;
557             break;
558         case FixedBackgroundAttachment:
559             m_value.ident = CSSValueFixed;
560             break;
561     }
562 }
563
564 template<> inline CSSPrimitiveValue::operator EFillAttachment() const
565 {
566     switch (m_value.ident) {
567         case CSSValueScroll:
568             return ScrollBackgroundAttachment;
569         case CSSValueLocal:
570             return LocalBackgroundAttachment;
571         case CSSValueFixed:
572             return FixedBackgroundAttachment;
573         default:
574             ASSERT_NOT_REACHED();
575             return ScrollBackgroundAttachment;
576     }
577 }
578
579 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
580     : CSSValue(PrimitiveClass)
581 {
582     m_primitiveUnitType = CSS_IDENT;
583     switch (e) {
584         case BorderFillBox:
585             m_value.ident = CSSValueBorderBox;
586             break;
587         case PaddingFillBox:
588             m_value.ident = CSSValuePaddingBox;
589             break;
590         case ContentFillBox:
591             m_value.ident = CSSValueContentBox;
592             break;
593         case TextFillBox:
594             m_value.ident = CSSValueText;
595             break;
596     }
597 }
598
599 template<> inline CSSPrimitiveValue::operator EFillBox() const
600 {
601     switch (m_value.ident) {
602         case CSSValueBorder:
603         case CSSValueBorderBox:
604             return BorderFillBox;
605         case CSSValuePadding:
606         case CSSValuePaddingBox:
607             return PaddingFillBox;
608         case CSSValueContent:
609         case CSSValueContentBox:
610             return ContentFillBox;
611         case CSSValueText:
612         case CSSValueWebkitText:
613             return TextFillBox;
614         default:
615             ASSERT_NOT_REACHED();
616             return BorderFillBox;
617     }
618 }
619
620 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)
621     : CSSValue(PrimitiveClass)
622 {
623     m_primitiveUnitType = CSS_IDENT;
624     switch (e) {
625         case RepeatFill:
626             m_value.ident = CSSValueRepeat;
627             break;
628         case NoRepeatFill:
629             m_value.ident = CSSValueNoRepeat;
630             break;
631         case RoundFill:
632             m_value.ident = CSSValueRound;
633             break;
634         case SpaceFill:
635             m_value.ident = CSSValueSpace;
636             break;
637     }
638 }
639
640 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
641 {
642     switch (m_value.ident) {
643         case CSSValueRepeat:
644             return RepeatFill;
645         case CSSValueNoRepeat:
646             return NoRepeatFill;
647         case CSSValueRound:
648             return RoundFill;
649         case CSSValueSpace:
650             return SpaceFill;
651         default:
652             ASSERT_NOT_REACHED();
653             return RepeatFill;
654     }
655 }
656
657 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)
658     : CSSValue(PrimitiveClass)
659 {
660     m_primitiveUnitType = CSS_IDENT;
661     switch (e) {
662         case BSTRETCH:
663             m_value.ident = CSSValueStretch;
664             break;
665         case BSTART:
666             m_value.ident = CSSValueStart;
667             break;
668         case BCENTER:
669             m_value.ident = CSSValueCenter;
670             break;
671         case BEND:
672             m_value.ident = CSSValueEnd;
673             break;
674         case BBASELINE:
675             m_value.ident = CSSValueBaseline;
676             break;
677         case BJUSTIFY:
678             m_value.ident = CSSValueJustify;
679             break;
680     }
681 }
682
683 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
684 {
685     switch (m_value.ident) {
686         case CSSValueStretch:
687             return BSTRETCH;
688         case CSSValueStart:
689             return BSTART;
690         case CSSValueEnd:
691             return BEND;
692         case CSSValueCenter:
693             return BCENTER;
694         case CSSValueBaseline:
695             return BBASELINE;
696         case CSSValueJustify:
697             return BJUSTIFY;
698         default:
699             ASSERT_NOT_REACHED();
700             return BSTRETCH;
701     }
702 }
703
704 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxSizing e)
705     : CSSValue(PrimitiveClass)
706 {
707     m_primitiveUnitType = CSS_IDENT;
708     switch (e) {
709     case BORDER_BOX:
710         m_value.ident = CSSValueBorderBox;
711         break;
712     case CONTENT_BOX:
713         m_value.ident = CSSValueContentBox;
714         break;
715     }
716 }
717
718 template<> inline CSSPrimitiveValue::operator EBoxSizing() const
719 {
720     switch (m_value.ident) {
721     case CSSValueBorderBox:
722         return BORDER_BOX;
723     case CSSValueContentBox:
724         return CONTENT_BOX;
725     default:
726         ASSERT_NOT_REACHED();
727         return BORDER_BOX;
728     }
729 }
730
731 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
732     : CSSValue(PrimitiveClass)
733 {
734     m_primitiveUnitType = CSS_IDENT;
735     switch (e) {
736         case BNORMAL:
737             m_value.ident = CSSValueNormal;
738             break;
739         case BREVERSE:
740             m_value.ident = CSSValueReverse;
741             break;
742     }
743 }
744
745 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
746 {
747     switch (m_value.ident) {
748         case CSSValueNormal:
749             return BNORMAL;
750         case CSSValueReverse:
751             return BREVERSE;
752         default:
753             ASSERT_NOT_REACHED();
754             return BNORMAL;
755     }
756 }
757
758 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)
759     : CSSValue(PrimitiveClass)
760 {
761     m_primitiveUnitType = CSS_IDENT;
762     switch (e) {
763         case SINGLE:
764             m_value.ident = CSSValueSingle;
765             break;
766         case MULTIPLE:
767             m_value.ident = CSSValueMultiple;
768             break;
769     }
770 }
771
772 template<> inline CSSPrimitiveValue::operator EBoxLines() const
773 {
774     switch (m_value.ident) {
775         case CSSValueSingle:
776             return SINGLE;
777         case CSSValueMultiple:
778             return MULTIPLE;
779         default:
780             ASSERT_NOT_REACHED();
781             return SINGLE;
782     }
783 }
784
785 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)
786     : CSSValue(PrimitiveClass)
787 {
788     m_primitiveUnitType = CSS_IDENT;
789     switch (e) {
790         case HORIZONTAL:
791             m_value.ident = CSSValueHorizontal;
792             break;
793         case VERTICAL:
794             m_value.ident = CSSValueVertical;
795             break;
796     }
797 }
798
799 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
800 {
801     switch (m_value.ident) {
802         case CSSValueHorizontal:
803         case CSSValueInlineAxis:
804             return HORIZONTAL;
805         case CSSValueVertical:
806         case CSSValueBlockAxis:
807             return VERTICAL;
808         default:
809             ASSERT_NOT_REACHED();
810             return HORIZONTAL;
811     }
812 }
813
814 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)
815     : CSSValue(PrimitiveClass)
816 {
817     m_primitiveUnitType = CSS_IDENT;
818     switch (e) {
819         case CAPLEFT:
820             m_value.ident = CSSValueLeft;
821             break;
822         case CAPRIGHT:
823             m_value.ident = CSSValueRight;
824             break;
825         case CAPTOP:
826             m_value.ident = CSSValueTop;
827             break;
828         case CAPBOTTOM:
829             m_value.ident = CSSValueBottom;
830             break;
831     }
832 }
833
834 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
835 {
836     switch (m_value.ident) {
837         case CSSValueLeft:
838             return CAPLEFT;
839         case CSSValueRight:
840             return CAPRIGHT;
841         case CSSValueTop:
842             return CAPTOP;
843         case CSSValueBottom:
844             return CAPBOTTOM;
845         default:
846             ASSERT_NOT_REACHED();
847             return CAPTOP;
848     }
849 }
850
851 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)
852     : CSSValue(PrimitiveClass)
853 {
854     m_primitiveUnitType = CSS_IDENT;
855     switch (e) {
856         case CNONE:
857             m_value.ident = CSSValueNone;
858             break;
859         case CLEFT:
860             m_value.ident = CSSValueLeft;
861             break;
862         case CRIGHT:
863             m_value.ident = CSSValueRight;
864             break;
865         case CBOTH:
866             m_value.ident = CSSValueBoth;
867             break;
868     }
869 }
870
871 template<> inline CSSPrimitiveValue::operator EClear() const
872 {
873     switch (m_value.ident) {
874         case CSSValueNone:
875             return CNONE;
876         case CSSValueLeft:
877             return CLEFT;
878         case CSSValueRight:
879             return CRIGHT;
880         case CSSValueBoth:
881             return CBOTH;
882         default:
883             ASSERT_NOT_REACHED();
884             return CNONE;
885     }
886 }
887
888 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e)
889     : CSSValue(PrimitiveClass)
890 {
891     m_primitiveUnitType = CSS_IDENT;
892     switch (e) {
893         case CURSOR_AUTO:
894             m_value.ident = CSSValueAuto;
895             break;
896         case CURSOR_CROSS:
897             m_value.ident = CSSValueCrosshair;
898             break;
899         case CURSOR_DEFAULT:
900             m_value.ident = CSSValueDefault;
901             break;
902         case CURSOR_POINTER:
903             m_value.ident = CSSValuePointer;
904             break;
905         case CURSOR_MOVE:
906             m_value.ident = CSSValueMove;
907             break;
908         case CURSOR_CELL:
909             m_value.ident = CSSValueCell;
910             break;
911         case CURSOR_VERTICAL_TEXT:
912             m_value.ident = CSSValueVerticalText;
913             break;
914         case CURSOR_CONTEXT_MENU:
915             m_value.ident = CSSValueContextMenu;
916             break;
917         case CURSOR_ALIAS:
918             m_value.ident = CSSValueAlias;
919             break;
920         case CURSOR_COPY:
921             m_value.ident = CSSValueCopy;
922             break;
923         case CURSOR_NONE:
924             m_value.ident = CSSValueNone;
925             break;
926         case CURSOR_PROGRESS:
927             m_value.ident = CSSValueProgress;
928             break;
929         case CURSOR_NO_DROP:
930             m_value.ident = CSSValueNoDrop;
931             break;
932         case CURSOR_NOT_ALLOWED:
933             m_value.ident = CSSValueNotAllowed;
934             break;
935         case CURSOR_WEBKIT_ZOOM_IN:
936             m_value.ident = CSSValueWebkitZoomIn;
937             break;
938         case CURSOR_WEBKIT_ZOOM_OUT:
939             m_value.ident = CSSValueWebkitZoomOut;
940             break;
941         case CURSOR_E_RESIZE:
942             m_value.ident = CSSValueEResize;
943             break;
944         case CURSOR_NE_RESIZE:
945             m_value.ident = CSSValueNeResize;
946             break;
947         case CURSOR_NW_RESIZE:
948             m_value.ident = CSSValueNwResize;
949             break;
950         case CURSOR_N_RESIZE:
951             m_value.ident = CSSValueNResize;
952             break;
953         case CURSOR_SE_RESIZE:
954             m_value.ident = CSSValueSeResize;
955             break;
956         case CURSOR_SW_RESIZE:
957             m_value.ident = CSSValueSwResize;
958             break;
959         case CURSOR_S_RESIZE:
960             m_value.ident = CSSValueSResize;
961             break;
962         case CURSOR_W_RESIZE:
963             m_value.ident = CSSValueWResize;
964             break;
965         case CURSOR_EW_RESIZE:
966             m_value.ident = CSSValueEwResize;
967             break;
968         case CURSOR_NS_RESIZE:
969             m_value.ident = CSSValueNsResize;
970             break;
971         case CURSOR_NESW_RESIZE:
972             m_value.ident = CSSValueNeswResize;
973             break;
974         case CURSOR_NWSE_RESIZE:
975             m_value.ident = CSSValueNwseResize;
976             break;
977         case CURSOR_COL_RESIZE:
978             m_value.ident = CSSValueColResize;
979             break;
980         case CURSOR_ROW_RESIZE:
981             m_value.ident = CSSValueRowResize;
982             break;
983         case CURSOR_TEXT:
984             m_value.ident = CSSValueText;
985             break;
986         case CURSOR_WAIT:
987             m_value.ident = CSSValueWait;
988             break;
989         case CURSOR_HELP:
990             m_value.ident = CSSValueHelp;
991             break;
992         case CURSOR_ALL_SCROLL:
993             m_value.ident = CSSValueAllScroll;
994             break;
995         case CURSOR_WEBKIT_GRAB:
996             m_value.ident = CSSValueWebkitGrab;
997             break;
998         case CURSOR_WEBKIT_GRABBING:
999             m_value.ident = CSSValueWebkitGrabbing;
1000             break;
1001     }
1002 }
1003
1004 template<> inline CSSPrimitiveValue::operator ECursor() const
1005 {
1006     if (m_value.ident == CSSValueCopy)
1007         return CURSOR_COPY;
1008     if (m_value.ident == CSSValueNone)
1009         return CURSOR_NONE;
1010     return static_cast<ECursor>(m_value.ident - CSSValueAuto);
1011 }
1012
1013 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e)
1014     : CSSValue(PrimitiveClass)
1015 {
1016     m_primitiveUnitType = CSS_IDENT;
1017     switch (e) {
1018         case INLINE:
1019             m_value.ident = CSSValueInline;
1020             break;
1021         case BLOCK:
1022             m_value.ident = CSSValueBlock;
1023             break;
1024         case LIST_ITEM:
1025             m_value.ident = CSSValueListItem;
1026             break;
1027         case RUN_IN:
1028             m_value.ident = CSSValueRunIn;
1029             break;
1030         case COMPACT:
1031             m_value.ident = CSSValueCompact;
1032             break;
1033         case INLINE_BLOCK:
1034             m_value.ident = CSSValueInlineBlock;
1035             break;
1036         case TABLE:
1037             m_value.ident = CSSValueTable;
1038             break;
1039         case INLINE_TABLE:
1040             m_value.ident = CSSValueInlineTable;
1041             break;
1042         case TABLE_ROW_GROUP:
1043             m_value.ident = CSSValueTableRowGroup;
1044             break;
1045         case TABLE_HEADER_GROUP:
1046             m_value.ident = CSSValueTableHeaderGroup;
1047             break;
1048         case TABLE_FOOTER_GROUP:
1049             m_value.ident = CSSValueTableFooterGroup;
1050             break;
1051         case TABLE_ROW:
1052             m_value.ident = CSSValueTableRow;
1053             break;
1054         case TABLE_COLUMN_GROUP:
1055             m_value.ident = CSSValueTableColumnGroup;
1056             break;
1057         case TABLE_COLUMN:
1058             m_value.ident = CSSValueTableColumn;
1059             break;
1060         case TABLE_CELL:
1061             m_value.ident = CSSValueTableCell;
1062             break;
1063         case TABLE_CAPTION:
1064             m_value.ident = CSSValueTableCaption;
1065             break;
1066         case BOX:
1067             m_value.ident = CSSValueWebkitBox;
1068             break;
1069         case INLINE_BOX:
1070             m_value.ident = CSSValueWebkitInlineBox;
1071             break;
1072         case FLEXBOX:
1073             m_value.ident = CSSValueWebkitFlexbox;
1074             break;
1075         case INLINE_FLEXBOX:
1076             m_value.ident = CSSValueWebkitInlineFlexbox;
1077             break;
1078 #if ENABLE(CSS_GRID_LAYOUT)
1079         case GRID:
1080             m_value.ident = CSSValueWebkitGrid;
1081             break;
1082         case INLINE_GRID:
1083             m_value.ident = CSSValueWebkitInlineGrid;
1084             break;
1085 #endif
1086         case NONE:
1087             m_value.ident = CSSValueNone;
1088             break;
1089     }
1090 }
1091
1092 template<> inline CSSPrimitiveValue::operator EDisplay() const
1093 {
1094     if (m_value.ident == CSSValueNone)
1095         return NONE;
1096
1097     EDisplay display = static_cast<EDisplay>(m_value.ident - CSSValueInline);
1098     ASSERT(display >= INLINE && display <= NONE);
1099     return display;
1100 }
1101
1102 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e)
1103     : CSSValue(PrimitiveClass)
1104 {
1105     m_primitiveUnitType = CSS_IDENT;
1106     switch (e) {
1107         case SHOW:
1108             m_value.ident = CSSValueShow;
1109             break;
1110         case HIDE:
1111             m_value.ident = CSSValueHide;
1112             break;
1113     }
1114 }
1115
1116 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
1117 {
1118     switch (m_value.ident) {
1119         case CSSValueShow:
1120             return SHOW;
1121         case CSSValueHide:
1122             return HIDE;
1123         default:
1124             ASSERT_NOT_REACHED();
1125             return SHOW;
1126     }
1127 }
1128
1129 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexAlign e)
1130     : CSSValue(PrimitiveClass)
1131 {
1132     m_primitiveUnitType = CSS_IDENT;
1133     switch (e) {
1134     case AlignStart:
1135         m_value.ident = CSSValueStart;
1136         break;
1137     case AlignEnd:
1138         m_value.ident = CSSValueEnd;
1139         break;
1140     case AlignCenter:
1141         m_value.ident = CSSValueCenter;
1142         break;
1143     case AlignStretch:
1144         m_value.ident = CSSValueStretch;
1145         break;
1146     case AlignBaseline:
1147         m_value.ident = CSSValueBaseline;
1148         break;
1149     }
1150 }
1151
1152 template<> inline CSSPrimitiveValue::operator EFlexAlign() const
1153 {
1154     switch (m_value.ident) {
1155     case CSSValueStart:
1156         return AlignStart;
1157     case CSSValueEnd:
1158         return AlignEnd;
1159     case CSSValueCenter:
1160         return AlignCenter;
1161     case CSSValueStretch:
1162         return AlignStretch;
1163     case CSSValueBaseline:
1164         return AlignBaseline;
1165     default:
1166         ASSERT_NOT_REACHED();
1167         return AlignStart;
1168     }
1169 }
1170
1171 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexPack e)
1172     : CSSValue(PrimitiveClass)
1173 {
1174     m_primitiveUnitType = CSS_IDENT;
1175     switch (e) {
1176     case PackStart:
1177         m_value.ident = CSSValueStart;
1178         break;
1179     case PackEnd:
1180         m_value.ident = CSSValueEnd;
1181         break;
1182     case PackCenter:
1183         m_value.ident = CSSValueCenter;
1184         break;
1185     case PackJustify:
1186         m_value.ident = CSSValueJustify;
1187         break;
1188     }
1189 }
1190
1191 template<> inline CSSPrimitiveValue::operator EFlexPack() const
1192 {
1193     switch (m_value.ident) {
1194     case CSSValueStart:
1195         return PackStart;
1196     case CSSValueEnd:
1197         return PackEnd;
1198     case CSSValueCenter:
1199         return PackCenter;
1200     case CSSValueJustify:
1201         return PackJustify;
1202     default:
1203         ASSERT_NOT_REACHED();
1204         return PackStart;
1205     }
1206 }
1207
1208 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexFlow e)
1209     : CSSValue(PrimitiveClass)
1210 {
1211     m_primitiveUnitType = CSS_IDENT;
1212     switch (e) {
1213     case FlowRow:
1214         m_value.ident = CSSValueRow;
1215         break;
1216     case FlowRowReverse:
1217         m_value.ident = CSSValueRowReverse;
1218         break;
1219     case FlowColumn:
1220         m_value.ident = CSSValueColumn;
1221         break;
1222     case FlowColumnReverse:
1223         m_value.ident = CSSValueColumnReverse;
1224         break;
1225     }
1226 }
1227
1228 template<> inline CSSPrimitiveValue::operator EFlexFlow() const
1229 {
1230     switch (m_value.ident) {
1231     case CSSValueRow:
1232         return FlowRow;
1233     case CSSValueRowReverse:
1234         return FlowRowReverse;
1235     case CSSValueColumn:
1236         return FlowColumn;
1237     case CSSValueColumnReverse:
1238         return FlowColumnReverse;
1239     default:
1240         ASSERT_NOT_REACHED();
1241         return FlowRow;
1242     }
1243 }
1244
1245 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
1246     : CSSValue(PrimitiveClass)
1247 {
1248     m_primitiveUnitType = CSS_IDENT;
1249     switch (e) {
1250         case NoFloat:
1251             m_value.ident = CSSValueNone;
1252             break;
1253         case LeftFloat:
1254             m_value.ident = CSSValueLeft;
1255             break;
1256         case RightFloat:
1257             m_value.ident = CSSValueRight;
1258             break;
1259         case PositionedFloat:
1260             m_value.ident = CSSValueWebkitPositioned;
1261             break;
1262     }
1263 }
1264
1265 template<> inline CSSPrimitiveValue::operator EFloat() const
1266 {
1267     switch (m_value.ident) {
1268         case CSSValueLeft:
1269             return LeftFloat;
1270         case CSSValueRight:
1271             return RightFloat;
1272         case CSSValueNone:
1273         case CSSValueCenter:  // Non-standard CSS value
1274             return NoFloat;
1275         case CSSValueWebkitPositioned:
1276             return PositionedFloat;
1277         default:
1278             ASSERT_NOT_REACHED();
1279             return NoFloat;
1280     }
1281 }
1282
1283 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e)
1284     : CSSValue(PrimitiveClass)
1285 {
1286     m_primitiveUnitType = CSS_IDENT;
1287     switch (e) {
1288         case LBNORMAL:
1289             m_value.ident = CSSValueNormal;
1290             break;
1291         case AFTER_WHITE_SPACE:
1292             m_value.ident = CSSValueAfterWhiteSpace;
1293             break;
1294     }
1295 }
1296
1297 template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
1298 {
1299     switch (m_value.ident) {
1300         case CSSValueAfterWhiteSpace:
1301             return AFTER_WHITE_SPACE;
1302         case CSSValueNormal:
1303             return LBNORMAL;
1304         default:
1305             ASSERT_NOT_REACHED();
1306             return LBNORMAL;
1307     }
1308 }
1309
1310 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
1311     : CSSValue(PrimitiveClass)
1312 {
1313     m_primitiveUnitType = CSS_IDENT;
1314     switch (e) {
1315         case OUTSIDE:
1316             m_value.ident = CSSValueOutside;
1317             break;
1318         case INSIDE:
1319             m_value.ident = CSSValueInside;
1320             break;
1321     }
1322 }
1323
1324 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
1325 {
1326     return (EListStylePosition)(m_value.ident - CSSValueOutside);
1327 }
1328
1329 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
1330     : CSSValue(PrimitiveClass)
1331 {
1332     m_primitiveUnitType = CSS_IDENT;
1333     switch (e) {
1334     case Afar:
1335         m_value.ident = CSSValueAfar;
1336         break;
1337     case Amharic:
1338         m_value.ident = CSSValueAmharic;
1339         break;
1340     case AmharicAbegede:
1341         m_value.ident = CSSValueAmharicAbegede;
1342         break;
1343     case ArabicIndic:
1344         m_value.ident = CSSValueArabicIndic;
1345         break;
1346     case Armenian:
1347         m_value.ident = CSSValueArmenian;
1348         break;
1349     case Asterisks:
1350         m_value.ident = CSSValueAsterisks;
1351         break;
1352     case BinaryListStyle:
1353         m_value.ident = CSSValueBinary;
1354         break;
1355     case Bengali:
1356         m_value.ident = CSSValueBengali;
1357         break;
1358     case Cambodian:
1359         m_value.ident = CSSValueCambodian;
1360         break;
1361     case Circle:
1362         m_value.ident = CSSValueCircle;
1363         break;
1364     case CjkEarthlyBranch:
1365         m_value.ident = CSSValueCjkEarthlyBranch;
1366         break;
1367     case CjkHeavenlyStem:
1368         m_value.ident = CSSValueCjkHeavenlyStem;
1369         break;
1370     case CJKIdeographic:
1371         m_value.ident = CSSValueCjkIdeographic;
1372         break;
1373     case DecimalLeadingZero:
1374         m_value.ident = CSSValueDecimalLeadingZero;
1375         break;
1376     case DecimalListStyle:
1377         m_value.ident = CSSValueDecimal;
1378         break;
1379     case Devanagari:
1380         m_value.ident = CSSValueDevanagari;
1381         break;
1382     case Disc:
1383         m_value.ident = CSSValueDisc;
1384         break;
1385     case Ethiopic:
1386         m_value.ident = CSSValueEthiopic;
1387         break;
1388     case EthiopicAbegede:
1389         m_value.ident = CSSValueEthiopicAbegede;
1390         break;
1391     case EthiopicAbegedeAmEt:
1392         m_value.ident = CSSValueEthiopicAbegedeAmEt;
1393         break;
1394     case EthiopicAbegedeGez:
1395         m_value.ident = CSSValueEthiopicAbegedeGez;
1396         break;
1397     case EthiopicAbegedeTiEr:
1398         m_value.ident = CSSValueEthiopicAbegedeTiEr;
1399         break;
1400     case EthiopicAbegedeTiEt:
1401         m_value.ident = CSSValueEthiopicAbegedeTiEt;
1402         break;
1403     case EthiopicHalehameAaEr:
1404         m_value.ident = CSSValueEthiopicHalehameAaEr;
1405         break;
1406     case EthiopicHalehameAaEt:
1407         m_value.ident = CSSValueEthiopicHalehameAaEt;
1408         break;
1409     case EthiopicHalehameAmEt:
1410         m_value.ident = CSSValueEthiopicHalehameAmEt;
1411         break;
1412     case EthiopicHalehameGez:
1413         m_value.ident = CSSValueEthiopicHalehameGez;
1414         break;
1415     case EthiopicHalehameOmEt:
1416         m_value.ident = CSSValueEthiopicHalehameOmEt;
1417         break;
1418     case EthiopicHalehameSidEt:
1419         m_value.ident = CSSValueEthiopicHalehameSidEt;
1420         break;
1421     case EthiopicHalehameSoEt:
1422         m_value.ident = CSSValueEthiopicHalehameSoEt;
1423         break;
1424     case EthiopicHalehameTiEr:
1425         m_value.ident = CSSValueEthiopicHalehameTiEr;
1426         break;
1427     case EthiopicHalehameTiEt:
1428         m_value.ident = CSSValueEthiopicHalehameTiEt;
1429         break;
1430     case EthiopicHalehameTig:
1431         m_value.ident = CSSValueEthiopicHalehameTig;
1432         break;
1433     case Footnotes:
1434         m_value.ident = CSSValueFootnotes;
1435         break;
1436     case Georgian:
1437         m_value.ident = CSSValueGeorgian;
1438         break;
1439     case Gujarati:
1440         m_value.ident = CSSValueGujarati;
1441         break;
1442     case Gurmukhi:
1443         m_value.ident = CSSValueGurmukhi;
1444         break;
1445     case Hangul:
1446         m_value.ident = CSSValueHangul;
1447         break;
1448     case HangulConsonant:
1449         m_value.ident = CSSValueHangulConsonant;
1450         break;
1451     case Hebrew:
1452         m_value.ident = CSSValueHebrew;
1453         break;
1454     case Hiragana:
1455         m_value.ident = CSSValueHiragana;
1456         break;
1457     case HiraganaIroha:
1458         m_value.ident = CSSValueHiraganaIroha;
1459         break;
1460     case Kannada:
1461         m_value.ident = CSSValueKannada;
1462         break;
1463     case Katakana:
1464         m_value.ident = CSSValueKatakana;
1465         break;
1466     case KatakanaIroha:
1467         m_value.ident = CSSValueKatakanaIroha;
1468         break;
1469     case Khmer:
1470         m_value.ident = CSSValueKhmer;
1471         break;
1472     case Lao:
1473         m_value.ident = CSSValueLao;
1474         break;
1475     case LowerAlpha:
1476         m_value.ident = CSSValueLowerAlpha;
1477         break;
1478     case LowerArmenian:
1479         m_value.ident = CSSValueLowerArmenian;
1480         break;
1481     case LowerGreek:
1482         m_value.ident = CSSValueLowerGreek;
1483         break;
1484     case LowerHexadecimal:
1485         m_value.ident = CSSValueLowerHexadecimal;
1486         break;
1487     case LowerLatin:
1488         m_value.ident = CSSValueLowerLatin;
1489         break;
1490     case LowerNorwegian:
1491         m_value.ident = CSSValueLowerNorwegian;
1492         break;
1493     case LowerRoman:
1494         m_value.ident = CSSValueLowerRoman;
1495         break;
1496     case Malayalam:
1497         m_value.ident = CSSValueMalayalam;
1498         break;
1499     case Mongolian:
1500         m_value.ident = CSSValueMongolian;
1501         break;
1502     case Myanmar:
1503         m_value.ident = CSSValueMyanmar;
1504         break;
1505     case NoneListStyle:
1506         m_value.ident = CSSValueNone;
1507         break;
1508     case Octal:
1509         m_value.ident = CSSValueOctal;
1510         break;
1511     case Oriya:
1512         m_value.ident = CSSValueOriya;
1513         break;
1514     case Oromo:
1515         m_value.ident = CSSValueOromo;
1516         break;
1517     case Persian:
1518         m_value.ident = CSSValuePersian;
1519         break;
1520     case Sidama:
1521         m_value.ident = CSSValueSidama;
1522         break;
1523     case Somali:
1524         m_value.ident = CSSValueSomali;
1525         break;
1526     case Square:
1527         m_value.ident = CSSValueSquare;
1528         break;
1529     case Telugu:
1530         m_value.ident = CSSValueTelugu;
1531         break;
1532     case Thai:
1533         m_value.ident = CSSValueThai;
1534         break;
1535     case Tibetan:
1536         m_value.ident = CSSValueTibetan;
1537         break;
1538     case Tigre:
1539         m_value.ident = CSSValueTigre;
1540         break;
1541     case TigrinyaEr:
1542         m_value.ident = CSSValueTigrinyaEr;
1543         break;
1544     case TigrinyaErAbegede:
1545         m_value.ident = CSSValueTigrinyaErAbegede;
1546         break;
1547     case TigrinyaEt:
1548         m_value.ident = CSSValueTigrinyaEt;
1549         break;
1550     case TigrinyaEtAbegede:
1551         m_value.ident = CSSValueTigrinyaEtAbegede;
1552         break;
1553     case UpperAlpha:
1554         m_value.ident = CSSValueUpperAlpha;
1555         break;
1556     case UpperArmenian:
1557         m_value.ident = CSSValueUpperArmenian;
1558         break;
1559     case UpperGreek:
1560         m_value.ident = CSSValueUpperGreek;
1561         break;
1562     case UpperHexadecimal:
1563         m_value.ident = CSSValueUpperHexadecimal;
1564         break;
1565     case UpperLatin:
1566         m_value.ident = CSSValueUpperLatin;
1567         break;
1568     case UpperNorwegian:
1569         m_value.ident = CSSValueUpperNorwegian;
1570         break;
1571     case UpperRoman:
1572         m_value.ident = CSSValueUpperRoman;
1573         break;
1574     case Urdu:
1575         m_value.ident = CSSValueUrdu;
1576         break;
1577     }
1578 }
1579
1580 template<> inline CSSPrimitiveValue::operator EListStyleType() const
1581 {
1582     switch (m_value.ident) {
1583         case CSSValueNone:
1584             return NoneListStyle;
1585         default:
1586             return static_cast<EListStyleType>(m_value.ident - CSSValueDisc);
1587     }
1588 }
1589
1590 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e)
1591     : CSSValue(PrimitiveClass)
1592 {
1593     m_primitiveUnitType = CSS_IDENT;
1594     switch (e) {
1595         case MCOLLAPSE:
1596             m_value.ident = CSSValueCollapse;
1597             break;
1598         case MSEPARATE:
1599             m_value.ident = CSSValueSeparate;
1600             break;
1601         case MDISCARD:
1602             m_value.ident = CSSValueDiscard;
1603             break;
1604     }
1605 }
1606
1607 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
1608 {
1609     switch (m_value.ident) {
1610         case CSSValueCollapse:
1611             return MCOLLAPSE;
1612         case CSSValueSeparate:
1613             return MSEPARATE;
1614         case CSSValueDiscard:
1615             return MDISCARD;
1616         default:
1617             ASSERT_NOT_REACHED();
1618             return MCOLLAPSE;
1619     }
1620 }
1621
1622 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e)
1623     : CSSValue(PrimitiveClass)
1624 {
1625     m_primitiveUnitType = CSS_IDENT;
1626     switch (e) {
1627         case MNONE:
1628             m_value.ident = CSSValueNone;
1629             break;
1630         case MSCROLL:
1631             m_value.ident = CSSValueScroll;
1632             break;
1633         case MSLIDE:
1634             m_value.ident = CSSValueSlide;
1635             break;
1636         case MALTERNATE:
1637             m_value.ident = CSSValueAlternate;
1638             break;
1639     }
1640 }
1641
1642 template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
1643 {
1644     switch (m_value.ident) {
1645         case CSSValueNone:
1646             return MNONE;
1647         case CSSValueScroll:
1648             return MSCROLL;
1649         case CSSValueSlide:
1650             return MSLIDE;
1651         case CSSValueAlternate:
1652             return MALTERNATE;
1653         default:
1654             ASSERT_NOT_REACHED();
1655             return MNONE;
1656     }
1657 }
1658
1659 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RegionOverflow e)
1660     : CSSValue(PrimitiveClass)
1661 {
1662     m_primitiveUnitType = CSS_IDENT;
1663     switch (e) {
1664     case AutoRegionOverflow:
1665         m_value.ident = CSSValueAuto;
1666         break;
1667     case BreakRegionOverflow:
1668         m_value.ident = CSSValueBreak;
1669         break;
1670     }
1671 }
1672
1673 template<> inline CSSPrimitiveValue::operator RegionOverflow() const
1674 {
1675     switch (m_value.ident) {
1676     case CSSValueAuto:
1677         return AutoRegionOverflow;
1678     case CSSValueBreak:
1679         return BreakRegionOverflow;
1680     default:
1681         ASSERT_NOT_REACHED();
1682         return AutoRegionOverflow;
1683     }
1684 }
1685
1686 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e)
1687     : CSSValue(PrimitiveClass)
1688 {
1689     m_primitiveUnitType = CSS_IDENT;
1690     switch (e) {
1691         case MFORWARD:
1692             m_value.ident = CSSValueForwards;
1693             break;
1694         case MBACKWARD:
1695             m_value.ident = CSSValueBackwards;
1696             break;
1697         case MAUTO:
1698             m_value.ident = CSSValueAuto;
1699             break;
1700         case MUP:
1701             m_value.ident = CSSValueUp;
1702             break;
1703         case MDOWN:
1704             m_value.ident = CSSValueDown;
1705             break;
1706         case MLEFT:
1707             m_value.ident = CSSValueLeft;
1708             break;
1709         case MRIGHT:
1710             m_value.ident = CSSValueRight;
1711             break;
1712     }
1713 }
1714
1715 template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
1716 {
1717     switch (m_value.ident) {
1718         case CSSValueForwards:
1719             return MFORWARD;
1720         case CSSValueBackwards:
1721             return MBACKWARD;
1722         case CSSValueAuto:
1723             return MAUTO;
1724         case CSSValueAhead:
1725         case CSSValueUp: // We don't support vertical languages, so AHEAD just maps to UP.
1726             return MUP;
1727         case CSSValueReverse:
1728         case CSSValueDown: // REVERSE just maps to DOWN, since we don't do vertical text.
1729             return MDOWN;
1730         case CSSValueLeft:
1731             return MLEFT;
1732         case CSSValueRight:
1733             return MRIGHT;
1734         default:
1735             ASSERT_NOT_REACHED();
1736             return MAUTO;
1737     }
1738 }
1739
1740 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e)
1741     : CSSValue(PrimitiveClass)
1742 {
1743     m_primitiveUnitType = CSS_IDENT;
1744     switch (e) {
1745         case BCNORMAL:
1746             m_value.ident = CSSValueNormal;
1747             break;
1748         case MATCH:
1749             m_value.ident = CSSValueMatch;
1750             break;
1751     }
1752 }
1753
1754 template<> inline CSSPrimitiveValue::operator EMatchNearestMailBlockquoteColor() const
1755 {
1756     switch (m_value.ident) {
1757         case CSSValueNormal:
1758             return BCNORMAL;
1759         case CSSValueMatch:
1760             return MATCH;
1761         default:
1762             ASSERT_NOT_REACHED();
1763             return BCNORMAL;
1764     }
1765 }
1766
1767 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e)
1768     : CSSValue(PrimitiveClass)
1769 {
1770     m_primitiveUnitType = CSS_IDENT;
1771     switch (e) {
1772         case NBNORMAL:
1773             m_value.ident = CSSValueNormal;
1774             break;
1775         case SPACE:
1776             m_value.ident = CSSValueSpace;
1777             break;
1778     }
1779 }
1780
1781 template<> inline CSSPrimitiveValue::operator ENBSPMode() const
1782 {
1783     switch (m_value.ident) {
1784         case CSSValueSpace:
1785             return SPACE;
1786         case CSSValueNormal:
1787             return NBNORMAL;
1788         default:
1789             ASSERT_NOT_REACHED();
1790             return NBNORMAL;
1791     }
1792 }
1793
1794 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e)
1795     : CSSValue(PrimitiveClass)
1796 {
1797     m_primitiveUnitType = CSS_IDENT;
1798     switch (e) {
1799         case OVISIBLE:
1800             m_value.ident = CSSValueVisible;
1801             break;
1802         case OHIDDEN:
1803             m_value.ident = CSSValueHidden;
1804             break;
1805         case OSCROLL:
1806             m_value.ident = CSSValueScroll;
1807             break;
1808         case OAUTO:
1809             m_value.ident = CSSValueAuto;
1810             break;
1811         case OMARQUEE:
1812             m_value.ident = CSSValueWebkitMarquee;
1813             break;
1814         case OOVERLAY:
1815             m_value.ident = CSSValueOverlay;
1816             break;
1817     }
1818 }
1819
1820 template<> inline CSSPrimitiveValue::operator EOverflow() const
1821 {
1822     switch (m_value.ident) {
1823         case CSSValueVisible:
1824             return OVISIBLE;
1825         case CSSValueHidden:
1826             return OHIDDEN;
1827         case CSSValueScroll:
1828             return OSCROLL;
1829         case CSSValueAuto:
1830             return OAUTO;
1831         case CSSValueWebkitMarquee:
1832             return OMARQUEE;
1833         case CSSValueOverlay:
1834             return OOVERLAY;
1835         default:
1836             ASSERT_NOT_REACHED();
1837             return OVISIBLE;
1838     }
1839 }
1840
1841 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
1842     : CSSValue(PrimitiveClass)
1843 {
1844     m_primitiveUnitType = CSS_IDENT;
1845     switch (e) {
1846         case PBAUTO:
1847             m_value.ident = CSSValueAuto;
1848             break;
1849         case PBALWAYS:
1850             m_value.ident = CSSValueAlways;
1851             break;
1852         case PBAVOID:
1853             m_value.ident = CSSValueAvoid;
1854             break;
1855     }
1856 }
1857
1858 template<> inline CSSPrimitiveValue::operator EPageBreak() const
1859 {
1860     switch (m_value.ident) {
1861         case CSSValueAuto:
1862             return PBAUTO;
1863         case CSSValueLeft:
1864         case CSSValueRight:
1865         case CSSValueAlways:
1866             return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always."
1867         case CSSValueAvoid:
1868             return PBAVOID;
1869         default:
1870             ASSERT_NOT_REACHED();
1871             return PBAUTO;
1872     }
1873 }
1874
1875 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
1876     : CSSValue(PrimitiveClass)
1877 {
1878     m_primitiveUnitType = CSS_IDENT;
1879     switch (e) {
1880         case StaticPosition:
1881             m_value.ident = CSSValueStatic;
1882             break;
1883         case RelativePosition:
1884             m_value.ident = CSSValueRelative;
1885             break;
1886         case AbsolutePosition:
1887             m_value.ident = CSSValueAbsolute;
1888             break;
1889         case FixedPosition:
1890             m_value.ident = CSSValueFixed;
1891             break;
1892     }
1893 }
1894
1895 template<> inline CSSPrimitiveValue::operator EPosition() const
1896 {
1897     switch (m_value.ident) {
1898         case CSSValueStatic:
1899             return StaticPosition;
1900         case CSSValueRelative:
1901             return RelativePosition;
1902         case CSSValueAbsolute:
1903             return AbsolutePosition;
1904         case CSSValueFixed:
1905             return FixedPosition;
1906         default:
1907             ASSERT_NOT_REACHED();
1908             return StaticPosition;
1909     }
1910 }
1911
1912 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e)
1913     : CSSValue(PrimitiveClass)
1914 {
1915     m_primitiveUnitType = CSS_IDENT;
1916     switch (e) {
1917         case RESIZE_BOTH:
1918             m_value.ident = CSSValueBoth;
1919             break;
1920         case RESIZE_HORIZONTAL:
1921             m_value.ident = CSSValueHorizontal;
1922             break;
1923         case RESIZE_VERTICAL:
1924             m_value.ident = CSSValueVertical;
1925             break;
1926         case RESIZE_NONE:
1927             m_value.ident = CSSValueNone;
1928             break;
1929     }
1930 }
1931
1932 template<> inline CSSPrimitiveValue::operator EResize() const
1933 {
1934     switch (m_value.ident) {
1935         case CSSValueBoth:
1936             return RESIZE_BOTH;
1937         case CSSValueHorizontal:
1938             return RESIZE_HORIZONTAL;
1939         case CSSValueVertical:
1940             return RESIZE_VERTICAL;
1941         case CSSValueAuto:
1942             ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
1943             return RESIZE_NONE;
1944         case CSSValueNone:
1945             return RESIZE_NONE;
1946         default:
1947             ASSERT_NOT_REACHED();
1948             return RESIZE_NONE;
1949     }
1950 }
1951
1952 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e)
1953     : CSSValue(PrimitiveClass)
1954 {
1955     m_primitiveUnitType = CSS_IDENT;
1956     switch (e) {
1957         case TAUTO:
1958             m_value.ident = CSSValueAuto;
1959             break;
1960         case TFIXED:
1961             m_value.ident = CSSValueFixed;
1962             break;
1963     }
1964 }
1965
1966 template<> inline CSSPrimitiveValue::operator ETableLayout() const
1967 {
1968     switch (m_value.ident) {
1969         case CSSValueFixed:
1970             return TFIXED;
1971         case CSSValueAuto:
1972             return TAUTO;
1973         default:
1974             ASSERT_NOT_REACHED();
1975             return TAUTO;
1976     }
1977 }
1978
1979 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
1980     : CSSValue(PrimitiveClass)
1981 {
1982     m_primitiveUnitType = CSS_IDENT;
1983     switch (e) {
1984     case TAAUTO:
1985         m_value.ident = CSSValueWebkitAuto;
1986         break;
1987     case TASTART:
1988         m_value.ident = CSSValueStart;
1989         break;
1990     case TAEND:
1991         m_value.ident = CSSValueEnd;
1992         break;
1993     case LEFT:
1994         m_value.ident = CSSValueLeft;
1995         break;
1996     case RIGHT:
1997         m_value.ident = CSSValueRight;
1998         break;
1999     case CENTER:
2000         m_value.ident = CSSValueCenter;
2001         break;
2002     case JUSTIFY:
2003         m_value.ident = CSSValueJustify;
2004         break;
2005     case WEBKIT_LEFT:
2006         m_value.ident = CSSValueWebkitLeft;
2007         break;
2008     case WEBKIT_RIGHT:
2009         m_value.ident = CSSValueWebkitRight;
2010         break;
2011     case WEBKIT_CENTER:
2012         m_value.ident = CSSValueWebkitCenter;
2013         break;
2014     }
2015 }
2016
2017 template<> inline CSSPrimitiveValue::operator ETextAlign() const
2018 {
2019     switch (m_value.ident) {
2020         case CSSValueStart:
2021             return TASTART;
2022         case CSSValueEnd:
2023             return TAEND;
2024         default:
2025             return static_cast<ETextAlign>(m_value.ident - CSSValueWebkitAuto);
2026     }
2027 }
2028
2029 template<> inline CSSPrimitiveValue::operator ETextDecoration() const
2030 {
2031     switch (m_value.ident) {
2032     case CSSValueNone:
2033         return TDNONE;
2034     case CSSValueUnderline:
2035         return UNDERLINE;
2036     case CSSValueOverline:
2037         return OVERLINE;
2038     case CSSValueLineThrough:
2039         return LINE_THROUGH;
2040     case CSSValueBlink:
2041         return BLINK;
2042     default:
2043         ASSERT_NOT_REACHED();
2044         return TDNONE;
2045     }
2046 }
2047
2048 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
2049     : CSSValue(PrimitiveClass)
2050 {
2051     m_primitiveUnitType = CSS_IDENT;
2052     switch (e) {
2053         case TSNONE:
2054             m_value.ident = CSSValueNone;
2055             break;
2056         case TSDISC:
2057             m_value.ident = CSSValueDisc;
2058             break;
2059         case TSCIRCLE:
2060             m_value.ident = CSSValueCircle;
2061             break;
2062         case TSSQUARE:
2063             m_value.ident = CSSValueSquare;
2064             break;
2065     }
2066 }
2067
2068 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
2069 {
2070     switch (m_value.ident) {
2071         case CSSValueNone:
2072             return TSNONE;
2073         case CSSValueDisc:
2074             return TSDISC;
2075         case CSSValueCircle:
2076             return TSCIRCLE;
2077         case CSSValueSquare:
2078             return TSSQUARE;
2079         default:
2080             ASSERT_NOT_REACHED();
2081             return TSNONE;
2082     }
2083 }
2084
2085 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e)
2086     : CSSValue(PrimitiveClass)
2087 {
2088     m_primitiveUnitType = CSS_IDENT;
2089     switch (e) {
2090         case CAPITALIZE:
2091             m_value.ident = CSSValueCapitalize;
2092             break;
2093         case UPPERCASE:
2094             m_value.ident = CSSValueUppercase;
2095             break;
2096         case LOWERCASE:
2097             m_value.ident = CSSValueLowercase;
2098             break;
2099         case TTNONE:
2100             m_value.ident = CSSValueNone;
2101             break;
2102     }
2103 }
2104
2105 template<> inline CSSPrimitiveValue::operator ETextTransform() const
2106 {
2107     switch (m_value.ident) {
2108         case CSSValueCapitalize:
2109             return CAPITALIZE;
2110         case CSSValueUppercase:
2111             return UPPERCASE;
2112         case CSSValueLowercase:
2113             return LOWERCASE;
2114         case CSSValueNone:
2115             return TTNONE;
2116         default:
2117             ASSERT_NOT_REACHED();
2118             return TTNONE;
2119     }
2120 }
2121
2122 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
2123     : CSSValue(PrimitiveClass)
2124 {
2125     m_primitiveUnitType = CSS_IDENT;
2126     switch (e) {
2127     case UBNormal:
2128         m_value.ident = CSSValueNormal;
2129         break;
2130     case Embed:
2131         m_value.ident = CSSValueEmbed;
2132         break;
2133     case Override:
2134         m_value.ident = CSSValueBidiOverride;
2135         break;
2136     case Isolate:
2137         m_value.ident = CSSValueWebkitIsolate;
2138         break;
2139     case Plaintext:
2140         m_value.ident = CSSValueWebkitPlaintext;
2141         break;
2142     }
2143 }
2144
2145 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
2146 {
2147     switch (m_value.ident) {
2148     case CSSValueNormal:
2149         return UBNormal;
2150     case CSSValueEmbed:
2151         return Embed;
2152     case CSSValueBidiOverride:
2153         return Override;
2154     case CSSValueWebkitIsolate:
2155         return Isolate;
2156     case CSSValueWebkitPlaintext:
2157         return Plaintext;
2158     default:
2159         ASSERT_NOT_REACHED();
2160         return UBNormal;
2161     }
2162 }
2163
2164 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e)
2165     : CSSValue(PrimitiveClass)
2166 {
2167     m_primitiveUnitType = CSS_IDENT;
2168     switch (e) {
2169         case DRAG_AUTO:
2170             m_value.ident = CSSValueAuto;
2171             break;
2172         case DRAG_NONE:
2173             m_value.ident = CSSValueNone;
2174             break;
2175         case DRAG_ELEMENT:
2176             m_value.ident = CSSValueElement;
2177             break;
2178     }
2179 }
2180
2181 template<> inline CSSPrimitiveValue::operator EUserDrag() const
2182 {
2183     switch (m_value.ident) {
2184         case CSSValueAuto:
2185             return DRAG_AUTO;
2186         case CSSValueNone:
2187             return DRAG_NONE;
2188         case CSSValueElement:
2189             return DRAG_ELEMENT;
2190         default:
2191             ASSERT_NOT_REACHED();
2192             return DRAG_AUTO;
2193     }
2194 }
2195
2196 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)
2197     : CSSValue(PrimitiveClass)
2198 {
2199     m_primitiveUnitType = CSS_IDENT;
2200     switch (e) {
2201         case READ_ONLY:
2202             m_value.ident = CSSValueReadOnly;
2203             break;
2204         case READ_WRITE:
2205             m_value.ident = CSSValueReadWrite;
2206             break;
2207         case READ_WRITE_PLAINTEXT_ONLY:
2208             m_value.ident = CSSValueReadWritePlaintextOnly;
2209             break;
2210     }
2211 }
2212
2213 template<> inline CSSPrimitiveValue::operator EUserModify() const
2214 {
2215     return static_cast<EUserModify>(m_value.ident - CSSValueReadOnly);
2216 }
2217
2218 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
2219     : CSSValue(PrimitiveClass)
2220 {
2221     m_primitiveUnitType = CSS_IDENT;
2222     switch (e) {
2223         case SELECT_NONE:
2224             m_value.ident = CSSValueNone;
2225             break;
2226         case SELECT_TEXT:
2227             m_value.ident = CSSValueText;
2228             break;
2229     }
2230 }
2231
2232 template<> inline CSSPrimitiveValue::operator EUserSelect() const
2233 {
2234     switch (m_value.ident) {
2235         case CSSValueAuto:
2236             return SELECT_TEXT;
2237         case CSSValueNone:
2238             return SELECT_NONE;
2239         case CSSValueText:
2240             return SELECT_TEXT;
2241         default:
2242             ASSERT_NOT_REACHED();
2243             return SELECT_TEXT;
2244     }
2245 }
2246
2247 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVerticalAlign a)
2248     : CSSValue(PrimitiveClass)
2249 {
2250     m_primitiveUnitType = CSS_IDENT;
2251     switch (a) {
2252     case TOP:
2253         m_value.ident = CSSValueTop;
2254         break;
2255     case BOTTOM:
2256         m_value.ident = CSSValueBottom;
2257         break;
2258     case MIDDLE:
2259         m_value.ident = CSSValueMiddle;
2260         break;
2261     case BASELINE:
2262         m_value.ident = CSSValueBaseline;
2263         break;
2264     case TEXT_BOTTOM:
2265         m_value.ident = CSSValueTextBottom;
2266         break;
2267     case TEXT_TOP:
2268         m_value.ident = CSSValueTextTop;
2269         break;
2270     case SUB:
2271         m_value.ident = CSSValueSub;
2272         break;
2273     case SUPER:
2274         m_value.ident = CSSValueSuper;
2275         break;
2276     case BASELINE_MIDDLE:
2277         m_value.ident = CSSValueWebkitBaselineMiddle;
2278         break;
2279     case LENGTH:
2280         m_value.ident = CSSValueInvalid;
2281     }
2282 }
2283
2284 template<> inline CSSPrimitiveValue::operator EVerticalAlign() const
2285 {
2286     switch (m_value.ident) {
2287     case CSSValueTop:
2288         return TOP;
2289     case CSSValueBottom:
2290         return BOTTOM;
2291     case CSSValueMiddle:
2292         return MIDDLE;
2293     case CSSValueBaseline:
2294         return BASELINE;
2295     case CSSValueTextBottom:
2296         return TEXT_BOTTOM;
2297     case CSSValueTextTop:
2298         return TEXT_TOP;
2299     case CSSValueSub:
2300         return SUB;
2301     case CSSValueSuper:
2302         return SUPER;
2303     case CSSValueWebkitBaselineMiddle:
2304         return BASELINE_MIDDLE;
2305     default:
2306         ASSERT_NOT_REACHED();
2307         return TOP;
2308     }
2309 }
2310
2311 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e)
2312     : CSSValue(PrimitiveClass)
2313 {
2314     m_primitiveUnitType = CSS_IDENT;
2315     switch (e) {
2316         case VISIBLE:
2317             m_value.ident = CSSValueVisible;
2318             break;
2319         case HIDDEN:
2320             m_value.ident = CSSValueHidden;
2321             break;
2322         case COLLAPSE:
2323             m_value.ident = CSSValueCollapse;
2324             break;
2325     }
2326 }
2327
2328 template<> inline CSSPrimitiveValue::operator EVisibility() const
2329 {
2330     switch (m_value.ident) {
2331         case CSSValueHidden:
2332             return HIDDEN;
2333         case CSSValueVisible:
2334             return VISIBLE;
2335         case CSSValueCollapse:
2336             return COLLAPSE;
2337         default:
2338             ASSERT_NOT_REACHED();
2339             return VISIBLE;
2340     }
2341 }
2342
2343 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e)
2344     : CSSValue(PrimitiveClass)
2345 {
2346     m_primitiveUnitType = CSS_IDENT;
2347     switch (e) {
2348         case NORMAL:
2349             m_value.ident = CSSValueNormal;
2350             break;
2351         case PRE:
2352             m_value.ident = CSSValuePre;
2353             break;
2354         case PRE_WRAP:
2355             m_value.ident = CSSValuePreWrap;
2356             break;
2357         case PRE_LINE:
2358             m_value.ident = CSSValuePreLine;
2359             break;
2360         case NOWRAP:
2361             m_value.ident = CSSValueNowrap;
2362             break;
2363         case KHTML_NOWRAP:
2364             m_value.ident = CSSValueWebkitNowrap;
2365             break;
2366     }
2367 }
2368
2369 template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
2370 {
2371     switch (m_value.ident) {
2372         case CSSValueWebkitNowrap:
2373             return KHTML_NOWRAP;
2374         case CSSValueNowrap:
2375             return NOWRAP;
2376         case CSSValuePre:
2377             return PRE;
2378         case CSSValuePreWrap:
2379             return PRE_WRAP;
2380         case CSSValuePreLine:
2381             return PRE_LINE;
2382         case CSSValueNormal:
2383             return NORMAL;
2384         default:
2385             ASSERT_NOT_REACHED();
2386             return NORMAL;
2387     }
2388 }
2389
2390 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e)
2391     : CSSValue(PrimitiveClass)
2392 {
2393     m_primitiveUnitType = CSS_IDENT;
2394     switch (e) {
2395         case NormalWordBreak:
2396             m_value.ident = CSSValueNormal;
2397             break;
2398         case BreakAllWordBreak:
2399             m_value.ident = CSSValueBreakAll;
2400             break;
2401         case BreakWordBreak:
2402             m_value.ident = CSSValueBreakWord;
2403             break;
2404     }
2405 }
2406
2407 template<> inline CSSPrimitiveValue::operator EWordBreak() const
2408 {
2409     switch (m_value.ident) {
2410         case CSSValueBreakAll:
2411             return BreakAllWordBreak;
2412         case CSSValueBreakWord:
2413             return BreakWordBreak;
2414         case CSSValueNormal:
2415             return NormalWordBreak;
2416         default:
2417         ASSERT_NOT_REACHED();
2418         return NormalWordBreak;
2419     }
2420 }
2421
2422 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e)
2423     : CSSValue(PrimitiveClass)
2424 {
2425     m_primitiveUnitType = CSS_IDENT;
2426     switch (e) {
2427         case NormalWordWrap:
2428             m_value.ident = CSSValueNormal;
2429             break;
2430         case BreakWordWrap:
2431             m_value.ident = CSSValueBreakWord;
2432             break;
2433     }
2434 }
2435
2436 template<> inline CSSPrimitiveValue::operator EWordWrap() const
2437 {
2438     switch (m_value.ident) {
2439         case CSSValueBreakWord:
2440             return BreakWordWrap;
2441         case CSSValueNormal:
2442             return NormalWordWrap;
2443         default:
2444             ASSERT_NOT_REACHED();
2445             return NormalWordWrap;
2446     }
2447 }
2448
2449 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
2450     : CSSValue(PrimitiveClass)
2451 {
2452     m_primitiveUnitType = CSS_IDENT;
2453     switch (e) {
2454         case LTR:
2455             m_value.ident = CSSValueLtr;
2456             break;
2457         case RTL:
2458             m_value.ident = CSSValueRtl;
2459             break;
2460     }
2461 }
2462
2463 template<> inline CSSPrimitiveValue::operator TextDirection() const
2464 {
2465     switch (m_value.ident) {
2466         case CSSValueLtr:
2467             return LTR;
2468         case CSSValueRtl:
2469             return RTL;
2470         default:
2471             ASSERT_NOT_REACHED();
2472             return LTR;
2473     }
2474 }
2475
2476 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e)
2477     : CSSValue(PrimitiveClass)
2478 {
2479     m_primitiveUnitType = CSS_IDENT;
2480     switch (e) {
2481     case TopToBottomWritingMode:
2482         m_value.ident = CSSValueHorizontalTb;
2483         break;
2484     case RightToLeftWritingMode:
2485         m_value.ident = CSSValueVerticalRl;
2486         break;
2487     case LeftToRightWritingMode:
2488         m_value.ident = CSSValueVerticalLr;
2489         break;
2490     case BottomToTopWritingMode:
2491         m_value.ident = CSSValueHorizontalBt;
2492         break;
2493     }
2494 }
2495
2496 template<> inline CSSPrimitiveValue::operator WritingMode() const
2497 {
2498     switch (m_value.ident) {
2499     case CSSValueHorizontalTb:
2500         return TopToBottomWritingMode;
2501     case CSSValueVerticalRl:
2502         return RightToLeftWritingMode;
2503     case CSSValueVerticalLr:
2504         return LeftToRightWritingMode;
2505     case CSSValueHorizontalBt:
2506         return BottomToTopWritingMode;
2507     default:
2508         ASSERT_NOT_REACHED();
2509         return TopToBottomWritingMode;
2510     }
2511 }
2512
2513 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e)
2514     : CSSValue(PrimitiveClass)
2515 {
2516     m_primitiveUnitType = CSS_IDENT;
2517     switch (e) {
2518     case TextCombineNone:
2519         m_value.ident = CSSValueNone;
2520         break;
2521     case TextCombineHorizontal:
2522         m_value.ident = CSSValueHorizontal;
2523         break;
2524     }
2525 }
2526
2527 template<> inline CSSPrimitiveValue::operator TextCombine() const
2528 {
2529     switch (m_value.ident) {
2530     case CSSValueNone:
2531         return TextCombineNone;
2532     case CSSValueHorizontal:
2533         return TextCombineHorizontal;
2534     default:
2535         ASSERT_NOT_REACHED();
2536         return TextCombineNone;
2537     }
2538 }
2539
2540 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position)
2541     : CSSValue(PrimitiveClass)
2542 {
2543     m_primitiveUnitType = CSS_IDENT;
2544     switch (position) {
2545     case TextEmphasisPositionOver:
2546         m_value.ident = CSSValueOver;
2547         break;
2548     case TextEmphasisPositionUnder:
2549         m_value.ident = CSSValueUnder;
2550         break;
2551     }
2552 }
2553
2554 template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const
2555 {
2556     switch (m_value.ident) {
2557     case CSSValueOver:
2558         return TextEmphasisPositionOver;
2559     case CSSValueUnder:
2560         return TextEmphasisPositionUnder;
2561     default:
2562         ASSERT_NOT_REACHED();
2563         return TextEmphasisPositionOver;
2564     }
2565 }
2566
2567 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow)
2568     : CSSValue(PrimitiveClass)
2569 {
2570     m_primitiveUnitType = CSS_IDENT;
2571     switch (overflow) {
2572     case TextOverflowClip:
2573         m_value.ident = CSSValueClip;
2574         break;
2575     case TextOverflowEllipsis:
2576         m_value.ident = CSSValueEllipsis;
2577         break;
2578     }
2579 }
2580
2581 template<> inline CSSPrimitiveValue::operator TextOverflow() const
2582 {
2583     switch (m_value.ident) {
2584     case CSSValueClip:
2585         return TextOverflowClip;
2586     case CSSValueEllipsis:
2587         return TextOverflowEllipsis;
2588     default:
2589         ASSERT_NOT_REACHED();
2590         return TextOverflowClip;
2591     }
2592 }
2593
2594 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
2595     : CSSValue(PrimitiveClass)
2596 {
2597     m_primitiveUnitType = CSS_IDENT;
2598     switch (fill) {
2599     case TextEmphasisFillFilled:
2600         m_value.ident = CSSValueFilled;
2601         break;
2602     case TextEmphasisFillOpen:
2603         m_value.ident = CSSValueOpen;
2604         break;
2605     }
2606 }
2607
2608 template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
2609 {
2610     switch (m_value.ident) {
2611     case CSSValueFilled:
2612         return TextEmphasisFillFilled;
2613     case CSSValueOpen:
2614         return TextEmphasisFillOpen;
2615     default:
2616         ASSERT_NOT_REACHED();
2617         return TextEmphasisFillFilled;
2618     }
2619 }
2620
2621 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark)
2622     : CSSValue(PrimitiveClass)
2623 {
2624     m_primitiveUnitType = CSS_IDENT;
2625     switch (mark) {
2626     case TextEmphasisMarkDot:
2627         m_value.ident = CSSValueDot;
2628         break;
2629     case TextEmphasisMarkCircle:
2630         m_value.ident = CSSValueCircle;
2631         break;
2632     case TextEmphasisMarkDoubleCircle:
2633         m_value.ident = CSSValueDoubleCircle;
2634         break;
2635     case TextEmphasisMarkTriangle:
2636         m_value.ident = CSSValueTriangle;
2637         break;
2638     case TextEmphasisMarkSesame:
2639         m_value.ident = CSSValueSesame;
2640         break;
2641     case TextEmphasisMarkNone:
2642     case TextEmphasisMarkAuto:
2643     case TextEmphasisMarkCustom:
2644         ASSERT_NOT_REACHED();
2645         m_value.ident = CSSValueNone;
2646         break;
2647     }
2648 }
2649
2650 template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
2651 {
2652     switch (m_value.ident) {
2653     case CSSValueNone:
2654         return TextEmphasisMarkNone;
2655     case CSSValueDot:
2656         return TextEmphasisMarkDot;
2657     case CSSValueCircle:
2658         return TextEmphasisMarkCircle;
2659     case CSSValueDoubleCircle:
2660         return TextEmphasisMarkDoubleCircle;
2661     case CSSValueTriangle:
2662         return TextEmphasisMarkTriangle;
2663     case CSSValueSesame:
2664         return TextEmphasisMarkSesame;
2665     default:
2666         ASSERT_NOT_REACHED();
2667         return TextEmphasisMarkNone;
2668     }
2669 }
2670
2671 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e)
2672     : CSSValue(PrimitiveClass)
2673 {
2674     m_primitiveUnitType = CSS_IDENT;
2675     switch (e) {
2676     case TextOrientationVerticalRight:
2677         m_value.ident = CSSValueVerticalRight;
2678         break;
2679     case TextOrientationUpright:
2680         m_value.ident = CSSValueUpright;
2681         break;
2682     }
2683 }
2684
2685 template<> inline CSSPrimitiveValue::operator TextOrientation() const
2686 {
2687     switch (m_value.ident) {
2688     case CSSValueVerticalRight:
2689         return TextOrientationVerticalRight;
2690     case CSSValueUpright:
2691         return TextOrientationUpright;
2692     default:
2693         ASSERT_NOT_REACHED();
2694         return TextOrientationVerticalRight;
2695     }
2696 }
2697
2698 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
2699     : CSSValue(PrimitiveClass)
2700 {
2701     m_primitiveUnitType = CSS_IDENT;
2702     switch (e) {
2703         case PE_NONE:
2704             m_value.ident = CSSValueNone;
2705             break;
2706         case PE_STROKE:
2707             m_value.ident = CSSValueStroke;
2708             break;
2709         case PE_FILL:
2710             m_value.ident = CSSValueFill;
2711             break;
2712         case PE_PAINTED:
2713             m_value.ident = CSSValuePainted;
2714             break;
2715         case PE_VISIBLE:
2716             m_value.ident = CSSValueVisible;
2717             break;
2718         case PE_VISIBLE_STROKE:
2719             m_value.ident = CSSValueVisiblestroke;
2720             break;
2721         case PE_VISIBLE_FILL:
2722             m_value.ident = CSSValueVisiblefill;
2723             break;
2724         case PE_VISIBLE_PAINTED:
2725             m_value.ident = CSSValueVisiblepainted;
2726             break;
2727         case PE_AUTO:
2728             m_value.ident = CSSValueAuto;
2729             break;
2730         case PE_ALL:
2731             m_value.ident = CSSValueAll;
2732             break;
2733     }
2734 }
2735
2736 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
2737 {
2738     switch (m_value.ident) {
2739         case CSSValueAll:
2740             return PE_ALL;
2741         case CSSValueAuto:
2742             return PE_AUTO;
2743         case CSSValueNone:
2744             return PE_NONE;
2745         case CSSValueVisiblepainted:
2746             return PE_VISIBLE_PAINTED;
2747         case CSSValueVisiblefill:
2748             return PE_VISIBLE_FILL;
2749         case CSSValueVisiblestroke:
2750             return PE_VISIBLE_STROKE;
2751         case CSSValueVisible:
2752             return PE_VISIBLE;
2753         case CSSValuePainted:
2754             return PE_PAINTED;
2755         case CSSValueFill:
2756             return PE_FILL;
2757         case CSSValueStroke:
2758             return PE_STROKE;
2759         default:
2760             ASSERT_NOT_REACHED();
2761             return PE_ALL;
2762     }
2763 }
2764
2765 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
2766     : CSSValue(PrimitiveClass)
2767 {
2768     m_primitiveUnitType = CSS_IDENT;
2769     switch (smoothing) {
2770     case AutoSmoothing:
2771         m_value.ident = CSSValueAuto;
2772         return;
2773     case NoSmoothing:
2774         m_value.ident = CSSValueNone;
2775         return;
2776     case Antialiased:
2777         m_value.ident = CSSValueAntialiased;
2778         return;
2779     case SubpixelAntialiased:
2780         m_value.ident = CSSValueSubpixelAntialiased;
2781         return;
2782     }
2783
2784     ASSERT_NOT_REACHED();
2785     m_value.ident = CSSValueAuto;
2786 }
2787
2788 template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
2789 {
2790     switch (m_value.ident) {
2791     case CSSValueAuto:
2792         return AutoSmoothing;
2793     case CSSValueNone:
2794         return NoSmoothing;
2795     case CSSValueAntialiased:
2796         return Antialiased;
2797     case CSSValueSubpixelAntialiased:
2798         return SubpixelAntialiased;
2799     }
2800
2801     ASSERT_NOT_REACHED();
2802     return AutoSmoothing;
2803 }
2804
2805 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontWeight weight)
2806     : CSSValue(PrimitiveClass)
2807 {
2808     m_primitiveUnitType = CSS_IDENT;
2809     switch (weight) {
2810     case FontWeight900:
2811         m_value.ident = CSSValue900;
2812         return;
2813     case FontWeight800:
2814         m_value.ident = CSSValue800;
2815         return;
2816     case FontWeight700:
2817         m_value.ident = CSSValue700;
2818         return;
2819     case FontWeight600:
2820         m_value.ident = CSSValue600;
2821         return;
2822     case FontWeight500:
2823         m_value.ident = CSSValue500;
2824         return;
2825     case FontWeight400:
2826         m_value.ident = CSSValue400;
2827         return;
2828     case FontWeight300:
2829         m_value.ident = CSSValue300;
2830         return;
2831     case FontWeight200:
2832         m_value.ident = CSSValue200;
2833         return;
2834     case FontWeight100:
2835         m_value.ident = CSSValue100;
2836         return;
2837     }
2838
2839     ASSERT_NOT_REACHED();
2840     m_value.ident = CSSValueNormal;
2841 }
2842
2843 template<> inline CSSPrimitiveValue::operator FontWeight() const
2844 {
2845     switch (m_value.ident) {
2846     case CSSValueBold:
2847         return FontWeightBold;
2848     case CSSValueNormal:
2849         return FontWeightNormal;
2850     case CSSValue900:
2851         return FontWeight900;
2852     case CSSValue800:
2853         return FontWeight800;
2854     case CSSValue700:
2855         return FontWeight700;
2856     case CSSValue600:
2857         return FontWeight600;
2858     case CSSValue500:
2859         return FontWeight500;
2860     case CSSValue400:
2861         return FontWeight400;
2862     case CSSValue300:
2863         return FontWeight300;
2864     case CSSValue200:
2865         return FontWeight200;
2866     case CSSValue100:
2867         return FontWeight100;
2868     }
2869
2870     ASSERT_NOT_REACHED();
2871     return FontWeightNormal;
2872 }
2873
2874 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontItalic italic)
2875     : CSSValue(PrimitiveClass)
2876 {
2877     m_primitiveUnitType = CSS_IDENT;
2878     switch (italic) {
2879     case FontItalicOff:
2880         m_value.ident = CSSValueNormal;
2881         return;
2882     case FontItalicOn:
2883         m_value.ident = CSSValueItalic;
2884         return;
2885     }
2886
2887     ASSERT_NOT_REACHED();
2888     m_value.ident = CSSValueNormal;
2889 }
2890
2891 template<> inline CSSPrimitiveValue::operator FontItalic() const
2892 {
2893     switch (m_value.ident) {
2894     case CSSValueOblique:
2895     // FIXME: oblique is the same as italic for the moment...
2896     case CSSValueItalic:
2897         return FontItalicOn;
2898     case CSSValueNormal:
2899         return FontItalicOff;
2900     }
2901     ASSERT_NOT_REACHED();
2902     return FontItalicOff;
2903 }
2904
2905 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
2906     : CSSValue(PrimitiveClass)
2907 {
2908     m_primitiveUnitType = CSS_IDENT;
2909     switch (smallCaps) {
2910     case FontSmallCapsOff:
2911         m_value.ident = CSSValueNormal;
2912         return;
2913     case FontSmallCapsOn:
2914         m_value.ident = CSSValueSmallCaps;
2915         return;
2916     }
2917
2918     ASSERT_NOT_REACHED();
2919     m_value.ident = CSSValueNormal;
2920 }
2921
2922 template<> inline CSSPrimitiveValue::operator FontSmallCaps() const
2923 {
2924     switch (m_value.ident) {
2925     case CSSValueSmallCaps:
2926         return FontSmallCapsOn;
2927     case CSSValueNormal:
2928         return FontSmallCapsOff;
2929     }
2930     ASSERT_NOT_REACHED();
2931     return FontSmallCapsOff;
2932 }
2933
2934 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
2935     : CSSValue(PrimitiveClass)
2936 {
2937     m_primitiveUnitType = CSS_IDENT;
2938     switch (e) {
2939         case AutoTextRendering:
2940             m_value.ident = CSSValueAuto;
2941             break;
2942         case OptimizeSpeed:
2943             m_value.ident = CSSValueOptimizespeed;
2944             break;
2945         case OptimizeLegibility:
2946             m_value.ident = CSSValueOptimizelegibility;
2947             break;
2948         case GeometricPrecision:
2949             m_value.ident = CSSValueGeometricprecision;
2950             break;
2951     }
2952 }
2953
2954 template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
2955 {
2956     switch (m_value.ident) {
2957         case CSSValueAuto:
2958             return AutoTextRendering;
2959         case CSSValueOptimizespeed:
2960             return OptimizeSpeed;
2961         case CSSValueOptimizelegibility:
2962             return OptimizeLegibility;
2963         case CSSValueGeometricprecision:
2964             return GeometricPrecision;
2965         default:
2966             ASSERT_NOT_REACHED();
2967             return AutoTextRendering;
2968     }
2969 }
2970
2971 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorSpace space)
2972     : CSSValue(PrimitiveClass)
2973 {
2974     m_primitiveUnitType = CSS_IDENT;
2975     switch (space) {
2976     case ColorSpaceDeviceRGB:
2977         m_value.ident = CSSValueDefault;
2978         break;
2979     case ColorSpaceSRGB:
2980         m_value.ident = CSSValueSrgb;
2981         break;
2982     case ColorSpaceLinearRGB:
2983         // CSS color correction does not support linearRGB yet.
2984         ASSERT_NOT_REACHED();
2985         m_value.ident = CSSValueDefault;
2986         break;
2987     }
2988 }
2989
2990 template<> inline CSSPrimitiveValue::operator ColorSpace() const
2991 {
2992     switch (m_value.ident) {
2993     case CSSValueDefault:
2994         return ColorSpaceDeviceRGB;
2995     case CSSValueSrgb:
2996         return ColorSpaceSRGB;
2997     default:
2998         ASSERT_NOT_REACHED();
2999         return ColorSpaceDeviceRGB;
3000     }
3001 }
3002
3003 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens)
3004     : CSSValue(PrimitiveClass)
3005 {
3006     m_primitiveUnitType = CSS_IDENT;
3007     switch (hyphens) {
3008     case HyphensNone:
3009         m_value.ident = CSSValueNone;
3010         break;
3011     case HyphensManual:
3012         m_value.ident = CSSValueManual;
3013         break;
3014     case HyphensAuto:
3015         m_value.ident = CSSValueAuto;
3016         break;
3017     }
3018 }
3019
3020 template<> inline CSSPrimitiveValue::operator Hyphens() const
3021 {
3022     switch (m_value.ident) {
3023     case CSSValueNone:
3024         return HyphensNone;
3025     case CSSValueManual:
3026         return HyphensManual;
3027     case CSSValueAuto:
3028         return HyphensAuto;
3029     default:
3030         ASSERT_NOT_REACHED();
3031         return HyphensAuto;
3032     }
3033 }
3034
3035 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineGridSnap gridSnap)
3036     : CSSValue(PrimitiveClass)
3037 {
3038     m_primitiveUnitType = CSS_IDENT;
3039     switch (gridSnap) {
3040     case LineGridSnapNone:
3041         m_value.ident = CSSValueNone;
3042         break;
3043     case LineGridSnapBaseline:
3044         m_value.ident = CSSValueBaseline;
3045         break;
3046     case LineGridSnapBounds:
3047         m_value.ident = CSSValueBounds;
3048         break;
3049     }
3050 }
3051
3052 template<> inline CSSPrimitiveValue::operator LineGridSnap() const
3053 {
3054     switch (m_value.ident) {
3055     case CSSValueNone:
3056         return LineGridSnapNone;
3057     case CSSValueBaseline:
3058         return LineGridSnapBaseline;
3059     case CSSValueBounds:
3060         return LineGridSnapBounds;
3061     default:
3062         ASSERT_NOT_REACHED();
3063         return LineGridSnapNone;
3064     }
3065 }
3066
3067 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e)
3068     : CSSValue(PrimitiveClass)
3069 {
3070     m_primitiveUnitType = CSS_IDENT;
3071     switch (e) {
3072     case SpeakNone:
3073         m_value.ident = CSSValueNone;
3074         break;
3075     case SpeakNormal:
3076         m_value.ident = CSSValueNormal;
3077         break;
3078     case SpeakSpellOut:
3079         m_value.ident = CSSValueSpellOut;
3080         break;
3081     case SpeakDigits:
3082         m_value.ident = CSSValueDigits;
3083         break;
3084     case SpeakLiteralPunctuation:
3085         m_value.ident = CSSValueLiteralPunctuation;
3086         break;
3087     case SpeakNoPunctuation:
3088         m_value.ident = CSSValueNoPunctuation;
3089         break;
3090     }
3091 }
3092
3093 template<> inline CSSPrimitiveValue::operator Order() const
3094 {
3095     switch (m_value.ident) {
3096     case CSSValueLogical:
3097         return LogicalOrder;
3098     case CSSValueVisual:
3099         return VisualOrder;
3100     default:
3101         ASSERT_NOT_REACHED();
3102         return LogicalOrder;
3103     }
3104 }
3105
3106 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e)
3107     : CSSValue(PrimitiveClass)
3108 {
3109     m_primitiveUnitType = CSS_IDENT;
3110     switch (e) {
3111     case LogicalOrder:
3112         m_value.ident = CSSValueLogical;
3113         break;
3114     case VisualOrder:
3115         m_value.ident = CSSValueVisual;
3116         break;
3117     }
3118 }
3119
3120 template<> inline CSSPrimitiveValue::operator ESpeak() const
3121 {
3122     switch (m_value.ident) {
3123     case CSSValueNone:
3124         return SpeakNone;
3125     case CSSValueNormal:
3126         return SpeakNormal;
3127     case CSSValueSpellOut:
3128         return SpeakSpellOut;
3129     case CSSValueDigits:
3130         return SpeakDigits;
3131     case CSSValueLiteralPunctuation:
3132         return SpeakLiteralPunctuation;
3133     case CSSValueNoPunctuation:
3134         return SpeakNoPunctuation;
3135     default:
3136         ASSERT_NOT_REACHED();
3137         return SpeakNormal;
3138     }
3139 }
3140
3141 #if ENABLE(CSS_SHADERS)
3142 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CustomFilterOperation::MeshBoxType meshBoxType)
3143     : CSSValue(PrimitiveClass)
3144 {
3145     m_primitiveUnitType = CSS_IDENT;
3146     switch (meshBoxType) {
3147     case CustomFilterOperation::FILTER_BOX:
3148         m_value.ident = CSSValueFilterBox;
3149         break;
3150     case CustomFilterOperation::BORDER_BOX:
3151         m_value.ident = CSSValueBorderBox;
3152         break;
3153     case CustomFilterOperation::PADDING_BOX:
3154         m_value.ident = CSSValuePaddingBox;
3155         break;
3156     case CustomFilterOperation::CONTENT_BOX:
3157         m_value.ident = CSSValueContentBox;
3158         break;
3159     }
3160 }
3161
3162 template<> inline CSSPrimitiveValue::operator CustomFilterOperation::MeshBoxType() const
3163 {
3164     switch (m_value.ident) {
3165     case CSSValueFilterBox:
3166         return CustomFilterOperation::FILTER_BOX;
3167     case CSSValueBorderBox:
3168         return CustomFilterOperation::BORDER_BOX;
3169     case CSSValuePaddingBox:
3170         return CustomFilterOperation::PADDING_BOX;
3171     case CSSValueContentBox:
3172         return CustomFilterOperation::CONTENT_BOX;
3173     default:
3174         ASSERT_NOT_REACHED();
3175         return CustomFilterOperation::FILTER_BOX;
3176     }
3177 }
3178 #endif // ENABLE(CSS_SHADERS)
3179
3180 #if ENABLE(SVG)
3181
3182 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
3183     : CSSValue(PrimitiveClass)
3184 {
3185     m_primitiveUnitType = CSS_IDENT;
3186     switch (e) {
3187         case ButtCap:
3188             m_value.ident = CSSValueButt;
3189             break;
3190         case RoundCap:
3191             m_value.ident = CSSValueRound;
3192             break;
3193         case SquareCap:
3194             m_value.ident = CSSValueSquare;
3195             break;
3196     }
3197 }
3198
3199 template<> inline CSSPrimitiveValue::operator LineCap() const
3200 {
3201     switch (m_value.ident) {
3202         case CSSValueButt:
3203             return ButtCap;
3204         case CSSValueRound:
3205             return RoundCap;
3206         case CSSValueSquare:
3207             return SquareCap;
3208         default:
3209             ASSERT_NOT_REACHED();
3210             return ButtCap;
3211     }
3212 }
3213
3214 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
3215     : CSSValue(PrimitiveClass)
3216 {
3217     m_primitiveUnitType = CSS_IDENT;
3218     switch (e) {
3219         case MiterJoin:
3220             m_value.ident = CSSValueMiter;
3221             break;
3222         case RoundJoin:
3223             m_value.ident = CSSValueRound;
3224             break;
3225         case BevelJoin:
3226             m_value.ident = CSSValueBevel;
3227             break;
3228     }
3229 }
3230
3231 template<> inline CSSPrimitiveValue::operator LineJoin() const
3232 {
3233     switch (m_value.ident) {
3234         case CSSValueMiter:
3235             return MiterJoin;
3236         case CSSValueRound:
3237             return RoundJoin;
3238         case CSSValueBevel:
3239             return BevelJoin;
3240         default:
3241             ASSERT_NOT_REACHED();
3242             return MiterJoin;
3243     }
3244 }
3245
3246 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
3247     : CSSValue(PrimitiveClass)
3248 {
3249     m_primitiveUnitType = CSS_IDENT;
3250     switch (e) {
3251         case RULE_NONZERO:
3252             m_value.ident = CSSValueNonzero;
3253             break;
3254         case RULE_EVENODD:
3255             m_value.ident = CSSValueEvenodd;
3256             break;
3257     }
3258 }
3259
3260 template<> inline CSSPrimitiveValue::operator WindRule() const
3261 {
3262     switch (m_value.ident) {
3263         case CSSValueNonzero:
3264             return RULE_NONZERO;
3265         case CSSValueEvenodd:
3266             return RULE_EVENODD;
3267         default:
3268             ASSERT_NOT_REACHED();
3269             return RULE_NONZERO;
3270     }
3271 }
3272
3273
3274 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e)
3275     : CSSValue(PrimitiveClass)
3276 {
3277     m_primitiveUnitType = CSS_IDENT;
3278     switch (e) {
3279         case AB_AUTO:
3280             m_value.ident = CSSValueAuto;
3281             break;
3282         case AB_BASELINE:
3283             m_value.ident = CSSValueBaseline;
3284             break;
3285         case AB_BEFORE_EDGE:
3286             m_value.ident = CSSValueBeforeEdge;
3287             break;
3288         case AB_TEXT_BEFORE_EDGE:
3289             m_value.ident = CSSValueTextBeforeEdge;
3290             break;
3291         case AB_MIDDLE:
3292             m_value.ident = CSSValueMiddle;
3293             break;
3294         case AB_CENTRAL:
3295             m_value.ident = CSSValueCentral;
3296             break;
3297         case AB_AFTER_EDGE:
3298             m_value.ident = CSSValueAfterEdge;
3299             break;
3300         case AB_TEXT_AFTER_EDGE:
3301             m_value.ident = CSSValueTextAfterEdge;
3302             break;
3303         case AB_IDEOGRAPHIC:
3304             m_value.ident = CSSValueIdeographic;
3305             break;
3306         case AB_ALPHABETIC:
3307             m_value.ident = CSSValueAlphabetic;
3308             break;
3309         case AB_HANGING:
3310             m_value.ident = CSSValueHanging;
3311             break;
3312         case AB_MATHEMATICAL:
3313             m_value.ident = CSSValueMathematical;
3314             break;
3315     }
3316 }
3317
3318 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
3319 {
3320     switch (m_value.ident) {
3321         case CSSValueAuto:
3322             return AB_AUTO;
3323         case CSSValueBaseline:
3324             return AB_BASELINE;
3325         case CSSValueBeforeEdge:
3326             return AB_BEFORE_EDGE;
3327         case CSSValueTextBeforeEdge:
3328             return AB_TEXT_BEFORE_EDGE;
3329         case CSSValueMiddle:
3330             return AB_MIDDLE;
3331         case CSSValueCentral:
3332             return AB_CENTRAL;
3333         case CSSValueAfterEdge:
3334             return AB_AFTER_EDGE;
3335         case CSSValueTextAfterEdge:
3336             return AB_TEXT_AFTER_EDGE;
3337         case CSSValueIdeographic:
3338             return AB_IDEOGRAPHIC;
3339         case CSSValueAlphabetic:
3340             return AB_ALPHABETIC;
3341         case CSSValueHanging:
3342             return AB_HANGING;
3343         case CSSValueMathematical:
3344             return AB_MATHEMATICAL;
3345         default:
3346             ASSERT_NOT_REACHED();
3347             return AB_AUTO;
3348     }
3349 }
3350
3351 #endif
3352
3353 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderCollapse e)
3354     : CSSValue(PrimitiveClass)
3355 {
3356     m_primitiveUnitType = CSS_IDENT;
3357     switch (e) {
3358     case BSEPARATE:
3359         m_value.ident = CSSValueSeparate;
3360         break;
3361     case BCOLLAPSE:
3362         m_value.ident = CSSValueCollapse;
3363         break;
3364     }
3365 }
3366
3367 template<> inline CSSPrimitiveValue::operator EBorderCollapse() const
3368 {
3369     switch (m_value.ident) {
3370     case CSSValueSeparate:
3371         return BSEPARATE;
3372     case CSSValueCollapse:
3373         return BCOLLAPSE;
3374     default:
3375         ASSERT_NOT_REACHED();
3376         return BSEPARATE;
3377     }
3378 }
3379
3380 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderFit e)
3381     : CSSValue(PrimitiveClass)
3382 {
3383     m_primitiveUnitType = CSS_IDENT;
3384     switch (e) {
3385     case BorderFitBorder:
3386         m_value.ident = CSSValueBorder;
3387         break;
3388     case BorderFitLines:
3389         m_value.ident = CSSValueLines;
3390         break;
3391     }
3392 }
3393
3394 template<> inline CSSPrimitiveValue::operator EBorderFit() const
3395 {
3396     switch (m_value.ident) {
3397     case CSSValueBorder:
3398         return BorderFitBorder;
3399     case CSSValueLines:
3400         return BorderFitLines;
3401     default:
3402         ASSERT_NOT_REACHED();
3403         return BorderFitLines;
3404     }
3405 }
3406
3407 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
3408     : CSSValue(PrimitiveClass)
3409 {
3410     m_primitiveUnitType = CSS_IDENT;
3411     switch (e) {
3412     case ImageRenderingAuto:
3413         m_value.ident = CSSValueAuto;
3414         break;
3415     case ImageRenderingOptimizeSpeed:
3416         m_value.ident = CSSValueOptimizespeed;
3417         break;
3418     case ImageRenderingOptimizeQuality:
3419         m_value.ident = CSSValueOptimizequality;
3420         break;
3421     case ImageRenderingOptimizeContrast:
3422         m_value.ident = CSSValueWebkitOptimizeContrast;
3423         break;
3424     }
3425 }
3426
3427 template<> inline CSSPrimitiveValue::operator EImageRendering() const
3428 {
3429     switch (m_value.ident) {
3430     case CSSValueAuto:
3431         return ImageRenderingAuto;
3432     case CSSValueOptimizespeed:
3433         return ImageRenderingOptimizeSpeed;
3434     case CSSValueOptimizequality:
3435         return ImageRenderingOptimizeQuality;
3436     case CSSValueWebkitOptimizeContrast:
3437         return ImageRenderingOptimizeContrast;
3438     default:
3439         ASSERT_NOT_REACHED();
3440         return ImageRenderingAuto;
3441     }
3442 }
3443
3444 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETransformStyle3D e)
3445     : CSSValue(PrimitiveClass)
3446 {
3447     m_primitiveUnitType = CSS_IDENT;
3448     switch (e) {
3449     case TransformStyle3DFlat:
3450         m_value.ident = CSSValueFlat;
3451         break;
3452     case TransformStyle3DPreserve3D:
3453         m_value.ident = CSSValuePreserve3d;
3454         break;
3455     }
3456 }
3457
3458 template<> inline CSSPrimitiveValue::operator ETransformStyle3D() const
3459 {
3460     switch (m_value.ident) {
3461     case CSSValueFlat:
3462         return TransformStyle3DFlat;
3463     case CSSValuePreserve3d:
3464         return TransformStyle3DPreserve3D;
3465     default:
3466         ASSERT_NOT_REACHED();
3467         return TransformStyle3DFlat;
3468     }
3469 }
3470
3471 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnAxis e)
3472     : CSSValue(PrimitiveClass)
3473 {
3474     m_primitiveUnitType = CSS_IDENT;
3475     switch (e) {
3476     case HorizontalColumnAxis:
3477         m_value.ident = CSSValueHorizontal;
3478         break;
3479     case VerticalColumnAxis:
3480         m_value.ident = CSSValueVertical;
3481         break;
3482     case AutoColumnAxis:
3483         m_value.ident = CSSValueAuto;
3484         break;
3485     }
3486 }
3487
3488 template<> inline CSSPrimitiveValue::operator ColumnAxis() const
3489 {
3490     switch (m_value.ident) {
3491     case CSSValueHorizontal:
3492         return HorizontalColumnAxis;
3493     case CSSValueVertical:
3494         return VerticalColumnAxis;
3495     case CSSValueAuto:
3496         return AutoColumnAxis;
3497     default:
3498         ASSERT_NOT_REACHED();
3499         return AutoColumnAxis;
3500     }
3501 }
3502
3503 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WrapFlow wrapFlow)
3504 : CSSValue(PrimitiveClass)
3505 {
3506     m_primitiveUnitType = CSS_IDENT;
3507     switch (wrapFlow) {
3508     case WrapFlowAuto:
3509         m_value.ident = CSSValueAuto;
3510         break;
3511     case WrapFlowBoth:
3512         m_value.ident = CSSValueBoth;
3513         break;
3514     case WrapFlowLeft:
3515         m_value.ident = CSSValueLeft;
3516         break;
3517     case WrapFlowRight:
3518         m_value.ident = CSSValueRight;
3519         break;
3520     case WrapFlowMaximum:
3521         m_value.ident = CSSValueMaximum;
3522         break;
3523     case WrapFlowClear:
3524         m_value.ident = CSSValueClear;
3525         break;
3526     }
3527 }
3528
3529 template<> inline CSSPrimitiveValue::operator WrapFlow() const
3530 {
3531     switch (m_value.ident) {
3532     case CSSValueAuto:
3533         return WrapFlowAuto;
3534     case CSSValueBoth:
3535         return WrapFlowBoth;
3536     case CSSValueLeft:
3537         return WrapFlowLeft;
3538     case CSSValueRight:
3539         return WrapFlowRight;
3540     case CSSValueMaximum:
3541         return WrapFlowMaximum;
3542     case CSSValueClear:
3543         return WrapFlowClear;
3544     default:
3545         ASSERT_NOT_REACHED();
3546         return WrapFlowAuto;
3547     }
3548 }
3549
3550 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WrapThrough wrapThrough)
3551 : CSSValue(PrimitiveClass)
3552 {
3553     m_primitiveUnitType = CSS_IDENT;
3554     switch (wrapThrough) {
3555     case WrapThroughWrap:
3556         m_value.ident = CSSValueWrap;
3557         break;
3558     case WrapThroughNone:
3559         m_value.ident = CSSValueNone;
3560         break;
3561     }
3562 }
3563
3564 template<> inline CSSPrimitiveValue::operator WrapThrough() const
3565 {
3566     switch (m_value.ident) {
3567     case CSSValueWrap:
3568         return WrapThroughWrap;
3569     case CSSValueNone:
3570         return WrapThroughNone;
3571     default:
3572         ASSERT_NOT_REACHED();
3573         return WrapThroughWrap;
3574     }
3575 }
3576
3577 #if ENABLE(SVG)
3578
3579 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
3580     : CSSValue(PrimitiveClass)
3581 {
3582     m_primitiveUnitType = CSS_IDENT;
3583     switch (e) {
3584         case CI_AUTO:
3585             m_value.ident = CSSValueAuto;
3586             break;
3587         case CI_SRGB:
3588             m_value.ident = CSSValueSrgb;
3589             break;
3590         case CI_LINEARRGB:
3591             m_value.ident = CSSValueLinearrgb;
3592             break;
3593     }
3594 }
3595
3596 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
3597 {
3598     switch (m_value.ident) {
3599         case CSSValueSrgb:
3600             return CI_SRGB;
3601         case CSSValueLinearrgb:
3602             return CI_LINEARRGB;
3603         case CSSValueAuto:
3604             return CI_AUTO;
3605         default:
3606             ASSERT_NOT_REACHED();
3607             return CI_AUTO;
3608     }
3609 }
3610
3611 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e)
3612     : CSSValue(PrimitiveClass)
3613 {
3614     m_primitiveUnitType = CSS_IDENT;
3615     switch (e) {
3616         case CR_AUTO:
3617             m_value.ident = CSSValueAuto;
3618             break;
3619         case CR_OPTIMIZESPEED:
3620             m_value.ident = CSSValueOptimizespeed;
3621             break;
3622         case CR_OPTIMIZEQUALITY:
3623             m_value.ident = CSSValueOptimizequality;
3624             break;
3625     }
3626 }
3627
3628 template<> inline CSSPrimitiveValue::operator EColorRendering() const
3629 {
3630     switch (m_value.ident) {
3631         case CSSValueOptimizespeed:
3632             return CR_OPTIMIZESPEED;
3633         case CSSValueOptimizequality:
3634             return CR_OPTIMIZEQUALITY;
3635         case CSSValueAuto:
3636             return CR_AUTO;
3637         default:
3638             ASSERT_NOT_REACHED();
3639             return CR_AUTO;
3640     }
3641 }
3642
3643 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e)
3644     : CSSValue(PrimitiveClass)
3645 {
3646     m_primitiveUnitType = CSS_IDENT;
3647     switch (e) {
3648         case DB_AUTO:
3649             m_value.ident = CSSValueAuto;
3650             break;
3651         case DB_USE_SCRIPT:
3652             m_value.ident = CSSValueUseScript;
3653             break;
3654         case DB_NO_CHANGE:
3655             m_value.ident = CSSValueNoChange;
3656             break;
3657         case DB_RESET_SIZE:
3658             m_value.ident = CSSValueResetSize;
3659             break;
3660         case DB_CENTRAL:
3661             m_value.ident = CSSValueCentral;
3662             break;
3663         case DB_MIDDLE:
3664             m_value.ident = CSSValueMiddle;
3665             break;
3666         case DB_TEXT_BEFORE_EDGE:
3667             m_value.ident = CSSValueTextBeforeEdge;
3668             break;
3669         case DB_TEXT_AFTER_EDGE:
3670             m_value.ident = CSSValueTextAfterEdge;
3671             break;
3672         case DB_IDEOGRAPHIC:
3673             m_value.ident = CSSValueIdeographic;
3674             break;
3675         case DB_ALPHABETIC:
3676             m_value.ident = CSSValueAlphabetic;
3677             break;
3678         case DB_HANGING:
3679             m_value.ident = CSSValueHanging;
3680             break;
3681         case DB_MATHEMATICAL:
3682             m_value.ident = CSSValueMathematical;
3683             break;
3684     }
3685 }
3686
3687 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
3688 {
3689     switch (m_value.ident) {
3690         case CSSValueAuto:
3691             return DB_AUTO;
3692         case CSSValueUseScript:
3693             return DB_USE_SCRIPT;
3694         case CSSValueNoChange:
3695             return DB_NO_CHANGE;
3696         case CSSValueResetSize:
3697             return DB_RESET_SIZE;
3698         case CSSValueIdeographic:
3699             return DB_IDEOGRAPHIC;
3700         case CSSValueAlphabetic:
3701             return DB_ALPHABETIC;
3702         case CSSValueHanging:
3703             return DB_HANGING;
3704         case CSSValueMathematical:
3705             return DB_MATHEMATICAL;
3706         case CSSValueCentral:
3707             return DB_CENTRAL;
3708         case CSSValueMiddle:
3709             return DB_MIDDLE;
3710         case CSSValueTextAfterEdge:
3711             return DB_TEXT_AFTER_EDGE;
3712         case CSSValueTextBeforeEdge:
3713             return DB_TEXT_BEFORE_EDGE;
3714         default:
3715             ASSERT_NOT_REACHED();
3716             return DB_AUTO;
3717     }
3718 }
3719
3720 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e)
3721     : CSSValue(PrimitiveClass)
3722 {
3723     m_primitiveUnitType = CSS_IDENT;
3724     switch (e) {
3725     case SR_AUTO:
3726         m_value.ident = CSSValueAuto;
3727         break;
3728     case SR_OPTIMIZESPEED:
3729         m_value.ident = CSSValueOptimizespeed;
3730         break;
3731     case SR_CRISPEDGES:
3732         m_value.ident = CSSValueCrispedges;
3733         break;
3734     case SR_GEOMETRICPRECISION:
3735         m_value.ident = CSSValueGeometricprecision;
3736         break;
3737     }
3738 }
3739
3740 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
3741 {
3742     switch (m_value.ident) {
3743     case CSSValueAuto:
3744         return SR_AUTO;
3745     case CSSValueOptimizespeed:
3746         return SR_OPTIMIZESPEED;
3747     case CSSValueCrispedges:
3748         return SR_CRISPEDGES;
3749     case CSSValueGeometricprecision:
3750         return SR_GEOMETRICPRECISION;
3751     default:
3752         ASSERT_NOT_REACHED();
3753         return SR_AUTO;
3754     }
3755 }
3756
3757 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e)
3758     : CSSValue(PrimitiveClass)
3759 {
3760     m_primitiveUnitType = CSS_IDENT;
3761     switch (e) {
3762         case TA_START:
3763             m_value.ident = CSSValueStart;
3764             break;
3765         case TA_MIDDLE:
3766             m_value.ident = CSSValueMiddle;
3767             break;
3768         case TA_END:
3769             m_value.ident = CSSValueEnd;
3770             break;
3771     }
3772 }
3773
3774 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
3775 {
3776     switch (m_value.ident) {
3777         case CSSValueStart:
3778             return TA_START;
3779         case CSSValueMiddle:
3780             return TA_MIDDLE;
3781         case CSSValueEnd:
3782             return TA_END;
3783         default:
3784             ASSERT_NOT_REACHED();
3785             return TA_START;
3786     }
3787 }
3788
3789 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SVGWritingMode e)
3790     : CSSValue(PrimitiveClass)
3791 {
3792     m_primitiveUnitType = CSS_IDENT;
3793     switch (e) {
3794         case WM_LRTB:
3795             m_value.ident = CSSValueLrTb;
3796             break;
3797         case WM_LR:
3798             m_value.ident = CSSValueLr;
3799             break;
3800         case WM_RLTB:
3801             m_value.ident = CSSValueRlTb;
3802             break;
3803         case WM_RL:
3804             m_value.ident = CSSValueRl;
3805             break;
3806         case WM_TBRL:
3807             m_value.ident = CSSValueTbRl;
3808             break;
3809         case WM_TB:
3810             m_value.ident = CSSValueTb;
3811             break;
3812     }
3813 }
3814
3815 template<> inline CSSPrimitiveValue::operator SVGWritingMode() const
3816 {
3817     switch (m_value.ident) {
3818     case CSSValueLrTb:
3819         return WM_LRTB;
3820     case CSSValueLr:
3821         return WM_LR;
3822     case CSSValueRlTb:
3823         return WM_RLTB;
3824     case CSSValueRl:
3825         return WM_RL;
3826     case CSSValueTbRl:
3827         return WM_TBRL;
3828     case CSSValueTb:
3829         return WM_TB;
3830     default:
3831         ASSERT_NOT_REACHED();
3832         return WM_LRTB;
3833     }
3834 }
3835
3836 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e)
3837     : CSSValue(PrimitiveClass)
3838 {
3839     m_primitiveUnitType = CSS_IDENT;
3840     switch (e) {
3841     case VE_NONE:
3842         m_value.ident = CSSValueNone;
3843         break;
3844     case VE_NON_SCALING_STROKE:
3845         m_value.ident = CSSValueNonScalingStroke;
3846         break;
3847     }
3848 }
3849
3850 template<> inline CSSPrimitiveValue::operator EVectorEffect() const
3851 {
3852     switch (m_value.ident) {
3853     case CSSValueNone:
3854         return VE_NONE;
3855     case CSSValueNonScalingStroke:
3856         return VE_NON_SCALING_STROKE;
3857     default:
3858         ASSERT_NOT_REACHED();
3859         return VE_NONE;
3860     }
3861 }
3862
3863 #endif // ENABLE(SVG)
3864
3865 }
3866
3867 #endif