• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
3  * Copyright (C) 2008, 2009, 2010 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 "FontSmoothingMode.h"
37 #include "GraphicsTypes.h"
38 #include "Path.h"
39 #include "RenderStyleConstants.h"
40 #include "SVGRenderStyleDefs.h"
41 #include "TextDirection.h"
42 #include "TextOrientation.h"
43 #include "TextRenderingMode.h"
44 #include "ThemeTypes.h"
45 #include "UnicodeBidi.h"
46 
47 namespace WebCore {
48 
CSSPrimitiveValue(EBorderStyle e)49 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
50     : m_type(CSS_IDENT)
51     , m_hasCachedCSSText(false)
52 {
53     switch (e) {
54         case BNONE:
55             m_value.ident = CSSValueNone;
56             break;
57         case BHIDDEN:
58             m_value.ident = CSSValueHidden;
59             break;
60         case INSET:
61             m_value.ident = CSSValueInset;
62             break;
63         case GROOVE:
64             m_value.ident = CSSValueGroove;
65             break;
66         case RIDGE:
67             m_value.ident = CSSValueRidge;
68             break;
69         case OUTSET:
70             m_value.ident = CSSValueOutset;
71             break;
72         case DOTTED:
73             m_value.ident = CSSValueDotted;
74             break;
75         case DASHED:
76             m_value.ident = CSSValueDashed;
77             break;
78         case SOLID:
79             m_value.ident = CSSValueSolid;
80             break;
81         case DOUBLE:
82             m_value.ident = CSSValueDouble;
83             break;
84     }
85 }
86 
EBorderStyle()87 template<> inline CSSPrimitiveValue::operator EBorderStyle() const
88 {
89     return (EBorderStyle)(m_value.ident - CSSValueNone);
90 }
91 
CSSPrimitiveValue(CompositeOperator e)92 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
93     : m_type(CSS_IDENT)
94     , m_hasCachedCSSText(false)
95 {
96     switch (e) {
97         case CompositeClear:
98             m_value.ident = CSSValueClear;
99             break;
100         case CompositeCopy:
101             m_value.ident = CSSValueCopy;
102             break;
103         case CompositeSourceOver:
104             m_value.ident = CSSValueSourceOver;
105             break;
106         case CompositeSourceIn:
107             m_value.ident = CSSValueSourceIn;
108             break;
109         case CompositeSourceOut:
110             m_value.ident = CSSValueSourceOut;
111             break;
112         case CompositeSourceAtop:
113             m_value.ident = CSSValueSourceAtop;
114             break;
115         case CompositeDestinationOver:
116             m_value.ident = CSSValueDestinationOver;
117             break;
118         case CompositeDestinationIn:
119             m_value.ident = CSSValueDestinationIn;
120             break;
121         case CompositeDestinationOut:
122             m_value.ident = CSSValueDestinationOut;
123             break;
124         case CompositeDestinationAtop:
125             m_value.ident = CSSValueDestinationAtop;
126             break;
127         case CompositeXOR:
128             m_value.ident = CSSValueXor;
129             break;
130         case CompositePlusDarker:
131             m_value.ident = CSSValuePlusDarker;
132             break;
133         case CompositeHighlight:
134             m_value.ident = CSSValueHighlight;
135             break;
136         case CompositePlusLighter:
137             m_value.ident = CSSValuePlusLighter;
138             break;
139     }
140 }
141 
CompositeOperator()142 template<> inline CSSPrimitiveValue::operator CompositeOperator() const
143 {
144     switch (m_value.ident) {
145         case CSSValueClear:
146             return CompositeClear;
147         case CSSValueCopy:
148             return CompositeCopy;
149         case CSSValueSourceOver:
150             return CompositeSourceOver;
151         case CSSValueSourceIn:
152             return CompositeSourceIn;
153         case CSSValueSourceOut:
154             return CompositeSourceOut;
155         case CSSValueSourceAtop:
156             return CompositeSourceAtop;
157         case CSSValueDestinationOver:
158             return CompositeDestinationOver;
159         case CSSValueDestinationIn:
160             return CompositeDestinationIn;
161         case CSSValueDestinationOut:
162             return CompositeDestinationOut;
163         case CSSValueDestinationAtop:
164             return CompositeDestinationAtop;
165         case CSSValueXor:
166             return CompositeXOR;
167         case CSSValuePlusDarker:
168             return CompositePlusDarker;
169         case CSSValueHighlight:
170             return CompositeHighlight;
171         case CSSValuePlusLighter:
172             return CompositePlusLighter;
173         default:
174             ASSERT_NOT_REACHED();
175             return CompositeClear;
176     }
177 }
178 
CSSPrimitiveValue(ControlPart e)179 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
180     : m_type(CSS_IDENT)
181     , m_hasCachedCSSText(false)
182 {
183     switch (e) {
184         case NoControlPart:
185             m_value.ident = CSSValueNone;
186             break;
187         case CheckboxPart:
188             m_value.ident = CSSValueCheckbox;
189             break;
190         case RadioPart:
191             m_value.ident = CSSValueRadio;
192             break;
193         case PushButtonPart:
194             m_value.ident = CSSValuePushButton;
195             break;
196         case SquareButtonPart:
197             m_value.ident = CSSValueSquareButton;
198             break;
199         case ButtonPart:
200             m_value.ident = CSSValueButton;
201             break;
202         case ButtonBevelPart:
203             m_value.ident = CSSValueButtonBevel;
204             break;
205         case DefaultButtonPart:
206             m_value.ident = CSSValueDefaultButton;
207             break;
208         case InnerSpinButtonPart:
209             m_value.ident = CSSValueInnerSpinButton;
210             break;
211         case ListboxPart:
212             m_value.ident = CSSValueListbox;
213             break;
214         case ListButtonPart:
215 #if ENABLE(DATALIST)
216             m_value.ident = CSSValueListButton;
217 #endif
218             break;
219         case ListItemPart:
220             m_value.ident = CSSValueListitem;
221             break;
222         case MediaFullscreenButtonPart:
223             m_value.ident = CSSValueMediaFullscreenButton;
224             break;
225         case MediaPlayButtonPart:
226             m_value.ident = CSSValueMediaPlayButton;
227             break;
228         case MediaMuteButtonPart:
229             m_value.ident = CSSValueMediaMuteButton;
230             break;
231         case MediaSeekBackButtonPart:
232             m_value.ident = CSSValueMediaSeekBackButton;
233             break;
234         case MediaSeekForwardButtonPart:
235             m_value.ident = CSSValueMediaSeekForwardButton;
236             break;
237         case MediaRewindButtonPart:
238             m_value.ident = CSSValueMediaRewindButton;
239             break;
240         case MediaReturnToRealtimeButtonPart:
241             m_value.ident = CSSValueMediaReturnToRealtimeButton;
242             break;
243         case MediaToggleClosedCaptionsButtonPart:
244             m_value.ident = CSSValueMediaToggleClosedCaptionsButton;
245             break;
246         case MediaSliderPart:
247             m_value.ident = CSSValueMediaSlider;
248             break;
249         case MediaSliderThumbPart:
250             m_value.ident = CSSValueMediaSliderthumb;
251             break;
252         case MediaVolumeSliderContainerPart:
253             m_value.ident = CSSValueMediaVolumeSliderContainer;
254             break;
255         case MediaVolumeSliderPart:
256             m_value.ident = CSSValueMediaVolumeSlider;
257             break;
258         case MediaVolumeSliderMuteButtonPart:
259             m_value.ident = CSSValueMediaVolumeSliderMuteButton;
260             break;
261         case MediaVolumeSliderThumbPart:
262             m_value.ident = CSSValueMediaVolumeSliderthumb;
263             break;
264         case MediaControlsBackgroundPart:
265             m_value.ident = CSSValueMediaControlsBackground;
266             break;
267         case MediaControlsFullscreenBackgroundPart:
268             m_value.ident = CSSValueMediaControlsFullscreenBackground;
269             break;
270         case MediaCurrentTimePart:
271             m_value.ident = CSSValueMediaCurrentTimeDisplay;
272             break;
273         case MediaTimeRemainingPart:
274             m_value.ident = CSSValueMediaTimeRemainingDisplay;
275             break;
276         case MenulistPart:
277             m_value.ident = CSSValueMenulist;
278             break;
279         case MenulistButtonPart:
280             m_value.ident = CSSValueMenulistButton;
281             break;
282         case MenulistTextPart:
283             m_value.ident = CSSValueMenulistText;
284             break;
285         case MenulistTextFieldPart:
286             m_value.ident = CSSValueMenulistTextfield;
287             break;
288         case MeterPart:
289             m_value.ident = CSSValueMeter;
290             break;
291         case RelevancyLevelIndicatorPart:
292             m_value.ident = CSSValueRelevancyLevelIndicator;
293             break;
294         case ContinuousCapacityLevelIndicatorPart:
295             m_value.ident = CSSValueContinuousCapacityLevelIndicator;
296             break;
297         case DiscreteCapacityLevelIndicatorPart:
298             m_value.ident = CSSValueDiscreteCapacityLevelIndicator;
299             break;
300         case RatingLevelIndicatorPart:
301             m_value.ident = CSSValueRatingLevelIndicator;
302             break;
303         case OuterSpinButtonPart:
304             m_value.ident = CSSValueOuterSpinButton;
305             break;
306         case ProgressBarPart:
307 #if ENABLE(PROGRESS_TAG)
308             m_value.ident = CSSValueProgressBar;
309 #endif
310             break;
311         case ProgressBarValuePart:
312 #if ENABLE(PROGRESS_TAG)
313             m_value.ident = CSSValueProgressBarValue;
314 #endif
315             break;
316         case SliderHorizontalPart:
317             m_value.ident = CSSValueSliderHorizontal;
318             break;
319         case SliderVerticalPart:
320             m_value.ident = CSSValueSliderVertical;
321             break;
322         case SliderThumbHorizontalPart:
323             m_value.ident = CSSValueSliderthumbHorizontal;
324             break;
325         case SliderThumbVerticalPart:
326             m_value.ident = CSSValueSliderthumbVertical;
327             break;
328         case CaretPart:
329             m_value.ident = CSSValueCaret;
330             break;
331         case SearchFieldPart:
332             m_value.ident = CSSValueSearchfield;
333             break;
334         case SearchFieldDecorationPart:
335             m_value.ident = CSSValueSearchfieldDecoration;
336             break;
337         case SearchFieldResultsDecorationPart:
338             m_value.ident = CSSValueSearchfieldResultsDecoration;
339             break;
340         case SearchFieldResultsButtonPart:
341             m_value.ident = CSSValueSearchfieldResultsButton;
342             break;
343         case SearchFieldCancelButtonPart:
344             m_value.ident = CSSValueSearchfieldCancelButton;
345             break;
346         case TextFieldPart:
347             m_value.ident = CSSValueTextfield;
348             break;
349         case TextAreaPart:
350             m_value.ident = CSSValueTextarea;
351             break;
352         case CapsLockIndicatorPart:
353             m_value.ident = CSSValueCapsLockIndicator;
354             break;
355         case InputSpeechButtonPart:
356 #if ENABLE(INPUT_SPEECH)
357             m_value.ident = CSSValueWebkitInputSpeechButton;
358 #endif
359             break;
360     }
361 }
362 
ControlPart()363 template<> inline CSSPrimitiveValue::operator ControlPart() const
364 {
365     if (m_value.ident == CSSValueNone)
366         return NoControlPart;
367     else
368         return ControlPart(m_value.ident - CSSValueCheckbox + 1);
369 }
370 
CSSPrimitiveValue(EFillAttachment e)371 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e)
372     : m_type(CSS_IDENT)
373     , m_hasCachedCSSText(false)
374 {
375     switch (e) {
376         case ScrollBackgroundAttachment:
377             m_value.ident = CSSValueScroll;
378             break;
379         case LocalBackgroundAttachment:
380             m_value.ident = CSSValueLocal;
381             break;
382         case FixedBackgroundAttachment:
383             m_value.ident = CSSValueFixed;
384             break;
385     }
386 }
387 
EFillAttachment()388 template<> inline CSSPrimitiveValue::operator EFillAttachment() const
389 {
390     switch (m_value.ident) {
391         case CSSValueScroll:
392             return ScrollBackgroundAttachment;
393         case CSSValueLocal:
394             return LocalBackgroundAttachment;
395         case CSSValueFixed:
396             return FixedBackgroundAttachment;
397         default:
398             ASSERT_NOT_REACHED();
399             return ScrollBackgroundAttachment;
400     }
401 }
402 
CSSPrimitiveValue(EFillBox e)403 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
404     : m_type(CSS_IDENT)
405     , m_hasCachedCSSText(false)
406 {
407     switch (e) {
408         case BorderFillBox:
409             m_value.ident = CSSValueBorderBox;
410             break;
411         case PaddingFillBox:
412             m_value.ident = CSSValuePaddingBox;
413             break;
414         case ContentFillBox:
415             m_value.ident = CSSValueContentBox;
416             break;
417         case TextFillBox:
418             m_value.ident = CSSValueText;
419             break;
420     }
421 }
422 
EFillBox()423 template<> inline CSSPrimitiveValue::operator EFillBox() const
424 {
425     switch (m_value.ident) {
426         case CSSValueBorder:
427         case CSSValueBorderBox:
428             return BorderFillBox;
429         case CSSValuePadding:
430         case CSSValuePaddingBox:
431             return PaddingFillBox;
432         case CSSValueContent:
433         case CSSValueContentBox:
434             return ContentFillBox;
435         case CSSValueText:
436         case CSSValueWebkitText:
437             return TextFillBox;
438         default:
439             ASSERT_NOT_REACHED();
440             return BorderFillBox;
441     }
442 }
443 
CSSPrimitiveValue(EFillRepeat e)444 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)
445     : m_type(CSS_IDENT)
446     , m_hasCachedCSSText(false)
447 {
448     switch (e) {
449         case RepeatFill:
450             m_value.ident = CSSValueRepeat;
451             break;
452         case NoRepeatFill:
453             m_value.ident = CSSValueNoRepeat;
454             break;
455         case RoundFill:
456             m_value.ident = CSSValueRound;
457             break;
458         case SpaceFill:
459             m_value.ident = CSSValueSpace;
460             break;
461     }
462 }
463 
EFillRepeat()464 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
465 {
466     switch (m_value.ident) {
467         case CSSValueRepeat:
468             return RepeatFill;
469         case CSSValueNoRepeat:
470             return NoRepeatFill;
471         case CSSValueRound:
472             return RoundFill;
473         case CSSValueSpace:
474             return SpaceFill;
475         default:
476             ASSERT_NOT_REACHED();
477             return RepeatFill;
478     }
479 }
480 
CSSPrimitiveValue(EBoxAlignment e)481 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)
482     : m_type(CSS_IDENT)
483     , m_hasCachedCSSText(false)
484 {
485     switch (e) {
486         case BSTRETCH:
487             m_value.ident = CSSValueStretch;
488             break;
489         case BSTART:
490             m_value.ident = CSSValueStart;
491             break;
492         case BCENTER:
493             m_value.ident = CSSValueCenter;
494             break;
495         case BEND:
496             m_value.ident = CSSValueEnd;
497             break;
498         case BBASELINE:
499             m_value.ident = CSSValueBaseline;
500             break;
501         case BJUSTIFY:
502             m_value.ident = CSSValueJustify;
503             break;
504     }
505 }
506 
EBoxAlignment()507 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
508 {
509     switch (m_value.ident) {
510         case CSSValueStretch:
511             return BSTRETCH;
512         case CSSValueStart:
513             return BSTART;
514         case CSSValueEnd:
515             return BEND;
516         case CSSValueCenter:
517             return BCENTER;
518         case CSSValueBaseline:
519             return BBASELINE;
520         case CSSValueJustify:
521             return BJUSTIFY;
522         default:
523             ASSERT_NOT_REACHED();
524             return BSTRETCH;
525     }
526 }
527 
CSSPrimitiveValue(EBoxDirection e)528 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
529     : m_type(CSS_IDENT)
530     , m_hasCachedCSSText(false)
531 {
532     switch (e) {
533         case BNORMAL:
534             m_value.ident = CSSValueNormal;
535             break;
536         case BREVERSE:
537             m_value.ident = CSSValueReverse;
538             break;
539     }
540 }
541 
EBoxDirection()542 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
543 {
544     switch (m_value.ident) {
545         case CSSValueNormal:
546             return BNORMAL;
547         case CSSValueReverse:
548             return BREVERSE;
549         default:
550             ASSERT_NOT_REACHED();
551             return BNORMAL;
552     }
553 }
554 
CSSPrimitiveValue(EBoxLines e)555 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)
556     : m_type(CSS_IDENT)
557     , m_hasCachedCSSText(false)
558 {
559     switch (e) {
560         case SINGLE:
561             m_value.ident = CSSValueSingle;
562             break;
563         case MULTIPLE:
564             m_value.ident = CSSValueMultiple;
565             break;
566     }
567 }
568 
EBoxLines()569 template<> inline CSSPrimitiveValue::operator EBoxLines() const
570 {
571     switch (m_value.ident) {
572         case CSSValueSingle:
573             return SINGLE;
574         case CSSValueMultiple:
575             return MULTIPLE;
576         default:
577             ASSERT_NOT_REACHED();
578             return SINGLE;
579     }
580 }
581 
CSSPrimitiveValue(EBoxOrient e)582 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)
583     : m_type(CSS_IDENT)
584     , m_hasCachedCSSText(false)
585 {
586     switch (e) {
587         case HORIZONTAL:
588             m_value.ident = CSSValueHorizontal;
589             break;
590         case VERTICAL:
591             m_value.ident = CSSValueVertical;
592             break;
593     }
594 }
595 
EBoxOrient()596 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
597 {
598     switch (m_value.ident) {
599         case CSSValueHorizontal:
600         case CSSValueInlineAxis:
601             return HORIZONTAL;
602         case CSSValueVertical:
603         case CSSValueBlockAxis:
604             return VERTICAL;
605         default:
606             ASSERT_NOT_REACHED();
607             return HORIZONTAL;
608     }
609 }
610 
CSSPrimitiveValue(ECaptionSide e)611 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)
612     : m_type(CSS_IDENT)
613     , m_hasCachedCSSText(false)
614 {
615     switch (e) {
616         case CAPLEFT:
617             m_value.ident = CSSValueLeft;
618             break;
619         case CAPRIGHT:
620             m_value.ident = CSSValueRight;
621             break;
622         case CAPTOP:
623             m_value.ident = CSSValueTop;
624             break;
625         case CAPBOTTOM:
626             m_value.ident = CSSValueBottom;
627             break;
628     }
629 }
630 
ECaptionSide()631 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
632 {
633     switch (m_value.ident) {
634         case CSSValueLeft:
635             return CAPLEFT;
636         case CSSValueRight:
637             return CAPRIGHT;
638         case CSSValueTop:
639             return CAPTOP;
640         case CSSValueBottom:
641             return CAPBOTTOM;
642         default:
643             ASSERT_NOT_REACHED();
644             return CAPTOP;
645     }
646 }
647 
CSSPrimitiveValue(EClear e)648 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)
649     : m_type(CSS_IDENT)
650     , m_hasCachedCSSText(false)
651 {
652     switch (e) {
653         case CNONE:
654             m_value.ident = CSSValueNone;
655             break;
656         case CLEFT:
657             m_value.ident = CSSValueLeft;
658             break;
659         case CRIGHT:
660             m_value.ident = CSSValueRight;
661             break;
662         case CBOTH:
663             m_value.ident = CSSValueBoth;
664             break;
665     }
666 }
667 
EClear()668 template<> inline CSSPrimitiveValue::operator EClear() const
669 {
670     switch (m_value.ident) {
671         case CSSValueNone:
672             return CNONE;
673         case CSSValueLeft:
674             return CLEFT;
675         case CSSValueRight:
676             return CRIGHT;
677         case CSSValueBoth:
678             return CBOTH;
679         default:
680             ASSERT_NOT_REACHED();
681             return CNONE;
682     }
683 }
684 
CSSPrimitiveValue(ECursor e)685 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e)
686     : m_type(CSS_IDENT)
687     , m_hasCachedCSSText(false)
688 {
689     switch (e) {
690         case CURSOR_AUTO:
691             m_value.ident = CSSValueAuto;
692             break;
693         case CURSOR_CROSS:
694             m_value.ident = CSSValueCrosshair;
695             break;
696         case CURSOR_DEFAULT:
697             m_value.ident = CSSValueDefault;
698             break;
699         case CURSOR_POINTER:
700             m_value.ident = CSSValuePointer;
701             break;
702         case CURSOR_MOVE:
703             m_value.ident = CSSValueMove;
704             break;
705         case CURSOR_CELL:
706             m_value.ident = CSSValueCell;
707             break;
708         case CURSOR_VERTICAL_TEXT:
709             m_value.ident = CSSValueVerticalText;
710             break;
711         case CURSOR_CONTEXT_MENU:
712             m_value.ident = CSSValueContextMenu;
713             break;
714         case CURSOR_ALIAS:
715             m_value.ident = CSSValueAlias;
716             break;
717         case CURSOR_COPY:
718             m_value.ident = CSSValueCopy;
719             break;
720         case CURSOR_NONE:
721             m_value.ident = CSSValueNone;
722             break;
723         case CURSOR_PROGRESS:
724             m_value.ident = CSSValueProgress;
725             break;
726         case CURSOR_NO_DROP:
727             m_value.ident = CSSValueNoDrop;
728             break;
729         case CURSOR_NOT_ALLOWED:
730             m_value.ident = CSSValueNotAllowed;
731             break;
732         case CURSOR_WEBKIT_ZOOM_IN:
733             m_value.ident = CSSValueWebkitZoomIn;
734             break;
735         case CURSOR_WEBKIT_ZOOM_OUT:
736             m_value.ident = CSSValueWebkitZoomOut;
737             break;
738         case CURSOR_E_RESIZE:
739             m_value.ident = CSSValueEResize;
740             break;
741         case CURSOR_NE_RESIZE:
742             m_value.ident = CSSValueNeResize;
743             break;
744         case CURSOR_NW_RESIZE:
745             m_value.ident = CSSValueNwResize;
746             break;
747         case CURSOR_N_RESIZE:
748             m_value.ident = CSSValueNResize;
749             break;
750         case CURSOR_SE_RESIZE:
751             m_value.ident = CSSValueSeResize;
752             break;
753         case CURSOR_SW_RESIZE:
754             m_value.ident = CSSValueSwResize;
755             break;
756         case CURSOR_S_RESIZE:
757             m_value.ident = CSSValueSResize;
758             break;
759         case CURSOR_W_RESIZE:
760             m_value.ident = CSSValueWResize;
761             break;
762         case CURSOR_EW_RESIZE:
763             m_value.ident = CSSValueEwResize;
764             break;
765         case CURSOR_NS_RESIZE:
766             m_value.ident = CSSValueNsResize;
767             break;
768         case CURSOR_NESW_RESIZE:
769             m_value.ident = CSSValueNeswResize;
770             break;
771         case CURSOR_NWSE_RESIZE:
772             m_value.ident = CSSValueNwseResize;
773             break;
774         case CURSOR_COL_RESIZE:
775             m_value.ident = CSSValueColResize;
776             break;
777         case CURSOR_ROW_RESIZE:
778             m_value.ident = CSSValueRowResize;
779             break;
780         case CURSOR_TEXT:
781             m_value.ident = CSSValueText;
782             break;
783         case CURSOR_WAIT:
784             m_value.ident = CSSValueWait;
785             break;
786         case CURSOR_HELP:
787             m_value.ident = CSSValueHelp;
788             break;
789         case CURSOR_ALL_SCROLL:
790             m_value.ident = CSSValueAllScroll;
791             break;
792         case CURSOR_WEBKIT_GRAB:
793             m_value.ident = CSSValueWebkitGrab;
794             break;
795         case CURSOR_WEBKIT_GRABBING:
796             m_value.ident = CSSValueWebkitGrabbing;
797             break;
798     }
799 }
800 
ECursor()801 template<> inline CSSPrimitiveValue::operator ECursor() const
802 {
803     if (m_value.ident == CSSValueCopy)
804         return CURSOR_COPY;
805     if (m_value.ident == CSSValueNone)
806         return CURSOR_NONE;
807     return static_cast<ECursor>(m_value.ident - CSSValueAuto);
808 }
809 
CSSPrimitiveValue(EDisplay e)810 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e)
811     : m_type(CSS_IDENT)
812     , m_hasCachedCSSText(false)
813 {
814     switch (e) {
815         case INLINE:
816             m_value.ident = CSSValueInline;
817             break;
818         case BLOCK:
819             m_value.ident = CSSValueBlock;
820             break;
821         case LIST_ITEM:
822             m_value.ident = CSSValueListItem;
823             break;
824         case RUN_IN:
825             m_value.ident = CSSValueRunIn;
826             break;
827         case COMPACT:
828             m_value.ident = CSSValueCompact;
829             break;
830         case INLINE_BLOCK:
831             m_value.ident = CSSValueInlineBlock;
832             break;
833         case TABLE:
834             m_value.ident = CSSValueTable;
835             break;
836         case INLINE_TABLE:
837             m_value.ident = CSSValueInlineTable;
838             break;
839         case TABLE_ROW_GROUP:
840             m_value.ident = CSSValueTableRowGroup;
841             break;
842         case TABLE_HEADER_GROUP:
843             m_value.ident = CSSValueTableHeaderGroup;
844             break;
845         case TABLE_FOOTER_GROUP:
846             m_value.ident = CSSValueTableFooterGroup;
847             break;
848         case TABLE_ROW:
849             m_value.ident = CSSValueTableRow;
850             break;
851         case TABLE_COLUMN_GROUP:
852             m_value.ident = CSSValueTableColumnGroup;
853             break;
854         case TABLE_COLUMN:
855             m_value.ident = CSSValueTableColumn;
856             break;
857         case TABLE_CELL:
858             m_value.ident = CSSValueTableCell;
859             break;
860         case TABLE_CAPTION:
861             m_value.ident = CSSValueTableCaption;
862             break;
863 #if ENABLE(WCSS)
864         case WAP_MARQUEE:
865             m_value.ident = CSSValueWapMarquee;
866             break;
867 #endif
868         case BOX:
869             m_value.ident = CSSValueWebkitBox;
870             break;
871         case INLINE_BOX:
872             m_value.ident = CSSValueWebkitInlineBox;
873             break;
874         case NONE:
875             m_value.ident = CSSValueNone;
876             break;
877     }
878 }
879 
EDisplay()880 template<> inline CSSPrimitiveValue::operator EDisplay() const
881 {
882     if (m_value.ident == CSSValueNone)
883         return NONE;
884     return static_cast<EDisplay>(m_value.ident - CSSValueInline);
885 }
886 
CSSPrimitiveValue(EEmptyCell e)887 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e)
888     : m_type(CSS_IDENT)
889     , m_hasCachedCSSText(false)
890 {
891     switch (e) {
892         case SHOW:
893             m_value.ident = CSSValueShow;
894             break;
895         case HIDE:
896             m_value.ident = CSSValueHide;
897             break;
898     }
899 }
900 
EEmptyCell()901 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
902 {
903     switch (m_value.ident) {
904         case CSSValueShow:
905             return SHOW;
906         case CSSValueHide:
907             return HIDE;
908         default:
909             ASSERT_NOT_REACHED();
910             return SHOW;
911     }
912 }
913 
CSSPrimitiveValue(EFloat e)914 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
915     : m_type(CSS_IDENT)
916     , m_hasCachedCSSText(false)
917 {
918     switch (e) {
919         case FNONE:
920             m_value.ident = CSSValueNone;
921             break;
922         case FLEFT:
923             m_value.ident = CSSValueLeft;
924             break;
925         case FRIGHT:
926             m_value.ident = CSSValueRight;
927             break;
928     }
929 }
930 
EFloat()931 template<> inline CSSPrimitiveValue::operator EFloat() const
932 {
933     switch (m_value.ident) {
934         case CSSValueLeft:
935             return FLEFT;
936         case CSSValueRight:
937             return FRIGHT;
938         case CSSValueNone:
939         case CSSValueCenter:  // Non-standard CSS value
940             return FNONE;
941         default:
942             ASSERT_NOT_REACHED();
943             return FNONE;
944     }
945 }
946 
CSSPrimitiveValue(EKHTMLLineBreak e)947 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e)
948     : m_type(CSS_IDENT)
949     , m_hasCachedCSSText(false)
950 {
951     switch (e) {
952         case LBNORMAL:
953             m_value.ident = CSSValueNormal;
954             break;
955         case AFTER_WHITE_SPACE:
956             m_value.ident = CSSValueAfterWhiteSpace;
957             break;
958     }
959 }
960 
EKHTMLLineBreak()961 template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
962 {
963     switch (m_value.ident) {
964         case CSSValueAfterWhiteSpace:
965             return AFTER_WHITE_SPACE;
966         case CSSValueNormal:
967             return LBNORMAL;
968         default:
969             ASSERT_NOT_REACHED();
970             return LBNORMAL;
971     }
972 }
973 
CSSPrimitiveValue(EListStylePosition e)974 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
975     : m_type(CSS_IDENT)
976     , m_hasCachedCSSText(false)
977 {
978     switch (e) {
979         case OUTSIDE:
980             m_value.ident = CSSValueOutside;
981             break;
982         case INSIDE:
983             m_value.ident = CSSValueInside;
984             break;
985     }
986 }
987 
EListStylePosition()988 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
989 {
990     return (EListStylePosition)(m_value.ident - CSSValueOutside);
991 }
992 
CSSPrimitiveValue(EListStyleType e)993 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
994     : m_type(CSS_IDENT)
995     , m_hasCachedCSSText(false)
996 {
997     switch (e) {
998     case Afar:
999         m_value.ident = CSSValueAfar;
1000         break;
1001     case Amharic:
1002         m_value.ident = CSSValueAmharic;
1003         break;
1004     case AmharicAbegede:
1005         m_value.ident = CSSValueAmharicAbegede;
1006         break;
1007     case ArabicIndic:
1008         m_value.ident = CSSValueArabicIndic;
1009         break;
1010     case Armenian:
1011         m_value.ident = CSSValueArmenian;
1012         break;
1013     case Asterisks:
1014         m_value.ident = CSSValueAsterisks;
1015         break;
1016     case BinaryListStyle:
1017         m_value.ident = CSSValueBinary;
1018         break;
1019     case Bengali:
1020         m_value.ident = CSSValueBengali;
1021         break;
1022     case Cambodian:
1023         m_value.ident = CSSValueCambodian;
1024         break;
1025     case Circle:
1026         m_value.ident = CSSValueCircle;
1027         break;
1028     case CjkEarthlyBranch:
1029         m_value.ident = CSSValueCjkEarthlyBranch;
1030         break;
1031     case CjkHeavenlyStem:
1032         m_value.ident = CSSValueCjkHeavenlyStem;
1033         break;
1034     case CJKIdeographic:
1035         m_value.ident = CSSValueCjkIdeographic;
1036         break;
1037     case DecimalLeadingZero:
1038         m_value.ident = CSSValueDecimalLeadingZero;
1039         break;
1040     case DecimalListStyle:
1041         m_value.ident = CSSValueDecimal;
1042         break;
1043     case Devanagari:
1044         m_value.ident = CSSValueDevanagari;
1045         break;
1046     case Disc:
1047         m_value.ident = CSSValueDisc;
1048         break;
1049     case Ethiopic:
1050         m_value.ident = CSSValueEthiopic;
1051         break;
1052     case EthiopicAbegede:
1053         m_value.ident = CSSValueEthiopicAbegede;
1054         break;
1055     case EthiopicAbegedeAmEt:
1056         m_value.ident = CSSValueEthiopicAbegedeAmEt;
1057         break;
1058     case EthiopicAbegedeGez:
1059         m_value.ident = CSSValueEthiopicAbegedeGez;
1060         break;
1061     case EthiopicAbegedeTiEr:
1062         m_value.ident = CSSValueEthiopicAbegedeTiEr;
1063         break;
1064     case EthiopicAbegedeTiEt:
1065         m_value.ident = CSSValueEthiopicAbegedeTiEt;
1066         break;
1067     case EthiopicHalehameAaEr:
1068         m_value.ident = CSSValueEthiopicHalehameAaEr;
1069         break;
1070     case EthiopicHalehameAaEt:
1071         m_value.ident = CSSValueEthiopicHalehameAaEt;
1072         break;
1073     case EthiopicHalehameAmEt:
1074         m_value.ident = CSSValueEthiopicHalehameAmEt;
1075         break;
1076     case EthiopicHalehameGez:
1077         m_value.ident = CSSValueEthiopicHalehameGez;
1078         break;
1079     case EthiopicHalehameOmEt:
1080         m_value.ident = CSSValueEthiopicHalehameOmEt;
1081         break;
1082     case EthiopicHalehameSidEt:
1083         m_value.ident = CSSValueEthiopicHalehameSidEt;
1084         break;
1085     case EthiopicHalehameSoEt:
1086         m_value.ident = CSSValueEthiopicHalehameSoEt;
1087         break;
1088     case EthiopicHalehameTiEr:
1089         m_value.ident = CSSValueEthiopicHalehameTiEr;
1090         break;
1091     case EthiopicHalehameTiEt:
1092         m_value.ident = CSSValueEthiopicHalehameTiEt;
1093         break;
1094     case EthiopicHalehameTig:
1095         m_value.ident = CSSValueEthiopicHalehameTig;
1096         break;
1097     case Footnotes:
1098         m_value.ident = CSSValueFootnotes;
1099         break;
1100     case Georgian:
1101         m_value.ident = CSSValueGeorgian;
1102         break;
1103     case Gujarati:
1104         m_value.ident = CSSValueGujarati;
1105         break;
1106     case Gurmukhi:
1107         m_value.ident = CSSValueGurmukhi;
1108         break;
1109     case Hangul:
1110         m_value.ident = CSSValueHangul;
1111         break;
1112     case HangulConsonant:
1113         m_value.ident = CSSValueHangulConsonant;
1114         break;
1115     case Hebrew:
1116         m_value.ident = CSSValueHebrew;
1117         break;
1118     case Hiragana:
1119         m_value.ident = CSSValueHiragana;
1120         break;
1121     case HiraganaIroha:
1122         m_value.ident = CSSValueHiraganaIroha;
1123         break;
1124     case Kannada:
1125         m_value.ident = CSSValueKannada;
1126         break;
1127     case Katakana:
1128         m_value.ident = CSSValueKatakana;
1129         break;
1130     case KatakanaIroha:
1131         m_value.ident = CSSValueKatakanaIroha;
1132         break;
1133     case Khmer:
1134         m_value.ident = CSSValueKhmer;
1135         break;
1136     case Lao:
1137         m_value.ident = CSSValueLao;
1138         break;
1139     case LowerAlpha:
1140         m_value.ident = CSSValueLowerAlpha;
1141         break;
1142     case LowerArmenian:
1143         m_value.ident = CSSValueLowerArmenian;
1144         break;
1145     case LowerGreek:
1146         m_value.ident = CSSValueLowerGreek;
1147         break;
1148     case LowerHexadecimal:
1149         m_value.ident = CSSValueLowerHexadecimal;
1150         break;
1151     case LowerLatin:
1152         m_value.ident = CSSValueLowerLatin;
1153         break;
1154     case LowerNorwegian:
1155         m_value.ident = CSSValueLowerNorwegian;
1156         break;
1157     case LowerRoman:
1158         m_value.ident = CSSValueLowerRoman;
1159         break;
1160     case Malayalam:
1161         m_value.ident = CSSValueMalayalam;
1162         break;
1163     case Mongolian:
1164         m_value.ident = CSSValueMongolian;
1165         break;
1166     case Myanmar:
1167         m_value.ident = CSSValueMyanmar;
1168         break;
1169     case NoneListStyle:
1170         m_value.ident = CSSValueNone;
1171         break;
1172     case Octal:
1173         m_value.ident = CSSValueOctal;
1174         break;
1175     case Oriya:
1176         m_value.ident = CSSValueOriya;
1177         break;
1178     case Oromo:
1179         m_value.ident = CSSValueOromo;
1180         break;
1181     case Persian:
1182         m_value.ident = CSSValuePersian;
1183         break;
1184     case Sidama:
1185         m_value.ident = CSSValueSidama;
1186         break;
1187     case Somali:
1188         m_value.ident = CSSValueSomali;
1189         break;
1190     case Square:
1191         m_value.ident = CSSValueSquare;
1192         break;
1193     case Telugu:
1194         m_value.ident = CSSValueTelugu;
1195         break;
1196     case Thai:
1197         m_value.ident = CSSValueThai;
1198         break;
1199     case Tibetan:
1200         m_value.ident = CSSValueTibetan;
1201         break;
1202     case Tigre:
1203         m_value.ident = CSSValueTigre;
1204         break;
1205     case TigrinyaEr:
1206         m_value.ident = CSSValueTigrinyaEr;
1207         break;
1208     case TigrinyaErAbegede:
1209         m_value.ident = CSSValueTigrinyaErAbegede;
1210         break;
1211     case TigrinyaEt:
1212         m_value.ident = CSSValueTigrinyaEt;
1213         break;
1214     case TigrinyaEtAbegede:
1215         m_value.ident = CSSValueTigrinyaEtAbegede;
1216         break;
1217     case UpperAlpha:
1218         m_value.ident = CSSValueUpperAlpha;
1219         break;
1220     case UpperArmenian:
1221         m_value.ident = CSSValueUpperArmenian;
1222         break;
1223     case UpperGreek:
1224         m_value.ident = CSSValueUpperGreek;
1225         break;
1226     case UpperHexadecimal:
1227         m_value.ident = CSSValueUpperHexadecimal;
1228         break;
1229     case UpperLatin:
1230         m_value.ident = CSSValueUpperLatin;
1231         break;
1232     case UpperNorwegian:
1233         m_value.ident = CSSValueUpperNorwegian;
1234         break;
1235     case UpperRoman:
1236         m_value.ident = CSSValueUpperRoman;
1237         break;
1238     case Urdu:
1239         m_value.ident = CSSValueUrdu;
1240         break;
1241     }
1242 }
1243 
EListStyleType()1244 template<> inline CSSPrimitiveValue::operator EListStyleType() const
1245 {
1246     switch (m_value.ident) {
1247         case CSSValueNone:
1248             return NoneListStyle;
1249         default:
1250             return static_cast<EListStyleType>(m_value.ident - CSSValueDisc);
1251     }
1252 }
1253 
CSSPrimitiveValue(EMarginCollapse e)1254 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e)
1255     : m_type(CSS_IDENT)
1256     , m_hasCachedCSSText(false)
1257 {
1258     switch (e) {
1259         case MCOLLAPSE:
1260             m_value.ident = CSSValueCollapse;
1261             break;
1262         case MSEPARATE:
1263             m_value.ident = CSSValueSeparate;
1264             break;
1265         case MDISCARD:
1266             m_value.ident = CSSValueDiscard;
1267             break;
1268     }
1269 }
1270 
EMarginCollapse()1271 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
1272 {
1273     switch (m_value.ident) {
1274         case CSSValueCollapse:
1275             return MCOLLAPSE;
1276         case CSSValueSeparate:
1277             return MSEPARATE;
1278         case CSSValueDiscard:
1279             return MDISCARD;
1280         default:
1281             ASSERT_NOT_REACHED();
1282             return MCOLLAPSE;
1283     }
1284 }
1285 
CSSPrimitiveValue(EMarqueeBehavior e)1286 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e)
1287     : m_type(CSS_IDENT)
1288     , m_hasCachedCSSText(false)
1289 {
1290     switch (e) {
1291         case MNONE:
1292             m_value.ident = CSSValueNone;
1293             break;
1294         case MSCROLL:
1295             m_value.ident = CSSValueScroll;
1296             break;
1297         case MSLIDE:
1298             m_value.ident = CSSValueSlide;
1299             break;
1300         case MALTERNATE:
1301             m_value.ident = CSSValueAlternate;
1302             break;
1303     }
1304 }
1305 
EMarqueeBehavior()1306 template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
1307 {
1308     switch (m_value.ident) {
1309         case CSSValueNone:
1310             return MNONE;
1311         case CSSValueScroll:
1312             return MSCROLL;
1313         case CSSValueSlide:
1314             return MSLIDE;
1315         case CSSValueAlternate:
1316             return MALTERNATE;
1317         default:
1318             ASSERT_NOT_REACHED();
1319             return MNONE;
1320     }
1321 }
1322 
CSSPrimitiveValue(EMarqueeDirection e)1323 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e)
1324     : m_type(CSS_IDENT)
1325     , m_hasCachedCSSText(false)
1326 {
1327     switch (e) {
1328         case MFORWARD:
1329             m_value.ident = CSSValueForwards;
1330             break;
1331         case MBACKWARD:
1332             m_value.ident = CSSValueBackwards;
1333             break;
1334         case MAUTO:
1335             m_value.ident = CSSValueAuto;
1336             break;
1337         case MUP:
1338             m_value.ident = CSSValueUp;
1339             break;
1340         case MDOWN:
1341             m_value.ident = CSSValueDown;
1342             break;
1343         case MLEFT:
1344             m_value.ident = CSSValueLeft;
1345             break;
1346         case MRIGHT:
1347             m_value.ident = CSSValueRight;
1348             break;
1349     }
1350 }
1351 
EMarqueeDirection()1352 template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
1353 {
1354     switch (m_value.ident) {
1355         case CSSValueForwards:
1356             return MFORWARD;
1357         case CSSValueBackwards:
1358             return MBACKWARD;
1359         case CSSValueAuto:
1360             return MAUTO;
1361         case CSSValueAhead:
1362         case CSSValueUp: // We don't support vertical languages, so AHEAD just maps to UP.
1363             return MUP;
1364         case CSSValueReverse:
1365         case CSSValueDown: // REVERSE just maps to DOWN, since we don't do vertical text.
1366             return MDOWN;
1367         case CSSValueLeft:
1368             return MLEFT;
1369         case CSSValueRight:
1370             return MRIGHT;
1371         default:
1372             ASSERT_NOT_REACHED();
1373             return MAUTO;
1374     }
1375 }
1376 
CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e)1377 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e)
1378     : m_type(CSS_IDENT)
1379     , m_hasCachedCSSText(false)
1380 {
1381     switch (e) {
1382         case BCNORMAL:
1383             m_value.ident = CSSValueNormal;
1384             break;
1385         case MATCH:
1386             m_value.ident = CSSValueMatch;
1387             break;
1388     }
1389 }
1390 
EMatchNearestMailBlockquoteColor()1391 template<> inline CSSPrimitiveValue::operator EMatchNearestMailBlockquoteColor() const
1392 {
1393     switch (m_value.ident) {
1394         case CSSValueNormal:
1395             return BCNORMAL;
1396         case CSSValueMatch:
1397             return MATCH;
1398         default:
1399             ASSERT_NOT_REACHED();
1400             return BCNORMAL;
1401     }
1402 }
1403 
CSSPrimitiveValue(ENBSPMode e)1404 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e)
1405     : m_type(CSS_IDENT)
1406     , m_hasCachedCSSText(false)
1407 {
1408     switch (e) {
1409         case NBNORMAL:
1410             m_value.ident = CSSValueNormal;
1411             break;
1412         case SPACE:
1413             m_value.ident = CSSValueSpace;
1414             break;
1415     }
1416 }
1417 
ENBSPMode()1418 template<> inline CSSPrimitiveValue::operator ENBSPMode() const
1419 {
1420     switch (m_value.ident) {
1421         case CSSValueSpace:
1422             return SPACE;
1423         case CSSValueNormal:
1424             return NBNORMAL;
1425         default:
1426             ASSERT_NOT_REACHED();
1427             return NBNORMAL;
1428     }
1429 }
1430 
CSSPrimitiveValue(EOverflow e)1431 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e)
1432     : m_type(CSS_IDENT)
1433     , m_hasCachedCSSText(false)
1434 {
1435     switch (e) {
1436         case OVISIBLE:
1437             m_value.ident = CSSValueVisible;
1438             break;
1439         case OHIDDEN:
1440             m_value.ident = CSSValueHidden;
1441             break;
1442         case OSCROLL:
1443             m_value.ident = CSSValueScroll;
1444             break;
1445         case OAUTO:
1446             m_value.ident = CSSValueAuto;
1447             break;
1448         case OMARQUEE:
1449             m_value.ident = CSSValueWebkitMarquee;
1450             break;
1451         case OOVERLAY:
1452             m_value.ident = CSSValueOverlay;
1453             break;
1454     }
1455 }
1456 
EOverflow()1457 template<> inline CSSPrimitiveValue::operator EOverflow() const
1458 {
1459     switch (m_value.ident) {
1460         case CSSValueVisible:
1461             return OVISIBLE;
1462         case CSSValueHidden:
1463             return OHIDDEN;
1464         case CSSValueScroll:
1465             return OSCROLL;
1466         case CSSValueAuto:
1467             return OAUTO;
1468         case CSSValueWebkitMarquee:
1469             return OMARQUEE;
1470         case CSSValueOverlay:
1471             return OOVERLAY;
1472         default:
1473             ASSERT_NOT_REACHED();
1474             return OVISIBLE;
1475     }
1476 }
1477 
CSSPrimitiveValue(EPageBreak e)1478 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
1479     : m_type(CSS_IDENT)
1480     , m_hasCachedCSSText(false)
1481 {
1482     switch (e) {
1483         case PBAUTO:
1484             m_value.ident = CSSValueAuto;
1485             break;
1486         case PBALWAYS:
1487             m_value.ident = CSSValueAlways;
1488             break;
1489         case PBAVOID:
1490             m_value.ident = CSSValueAvoid;
1491             break;
1492     }
1493 }
1494 
EPageBreak()1495 template<> inline CSSPrimitiveValue::operator EPageBreak() const
1496 {
1497     switch (m_value.ident) {
1498         case CSSValueAuto:
1499             return PBAUTO;
1500         case CSSValueLeft:
1501         case CSSValueRight:
1502         case CSSValueAlways:
1503             return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always."
1504         case CSSValueAvoid:
1505             return PBAVOID;
1506         default:
1507             ASSERT_NOT_REACHED();
1508             return PBAUTO;
1509     }
1510 }
1511 
CSSPrimitiveValue(EPosition e)1512 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
1513     : m_type(CSS_IDENT)
1514     , m_hasCachedCSSText(false)
1515 {
1516     switch (e) {
1517         case StaticPosition:
1518             m_value.ident = CSSValueStatic;
1519             break;
1520         case RelativePosition:
1521             m_value.ident = CSSValueRelative;
1522             break;
1523         case AbsolutePosition:
1524             m_value.ident = CSSValueAbsolute;
1525             break;
1526         case FixedPosition:
1527             m_value.ident = CSSValueFixed;
1528             break;
1529     }
1530 }
1531 
EPosition()1532 template<> inline CSSPrimitiveValue::operator EPosition() const
1533 {
1534     switch (m_value.ident) {
1535         case CSSValueStatic:
1536             return StaticPosition;
1537         case CSSValueRelative:
1538             return RelativePosition;
1539         case CSSValueAbsolute:
1540             return AbsolutePosition;
1541         case CSSValueFixed:
1542             return FixedPosition;
1543         default:
1544             ASSERT_NOT_REACHED();
1545             return StaticPosition;
1546     }
1547 }
1548 
CSSPrimitiveValue(EResize e)1549 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e)
1550     : m_type(CSS_IDENT)
1551     , m_hasCachedCSSText(false)
1552 {
1553     switch (e) {
1554         case RESIZE_BOTH:
1555             m_value.ident = CSSValueBoth;
1556             break;
1557         case RESIZE_HORIZONTAL:
1558             m_value.ident = CSSValueHorizontal;
1559             break;
1560         case RESIZE_VERTICAL:
1561             m_value.ident = CSSValueVertical;
1562             break;
1563         case RESIZE_NONE:
1564             m_value.ident = CSSValueNone;
1565             break;
1566     }
1567 }
1568 
EResize()1569 template<> inline CSSPrimitiveValue::operator EResize() const
1570 {
1571     switch (m_value.ident) {
1572         case CSSValueBoth:
1573             return RESIZE_BOTH;
1574         case CSSValueHorizontal:
1575             return RESIZE_HORIZONTAL;
1576         case CSSValueVertical:
1577             return RESIZE_VERTICAL;
1578         case CSSValueAuto:
1579             ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
1580             return RESIZE_NONE;
1581         case CSSValueNone:
1582             return RESIZE_NONE;
1583         default:
1584             ASSERT_NOT_REACHED();
1585             return RESIZE_NONE;
1586     }
1587 }
1588 
CSSPrimitiveValue(ETableLayout e)1589 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e)
1590     : m_type(CSS_IDENT)
1591     , m_hasCachedCSSText(false)
1592 {
1593     switch (e) {
1594         case TAUTO:
1595             m_value.ident = CSSValueAuto;
1596             break;
1597         case TFIXED:
1598             m_value.ident = CSSValueFixed;
1599             break;
1600     }
1601 }
1602 
ETableLayout()1603 template<> inline CSSPrimitiveValue::operator ETableLayout() const
1604 {
1605     switch (m_value.ident) {
1606         case CSSValueFixed:
1607             return TFIXED;
1608         case CSSValueAuto:
1609             return TAUTO;
1610         default:
1611             ASSERT_NOT_REACHED();
1612             return TAUTO;
1613     }
1614 }
1615 
CSSPrimitiveValue(ETextAlign e)1616 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
1617     : m_type(CSS_IDENT)
1618     , m_hasCachedCSSText(false)
1619 {
1620     switch (e) {
1621     case TAAUTO:
1622         m_value.ident = CSSValueWebkitAuto;
1623         break;
1624     case TASTART:
1625         m_value.ident = CSSValueStart;
1626         break;
1627     case TAEND:
1628         m_value.ident = CSSValueEnd;
1629         break;
1630     case LEFT:
1631         m_value.ident = CSSValueLeft;
1632         break;
1633     case RIGHT:
1634         m_value.ident = CSSValueRight;
1635         break;
1636     case CENTER:
1637         m_value.ident = CSSValueCenter;
1638         break;
1639     case JUSTIFY:
1640         m_value.ident = CSSValueJustify;
1641         break;
1642     case WEBKIT_LEFT:
1643         m_value.ident = CSSValueWebkitLeft;
1644         break;
1645     case WEBKIT_RIGHT:
1646         m_value.ident = CSSValueWebkitRight;
1647         break;
1648     case WEBKIT_CENTER:
1649         m_value.ident = CSSValueWebkitCenter;
1650         break;
1651     }
1652 }
1653 
ETextAlign()1654 template<> inline CSSPrimitiveValue::operator ETextAlign() const
1655 {
1656     switch (m_value.ident) {
1657         case CSSValueStart:
1658             return TASTART;
1659         case CSSValueEnd:
1660             return TAEND;
1661         default:
1662             return static_cast<ETextAlign>(m_value.ident - CSSValueWebkitAuto);
1663     }
1664 }
1665 
CSSPrimitiveValue(ETextSecurity e)1666 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
1667     : m_type(CSS_IDENT)
1668     , m_hasCachedCSSText(false)
1669 {
1670     switch (e) {
1671         case TSNONE:
1672             m_value.ident = CSSValueNone;
1673             break;
1674         case TSDISC:
1675             m_value.ident = CSSValueDisc;
1676             break;
1677         case TSCIRCLE:
1678             m_value.ident = CSSValueCircle;
1679             break;
1680         case TSSQUARE:
1681             m_value.ident = CSSValueSquare;
1682             break;
1683     }
1684 }
1685 
ETextSecurity()1686 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
1687 {
1688     switch (m_value.ident) {
1689         case CSSValueNone:
1690             return TSNONE;
1691         case CSSValueDisc:
1692             return TSDISC;
1693         case CSSValueCircle:
1694             return TSCIRCLE;
1695         case CSSValueSquare:
1696             return TSSQUARE;
1697         default:
1698             ASSERT_NOT_REACHED();
1699             return TSNONE;
1700     }
1701 }
1702 
CSSPrimitiveValue(ETextTransform e)1703 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e)
1704     : m_type(CSS_IDENT)
1705     , m_hasCachedCSSText(false)
1706 {
1707     switch (e) {
1708         case CAPITALIZE:
1709             m_value.ident = CSSValueCapitalize;
1710             break;
1711         case UPPERCASE:
1712             m_value.ident = CSSValueUppercase;
1713             break;
1714         case LOWERCASE:
1715             m_value.ident = CSSValueLowercase;
1716             break;
1717         case TTNONE:
1718             m_value.ident = CSSValueNone;
1719             break;
1720     }
1721 }
1722 
ETextTransform()1723 template<> inline CSSPrimitiveValue::operator ETextTransform() const
1724 {
1725     switch (m_value.ident) {
1726         case CSSValueCapitalize:
1727             return CAPITALIZE;
1728         case CSSValueUppercase:
1729             return UPPERCASE;
1730         case CSSValueLowercase:
1731             return LOWERCASE;
1732         case CSSValueNone:
1733             return TTNONE;
1734         default:
1735             ASSERT_NOT_REACHED();
1736             return TTNONE;
1737     }
1738 }
1739 
CSSPrimitiveValue(EUnicodeBidi e)1740 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
1741     : m_type(CSS_IDENT)
1742     , m_hasCachedCSSText(false)
1743 {
1744     switch (e) {
1745     case UBNormal:
1746         m_value.ident = CSSValueNormal;
1747         break;
1748     case Embed:
1749         m_value.ident = CSSValueEmbed;
1750         break;
1751     case Override:
1752         m_value.ident = CSSValueBidiOverride;
1753         break;
1754     case Isolate:
1755         m_value.ident = CSSValueWebkitIsolate;
1756     }
1757 }
1758 
EUnicodeBidi()1759 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
1760 {
1761     switch (m_value.ident) {
1762     case CSSValueNormal:
1763         return UBNormal;
1764     case CSSValueEmbed:
1765         return Embed;
1766     case CSSValueBidiOverride:
1767         return Override;
1768     case CSSValueWebkitIsolate:
1769         return Isolate;
1770     default:
1771         ASSERT_NOT_REACHED();
1772         return UBNormal;
1773     }
1774 }
1775 
CSSPrimitiveValue(EUserDrag e)1776 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e)
1777     : m_type(CSS_IDENT)
1778     , m_hasCachedCSSText(false)
1779 {
1780     switch (e) {
1781         case DRAG_AUTO:
1782             m_value.ident = CSSValueAuto;
1783             break;
1784         case DRAG_NONE:
1785             m_value.ident = CSSValueNone;
1786             break;
1787         case DRAG_ELEMENT:
1788             m_value.ident = CSSValueElement;
1789             break;
1790     }
1791 }
1792 
EUserDrag()1793 template<> inline CSSPrimitiveValue::operator EUserDrag() const
1794 {
1795     switch (m_value.ident) {
1796         case CSSValueAuto:
1797             return DRAG_AUTO;
1798         case CSSValueNone:
1799             return DRAG_NONE;
1800         case CSSValueElement:
1801             return DRAG_ELEMENT;
1802         default:
1803             ASSERT_NOT_REACHED();
1804             return DRAG_AUTO;
1805     }
1806 }
1807 
CSSPrimitiveValue(EUserModify e)1808 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)
1809     : m_type(CSS_IDENT)
1810     , m_hasCachedCSSText(false)
1811 {
1812     switch (e) {
1813         case READ_ONLY:
1814             m_value.ident = CSSValueReadOnly;
1815             break;
1816         case READ_WRITE:
1817             m_value.ident = CSSValueReadWrite;
1818             break;
1819         case READ_WRITE_PLAINTEXT_ONLY:
1820             m_value.ident = CSSValueReadWritePlaintextOnly;
1821             break;
1822     }
1823 }
1824 
EUserModify()1825 template<> inline CSSPrimitiveValue::operator EUserModify() const
1826 {
1827     return static_cast<EUserModify>(m_value.ident - CSSValueReadOnly);
1828 }
1829 
CSSPrimitiveValue(EUserSelect e)1830 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
1831     : m_type(CSS_IDENT)
1832     , m_hasCachedCSSText(false)
1833 {
1834     switch (e) {
1835         case SELECT_NONE:
1836             m_value.ident = CSSValueNone;
1837             break;
1838         case SELECT_TEXT:
1839             m_value.ident = CSSValueText;
1840             break;
1841     }
1842 }
1843 
EUserSelect()1844 template<> inline CSSPrimitiveValue::operator EUserSelect() const
1845 {
1846     switch (m_value.ident) {
1847         case CSSValueAuto:
1848             return SELECT_TEXT;
1849         case CSSValueNone:
1850             return SELECT_NONE;
1851         case CSSValueText:
1852             return SELECT_TEXT;
1853         default:
1854             ASSERT_NOT_REACHED();
1855             return SELECT_TEXT;
1856     }
1857 }
1858 
CSSPrimitiveValue(EVisibility e)1859 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e)
1860     : m_type(CSS_IDENT)
1861     , m_hasCachedCSSText(false)
1862 {
1863     switch (e) {
1864         case VISIBLE:
1865             m_value.ident = CSSValueVisible;
1866             break;
1867         case HIDDEN:
1868             m_value.ident = CSSValueHidden;
1869             break;
1870         case COLLAPSE:
1871             m_value.ident = CSSValueCollapse;
1872             break;
1873     }
1874 }
1875 
EVisibility()1876 template<> inline CSSPrimitiveValue::operator EVisibility() const
1877 {
1878     switch (m_value.ident) {
1879         case CSSValueHidden:
1880             return HIDDEN;
1881         case CSSValueVisible:
1882             return VISIBLE;
1883         case CSSValueCollapse:
1884             return COLLAPSE;
1885         default:
1886             ASSERT_NOT_REACHED();
1887             return VISIBLE;
1888     }
1889 }
1890 
CSSPrimitiveValue(EWhiteSpace e)1891 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e)
1892     : m_type(CSS_IDENT)
1893     , m_hasCachedCSSText(false)
1894 {
1895     switch (e) {
1896         case NORMAL:
1897             m_value.ident = CSSValueNormal;
1898             break;
1899         case PRE:
1900             m_value.ident = CSSValuePre;
1901             break;
1902         case PRE_WRAP:
1903             m_value.ident = CSSValuePreWrap;
1904             break;
1905         case PRE_LINE:
1906             m_value.ident = CSSValuePreLine;
1907             break;
1908         case NOWRAP:
1909             m_value.ident = CSSValueNowrap;
1910             break;
1911         case KHTML_NOWRAP:
1912             m_value.ident = CSSValueWebkitNowrap;
1913             break;
1914     }
1915 }
1916 
EWhiteSpace()1917 template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
1918 {
1919     switch (m_value.ident) {
1920         case CSSValueWebkitNowrap:
1921             return KHTML_NOWRAP;
1922         case CSSValueNowrap:
1923             return NOWRAP;
1924         case CSSValuePre:
1925             return PRE;
1926         case CSSValuePreWrap:
1927             return PRE_WRAP;
1928         case CSSValuePreLine:
1929             return PRE_LINE;
1930         case CSSValueNormal:
1931             return NORMAL;
1932         default:
1933             ASSERT_NOT_REACHED();
1934             return NORMAL;
1935     }
1936 }
1937 
CSSPrimitiveValue(EWordBreak e)1938 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e)
1939     : m_type(CSS_IDENT)
1940     , m_hasCachedCSSText(false)
1941 {
1942     switch (e) {
1943         case NormalWordBreak:
1944             m_value.ident = CSSValueNormal;
1945             break;
1946         case BreakAllWordBreak:
1947             m_value.ident = CSSValueBreakAll;
1948             break;
1949         case BreakWordBreak:
1950             m_value.ident = CSSValueBreakWord;
1951             break;
1952     }
1953 }
1954 
EWordBreak()1955 template<> inline CSSPrimitiveValue::operator EWordBreak() const
1956 {
1957     switch (m_value.ident) {
1958         case CSSValueBreakAll:
1959             return BreakAllWordBreak;
1960         case CSSValueBreakWord:
1961             return BreakWordBreak;
1962         case CSSValueNormal:
1963             return NormalWordBreak;
1964         default:
1965         ASSERT_NOT_REACHED();
1966         return NormalWordBreak;
1967     }
1968 }
1969 
CSSPrimitiveValue(EWordWrap e)1970 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e)
1971     : m_type(CSS_IDENT)
1972     , m_hasCachedCSSText(false)
1973 {
1974     switch (e) {
1975         case NormalWordWrap:
1976             m_value.ident = CSSValueNormal;
1977             break;
1978         case BreakWordWrap:
1979             m_value.ident = CSSValueBreakWord;
1980             break;
1981     }
1982 }
1983 
EWordWrap()1984 template<> inline CSSPrimitiveValue::operator EWordWrap() const
1985 {
1986     switch (m_value.ident) {
1987         case CSSValueBreakWord:
1988             return BreakWordWrap;
1989         case CSSValueNormal:
1990             return NormalWordWrap;
1991         default:
1992             ASSERT_NOT_REACHED();
1993             return NormalWordWrap;
1994     }
1995 }
1996 
CSSPrimitiveValue(TextDirection e)1997 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
1998     : m_type(CSS_IDENT)
1999     , m_hasCachedCSSText(false)
2000 {
2001     switch (e) {
2002         case LTR:
2003             m_value.ident = CSSValueLtr;
2004             break;
2005         case RTL:
2006             m_value.ident = CSSValueRtl;
2007             break;
2008     }
2009 }
2010 
TextDirection()2011 template<> inline CSSPrimitiveValue::operator TextDirection() const
2012 {
2013     switch (m_value.ident) {
2014         case CSSValueLtr:
2015             return LTR;
2016         case CSSValueRtl:
2017             return RTL;
2018         default:
2019             ASSERT_NOT_REACHED();
2020             return LTR;
2021     }
2022 }
2023 
CSSPrimitiveValue(WritingMode e)2024 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e)
2025     : m_type(CSS_IDENT)
2026     , m_hasCachedCSSText(false)
2027 {
2028     switch (e) {
2029     case TopToBottomWritingMode:
2030         m_value.ident = CSSValueHorizontalTb;
2031         break;
2032     case RightToLeftWritingMode:
2033         m_value.ident = CSSValueVerticalRl;
2034         break;
2035     case LeftToRightWritingMode:
2036         m_value.ident = CSSValueVerticalLr;
2037         break;
2038     case BottomToTopWritingMode:
2039         m_value.ident = CSSValueHorizontalBt;
2040         break;
2041     }
2042 }
2043 
WritingMode()2044 template<> inline CSSPrimitiveValue::operator WritingMode() const
2045 {
2046     switch (m_value.ident) {
2047     case CSSValueHorizontalTb:
2048         return TopToBottomWritingMode;
2049     case CSSValueVerticalRl:
2050         return RightToLeftWritingMode;
2051     case CSSValueVerticalLr:
2052         return LeftToRightWritingMode;
2053     case CSSValueHorizontalBt:
2054         return BottomToTopWritingMode;
2055     default:
2056         ASSERT_NOT_REACHED();
2057         return TopToBottomWritingMode;
2058     }
2059 }
2060 
CSSPrimitiveValue(TextCombine e)2061 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e)
2062     : m_type(CSS_IDENT)
2063     , m_hasCachedCSSText(false)
2064 {
2065     switch (e) {
2066     case TextCombineNone:
2067         m_value.ident = CSSValueNone;
2068         break;
2069     case TextCombineHorizontal:
2070         m_value.ident = CSSValueHorizontal;
2071         break;
2072     }
2073 }
2074 
TextCombine()2075 template<> inline CSSPrimitiveValue::operator TextCombine() const
2076 {
2077     switch (m_value.ident) {
2078     case CSSValueNone:
2079         return TextCombineNone;
2080     case CSSValueHorizontal:
2081         return TextCombineHorizontal;
2082     default:
2083         ASSERT_NOT_REACHED();
2084         return TextCombineNone;
2085     }
2086 }
2087 
CSSPrimitiveValue(TextEmphasisPosition position)2088 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position)
2089     : m_type(CSS_IDENT)
2090     , m_hasCachedCSSText(false)
2091 {
2092     switch (position) {
2093     case TextEmphasisPositionOver:
2094         m_value.ident = CSSValueOver;
2095         break;
2096     case TextEmphasisPositionUnder:
2097         m_value.ident = CSSValueUnder;
2098         break;
2099     }
2100 }
2101 
TextEmphasisPosition()2102 template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const
2103 {
2104     switch (m_value.ident) {
2105     case CSSValueOver:
2106         return TextEmphasisPositionOver;
2107     case CSSValueUnder:
2108         return TextEmphasisPositionUnder;
2109     default:
2110         ASSERT_NOT_REACHED();
2111         return TextEmphasisPositionOver;
2112     }
2113 }
2114 
CSSPrimitiveValue(TextEmphasisFill fill)2115 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
2116     : m_type(CSS_IDENT)
2117     , m_hasCachedCSSText(false)
2118 {
2119     switch (fill) {
2120     case TextEmphasisFillFilled:
2121         m_value.ident = CSSValueFilled;
2122         break;
2123     case TextEmphasisFillOpen:
2124         m_value.ident = CSSValueOpen;
2125         break;
2126     }
2127 }
2128 
TextEmphasisFill()2129 template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
2130 {
2131     switch (m_value.ident) {
2132     case CSSValueFilled:
2133         return TextEmphasisFillFilled;
2134     case CSSValueOpen:
2135         return TextEmphasisFillOpen;
2136     default:
2137         ASSERT_NOT_REACHED();
2138         return TextEmphasisFillFilled;
2139     }
2140 }
2141 
CSSPrimitiveValue(TextEmphasisMark mark)2142 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark)
2143     : m_type(CSS_IDENT)
2144     , m_hasCachedCSSText(false)
2145 {
2146     switch (mark) {
2147     case TextEmphasisMarkDot:
2148         m_value.ident = CSSValueDot;
2149         break;
2150     case TextEmphasisMarkCircle:
2151         m_value.ident = CSSValueCircle;
2152         break;
2153     case TextEmphasisMarkDoubleCircle:
2154         m_value.ident = CSSValueDoubleCircle;
2155         break;
2156     case TextEmphasisMarkTriangle:
2157         m_value.ident = CSSValueTriangle;
2158         break;
2159     case TextEmphasisMarkSesame:
2160         m_value.ident = CSSValueSesame;
2161         break;
2162     case TextEmphasisMarkNone:
2163     case TextEmphasisMarkAuto:
2164     case TextEmphasisMarkCustom:
2165         ASSERT_NOT_REACHED();
2166         m_value.ident = CSSValueNone;
2167         break;
2168     }
2169 }
2170 
TextEmphasisMark()2171 template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
2172 {
2173     switch (m_value.ident) {
2174     case CSSValueNone:
2175         return TextEmphasisMarkNone;
2176     case CSSValueDot:
2177         return TextEmphasisMarkDot;
2178     case CSSValueCircle:
2179         return TextEmphasisMarkCircle;
2180     case CSSValueDoubleCircle:
2181         return TextEmphasisMarkDoubleCircle;
2182     case CSSValueTriangle:
2183         return TextEmphasisMarkTriangle;
2184     case CSSValueSesame:
2185         return TextEmphasisMarkSesame;
2186     default:
2187         ASSERT_NOT_REACHED();
2188         return TextEmphasisMarkNone;
2189     }
2190 }
2191 
CSSPrimitiveValue(TextOrientation e)2192 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e)
2193     : m_type(CSS_IDENT)
2194     , m_hasCachedCSSText(false)
2195 {
2196     switch (e) {
2197     case TextOrientationVerticalRight:
2198         m_value.ident = CSSValueVerticalRight;
2199         break;
2200     case TextOrientationUpright:
2201         m_value.ident = CSSValueUpright;
2202         break;
2203     }
2204 }
2205 
TextOrientation()2206 template<> inline CSSPrimitiveValue::operator TextOrientation() const
2207 {
2208     switch (m_value.ident) {
2209     case CSSValueVerticalRight:
2210         return TextOrientationVerticalRight;
2211     case CSSValueUpright:
2212         return TextOrientationUpright;
2213     default:
2214         ASSERT_NOT_REACHED();
2215         return TextOrientationVerticalRight;
2216     }
2217 }
2218 
CSSPrimitiveValue(EPointerEvents e)2219 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
2220     : m_type(CSS_IDENT)
2221     , m_hasCachedCSSText(false)
2222 {
2223     switch (e) {
2224         case PE_NONE:
2225             m_value.ident = CSSValueNone;
2226             break;
2227         case PE_STROKE:
2228             m_value.ident = CSSValueStroke;
2229             break;
2230         case PE_FILL:
2231             m_value.ident = CSSValueFill;
2232             break;
2233         case PE_PAINTED:
2234             m_value.ident = CSSValuePainted;
2235             break;
2236         case PE_VISIBLE:
2237             m_value.ident = CSSValueVisible;
2238             break;
2239         case PE_VISIBLE_STROKE:
2240             m_value.ident = CSSValueVisiblestroke;
2241             break;
2242         case PE_VISIBLE_FILL:
2243             m_value.ident = CSSValueVisiblefill;
2244             break;
2245         case PE_VISIBLE_PAINTED:
2246             m_value.ident = CSSValueVisiblepainted;
2247             break;
2248         case PE_AUTO:
2249             m_value.ident = CSSValueAuto;
2250             break;
2251         case PE_ALL:
2252             m_value.ident = CSSValueAll;
2253             break;
2254     }
2255 }
2256 
EPointerEvents()2257 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
2258 {
2259     switch (m_value.ident) {
2260         case CSSValueAll:
2261             return PE_ALL;
2262         case CSSValueAuto:
2263             return PE_AUTO;
2264         case CSSValueNone:
2265             return PE_NONE;
2266         case CSSValueVisiblepainted:
2267             return PE_VISIBLE_PAINTED;
2268         case CSSValueVisiblefill:
2269             return PE_VISIBLE_FILL;
2270         case CSSValueVisiblestroke:
2271             return PE_VISIBLE_STROKE;
2272         case CSSValueVisible:
2273             return PE_VISIBLE;
2274         case CSSValuePainted:
2275             return PE_PAINTED;
2276         case CSSValueFill:
2277             return PE_FILL;
2278         case CSSValueStroke:
2279             return PE_STROKE;
2280         default:
2281             ASSERT_NOT_REACHED();
2282             return PE_ALL;
2283     }
2284 }
2285 
CSSPrimitiveValue(FontSmoothingMode smoothing)2286 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
2287     : m_type(CSS_IDENT)
2288     , m_hasCachedCSSText(false)
2289 {
2290     switch (smoothing) {
2291     case AutoSmoothing:
2292         m_value.ident = CSSValueAuto;
2293         return;
2294     case NoSmoothing:
2295         m_value.ident = CSSValueNone;
2296         return;
2297     case Antialiased:
2298         m_value.ident = CSSValueAntialiased;
2299         return;
2300     case SubpixelAntialiased:
2301         m_value.ident = CSSValueSubpixelAntialiased;
2302         return;
2303     }
2304 
2305     ASSERT_NOT_REACHED();
2306     m_value.ident = CSSValueAuto;
2307 }
2308 
FontSmoothingMode()2309 template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
2310 {
2311     switch (m_value.ident) {
2312     case CSSValueAuto:
2313         return AutoSmoothing;
2314     case CSSValueNone:
2315         return NoSmoothing;
2316     case CSSValueAntialiased:
2317         return Antialiased;
2318     case CSSValueSubpixelAntialiased:
2319         return SubpixelAntialiased;
2320     }
2321 
2322     ASSERT_NOT_REACHED();
2323     return AutoSmoothing;
2324 }
2325 
CSSPrimitiveValue(TextRenderingMode e)2326 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
2327     : m_type(CSS_IDENT)
2328     , m_hasCachedCSSText(false)
2329 {
2330     switch (e) {
2331         case AutoTextRendering:
2332             m_value.ident = CSSValueAuto;
2333             break;
2334         case OptimizeSpeed:
2335             m_value.ident = CSSValueOptimizespeed;
2336             break;
2337         case OptimizeLegibility:
2338             m_value.ident = CSSValueOptimizelegibility;
2339             break;
2340         case GeometricPrecision:
2341             m_value.ident = CSSValueGeometricprecision;
2342             break;
2343     }
2344 }
2345 
TextRenderingMode()2346 template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
2347 {
2348     switch (m_value.ident) {
2349         case CSSValueAuto:
2350             return AutoTextRendering;
2351         case CSSValueOptimizespeed:
2352             return OptimizeSpeed;
2353         case CSSValueOptimizelegibility:
2354             return OptimizeLegibility;
2355         case CSSValueGeometricprecision:
2356             return GeometricPrecision;
2357         default:
2358             ASSERT_NOT_REACHED();
2359             return AutoTextRendering;
2360     }
2361 }
2362 
CSSPrimitiveValue(ColorSpace space)2363 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorSpace space)
2364     : m_type(CSS_IDENT)
2365     , m_hasCachedCSSText(false)
2366 {
2367     switch (space) {
2368     case ColorSpaceDeviceRGB:
2369         m_value.ident = CSSValueDefault;
2370         break;
2371     case ColorSpaceSRGB:
2372         m_value.ident = CSSValueSrgb;
2373         break;
2374     case ColorSpaceLinearRGB:
2375         // CSS color correction does not support linearRGB yet.
2376         ASSERT_NOT_REACHED();
2377         m_value.ident = CSSValueDefault;
2378         break;
2379     }
2380 }
2381 
ColorSpace()2382 template<> inline CSSPrimitiveValue::operator ColorSpace() const
2383 {
2384     switch (m_value.ident) {
2385     case CSSValueDefault:
2386         return ColorSpaceDeviceRGB;
2387     case CSSValueSrgb:
2388         return ColorSpaceSRGB;
2389     default:
2390         ASSERT_NOT_REACHED();
2391         return ColorSpaceDeviceRGB;
2392     }
2393 }
2394 
CSSPrimitiveValue(Hyphens hyphens)2395 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens)
2396     : m_type(CSS_IDENT)
2397     , m_hasCachedCSSText(false)
2398 {
2399     switch (hyphens) {
2400     case HyphensNone:
2401         m_value.ident = CSSValueNone;
2402         break;
2403     case HyphensManual:
2404         m_value.ident = CSSValueManual;
2405         break;
2406     case HyphensAuto:
2407         m_value.ident = CSSValueAuto;
2408         break;
2409     }
2410 }
2411 
Hyphens()2412 template<> inline CSSPrimitiveValue::operator Hyphens() const
2413 {
2414     switch (m_value.ident) {
2415     case CSSValueNone:
2416         return HyphensNone;
2417     case CSSValueManual:
2418         return HyphensManual;
2419     case CSSValueAuto:
2420         return HyphensAuto;
2421     default:
2422         ASSERT_NOT_REACHED();
2423         return HyphensAuto;
2424     }
2425 }
2426 
CSSPrimitiveValue(ESpeak e)2427 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e)
2428     : m_type(CSS_IDENT)
2429     , m_hasCachedCSSText(false)
2430 {
2431     switch (e) {
2432     case SpeakNone:
2433         m_value.ident = CSSValueNone;
2434         break;
2435     case SpeakNormal:
2436         m_value.ident = CSSValueNormal;
2437         break;
2438     case SpeakSpellOut:
2439         m_value.ident = CSSValueSpellOut;
2440         break;
2441     case SpeakDigits:
2442         m_value.ident = CSSValueDigits;
2443         break;
2444     case SpeakLiteralPunctuation:
2445         m_value.ident = CSSValueLiteralPunctuation;
2446         break;
2447     case SpeakNoPunctuation:
2448         m_value.ident = CSSValueNoPunctuation;
2449         break;
2450     }
2451 }
2452 
ESpeak()2453 template<> inline CSSPrimitiveValue::operator ESpeak() const
2454 {
2455     switch (m_value.ident) {
2456     case CSSValueNone:
2457         return SpeakNone;
2458     case CSSValueNormal:
2459         return SpeakNormal;
2460     case CSSValueSpellOut:
2461         return SpeakSpellOut;
2462     case CSSValueDigits:
2463         return SpeakDigits;
2464     case CSSValueLiteralPunctuation:
2465         return SpeakLiteralPunctuation;
2466     case CSSValueNoPunctuation:
2467         return SpeakNoPunctuation;
2468     default:
2469         ASSERT_NOT_REACHED();
2470         return SpeakNormal;
2471     }
2472 }
2473 
2474 #if ENABLE(SVG)
2475 
CSSPrimitiveValue(LineCap e)2476 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
2477     : m_type(CSS_IDENT)
2478     , m_hasCachedCSSText(false)
2479 {
2480     switch (e) {
2481         case ButtCap:
2482             m_value.ident = CSSValueButt;
2483             break;
2484         case RoundCap:
2485             m_value.ident = CSSValueRound;
2486             break;
2487         case SquareCap:
2488             m_value.ident = CSSValueSquare;
2489             break;
2490     }
2491 }
2492 
LineCap()2493 template<> inline CSSPrimitiveValue::operator LineCap() const
2494 {
2495     switch (m_value.ident) {
2496         case CSSValueButt:
2497             return ButtCap;
2498         case CSSValueRound:
2499             return RoundCap;
2500         case CSSValueSquare:
2501             return SquareCap;
2502         default:
2503             ASSERT_NOT_REACHED();
2504             return ButtCap;
2505     }
2506 }
2507 
CSSPrimitiveValue(LineJoin e)2508 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
2509     : m_type(CSS_IDENT)
2510     , m_hasCachedCSSText(false)
2511 {
2512     switch (e) {
2513         case MiterJoin:
2514             m_value.ident = CSSValueMiter;
2515             break;
2516         case RoundJoin:
2517             m_value.ident = CSSValueRound;
2518             break;
2519         case BevelJoin:
2520             m_value.ident = CSSValueBevel;
2521             break;
2522     }
2523 }
2524 
LineJoin()2525 template<> inline CSSPrimitiveValue::operator LineJoin() const
2526 {
2527     switch (m_value.ident) {
2528         case CSSValueMiter:
2529             return MiterJoin;
2530         case CSSValueRound:
2531             return RoundJoin;
2532         case CSSValueBevel:
2533             return BevelJoin;
2534         default:
2535             ASSERT_NOT_REACHED();
2536             return MiterJoin;
2537     }
2538 }
2539 
CSSPrimitiveValue(WindRule e)2540 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
2541     : m_type(CSS_IDENT)
2542     , m_hasCachedCSSText(false)
2543 {
2544     switch (e) {
2545         case RULE_NONZERO:
2546             m_value.ident = CSSValueNonzero;
2547             break;
2548         case RULE_EVENODD:
2549             m_value.ident = CSSValueEvenodd;
2550             break;
2551     }
2552 }
2553 
WindRule()2554 template<> inline CSSPrimitiveValue::operator WindRule() const
2555 {
2556     switch (m_value.ident) {
2557         case CSSValueNonzero:
2558             return RULE_NONZERO;
2559         case CSSValueEvenodd:
2560             return RULE_EVENODD;
2561         default:
2562             ASSERT_NOT_REACHED();
2563             return RULE_NONZERO;
2564     }
2565 }
2566 
2567 
CSSPrimitiveValue(EAlignmentBaseline e)2568 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e)
2569     : m_type(CSS_IDENT)
2570     , m_hasCachedCSSText(false)
2571 {
2572     switch (e) {
2573         case AB_AUTO:
2574             m_value.ident = CSSValueAuto;
2575             break;
2576         case AB_BASELINE:
2577             m_value.ident = CSSValueBaseline;
2578             break;
2579         case AB_BEFORE_EDGE:
2580             m_value.ident = CSSValueBeforeEdge;
2581             break;
2582         case AB_TEXT_BEFORE_EDGE:
2583             m_value.ident = CSSValueTextBeforeEdge;
2584             break;
2585         case AB_MIDDLE:
2586             m_value.ident = CSSValueMiddle;
2587             break;
2588         case AB_CENTRAL:
2589             m_value.ident = CSSValueCentral;
2590             break;
2591         case AB_AFTER_EDGE:
2592             m_value.ident = CSSValueAfterEdge;
2593             break;
2594         case AB_TEXT_AFTER_EDGE:
2595             m_value.ident = CSSValueTextAfterEdge;
2596             break;
2597         case AB_IDEOGRAPHIC:
2598             m_value.ident = CSSValueIdeographic;
2599             break;
2600         case AB_ALPHABETIC:
2601             m_value.ident = CSSValueAlphabetic;
2602             break;
2603         case AB_HANGING:
2604             m_value.ident = CSSValueHanging;
2605             break;
2606         case AB_MATHEMATICAL:
2607             m_value.ident = CSSValueMathematical;
2608             break;
2609     }
2610 }
2611 
EAlignmentBaseline()2612 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
2613 {
2614     switch (m_value.ident) {
2615         case CSSValueAuto:
2616             return AB_AUTO;
2617         case CSSValueBaseline:
2618             return AB_BASELINE;
2619         case CSSValueBeforeEdge:
2620             return AB_BEFORE_EDGE;
2621         case CSSValueTextBeforeEdge:
2622             return AB_TEXT_BEFORE_EDGE;
2623         case CSSValueMiddle:
2624             return AB_MIDDLE;
2625         case CSSValueCentral:
2626             return AB_CENTRAL;
2627         case CSSValueAfterEdge:
2628             return AB_AFTER_EDGE;
2629         case CSSValueTextAfterEdge:
2630             return AB_TEXT_AFTER_EDGE;
2631         case CSSValueIdeographic:
2632             return AB_IDEOGRAPHIC;
2633         case CSSValueAlphabetic:
2634             return AB_ALPHABETIC;
2635         case CSSValueHanging:
2636             return AB_HANGING;
2637         case CSSValueMathematical:
2638             return AB_MATHEMATICAL;
2639         default:
2640             ASSERT_NOT_REACHED();
2641             return AB_AUTO;
2642     }
2643 }
2644 
CSSPrimitiveValue(EColorInterpolation e)2645 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
2646     : m_type(CSS_IDENT)
2647     , m_hasCachedCSSText(false)
2648 {
2649     switch (e) {
2650         case CI_AUTO:
2651             m_value.ident = CSSValueAuto;
2652             break;
2653         case CI_SRGB:
2654             m_value.ident = CSSValueSrgb;
2655             break;
2656         case CI_LINEARRGB:
2657             m_value.ident = CSSValueLinearrgb;
2658             break;
2659     }
2660 }
2661 
EColorInterpolation()2662 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
2663 {
2664     switch (m_value.ident) {
2665         case CSSValueSrgb:
2666             return CI_SRGB;
2667         case CSSValueLinearrgb:
2668             return CI_LINEARRGB;
2669         case CSSValueAuto:
2670             return CI_AUTO;
2671         default:
2672             ASSERT_NOT_REACHED();
2673             return CI_AUTO;
2674     }
2675 }
2676 
CSSPrimitiveValue(EColorRendering e)2677 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e)
2678     : m_type(CSS_IDENT)
2679     , m_hasCachedCSSText(false)
2680 {
2681     switch (e) {
2682         case CR_AUTO:
2683             m_value.ident = CSSValueAuto;
2684             break;
2685         case CR_OPTIMIZESPEED:
2686             m_value.ident = CSSValueOptimizespeed;
2687             break;
2688         case CR_OPTIMIZEQUALITY:
2689             m_value.ident = CSSValueOptimizequality;
2690             break;
2691     }
2692 }
2693 
EColorRendering()2694 template<> inline CSSPrimitiveValue::operator EColorRendering() const
2695 {
2696     switch (m_value.ident) {
2697         case CSSValueOptimizespeed:
2698             return CR_OPTIMIZESPEED;
2699         case CSSValueOptimizequality:
2700             return CR_OPTIMIZEQUALITY;
2701         case CSSValueAuto:
2702             return CR_AUTO;
2703         default:
2704             ASSERT_NOT_REACHED();
2705             return CR_AUTO;
2706     }
2707 }
2708 
CSSPrimitiveValue(EDominantBaseline e)2709 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e)
2710     : m_type(CSS_IDENT)
2711     , m_hasCachedCSSText(false)
2712 {
2713     switch (e) {
2714         case DB_AUTO:
2715             m_value.ident = CSSValueAuto;
2716             break;
2717         case DB_USE_SCRIPT:
2718             m_value.ident = CSSValueUseScript;
2719             break;
2720         case DB_NO_CHANGE:
2721             m_value.ident = CSSValueNoChange;
2722             break;
2723         case DB_RESET_SIZE:
2724             m_value.ident = CSSValueResetSize;
2725             break;
2726         case DB_CENTRAL:
2727             m_value.ident = CSSValueCentral;
2728             break;
2729         case DB_MIDDLE:
2730             m_value.ident = CSSValueMiddle;
2731             break;
2732         case DB_TEXT_BEFORE_EDGE:
2733             m_value.ident = CSSValueTextBeforeEdge;
2734             break;
2735         case DB_TEXT_AFTER_EDGE:
2736             m_value.ident = CSSValueTextAfterEdge;
2737             break;
2738         case DB_IDEOGRAPHIC:
2739             m_value.ident = CSSValueIdeographic;
2740             break;
2741         case DB_ALPHABETIC:
2742             m_value.ident = CSSValueAlphabetic;
2743             break;
2744         case DB_HANGING:
2745             m_value.ident = CSSValueHanging;
2746             break;
2747         case DB_MATHEMATICAL:
2748             m_value.ident = CSSValueMathematical;
2749             break;
2750     }
2751 }
2752 
EDominantBaseline()2753 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
2754 {
2755     switch (m_value.ident) {
2756         case CSSValueAuto:
2757             return DB_AUTO;
2758         case CSSValueUseScript:
2759             return DB_USE_SCRIPT;
2760         case CSSValueNoChange:
2761             return DB_NO_CHANGE;
2762         case CSSValueResetSize:
2763             return DB_RESET_SIZE;
2764         case CSSValueIdeographic:
2765             return DB_IDEOGRAPHIC;
2766         case CSSValueAlphabetic:
2767             return DB_ALPHABETIC;
2768         case CSSValueHanging:
2769             return DB_HANGING;
2770         case CSSValueMathematical:
2771             return DB_MATHEMATICAL;
2772         case CSSValueCentral:
2773             return DB_CENTRAL;
2774         case CSSValueMiddle:
2775             return DB_MIDDLE;
2776         case CSSValueTextAfterEdge:
2777             return DB_TEXT_AFTER_EDGE;
2778         case CSSValueTextBeforeEdge:
2779             return DB_TEXT_BEFORE_EDGE;
2780         default:
2781             ASSERT_NOT_REACHED();
2782             return DB_AUTO;
2783     }
2784 }
2785 
CSSPrimitiveValue(EImageRendering e)2786 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
2787     : m_type(CSS_IDENT)
2788     , m_hasCachedCSSText(false)
2789 {
2790     switch (e) {
2791         case IR_AUTO:
2792             m_value.ident = CSSValueAuto;
2793             break;
2794         case IR_OPTIMIZESPEED:
2795             m_value.ident = CSSValueOptimizespeed;
2796             break;
2797         case IR_OPTIMIZEQUALITY:
2798             m_value.ident = CSSValueOptimizequality;
2799             break;
2800     }
2801 }
2802 
EImageRendering()2803 template<> inline CSSPrimitiveValue::operator EImageRendering() const
2804 {
2805     switch (m_value.ident) {
2806         case CSSValueAuto:
2807             return IR_AUTO;
2808         case CSSValueOptimizespeed:
2809             return IR_OPTIMIZESPEED;
2810         case CSSValueOptimizequality:
2811             return IR_OPTIMIZEQUALITY;
2812         default:
2813             ASSERT_NOT_REACHED();
2814             return IR_AUTO;
2815     }
2816 }
2817 
CSSPrimitiveValue(EShapeRendering e)2818 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e)
2819     : m_type(CSS_IDENT)
2820     , m_hasCachedCSSText(false)
2821 {
2822     switch (e) {
2823         case IR_AUTO:
2824             m_value.ident = CSSValueAuto;
2825             break;
2826         case IR_OPTIMIZESPEED:
2827             m_value.ident = CSSValueOptimizespeed;
2828             break;
2829         case SR_CRISPEDGES:
2830             m_value.ident = CSSValueCrispedges;
2831             break;
2832         case SR_GEOMETRICPRECISION:
2833             m_value.ident = CSSValueGeometricprecision;
2834             break;
2835     }
2836 }
2837 
EShapeRendering()2838 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
2839 {
2840     switch (m_value.ident) {
2841         case CSSValueAuto:
2842             return SR_AUTO;
2843         case CSSValueOptimizespeed:
2844             return SR_OPTIMIZESPEED;
2845         case CSSValueCrispedges:
2846             return SR_CRISPEDGES;
2847         case CSSValueGeometricprecision:
2848             return SR_GEOMETRICPRECISION;
2849         default:
2850             ASSERT_NOT_REACHED();
2851             return SR_AUTO;
2852     }
2853 }
2854 
CSSPrimitiveValue(ETextAnchor e)2855 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e)
2856     : m_type(CSS_IDENT)
2857     , m_hasCachedCSSText(false)
2858 {
2859     switch (e) {
2860         case TA_START:
2861             m_value.ident = CSSValueStart;
2862             break;
2863         case TA_MIDDLE:
2864             m_value.ident = CSSValueMiddle;
2865             break;
2866         case TA_END:
2867             m_value.ident = CSSValueEnd;
2868             break;
2869     }
2870 }
2871 
ETextAnchor()2872 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
2873 {
2874     switch (m_value.ident) {
2875         case CSSValueStart:
2876             return TA_START;
2877         case CSSValueMiddle:
2878             return TA_MIDDLE;
2879         case CSSValueEnd:
2880             return TA_END;
2881         default:
2882             ASSERT_NOT_REACHED();
2883             return TA_START;
2884     }
2885 }
2886 
CSSPrimitiveValue(SVGWritingMode e)2887 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SVGWritingMode e)
2888     : m_type(CSS_IDENT)
2889     , m_hasCachedCSSText(false)
2890 {
2891     switch (e) {
2892         case WM_LRTB:
2893             m_value.ident = CSSValueLrTb;
2894             break;
2895         case WM_LR:
2896             m_value.ident = CSSValueLr;
2897             break;
2898         case WM_RLTB:
2899             m_value.ident = CSSValueRlTb;
2900             break;
2901         case WM_RL:
2902             m_value.ident = CSSValueRl;
2903             break;
2904         case WM_TBRL:
2905             m_value.ident = CSSValueTbRl;
2906             break;
2907         case WM_TB:
2908             m_value.ident = CSSValueTb;
2909             break;
2910     }
2911 }
2912 
SVGWritingMode()2913 template<> inline CSSPrimitiveValue::operator SVGWritingMode() const
2914 {
2915     switch (m_value.ident) {
2916     case CSSValueLrTb:
2917         return WM_LRTB;
2918     case CSSValueLr:
2919         return WM_LR;
2920     case CSSValueRlTb:
2921         return WM_RLTB;
2922     case CSSValueRl:
2923         return WM_RL;
2924     case CSSValueTbRl:
2925         return WM_TBRL;
2926     case CSSValueTb:
2927         return WM_TB;
2928     default:
2929         ASSERT_NOT_REACHED();
2930         return WM_LRTB;
2931     }
2932 }
2933 
CSSPrimitiveValue(EVectorEffect e)2934 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e)
2935     : m_type(CSS_IDENT)
2936     , m_hasCachedCSSText(false)
2937 {
2938     switch (e) {
2939     case VE_NONE:
2940         m_value.ident = CSSValueNone;
2941         break;
2942     case VE_NON_SCALING_STROKE:
2943         m_value.ident = CSSValueNonScalingStroke;
2944         break;
2945     }
2946 }
2947 
EVectorEffect()2948 template<> inline CSSPrimitiveValue::operator EVectorEffect() const
2949 {
2950     switch (m_value.ident) {
2951     case CSSValueNone:
2952         return VE_NONE;
2953     case CSSValueNonScalingStroke:
2954         return VE_NON_SCALING_STROKE;
2955     default:
2956         ASSERT_NOT_REACHED();
2957         return VE_NONE;
2958     }
2959 }
2960 
2961 #endif
2962 
2963 }
2964 
2965 #endif
2966