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