Home | History | Annotate | Download | only in css
      1 /*
      2  * Copyright (C) 2007 Alexey Proskuryakov <ap (at) nypop.com>.
      3  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
      4  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
      5  * Copyright (C) 2009 Jeff Schiller <codedread (at) 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 "CSSValueKeywords.h"
     34 #include "core/css/CSSCalculationValue.h"
     35 #include "core/css/CSSPrimitiveValue.h"
     36 #include "core/css/CSSReflectionDirection.h"
     37 #include "core/css/CSSToLengthConversionData.h"
     38 #include "core/rendering/style/LineClampValue.h"
     39 #include "core/rendering/style/RenderStyleConstants.h"
     40 #include "core/rendering/style/SVGRenderStyleDefs.h"
     41 #include "platform/Length.h"
     42 #include "platform/ThemeTypes.h"
     43 #include "platform/fonts/FontDescription.h"
     44 #include "platform/fonts/FontSmoothingMode.h"
     45 #include "platform/fonts/TextRenderingMode.h"
     46 #include "platform/graphics/GraphicsTypes.h"
     47 #include "platform/graphics/Path.h"
     48 #include "platform/text/TextDirection.h"
     49 #include "platform/text/UnicodeBidi.h"
     50 #include "platform/text/WritingMode.h"
     51 #include "wtf/MathExtras.h"
     52 
     53 namespace WebCore {
     54 
     55 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i)
     56     : CSSValue(PrimitiveClass)
     57 {
     58     m_primitiveUnitType = CSS_NUMBER;
     59     m_value.num = static_cast<double>(i);
     60 }
     61 
     62 template<> inline CSSPrimitiveValue::operator short() const
     63 {
     64     if (m_primitiveUnitType == CSS_NUMBER)
     65         return clampTo<short>(m_value.num);
     66 
     67     ASSERT_NOT_REACHED();
     68     return 0;
     69 }
     70 
     71 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(unsigned short i)
     72     : CSSValue(PrimitiveClass)
     73 {
     74     m_primitiveUnitType = CSS_NUMBER;
     75     m_value.num = static_cast<double>(i);
     76 }
     77 
     78 template<> inline CSSPrimitiveValue::operator unsigned short() const
     79 {
     80     if (m_primitiveUnitType == CSS_NUMBER)
     81         return clampTo<unsigned short>(m_value.num);
     82 
     83     ASSERT_NOT_REACHED();
     84     return 0;
     85 }
     86 
     87 template<> inline CSSPrimitiveValue::operator int() const
     88 {
     89     if (m_primitiveUnitType == CSS_NUMBER)
     90         return clampTo<int>(m_value.num);
     91 
     92     ASSERT_NOT_REACHED();
     93     return 0;
     94 }
     95 
     96 template<> inline CSSPrimitiveValue::operator unsigned() const
     97 {
     98     if (m_primitiveUnitType == CSS_NUMBER)
     99         return clampTo<unsigned>(m_value.num);
    100 
    101     ASSERT_NOT_REACHED();
    102     return 0;
    103 }
    104 
    105 
    106 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(float i)
    107     : CSSValue(PrimitiveClass)
    108 {
    109     m_primitiveUnitType = CSS_NUMBER;
    110     m_value.num = static_cast<double>(i);
    111 }
    112 
    113 template<> inline CSSPrimitiveValue::operator float() const
    114 {
    115     if (m_primitiveUnitType == CSS_NUMBER)
    116         return clampTo<float>(m_value.num);
    117 
    118     ASSERT_NOT_REACHED();
    119     return 0.0f;
    120 }
    121 
    122 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineClampValue i)
    123     : CSSValue(PrimitiveClass)
    124 {
    125     m_primitiveUnitType = i.isPercentage() ? CSS_PERCENTAGE : CSS_NUMBER;
    126     m_value.num = static_cast<double>(i.value());
    127 }
    128 
    129 template<> inline CSSPrimitiveValue::operator LineClampValue() const
    130 {
    131     if (m_primitiveUnitType == CSS_NUMBER)
    132         return LineClampValue(clampTo<int>(m_value.num), LineClampLineCount);
    133 
    134     if (m_primitiveUnitType == CSS_PERCENTAGE)
    135         return LineClampValue(clampTo<int>(m_value.num), LineClampPercentage);
    136 
    137     ASSERT_NOT_REACHED();
    138     return LineClampValue();
    139 }
    140 
    141 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSReflectionDirection e)
    142     : CSSValue(PrimitiveClass)
    143 {
    144     m_primitiveUnitType = CSS_VALUE_ID;
    145     switch (e) {
    146     case ReflectionAbove:
    147         m_value.valueID = CSSValueAbove;
    148         break;
    149     case ReflectionBelow:
    150         m_value.valueID = CSSValueBelow;
    151         break;
    152     case ReflectionLeft:
    153         m_value.valueID = CSSValueLeft;
    154         break;
    155     case ReflectionRight:
    156         m_value.valueID = CSSValueRight;
    157     }
    158 }
    159 
    160 template<> inline CSSPrimitiveValue::operator CSSReflectionDirection() const
    161 {
    162     ASSERT(isValueID());
    163     switch (m_value.valueID) {
    164     case CSSValueAbove:
    165         return ReflectionAbove;
    166     case CSSValueBelow:
    167         return ReflectionBelow;
    168     case CSSValueLeft:
    169         return ReflectionLeft;
    170     case CSSValueRight:
    171         return ReflectionRight;
    172     default:
    173         break;
    174     }
    175 
    176     ASSERT_NOT_REACHED();
    177     return ReflectionBelow;
    178 }
    179 
    180 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill)
    181     : CSSValue(PrimitiveClass)
    182 {
    183     m_primitiveUnitType = CSS_VALUE_ID;
    184     switch (columnFill) {
    185     case ColumnFillAuto:
    186         m_value.valueID = CSSValueAuto;
    187         break;
    188     case ColumnFillBalance:
    189         m_value.valueID = CSSValueBalance;
    190         break;
    191     }
    192 }
    193 
    194 template<> inline CSSPrimitiveValue::operator ColumnFill() const
    195 {
    196     if (m_primitiveUnitType == CSS_VALUE_ID) {
    197         if (m_value.valueID == CSSValueBalance)
    198             return ColumnFillBalance;
    199         if (m_value.valueID == CSSValueAuto)
    200             return ColumnFillAuto;
    201     }
    202     ASSERT_NOT_REACHED();
    203     return ColumnFillBalance;
    204 }
    205 
    206 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
    207     : CSSValue(PrimitiveClass)
    208 {
    209     m_primitiveUnitType = CSS_VALUE_ID;
    210     switch (columnSpan) {
    211     case ColumnSpanAll:
    212         m_value.valueID = CSSValueAll;
    213         break;
    214     case ColumnSpanNone:
    215         m_value.valueID = CSSValueNone;
    216         break;
    217     }
    218 }
    219 
    220 template<> inline CSSPrimitiveValue::operator ColumnSpan() const
    221 {
    222     // Map 1 to none for compatibility reasons.
    223     if (m_primitiveUnitType == CSS_NUMBER && m_value.num == 1)
    224         return ColumnSpanNone;
    225 
    226     ASSERT(isValueID());
    227     switch (m_value.valueID) {
    228     case CSSValueAll:
    229         return ColumnSpanAll;
    230     case CSSValueNone:
    231         return ColumnSpanNone;
    232     default:
    233         break;
    234     }
    235 
    236     ASSERT_NOT_REACHED();
    237     return ColumnSpanNone;
    238 }
    239 
    240 
    241 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PrintColorAdjust value)
    242     : CSSValue(PrimitiveClass)
    243 {
    244     m_primitiveUnitType = CSS_VALUE_ID;
    245     switch (value) {
    246     case PrintColorAdjustExact:
    247         m_value.valueID = CSSValueExact;
    248         break;
    249     case PrintColorAdjustEconomy:
    250         m_value.valueID = CSSValueEconomy;
    251         break;
    252     }
    253 }
    254 
    255 template<> inline CSSPrimitiveValue::operator PrintColorAdjust() const
    256 {
    257     ASSERT(isValueID());
    258     switch (m_value.valueID) {
    259     case CSSValueEconomy:
    260         return PrintColorAdjustEconomy;
    261     case CSSValueExact:
    262         return PrintColorAdjustExact;
    263     default:
    264         break;
    265     }
    266 
    267     ASSERT_NOT_REACHED();
    268     return PrintColorAdjustEconomy;
    269 }
    270 
    271 
    272 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
    273     : CSSValue(PrimitiveClass)
    274 {
    275     m_primitiveUnitType = CSS_VALUE_ID;
    276     switch (e) {
    277     case BNONE:
    278         m_value.valueID = CSSValueNone;
    279         break;
    280     case BHIDDEN:
    281         m_value.valueID = CSSValueHidden;
    282         break;
    283     case INSET:
    284         m_value.valueID = CSSValueInset;
    285         break;
    286     case GROOVE:
    287         m_value.valueID = CSSValueGroove;
    288         break;
    289     case RIDGE:
    290         m_value.valueID = CSSValueRidge;
    291         break;
    292     case OUTSET:
    293         m_value.valueID = CSSValueOutset;
    294         break;
    295     case DOTTED:
    296         m_value.valueID = CSSValueDotted;
    297         break;
    298     case DASHED:
    299         m_value.valueID = CSSValueDashed;
    300         break;
    301     case SOLID:
    302         m_value.valueID = CSSValueSolid;
    303         break;
    304     case DOUBLE:
    305         m_value.valueID = CSSValueDouble;
    306         break;
    307     }
    308 }
    309 
    310 template<> inline CSSPrimitiveValue::operator EBorderStyle() const
    311 {
    312     ASSERT(isValueID());
    313     if (m_value.valueID == CSSValueAuto) // Valid for CSS outline-style
    314         return DOTTED;
    315     return (EBorderStyle)(m_value.valueID - CSSValueNone);
    316 }
    317 
    318 template<> inline CSSPrimitiveValue::operator OutlineIsAuto() const
    319 {
    320     if (m_value.valueID == CSSValueAuto)
    321         return AUTO_ON;
    322     return AUTO_OFF;
    323 }
    324 
    325 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
    326     : CSSValue(PrimitiveClass)
    327 {
    328     m_primitiveUnitType = CSS_VALUE_ID;
    329     switch (e) {
    330     case CompositeClear:
    331         m_value.valueID = CSSValueClear;
    332         break;
    333     case CompositeCopy:
    334         m_value.valueID = CSSValueCopy;
    335         break;
    336     case CompositeSourceOver:
    337         m_value.valueID = CSSValueSourceOver;
    338         break;
    339     case CompositeSourceIn:
    340         m_value.valueID = CSSValueSourceIn;
    341         break;
    342     case CompositeSourceOut:
    343         m_value.valueID = CSSValueSourceOut;
    344         break;
    345     case CompositeSourceAtop:
    346         m_value.valueID = CSSValueSourceAtop;
    347         break;
    348     case CompositeDestinationOver:
    349         m_value.valueID = CSSValueDestinationOver;
    350         break;
    351     case CompositeDestinationIn:
    352         m_value.valueID = CSSValueDestinationIn;
    353         break;
    354     case CompositeDestinationOut:
    355         m_value.valueID = CSSValueDestinationOut;
    356         break;
    357     case CompositeDestinationAtop:
    358         m_value.valueID = CSSValueDestinationAtop;
    359         break;
    360     case CompositeXOR:
    361         m_value.valueID = CSSValueXor;
    362         break;
    363     case CompositePlusDarker:
    364         m_value.valueID = CSSValuePlusDarker;
    365         break;
    366     case CompositePlusLighter:
    367         m_value.valueID = CSSValuePlusLighter;
    368         break;
    369     case CompositeDifference:
    370         ASSERT_NOT_REACHED();
    371         break;
    372     }
    373 }
    374 
    375 template<> inline CSSPrimitiveValue::operator CompositeOperator() const
    376 {
    377     ASSERT(isValueID());
    378     switch (m_value.valueID) {
    379     case CSSValueClear:
    380         return CompositeClear;
    381     case CSSValueCopy:
    382         return CompositeCopy;
    383     case CSSValueSourceOver:
    384         return CompositeSourceOver;
    385     case CSSValueSourceIn:
    386         return CompositeSourceIn;
    387     case CSSValueSourceOut:
    388         return CompositeSourceOut;
    389     case CSSValueSourceAtop:
    390         return CompositeSourceAtop;
    391     case CSSValueDestinationOver:
    392         return CompositeDestinationOver;
    393     case CSSValueDestinationIn:
    394         return CompositeDestinationIn;
    395     case CSSValueDestinationOut:
    396         return CompositeDestinationOut;
    397     case CSSValueDestinationAtop:
    398         return CompositeDestinationAtop;
    399     case CSSValueXor:
    400         return CompositeXOR;
    401     case CSSValuePlusDarker:
    402         return CompositePlusDarker;
    403     case CSSValuePlusLighter:
    404         return CompositePlusLighter;
    405     default:
    406         break;
    407     }
    408 
    409     ASSERT_NOT_REACHED();
    410     return CompositeClear;
    411 }
    412 
    413 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
    414     : CSSValue(PrimitiveClass)
    415 {
    416     m_primitiveUnitType = CSS_VALUE_ID;
    417     switch (e) {
    418     case NoControlPart:
    419         m_value.valueID = CSSValueNone;
    420         break;
    421     case CheckboxPart:
    422         m_value.valueID = CSSValueCheckbox;
    423         break;
    424     case RadioPart:
    425         m_value.valueID = CSSValueRadio;
    426         break;
    427     case PushButtonPart:
    428         m_value.valueID = CSSValuePushButton;
    429         break;
    430     case SquareButtonPart:
    431         m_value.valueID = CSSValueSquareButton;
    432         break;
    433     case ButtonPart:
    434         m_value.valueID = CSSValueButton;
    435         break;
    436     case ButtonBevelPart:
    437         m_value.valueID = CSSValueButtonBevel;
    438         break;
    439     case InnerSpinButtonPart:
    440         m_value.valueID = CSSValueInnerSpinButton;
    441         break;
    442     case ListboxPart:
    443         m_value.valueID = CSSValueListbox;
    444         break;
    445     case ListItemPart:
    446         m_value.valueID = CSSValueListitem;
    447         break;
    448     case MediaEnterFullscreenButtonPart:
    449         m_value.valueID = CSSValueMediaEnterFullscreenButton;
    450         break;
    451     case MediaExitFullscreenButtonPart:
    452         m_value.valueID = CSSValueMediaExitFullscreenButton;
    453         break;
    454     case MediaPlayButtonPart:
    455         m_value.valueID = CSSValueMediaPlayButton;
    456         break;
    457     case MediaOverlayPlayButtonPart:
    458         m_value.valueID = CSSValueMediaOverlayPlayButton;
    459         break;
    460     case MediaMuteButtonPart:
    461         m_value.valueID = CSSValueMediaMuteButton;
    462         break;
    463     case MediaSeekBackButtonPart:
    464         m_value.valueID = CSSValueMediaSeekBackButton;
    465         break;
    466     case MediaSeekForwardButtonPart:
    467         m_value.valueID = CSSValueMediaSeekForwardButton;
    468         break;
    469     case MediaRewindButtonPart:
    470         m_value.valueID = CSSValueMediaRewindButton;
    471         break;
    472     case MediaReturnToRealtimeButtonPart:
    473         m_value.valueID = CSSValueMediaReturnToRealtimeButton;
    474         break;
    475     case MediaToggleClosedCaptionsButtonPart:
    476         m_value.valueID = CSSValueMediaToggleClosedCaptionsButton;
    477         break;
    478     case MediaSliderPart:
    479         m_value.valueID = CSSValueMediaSlider;
    480         break;
    481     case MediaSliderThumbPart:
    482         m_value.valueID = CSSValueMediaSliderthumb;
    483         break;
    484     case MediaVolumeSliderContainerPart:
    485         m_value.valueID = CSSValueMediaVolumeSliderContainer;
    486         break;
    487     case MediaVolumeSliderPart:
    488         m_value.valueID = CSSValueMediaVolumeSlider;
    489         break;
    490     case MediaVolumeSliderMuteButtonPart:
    491         m_value.valueID = CSSValueMediaVolumeSliderMuteButton;
    492         break;
    493     case MediaVolumeSliderThumbPart:
    494         m_value.valueID = CSSValueMediaVolumeSliderthumb;
    495         break;
    496     case MediaControlsBackgroundPart:
    497         m_value.valueID = CSSValueMediaControlsBackground;
    498         break;
    499     case MediaControlsFullscreenBackgroundPart:
    500         m_value.valueID = CSSValueMediaControlsFullscreenBackground;
    501         break;
    502     case MediaFullScreenVolumeSliderPart:
    503         m_value.valueID = CSSValueMediaFullscreenVolumeSlider;
    504         break;
    505     case MediaFullScreenVolumeSliderThumbPart:
    506         m_value.valueID = CSSValueMediaFullscreenVolumeSliderThumb;
    507         break;
    508     case MediaCurrentTimePart:
    509         m_value.valueID = CSSValueMediaCurrentTimeDisplay;
    510         break;
    511     case MediaTimeRemainingPart:
    512         m_value.valueID = CSSValueMediaTimeRemainingDisplay;
    513         break;
    514     case MenulistPart:
    515         m_value.valueID = CSSValueMenulist;
    516         break;
    517     case MenulistButtonPart:
    518         m_value.valueID = CSSValueMenulistButton;
    519         break;
    520     case MenulistTextPart:
    521         m_value.valueID = CSSValueMenulistText;
    522         break;
    523     case MenulistTextFieldPart:
    524         m_value.valueID = CSSValueMenulistTextfield;
    525         break;
    526     case MeterPart:
    527         m_value.valueID = CSSValueMeter;
    528         break;
    529     case RelevancyLevelIndicatorPart:
    530         m_value.valueID = CSSValueRelevancyLevelIndicator;
    531         break;
    532     case ContinuousCapacityLevelIndicatorPart:
    533         m_value.valueID = CSSValueContinuousCapacityLevelIndicator;
    534         break;
    535     case DiscreteCapacityLevelIndicatorPart:
    536         m_value.valueID = CSSValueDiscreteCapacityLevelIndicator;
    537         break;
    538     case RatingLevelIndicatorPart:
    539         m_value.valueID = CSSValueRatingLevelIndicator;
    540         break;
    541     case ProgressBarPart:
    542         m_value.valueID = CSSValueProgressBar;
    543         break;
    544     case ProgressBarValuePart:
    545         m_value.valueID = CSSValueProgressBarValue;
    546         break;
    547     case SliderHorizontalPart:
    548         m_value.valueID = CSSValueSliderHorizontal;
    549         break;
    550     case SliderVerticalPart:
    551         m_value.valueID = CSSValueSliderVertical;
    552         break;
    553     case SliderThumbHorizontalPart:
    554         m_value.valueID = CSSValueSliderthumbHorizontal;
    555         break;
    556     case SliderThumbVerticalPart:
    557         m_value.valueID = CSSValueSliderthumbVertical;
    558         break;
    559     case CaretPart:
    560         m_value.valueID = CSSValueCaret;
    561         break;
    562     case SearchFieldPart:
    563         m_value.valueID = CSSValueSearchfield;
    564         break;
    565     case SearchFieldDecorationPart:
    566         m_value.valueID = CSSValueSearchfieldDecoration;
    567         break;
    568     case SearchFieldResultsDecorationPart:
    569         m_value.valueID = CSSValueSearchfieldResultsDecoration;
    570         break;
    571     case SearchFieldCancelButtonPart:
    572         m_value.valueID = CSSValueSearchfieldCancelButton;
    573         break;
    574     case TextFieldPart:
    575         m_value.valueID = CSSValueTextfield;
    576         break;
    577     case TextAreaPart:
    578         m_value.valueID = CSSValueTextarea;
    579         break;
    580     case CapsLockIndicatorPart:
    581         m_value.valueID = CSSValueCapsLockIndicator;
    582         break;
    583     case InputSpeechButtonPart:
    584 #if ENABLE(INPUT_SPEECH)
    585         m_value.valueID = CSSValueWebkitInputSpeechButton;
    586 #endif
    587         break;
    588     }
    589 }
    590 
    591 template<> inline CSSPrimitiveValue::operator ControlPart() const
    592 {
    593     ASSERT(isValueID());
    594     if (m_value.valueID == CSSValueNone)
    595         return NoControlPart;
    596     return ControlPart(m_value.valueID - CSSValueCheckbox + 1);
    597 }
    598 
    599 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBackfaceVisibility e)
    600     : CSSValue(PrimitiveClass)
    601 {
    602     m_primitiveUnitType = CSS_VALUE_ID;
    603     switch (e) {
    604     case BackfaceVisibilityVisible:
    605         m_value.valueID = CSSValueVisible;
    606         break;
    607     case BackfaceVisibilityHidden:
    608         m_value.valueID = CSSValueHidden;
    609         break;
    610     }
    611 }
    612 
    613 template<> inline CSSPrimitiveValue::operator EBackfaceVisibility() const
    614 {
    615     ASSERT(isValueID());
    616     switch (m_value.valueID) {
    617     case CSSValueVisible:
    618         return BackfaceVisibilityVisible;
    619     case CSSValueHidden:
    620         return BackfaceVisibilityHidden;
    621     default:
    622         break;
    623     }
    624 
    625     ASSERT_NOT_REACHED();
    626     return BackfaceVisibilityHidden;
    627 }
    628 
    629 
    630 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e)
    631     : CSSValue(PrimitiveClass)
    632 {
    633     m_primitiveUnitType = CSS_VALUE_ID;
    634     switch (e) {
    635     case ScrollBackgroundAttachment:
    636         m_value.valueID = CSSValueScroll;
    637         break;
    638     case LocalBackgroundAttachment:
    639         m_value.valueID = CSSValueLocal;
    640         break;
    641     case FixedBackgroundAttachment:
    642         m_value.valueID = CSSValueFixed;
    643         break;
    644     }
    645 }
    646 
    647 template<> inline CSSPrimitiveValue::operator EFillAttachment() const
    648 {
    649     ASSERT(isValueID());
    650     switch (m_value.valueID) {
    651     case CSSValueScroll:
    652         return ScrollBackgroundAttachment;
    653     case CSSValueLocal:
    654         return LocalBackgroundAttachment;
    655     case CSSValueFixed:
    656         return FixedBackgroundAttachment;
    657     default:
    658         break;
    659     }
    660 
    661     ASSERT_NOT_REACHED();
    662     return ScrollBackgroundAttachment;
    663 }
    664 
    665 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
    666     : CSSValue(PrimitiveClass)
    667 {
    668     m_primitiveUnitType = CSS_VALUE_ID;
    669     switch (e) {
    670     case BorderFillBox:
    671         m_value.valueID = CSSValueBorderBox;
    672         break;
    673     case PaddingFillBox:
    674         m_value.valueID = CSSValuePaddingBox;
    675         break;
    676     case ContentFillBox:
    677         m_value.valueID = CSSValueContentBox;
    678         break;
    679     case TextFillBox:
    680         m_value.valueID = CSSValueText;
    681         break;
    682     }
    683 }
    684 
    685 template<> inline CSSPrimitiveValue::operator EFillBox() const
    686 {
    687     ASSERT(isValueID());
    688     switch (m_value.valueID) {
    689     case CSSValueBorder:
    690     case CSSValueBorderBox:
    691         return BorderFillBox;
    692     case CSSValuePadding:
    693     case CSSValuePaddingBox:
    694         return PaddingFillBox;
    695     case CSSValueContent:
    696     case CSSValueContentBox:
    697         return ContentFillBox;
    698     case CSSValueText:
    699     case CSSValueWebkitText:
    700         return TextFillBox;
    701     default:
    702         break;
    703     }
    704 
    705     ASSERT_NOT_REACHED();
    706     return BorderFillBox;
    707 }
    708 
    709 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)
    710     : CSSValue(PrimitiveClass)
    711 {
    712     m_primitiveUnitType = CSS_VALUE_ID;
    713     switch (e) {
    714     case RepeatFill:
    715         m_value.valueID = CSSValueRepeat;
    716         break;
    717     case NoRepeatFill:
    718         m_value.valueID = CSSValueNoRepeat;
    719         break;
    720     case RoundFill:
    721         m_value.valueID = CSSValueRound;
    722         break;
    723     case SpaceFill:
    724         m_value.valueID = CSSValueSpace;
    725         break;
    726     }
    727 }
    728 
    729 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
    730 {
    731     ASSERT(isValueID());
    732     switch (m_value.valueID) {
    733     case CSSValueRepeat:
    734         return RepeatFill;
    735     case CSSValueNoRepeat:
    736         return NoRepeatFill;
    737     case CSSValueRound:
    738         return RoundFill;
    739     case CSSValueSpace:
    740         return SpaceFill;
    741     default:
    742         break;
    743     }
    744 
    745     ASSERT_NOT_REACHED();
    746     return RepeatFill;
    747 }
    748 
    749 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxPack e)
    750     : CSSValue(PrimitiveClass)
    751 {
    752     m_primitiveUnitType = CSS_VALUE_ID;
    753     switch (e) {
    754     case Start:
    755         m_value.valueID = CSSValueStart;
    756         break;
    757     case Center:
    758         m_value.valueID = CSSValueCenter;
    759         break;
    760     case End:
    761         m_value.valueID = CSSValueEnd;
    762         break;
    763     case Justify:
    764         m_value.valueID = CSSValueJustify;
    765         break;
    766     }
    767 }
    768 
    769 template<> inline CSSPrimitiveValue::operator EBoxPack() const
    770 {
    771     ASSERT(isValueID());
    772     switch (m_value.valueID) {
    773     case CSSValueStart:
    774         return Start;
    775     case CSSValueEnd:
    776         return End;
    777     case CSSValueCenter:
    778         return Center;
    779     case CSSValueJustify:
    780         return Justify;
    781     default:
    782         break;
    783     }
    784 
    785     ASSERT_NOT_REACHED();
    786     return Justify;
    787 }
    788 
    789 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)
    790     : CSSValue(PrimitiveClass)
    791 {
    792     m_primitiveUnitType = CSS_VALUE_ID;
    793     switch (e) {
    794     case BSTRETCH:
    795         m_value.valueID = CSSValueStretch;
    796         break;
    797     case BSTART:
    798         m_value.valueID = CSSValueStart;
    799         break;
    800     case BCENTER:
    801         m_value.valueID = CSSValueCenter;
    802         break;
    803     case BEND:
    804         m_value.valueID = CSSValueEnd;
    805         break;
    806     case BBASELINE:
    807         m_value.valueID = CSSValueBaseline;
    808         break;
    809     }
    810 }
    811 
    812 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
    813 {
    814     ASSERT(isValueID());
    815     switch (m_value.valueID) {
    816     case CSSValueStretch:
    817         return BSTRETCH;
    818     case CSSValueStart:
    819         return BSTART;
    820     case CSSValueEnd:
    821         return BEND;
    822     case CSSValueCenter:
    823         return BCENTER;
    824     case CSSValueBaseline:
    825         return BBASELINE;
    826     default:
    827         break;
    828     }
    829 
    830     ASSERT_NOT_REACHED();
    831     return BSTRETCH;
    832 }
    833 
    834 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDecorationBreak e)
    835     : CSSValue(PrimitiveClass)
    836 {
    837     m_primitiveUnitType = CSS_VALUE_ID;
    838     switch (e) {
    839     case DSLICE:
    840         m_value.valueID = CSSValueSlice;
    841         break;
    842     case DCLONE:
    843         m_value.valueID = CSSValueClone;
    844         break;
    845     }
    846 }
    847 
    848 template<> inline CSSPrimitiveValue::operator EBoxDecorationBreak() const
    849 {
    850     ASSERT(isValueID());
    851     switch (m_value.valueID) {
    852     case CSSValueSlice:
    853         return DSLICE;
    854     case CSSValueClone:
    855         return DCLONE;
    856     default:
    857         break;
    858     }
    859 
    860     ASSERT_NOT_REACHED();
    861     return DSLICE;
    862 }
    863 
    864 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BackgroundEdgeOrigin e)
    865     : CSSValue(PrimitiveClass)
    866 {
    867     m_primitiveUnitType = CSS_VALUE_ID;
    868     switch (e) {
    869     case TopEdge:
    870         m_value.valueID = CSSValueTop;
    871         break;
    872     case RightEdge:
    873         m_value.valueID = CSSValueRight;
    874         break;
    875     case BottomEdge:
    876         m_value.valueID = CSSValueBottom;
    877         break;
    878     case LeftEdge:
    879         m_value.valueID = CSSValueLeft;
    880         break;
    881     }
    882 }
    883 
    884 template<> inline CSSPrimitiveValue::operator BackgroundEdgeOrigin() const
    885 {
    886     ASSERT(isValueID());
    887     switch (m_value.valueID) {
    888     case CSSValueTop:
    889         return TopEdge;
    890     case CSSValueRight:
    891         return RightEdge;
    892     case CSSValueBottom:
    893         return BottomEdge;
    894     case CSSValueLeft:
    895         return LeftEdge;
    896     default:
    897         break;
    898     }
    899 
    900     ASSERT_NOT_REACHED();
    901     return TopEdge;
    902 }
    903 
    904 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxSizing e)
    905     : CSSValue(PrimitiveClass)
    906 {
    907     m_primitiveUnitType = CSS_VALUE_ID;
    908     switch (e) {
    909     case BORDER_BOX:
    910         m_value.valueID = CSSValueBorderBox;
    911         break;
    912     case CONTENT_BOX:
    913         m_value.valueID = CSSValueContentBox;
    914         break;
    915     }
    916 }
    917 
    918 template<> inline CSSPrimitiveValue::operator EBoxSizing() const
    919 {
    920     ASSERT(isValueID());
    921     switch (m_value.valueID) {
    922     case CSSValueBorderBox:
    923         return BORDER_BOX;
    924     case CSSValueContentBox:
    925         return CONTENT_BOX;
    926     default:
    927         break;
    928     }
    929 
    930     ASSERT_NOT_REACHED();
    931     return BORDER_BOX;
    932 }
    933 
    934 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
    935     : CSSValue(PrimitiveClass)
    936 {
    937     m_primitiveUnitType = CSS_VALUE_ID;
    938     switch (e) {
    939     case BNORMAL:
    940         m_value.valueID = CSSValueNormal;
    941         break;
    942     case BREVERSE:
    943         m_value.valueID = CSSValueReverse;
    944         break;
    945     }
    946 }
    947 
    948 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
    949 {
    950     ASSERT(isValueID());
    951     switch (m_value.valueID) {
    952     case CSSValueNormal:
    953         return BNORMAL;
    954     case CSSValueReverse:
    955         return BREVERSE;
    956     default:
    957         break;
    958     }
    959 
    960     ASSERT_NOT_REACHED();
    961     return BNORMAL;
    962 }
    963 
    964 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)
    965     : CSSValue(PrimitiveClass)
    966 {
    967     m_primitiveUnitType = CSS_VALUE_ID;
    968     switch (e) {
    969     case SINGLE:
    970         m_value.valueID = CSSValueSingle;
    971         break;
    972     case MULTIPLE:
    973         m_value.valueID = CSSValueMultiple;
    974         break;
    975     }
    976 }
    977 
    978 template<> inline CSSPrimitiveValue::operator EBoxLines() const
    979 {
    980     ASSERT(isValueID());
    981     switch (m_value.valueID) {
    982     case CSSValueSingle:
    983         return SINGLE;
    984     case CSSValueMultiple:
    985         return MULTIPLE;
    986     default:
    987         break;
    988     }
    989 
    990     ASSERT_NOT_REACHED();
    991     return SINGLE;
    992 }
    993 
    994 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)
    995     : CSSValue(PrimitiveClass)
    996 {
    997     m_primitiveUnitType = CSS_VALUE_ID;
    998     switch (e) {
    999     case HORIZONTAL:
   1000         m_value.valueID = CSSValueHorizontal;
   1001         break;
   1002     case VERTICAL:
   1003         m_value.valueID = CSSValueVertical;
   1004         break;
   1005     }
   1006 }
   1007 
   1008 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
   1009 {
   1010     ASSERT(isValueID());
   1011     switch (m_value.valueID) {
   1012     case CSSValueHorizontal:
   1013     case CSSValueInlineAxis:
   1014         return HORIZONTAL;
   1015     case CSSValueVertical:
   1016     case CSSValueBlockAxis:
   1017         return VERTICAL;
   1018     default:
   1019         break;
   1020     }
   1021 
   1022     ASSERT_NOT_REACHED();
   1023     return HORIZONTAL;
   1024 }
   1025 
   1026 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)
   1027     : CSSValue(PrimitiveClass)
   1028 {
   1029     m_primitiveUnitType = CSS_VALUE_ID;
   1030     switch (e) {
   1031     case CAPLEFT:
   1032         m_value.valueID = CSSValueLeft;
   1033         break;
   1034     case CAPRIGHT:
   1035         m_value.valueID = CSSValueRight;
   1036         break;
   1037     case CAPTOP:
   1038         m_value.valueID = CSSValueTop;
   1039         break;
   1040     case CAPBOTTOM:
   1041         m_value.valueID = CSSValueBottom;
   1042         break;
   1043     }
   1044 }
   1045 
   1046 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
   1047 {
   1048     ASSERT(isValueID());
   1049     switch (m_value.valueID) {
   1050     case CSSValueLeft:
   1051         return CAPLEFT;
   1052     case CSSValueRight:
   1053         return CAPRIGHT;
   1054     case CSSValueTop:
   1055         return CAPTOP;
   1056     case CSSValueBottom:
   1057         return CAPBOTTOM;
   1058     default:
   1059         break;
   1060     }
   1061 
   1062     ASSERT_NOT_REACHED();
   1063     return CAPTOP;
   1064 }
   1065 
   1066 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)
   1067     : CSSValue(PrimitiveClass)
   1068 {
   1069     m_primitiveUnitType = CSS_VALUE_ID;
   1070     switch (e) {
   1071     case CNONE:
   1072         m_value.valueID = CSSValueNone;
   1073         break;
   1074     case CLEFT:
   1075         m_value.valueID = CSSValueLeft;
   1076         break;
   1077     case CRIGHT:
   1078         m_value.valueID = CSSValueRight;
   1079         break;
   1080     case CBOTH:
   1081         m_value.valueID = CSSValueBoth;
   1082         break;
   1083     }
   1084 }
   1085 
   1086 template<> inline CSSPrimitiveValue::operator EClear() const
   1087 {
   1088     ASSERT(isValueID());
   1089     switch (m_value.valueID) {
   1090     case CSSValueNone:
   1091         return CNONE;
   1092     case CSSValueLeft:
   1093         return CLEFT;
   1094     case CSSValueRight:
   1095         return CRIGHT;
   1096     case CSSValueBoth:
   1097         return CBOTH;
   1098     default:
   1099         break;
   1100     }
   1101 
   1102     ASSERT_NOT_REACHED();
   1103     return CNONE;
   1104 }
   1105 
   1106 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e)
   1107     : CSSValue(PrimitiveClass)
   1108 {
   1109     m_primitiveUnitType = CSS_VALUE_ID;
   1110     switch (e) {
   1111     case CURSOR_AUTO:
   1112         m_value.valueID = CSSValueAuto;
   1113         break;
   1114     case CURSOR_CROSS:
   1115         m_value.valueID = CSSValueCrosshair;
   1116         break;
   1117     case CURSOR_DEFAULT:
   1118         m_value.valueID = CSSValueDefault;
   1119         break;
   1120     case CURSOR_POINTER:
   1121         m_value.valueID = CSSValuePointer;
   1122         break;
   1123     case CURSOR_MOVE:
   1124         m_value.valueID = CSSValueMove;
   1125         break;
   1126     case CURSOR_CELL:
   1127         m_value.valueID = CSSValueCell;
   1128         break;
   1129     case CURSOR_VERTICAL_TEXT:
   1130         m_value.valueID = CSSValueVerticalText;
   1131         break;
   1132     case CURSOR_CONTEXT_MENU:
   1133         m_value.valueID = CSSValueContextMenu;
   1134         break;
   1135     case CURSOR_ALIAS:
   1136         m_value.valueID = CSSValueAlias;
   1137         break;
   1138     case CURSOR_COPY:
   1139         m_value.valueID = CSSValueCopy;
   1140         break;
   1141     case CURSOR_NONE:
   1142         m_value.valueID = CSSValueNone;
   1143         break;
   1144     case CURSOR_PROGRESS:
   1145         m_value.valueID = CSSValueProgress;
   1146         break;
   1147     case CURSOR_NO_DROP:
   1148         m_value.valueID = CSSValueNoDrop;
   1149         break;
   1150     case CURSOR_NOT_ALLOWED:
   1151         m_value.valueID = CSSValueNotAllowed;
   1152         break;
   1153     case CURSOR_WEBKIT_ZOOM_IN:
   1154         m_value.valueID = CSSValueWebkitZoomIn;
   1155         break;
   1156     case CURSOR_WEBKIT_ZOOM_OUT:
   1157         m_value.valueID = CSSValueWebkitZoomOut;
   1158         break;
   1159     case CURSOR_E_RESIZE:
   1160         m_value.valueID = CSSValueEResize;
   1161         break;
   1162     case CURSOR_NE_RESIZE:
   1163         m_value.valueID = CSSValueNeResize;
   1164         break;
   1165     case CURSOR_NW_RESIZE:
   1166         m_value.valueID = CSSValueNwResize;
   1167         break;
   1168     case CURSOR_N_RESIZE:
   1169         m_value.valueID = CSSValueNResize;
   1170         break;
   1171     case CURSOR_SE_RESIZE:
   1172         m_value.valueID = CSSValueSeResize;
   1173         break;
   1174     case CURSOR_SW_RESIZE:
   1175         m_value.valueID = CSSValueSwResize;
   1176         break;
   1177     case CURSOR_S_RESIZE:
   1178         m_value.valueID = CSSValueSResize;
   1179         break;
   1180     case CURSOR_W_RESIZE:
   1181         m_value.valueID = CSSValueWResize;
   1182         break;
   1183     case CURSOR_EW_RESIZE:
   1184         m_value.valueID = CSSValueEwResize;
   1185         break;
   1186     case CURSOR_NS_RESIZE:
   1187         m_value.valueID = CSSValueNsResize;
   1188         break;
   1189     case CURSOR_NESW_RESIZE:
   1190         m_value.valueID = CSSValueNeswResize;
   1191         break;
   1192     case CURSOR_NWSE_RESIZE:
   1193         m_value.valueID = CSSValueNwseResize;
   1194         break;
   1195     case CURSOR_COL_RESIZE:
   1196         m_value.valueID = CSSValueColResize;
   1197         break;
   1198     case CURSOR_ROW_RESIZE:
   1199         m_value.valueID = CSSValueRowResize;
   1200         break;
   1201     case CURSOR_TEXT:
   1202         m_value.valueID = CSSValueText;
   1203         break;
   1204     case CURSOR_WAIT:
   1205         m_value.valueID = CSSValueWait;
   1206         break;
   1207     case CURSOR_HELP:
   1208         m_value.valueID = CSSValueHelp;
   1209         break;
   1210     case CURSOR_ALL_SCROLL:
   1211         m_value.valueID = CSSValueAllScroll;
   1212         break;
   1213     case CURSOR_WEBKIT_GRAB:
   1214         m_value.valueID = CSSValueWebkitGrab;
   1215         break;
   1216     case CURSOR_WEBKIT_GRABBING:
   1217         m_value.valueID = CSSValueWebkitGrabbing;
   1218         break;
   1219     }
   1220 }
   1221 
   1222 template<> inline CSSPrimitiveValue::operator ECursor() const
   1223 {
   1224     ASSERT(isValueID());
   1225     if (m_value.valueID == CSSValueCopy)
   1226         return CURSOR_COPY;
   1227     if (m_value.valueID == CSSValueNone)
   1228         return CURSOR_NONE;
   1229     return static_cast<ECursor>(m_value.valueID - CSSValueAuto);
   1230 }
   1231 
   1232 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e)
   1233     : CSSValue(PrimitiveClass)
   1234 {
   1235     m_primitiveUnitType = CSS_VALUE_ID;
   1236     switch (e) {
   1237     case INLINE:
   1238         m_value.valueID = CSSValueInline;
   1239         break;
   1240     case BLOCK:
   1241         m_value.valueID = CSSValueBlock;
   1242         break;
   1243     case LIST_ITEM:
   1244         m_value.valueID = CSSValueListItem;
   1245         break;
   1246     case INLINE_BLOCK:
   1247         m_value.valueID = CSSValueInlineBlock;
   1248         break;
   1249     case TABLE:
   1250         m_value.valueID = CSSValueTable;
   1251         break;
   1252     case INLINE_TABLE:
   1253         m_value.valueID = CSSValueInlineTable;
   1254         break;
   1255     case TABLE_ROW_GROUP:
   1256         m_value.valueID = CSSValueTableRowGroup;
   1257         break;
   1258     case TABLE_HEADER_GROUP:
   1259         m_value.valueID = CSSValueTableHeaderGroup;
   1260         break;
   1261     case TABLE_FOOTER_GROUP:
   1262         m_value.valueID = CSSValueTableFooterGroup;
   1263         break;
   1264     case TABLE_ROW:
   1265         m_value.valueID = CSSValueTableRow;
   1266         break;
   1267     case TABLE_COLUMN_GROUP:
   1268         m_value.valueID = CSSValueTableColumnGroup;
   1269         break;
   1270     case TABLE_COLUMN:
   1271         m_value.valueID = CSSValueTableColumn;
   1272         break;
   1273     case TABLE_CELL:
   1274         m_value.valueID = CSSValueTableCell;
   1275         break;
   1276     case TABLE_CAPTION:
   1277         m_value.valueID = CSSValueTableCaption;
   1278         break;
   1279     case BOX:
   1280         m_value.valueID = CSSValueWebkitBox;
   1281         break;
   1282     case INLINE_BOX:
   1283         m_value.valueID = CSSValueWebkitInlineBox;
   1284         break;
   1285     case FLEX:
   1286         m_value.valueID = CSSValueFlex;
   1287         break;
   1288     case INLINE_FLEX:
   1289         m_value.valueID = CSSValueInlineFlex;
   1290         break;
   1291     case GRID:
   1292         m_value.valueID = CSSValueGrid;
   1293         break;
   1294     case INLINE_GRID:
   1295         m_value.valueID = CSSValueInlineGrid;
   1296         break;
   1297     case NONE:
   1298         m_value.valueID = CSSValueNone;
   1299         break;
   1300     }
   1301 }
   1302 
   1303 template<> inline CSSPrimitiveValue::operator EDisplay() const
   1304 {
   1305     ASSERT(isValueID());
   1306     if (m_value.valueID == CSSValueNone)
   1307         return NONE;
   1308 
   1309     if (m_value.valueID == CSSValueWebkitFlex)
   1310         return FLEX;
   1311     if (m_value.valueID == CSSValueWebkitInlineFlex)
   1312         return INLINE_FLEX;
   1313 
   1314     EDisplay display = static_cast<EDisplay>(m_value.valueID - CSSValueInline);
   1315     ASSERT(display >= INLINE && display <= NONE);
   1316     return display;
   1317 }
   1318 
   1319 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e)
   1320     : CSSValue(PrimitiveClass)
   1321 {
   1322     m_primitiveUnitType = CSS_VALUE_ID;
   1323     switch (e) {
   1324     case SHOW:
   1325         m_value.valueID = CSSValueShow;
   1326         break;
   1327     case HIDE:
   1328         m_value.valueID = CSSValueHide;
   1329         break;
   1330     }
   1331 }
   1332 
   1333 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
   1334 {
   1335     ASSERT(isValueID());
   1336     switch (m_value.valueID) {
   1337     case CSSValueShow:
   1338         return SHOW;
   1339     case CSSValueHide:
   1340         return HIDE;
   1341     default:
   1342         break;
   1343     }
   1344 
   1345     ASSERT_NOT_REACHED();
   1346     return SHOW;
   1347 }
   1348 
   1349 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignItems e)
   1350     : CSSValue(PrimitiveClass)
   1351 {
   1352     m_primitiveUnitType = CSS_VALUE_ID;
   1353     switch (e) {
   1354     case AlignAuto:
   1355         m_value.valueID = CSSValueAuto;
   1356         break;
   1357     case AlignFlexStart:
   1358         m_value.valueID = CSSValueFlexStart;
   1359         break;
   1360     case AlignFlexEnd:
   1361         m_value.valueID = CSSValueFlexEnd;
   1362         break;
   1363     case AlignCenter:
   1364         m_value.valueID = CSSValueCenter;
   1365         break;
   1366     case AlignStretch:
   1367         m_value.valueID = CSSValueStretch;
   1368         break;
   1369     case AlignBaseline:
   1370         m_value.valueID = CSSValueBaseline;
   1371         break;
   1372     }
   1373 }
   1374 
   1375 template<> inline CSSPrimitiveValue::operator EAlignItems() const
   1376 {
   1377     ASSERT(isValueID());
   1378     switch (m_value.valueID) {
   1379     case CSSValueAuto:
   1380         return AlignAuto;
   1381     case CSSValueFlexStart:
   1382         return AlignFlexStart;
   1383     case CSSValueFlexEnd:
   1384         return AlignFlexEnd;
   1385     case CSSValueCenter:
   1386         return AlignCenter;
   1387     case CSSValueStretch:
   1388         return AlignStretch;
   1389     case CSSValueBaseline:
   1390         return AlignBaseline;
   1391     default:
   1392         break;
   1393     }
   1394 
   1395     ASSERT_NOT_REACHED();
   1396     return AlignFlexStart;
   1397 }
   1398 
   1399 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EJustifyContent e)
   1400     : CSSValue(PrimitiveClass)
   1401 {
   1402     m_primitiveUnitType = CSS_VALUE_ID;
   1403     switch (e) {
   1404     case JustifyFlexStart:
   1405         m_value.valueID = CSSValueFlexStart;
   1406         break;
   1407     case JustifyFlexEnd:
   1408         m_value.valueID = CSSValueFlexEnd;
   1409         break;
   1410     case JustifyCenter:
   1411         m_value.valueID = CSSValueCenter;
   1412         break;
   1413     case JustifySpaceBetween:
   1414         m_value.valueID = CSSValueSpaceBetween;
   1415         break;
   1416     case JustifySpaceAround:
   1417         m_value.valueID = CSSValueSpaceAround;
   1418         break;
   1419     }
   1420 }
   1421 
   1422 template<> inline CSSPrimitiveValue::operator EJustifyContent() const
   1423 {
   1424     ASSERT(isValueID());
   1425     switch (m_value.valueID) {
   1426     case CSSValueFlexStart:
   1427         return JustifyFlexStart;
   1428     case CSSValueFlexEnd:
   1429         return JustifyFlexEnd;
   1430     case CSSValueCenter:
   1431         return JustifyCenter;
   1432     case CSSValueSpaceBetween:
   1433         return JustifySpaceBetween;
   1434     case CSSValueSpaceAround:
   1435         return JustifySpaceAround;
   1436     default:
   1437         break;
   1438     }
   1439 
   1440     ASSERT_NOT_REACHED();
   1441     return JustifyFlexStart;
   1442 }
   1443 
   1444 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e)
   1445     : CSSValue(PrimitiveClass)
   1446 {
   1447     m_primitiveUnitType = CSS_VALUE_ID;
   1448     switch (e) {
   1449     case FlowRow:
   1450         m_value.valueID = CSSValueRow;
   1451         break;
   1452     case FlowRowReverse:
   1453         m_value.valueID = CSSValueRowReverse;
   1454         break;
   1455     case FlowColumn:
   1456         m_value.valueID = CSSValueColumn;
   1457         break;
   1458     case FlowColumnReverse:
   1459         m_value.valueID = CSSValueColumnReverse;
   1460         break;
   1461     }
   1462 }
   1463 
   1464 template<> inline CSSPrimitiveValue::operator EFlexDirection() const
   1465 {
   1466     ASSERT(isValueID());
   1467     switch (m_value.valueID) {
   1468     case CSSValueRow:
   1469         return FlowRow;
   1470     case CSSValueRowReverse:
   1471         return FlowRowReverse;
   1472     case CSSValueColumn:
   1473         return FlowColumn;
   1474     case CSSValueColumnReverse:
   1475         return FlowColumnReverse;
   1476     default:
   1477         break;
   1478     }
   1479 
   1480     ASSERT_NOT_REACHED();
   1481     return FlowRow;
   1482 }
   1483 
   1484 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignContent e)
   1485     : CSSValue(PrimitiveClass)
   1486 {
   1487     m_primitiveUnitType = CSS_VALUE_ID;
   1488     switch (e) {
   1489     case AlignContentFlexStart:
   1490         m_value.valueID = CSSValueFlexStart;
   1491         break;
   1492     case AlignContentFlexEnd:
   1493         m_value.valueID = CSSValueFlexEnd;
   1494         break;
   1495     case AlignContentCenter:
   1496         m_value.valueID = CSSValueCenter;
   1497         break;
   1498     case AlignContentSpaceBetween:
   1499         m_value.valueID = CSSValueSpaceBetween;
   1500         break;
   1501     case AlignContentSpaceAround:
   1502         m_value.valueID = CSSValueSpaceAround;
   1503         break;
   1504     case AlignContentStretch:
   1505         m_value.valueID = CSSValueStretch;
   1506         break;
   1507     }
   1508 }
   1509 
   1510 template<> inline CSSPrimitiveValue::operator EAlignContent() const
   1511 {
   1512     ASSERT(isValueID());
   1513     switch (m_value.valueID) {
   1514     case CSSValueFlexStart:
   1515         return AlignContentFlexStart;
   1516     case CSSValueFlexEnd:
   1517         return AlignContentFlexEnd;
   1518     case CSSValueCenter:
   1519         return AlignContentCenter;
   1520     case CSSValueSpaceBetween:
   1521         return AlignContentSpaceBetween;
   1522     case CSSValueSpaceAround:
   1523         return AlignContentSpaceAround;
   1524     case CSSValueStretch:
   1525         return AlignContentStretch;
   1526     default:
   1527         break;
   1528     }
   1529 
   1530     ASSERT_NOT_REACHED();
   1531     return AlignContentStretch;
   1532 }
   1533 
   1534 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexWrap e)
   1535     : CSSValue(PrimitiveClass)
   1536 {
   1537     m_primitiveUnitType = CSS_VALUE_ID;
   1538     switch (e) {
   1539     case FlexNoWrap:
   1540         m_value.valueID = CSSValueNowrap;
   1541         break;
   1542     case FlexWrap:
   1543         m_value.valueID = CSSValueWrap;
   1544         break;
   1545     case FlexWrapReverse:
   1546         m_value.valueID = CSSValueWrapReverse;
   1547         break;
   1548     }
   1549 }
   1550 
   1551 template<> inline CSSPrimitiveValue::operator EFlexWrap() const
   1552 {
   1553     ASSERT(isValueID());
   1554     switch (m_value.valueID) {
   1555     case CSSValueNowrap:
   1556         return FlexNoWrap;
   1557     case CSSValueWrap:
   1558         return FlexWrap;
   1559     case CSSValueWrapReverse:
   1560         return FlexWrapReverse;
   1561     default:
   1562         break;
   1563     }
   1564 
   1565     ASSERT_NOT_REACHED();
   1566     return FlexNoWrap;
   1567 }
   1568 
   1569 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
   1570     : CSSValue(PrimitiveClass)
   1571 {
   1572     m_primitiveUnitType = CSS_VALUE_ID;
   1573     switch (e) {
   1574     case NoFloat:
   1575         m_value.valueID = CSSValueNone;
   1576         break;
   1577     case LeftFloat:
   1578         m_value.valueID = CSSValueLeft;
   1579         break;
   1580     case RightFloat:
   1581         m_value.valueID = CSSValueRight;
   1582         break;
   1583     }
   1584 }
   1585 
   1586 template<> inline CSSPrimitiveValue::operator EFloat() const
   1587 {
   1588     ASSERT(isValueID());
   1589     switch (m_value.valueID) {
   1590     case CSSValueLeft:
   1591         return LeftFloat;
   1592     case CSSValueRight:
   1593         return RightFloat;
   1594     case CSSValueNone:
   1595     case CSSValueCenter: // Non-standard CSS value.
   1596         return NoFloat;
   1597     default:
   1598         break;
   1599     }
   1600 
   1601     ASSERT_NOT_REACHED();
   1602     return NoFloat;
   1603 }
   1604 
   1605 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineBreak e)
   1606     : CSSValue(PrimitiveClass)
   1607 {
   1608     m_primitiveUnitType = CSS_VALUE_ID;
   1609     switch (e) {
   1610     case LineBreakAuto:
   1611         m_value.valueID = CSSValueAuto;
   1612         break;
   1613     case LineBreakLoose:
   1614         m_value.valueID = CSSValueLoose;
   1615         break;
   1616     case LineBreakNormal:
   1617         m_value.valueID = CSSValueNormal;
   1618         break;
   1619     case LineBreakStrict:
   1620         m_value.valueID = CSSValueStrict;
   1621         break;
   1622     case LineBreakAfterWhiteSpace:
   1623         m_value.valueID = CSSValueAfterWhiteSpace;
   1624         break;
   1625     }
   1626 }
   1627 
   1628 template<> inline CSSPrimitiveValue::operator LineBreak() const
   1629 {
   1630     ASSERT(isValueID());
   1631     switch (m_value.valueID) {
   1632     case CSSValueAuto:
   1633         return LineBreakAuto;
   1634     case CSSValueLoose:
   1635         return LineBreakLoose;
   1636     case CSSValueNormal:
   1637         return LineBreakNormal;
   1638     case CSSValueStrict:
   1639         return LineBreakStrict;
   1640     case CSSValueAfterWhiteSpace:
   1641         return LineBreakAfterWhiteSpace;
   1642     default:
   1643         break;
   1644     }
   1645 
   1646     ASSERT_NOT_REACHED();
   1647     return LineBreakAuto;
   1648 }
   1649 
   1650 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
   1651     : CSSValue(PrimitiveClass)
   1652 {
   1653     m_primitiveUnitType = CSS_VALUE_ID;
   1654     switch (e) {
   1655     case OUTSIDE:
   1656         m_value.valueID = CSSValueOutside;
   1657         break;
   1658     case INSIDE:
   1659         m_value.valueID = CSSValueInside;
   1660         break;
   1661     }
   1662 }
   1663 
   1664 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
   1665 {
   1666     ASSERT(isValueID());
   1667     switch (m_value.valueID) {
   1668     case CSSValueOutside:
   1669         return OUTSIDE;
   1670     case CSSValueInside:
   1671         return INSIDE;
   1672     default:
   1673         break;
   1674     }
   1675 
   1676     ASSERT_NOT_REACHED();
   1677     return OUTSIDE;
   1678 }
   1679 
   1680 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
   1681     : CSSValue(PrimitiveClass)
   1682 {
   1683     m_primitiveUnitType = CSS_VALUE_ID;
   1684     switch (e) {
   1685     case Afar:
   1686         m_value.valueID = CSSValueAfar;
   1687         break;
   1688     case Amharic:
   1689         m_value.valueID = CSSValueAmharic;
   1690         break;
   1691     case AmharicAbegede:
   1692         m_value.valueID = CSSValueAmharicAbegede;
   1693         break;
   1694     case ArabicIndic:
   1695         m_value.valueID = CSSValueArabicIndic;
   1696         break;
   1697     case Armenian:
   1698         m_value.valueID = CSSValueArmenian;
   1699         break;
   1700     case Asterisks:
   1701         m_value.valueID = CSSValueAsterisks;
   1702         break;
   1703     case BinaryListStyle:
   1704         m_value.valueID = CSSValueBinary;
   1705         break;
   1706     case Bengali:
   1707         m_value.valueID = CSSValueBengali;
   1708         break;
   1709     case Cambodian:
   1710         m_value.valueID = CSSValueCambodian;
   1711         break;
   1712     case Circle:
   1713         m_value.valueID = CSSValueCircle;
   1714         break;
   1715     case CjkEarthlyBranch:
   1716         m_value.valueID = CSSValueCjkEarthlyBranch;
   1717         break;
   1718     case CjkHeavenlyStem:
   1719         m_value.valueID = CSSValueCjkHeavenlyStem;
   1720         break;
   1721     case CJKIdeographic:
   1722         m_value.valueID = CSSValueCjkIdeographic;
   1723         break;
   1724     case DecimalLeadingZero:
   1725         m_value.valueID = CSSValueDecimalLeadingZero;
   1726         break;
   1727     case DecimalListStyle:
   1728         m_value.valueID = CSSValueDecimal;
   1729         break;
   1730     case Devanagari:
   1731         m_value.valueID = CSSValueDevanagari;
   1732         break;
   1733     case Disc:
   1734         m_value.valueID = CSSValueDisc;
   1735         break;
   1736     case Ethiopic:
   1737         m_value.valueID = CSSValueEthiopic;
   1738         break;
   1739     case EthiopicAbegede:
   1740         m_value.valueID = CSSValueEthiopicAbegede;
   1741         break;
   1742     case EthiopicAbegedeAmEt:
   1743         m_value.valueID = CSSValueEthiopicAbegedeAmEt;
   1744         break;
   1745     case EthiopicAbegedeGez:
   1746         m_value.valueID = CSSValueEthiopicAbegedeGez;
   1747         break;
   1748     case EthiopicAbegedeTiEr:
   1749         m_value.valueID = CSSValueEthiopicAbegedeTiEr;
   1750         break;
   1751     case EthiopicAbegedeTiEt:
   1752         m_value.valueID = CSSValueEthiopicAbegedeTiEt;
   1753         break;
   1754     case EthiopicHalehameAaEr:
   1755         m_value.valueID = CSSValueEthiopicHalehameAaEr;
   1756         break;
   1757     case EthiopicHalehameAaEt:
   1758         m_value.valueID = CSSValueEthiopicHalehameAaEt;
   1759         break;
   1760     case EthiopicHalehameAmEt:
   1761         m_value.valueID = CSSValueEthiopicHalehameAmEt;
   1762         break;
   1763     case EthiopicHalehameGez:
   1764         m_value.valueID = CSSValueEthiopicHalehameGez;
   1765         break;
   1766     case EthiopicHalehameOmEt:
   1767         m_value.valueID = CSSValueEthiopicHalehameOmEt;
   1768         break;
   1769     case EthiopicHalehameSidEt:
   1770         m_value.valueID = CSSValueEthiopicHalehameSidEt;
   1771         break;
   1772     case EthiopicHalehameSoEt:
   1773         m_value.valueID = CSSValueEthiopicHalehameSoEt;
   1774         break;
   1775     case EthiopicHalehameTiEr:
   1776         m_value.valueID = CSSValueEthiopicHalehameTiEr;
   1777         break;
   1778     case EthiopicHalehameTiEt:
   1779         m_value.valueID = CSSValueEthiopicHalehameTiEt;
   1780         break;
   1781     case EthiopicHalehameTig:
   1782         m_value.valueID = CSSValueEthiopicHalehameTig;
   1783         break;
   1784     case Footnotes:
   1785         m_value.valueID = CSSValueFootnotes;
   1786         break;
   1787     case Georgian:
   1788         m_value.valueID = CSSValueGeorgian;
   1789         break;
   1790     case Gujarati:
   1791         m_value.valueID = CSSValueGujarati;
   1792         break;
   1793     case Gurmukhi:
   1794         m_value.valueID = CSSValueGurmukhi;
   1795         break;
   1796     case Hangul:
   1797         m_value.valueID = CSSValueHangul;
   1798         break;
   1799     case HangulConsonant:
   1800         m_value.valueID = CSSValueHangulConsonant;
   1801         break;
   1802     case Hebrew:
   1803         m_value.valueID = CSSValueHebrew;
   1804         break;
   1805     case Hiragana:
   1806         m_value.valueID = CSSValueHiragana;
   1807         break;
   1808     case HiraganaIroha:
   1809         m_value.valueID = CSSValueHiraganaIroha;
   1810         break;
   1811     case Kannada:
   1812         m_value.valueID = CSSValueKannada;
   1813         break;
   1814     case Katakana:
   1815         m_value.valueID = CSSValueKatakana;
   1816         break;
   1817     case KatakanaIroha:
   1818         m_value.valueID = CSSValueKatakanaIroha;
   1819         break;
   1820     case Khmer:
   1821         m_value.valueID = CSSValueKhmer;
   1822         break;
   1823     case Lao:
   1824         m_value.valueID = CSSValueLao;
   1825         break;
   1826     case LowerAlpha:
   1827         m_value.valueID = CSSValueLowerAlpha;
   1828         break;
   1829     case LowerArmenian:
   1830         m_value.valueID = CSSValueLowerArmenian;
   1831         break;
   1832     case LowerGreek:
   1833         m_value.valueID = CSSValueLowerGreek;
   1834         break;
   1835     case LowerHexadecimal:
   1836         m_value.valueID = CSSValueLowerHexadecimal;
   1837         break;
   1838     case LowerLatin:
   1839         m_value.valueID = CSSValueLowerLatin;
   1840         break;
   1841     case LowerNorwegian:
   1842         m_value.valueID = CSSValueLowerNorwegian;
   1843         break;
   1844     case LowerRoman:
   1845         m_value.valueID = CSSValueLowerRoman;
   1846         break;
   1847     case Malayalam:
   1848         m_value.valueID = CSSValueMalayalam;
   1849         break;
   1850     case Mongolian:
   1851         m_value.valueID = CSSValueMongolian;
   1852         break;
   1853     case Myanmar:
   1854         m_value.valueID = CSSValueMyanmar;
   1855         break;
   1856     case NoneListStyle:
   1857         m_value.valueID = CSSValueNone;
   1858         break;
   1859     case Octal:
   1860         m_value.valueID = CSSValueOctal;
   1861         break;
   1862     case Oriya:
   1863         m_value.valueID = CSSValueOriya;
   1864         break;
   1865     case Oromo:
   1866         m_value.valueID = CSSValueOromo;
   1867         break;
   1868     case Persian:
   1869         m_value.valueID = CSSValuePersian;
   1870         break;
   1871     case Sidama:
   1872         m_value.valueID = CSSValueSidama;
   1873         break;
   1874     case Somali:
   1875         m_value.valueID = CSSValueSomali;
   1876         break;
   1877     case Square:
   1878         m_value.valueID = CSSValueSquare;
   1879         break;
   1880     case Telugu:
   1881         m_value.valueID = CSSValueTelugu;
   1882         break;
   1883     case Thai:
   1884         m_value.valueID = CSSValueThai;
   1885         break;
   1886     case Tibetan:
   1887         m_value.valueID = CSSValueTibetan;
   1888         break;
   1889     case Tigre:
   1890         m_value.valueID = CSSValueTigre;
   1891         break;
   1892     case TigrinyaEr:
   1893         m_value.valueID = CSSValueTigrinyaEr;
   1894         break;
   1895     case TigrinyaErAbegede:
   1896         m_value.valueID = CSSValueTigrinyaErAbegede;
   1897         break;
   1898     case TigrinyaEt:
   1899         m_value.valueID = CSSValueTigrinyaEt;
   1900         break;
   1901     case TigrinyaEtAbegede:
   1902         m_value.valueID = CSSValueTigrinyaEtAbegede;
   1903         break;
   1904     case UpperAlpha:
   1905         m_value.valueID = CSSValueUpperAlpha;
   1906         break;
   1907     case UpperArmenian:
   1908         m_value.valueID = CSSValueUpperArmenian;
   1909         break;
   1910     case UpperGreek:
   1911         m_value.valueID = CSSValueUpperGreek;
   1912         break;
   1913     case UpperHexadecimal:
   1914         m_value.valueID = CSSValueUpperHexadecimal;
   1915         break;
   1916     case UpperLatin:
   1917         m_value.valueID = CSSValueUpperLatin;
   1918         break;
   1919     case UpperNorwegian:
   1920         m_value.valueID = CSSValueUpperNorwegian;
   1921         break;
   1922     case UpperRoman:
   1923         m_value.valueID = CSSValueUpperRoman;
   1924         break;
   1925     case Urdu:
   1926         m_value.valueID = CSSValueUrdu;
   1927         break;
   1928     }
   1929 }
   1930 
   1931 template<> inline CSSPrimitiveValue::operator EListStyleType() const
   1932 {
   1933     ASSERT(isValueID());
   1934     switch (m_value.valueID) {
   1935     case CSSValueNone:
   1936         return NoneListStyle;
   1937     default:
   1938         return static_cast<EListStyleType>(m_value.valueID - CSSValueDisc);
   1939     }
   1940 }
   1941 
   1942 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e)
   1943     : CSSValue(PrimitiveClass)
   1944 {
   1945     m_primitiveUnitType = CSS_VALUE_ID;
   1946     switch (e) {
   1947     case MCOLLAPSE:
   1948         m_value.valueID = CSSValueCollapse;
   1949         break;
   1950     case MSEPARATE:
   1951         m_value.valueID = CSSValueSeparate;
   1952         break;
   1953     case MDISCARD:
   1954         m_value.valueID = CSSValueDiscard;
   1955         break;
   1956     }
   1957 }
   1958 
   1959 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
   1960 {
   1961     ASSERT(isValueID());
   1962     switch (m_value.valueID) {
   1963     case CSSValueCollapse:
   1964         return MCOLLAPSE;
   1965     case CSSValueSeparate:
   1966         return MSEPARATE;
   1967     case CSSValueDiscard:
   1968         return MDISCARD;
   1969     default:
   1970         break;
   1971     }
   1972 
   1973     ASSERT_NOT_REACHED();
   1974     return MCOLLAPSE;
   1975 }
   1976 
   1977 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e)
   1978     : CSSValue(PrimitiveClass)
   1979 {
   1980     m_primitiveUnitType = CSS_VALUE_ID;
   1981     switch (e) {
   1982     case MNONE:
   1983         m_value.valueID = CSSValueNone;
   1984         break;
   1985     case MSCROLL:
   1986         m_value.valueID = CSSValueScroll;
   1987         break;
   1988     case MSLIDE:
   1989         m_value.valueID = CSSValueSlide;
   1990         break;
   1991     case MALTERNATE:
   1992         m_value.valueID = CSSValueAlternate;
   1993         break;
   1994     }
   1995 }
   1996 
   1997 template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
   1998 {
   1999     ASSERT(isValueID());
   2000     switch (m_value.valueID) {
   2001     case CSSValueNone:
   2002         return MNONE;
   2003     case CSSValueScroll:
   2004         return MSCROLL;
   2005     case CSSValueSlide:
   2006         return MSLIDE;
   2007     case CSSValueAlternate:
   2008         return MALTERNATE;
   2009     default:
   2010         break;
   2011     }
   2012 
   2013     ASSERT_NOT_REACHED();
   2014     return MNONE;
   2015 }
   2016 
   2017 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RegionFragment e)
   2018     : CSSValue(PrimitiveClass)
   2019 {
   2020     m_primitiveUnitType = CSS_VALUE_ID;
   2021     switch (e) {
   2022     case AutoRegionFragment:
   2023         m_value.valueID = CSSValueAuto;
   2024         break;
   2025     case BreakRegionFragment:
   2026         m_value.valueID = CSSValueBreak;
   2027         break;
   2028     }
   2029 }
   2030 
   2031 template<> inline CSSPrimitiveValue::operator RegionFragment() const
   2032 {
   2033     ASSERT(isValueID());
   2034     switch (m_value.valueID) {
   2035     case CSSValueAuto:
   2036         return AutoRegionFragment;
   2037     case CSSValueBreak:
   2038         return BreakRegionFragment;
   2039     default:
   2040         break;
   2041     }
   2042 
   2043     ASSERT_NOT_REACHED();
   2044     return AutoRegionFragment;
   2045 }
   2046 
   2047 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e)
   2048     : CSSValue(PrimitiveClass)
   2049 {
   2050     m_primitiveUnitType = CSS_VALUE_ID;
   2051     switch (e) {
   2052     case MFORWARD:
   2053         m_value.valueID = CSSValueForwards;
   2054         break;
   2055     case MBACKWARD:
   2056         m_value.valueID = CSSValueBackwards;
   2057         break;
   2058     case MAUTO:
   2059         m_value.valueID = CSSValueAuto;
   2060         break;
   2061     case MUP:
   2062         m_value.valueID = CSSValueUp;
   2063         break;
   2064     case MDOWN:
   2065         m_value.valueID = CSSValueDown;
   2066         break;
   2067     case MLEFT:
   2068         m_value.valueID = CSSValueLeft;
   2069         break;
   2070     case MRIGHT:
   2071         m_value.valueID = CSSValueRight;
   2072         break;
   2073     }
   2074 }
   2075 
   2076 template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
   2077 {
   2078     ASSERT(isValueID());
   2079     switch (m_value.valueID) {
   2080     case CSSValueForwards:
   2081         return MFORWARD;
   2082     case CSSValueBackwards:
   2083         return MBACKWARD;
   2084     case CSSValueAuto:
   2085         return MAUTO;
   2086     case CSSValueAhead:
   2087     case CSSValueUp: // We don't support vertical languages, so AHEAD just maps to UP.
   2088         return MUP;
   2089     case CSSValueReverse:
   2090     case CSSValueDown: // REVERSE just maps to DOWN, since we don't do vertical text.
   2091         return MDOWN;
   2092     case CSSValueLeft:
   2093         return MLEFT;
   2094     case CSSValueRight:
   2095         return MRIGHT;
   2096     default:
   2097         break;
   2098     }
   2099 
   2100     ASSERT_NOT_REACHED();
   2101     return MAUTO;
   2102 }
   2103 
   2104 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e)
   2105     : CSSValue(PrimitiveClass)
   2106 {
   2107     m_primitiveUnitType = CSS_VALUE_ID;
   2108     switch (e) {
   2109     case OVISIBLE:
   2110         m_value.valueID = CSSValueVisible;
   2111         break;
   2112     case OHIDDEN:
   2113         m_value.valueID = CSSValueHidden;
   2114         break;
   2115     case OSCROLL:
   2116         m_value.valueID = CSSValueScroll;
   2117         break;
   2118     case OAUTO:
   2119         m_value.valueID = CSSValueAuto;
   2120         break;
   2121     case OOVERLAY:
   2122         m_value.valueID = CSSValueOverlay;
   2123         break;
   2124     case OPAGEDX:
   2125         m_value.valueID = CSSValueWebkitPagedX;
   2126         break;
   2127     case OPAGEDY:
   2128         m_value.valueID = CSSValueWebkitPagedY;
   2129         break;
   2130     }
   2131 }
   2132 
   2133 template<> inline CSSPrimitiveValue::operator EOverflow() const
   2134 {
   2135     ASSERT(isValueID());
   2136     switch (m_value.valueID) {
   2137     case CSSValueVisible:
   2138         return OVISIBLE;
   2139     case CSSValueHidden:
   2140         return OHIDDEN;
   2141     case CSSValueScroll:
   2142         return OSCROLL;
   2143     case CSSValueAuto:
   2144         return OAUTO;
   2145     case CSSValueOverlay:
   2146         return OOVERLAY;
   2147     case CSSValueWebkitPagedX:
   2148         return OPAGEDX;
   2149     case CSSValueWebkitPagedY:
   2150         return OPAGEDY;
   2151     default:
   2152         break;
   2153     }
   2154 
   2155     ASSERT_NOT_REACHED();
   2156     return OVISIBLE;
   2157 }
   2158 
   2159 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
   2160     : CSSValue(PrimitiveClass)
   2161 {
   2162     m_primitiveUnitType = CSS_VALUE_ID;
   2163     switch (e) {
   2164     case PBAUTO:
   2165         m_value.valueID = CSSValueAuto;
   2166         break;
   2167     case PBALWAYS:
   2168         m_value.valueID = CSSValueAlways;
   2169         break;
   2170     case PBAVOID:
   2171         m_value.valueID = CSSValueAvoid;
   2172         break;
   2173     }
   2174 }
   2175 
   2176 template<> inline CSSPrimitiveValue::operator EPageBreak() const
   2177 {
   2178     ASSERT(isValueID());
   2179     switch (m_value.valueID) {
   2180     case CSSValueAuto:
   2181         return PBAUTO;
   2182     case CSSValueLeft:
   2183     case CSSValueRight:
   2184     case CSSValueAlways:
   2185         return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always."
   2186     case CSSValueAvoid:
   2187         return PBAVOID;
   2188     default:
   2189         break;
   2190     }
   2191 
   2192     ASSERT_NOT_REACHED();
   2193     return PBAUTO;
   2194 }
   2195 
   2196 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
   2197     : CSSValue(PrimitiveClass)
   2198 {
   2199     m_primitiveUnitType = CSS_VALUE_ID;
   2200     switch (e) {
   2201     case StaticPosition:
   2202         m_value.valueID = CSSValueStatic;
   2203         break;
   2204     case RelativePosition:
   2205         m_value.valueID = CSSValueRelative;
   2206         break;
   2207     case AbsolutePosition:
   2208         m_value.valueID = CSSValueAbsolute;
   2209         break;
   2210     case FixedPosition:
   2211         m_value.valueID = CSSValueFixed;
   2212         break;
   2213     case StickyPosition:
   2214         m_value.valueID = CSSValueSticky;
   2215         break;
   2216     }
   2217 }
   2218 
   2219 template<> inline CSSPrimitiveValue::operator EPosition() const
   2220 {
   2221     ASSERT(isValueID());
   2222     switch (m_value.valueID) {
   2223     case CSSValueStatic:
   2224         return StaticPosition;
   2225     case CSSValueRelative:
   2226         return RelativePosition;
   2227     case CSSValueAbsolute:
   2228         return AbsolutePosition;
   2229     case CSSValueFixed:
   2230         return FixedPosition;
   2231     case CSSValueSticky:
   2232         return StickyPosition;
   2233     default:
   2234         break;
   2235     }
   2236 
   2237     ASSERT_NOT_REACHED();
   2238     return StaticPosition;
   2239 }
   2240 
   2241 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e)
   2242     : CSSValue(PrimitiveClass)
   2243 {
   2244     m_primitiveUnitType = CSS_VALUE_ID;
   2245     switch (e) {
   2246     case RESIZE_BOTH:
   2247         m_value.valueID = CSSValueBoth;
   2248         break;
   2249     case RESIZE_HORIZONTAL:
   2250         m_value.valueID = CSSValueHorizontal;
   2251         break;
   2252     case RESIZE_VERTICAL:
   2253         m_value.valueID = CSSValueVertical;
   2254         break;
   2255     case RESIZE_NONE:
   2256         m_value.valueID = CSSValueNone;
   2257         break;
   2258     }
   2259 }
   2260 
   2261 template<> inline CSSPrimitiveValue::operator EResize() const
   2262 {
   2263     ASSERT(isValueID());
   2264     switch (m_value.valueID) {
   2265     case CSSValueBoth:
   2266         return RESIZE_BOTH;
   2267     case CSSValueHorizontal:
   2268         return RESIZE_HORIZONTAL;
   2269     case CSSValueVertical:
   2270         return RESIZE_VERTICAL;
   2271     case CSSValueAuto:
   2272         ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
   2273         return RESIZE_NONE;
   2274     case CSSValueNone:
   2275         return RESIZE_NONE;
   2276     default:
   2277         break;
   2278     }
   2279 
   2280     ASSERT_NOT_REACHED();
   2281     return RESIZE_NONE;
   2282 }
   2283 
   2284 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e)
   2285     : CSSValue(PrimitiveClass)
   2286 {
   2287     m_primitiveUnitType = CSS_VALUE_ID;
   2288     switch (e) {
   2289     case TAUTO:
   2290         m_value.valueID = CSSValueAuto;
   2291         break;
   2292     case TFIXED:
   2293         m_value.valueID = CSSValueFixed;
   2294         break;
   2295     }
   2296 }
   2297 
   2298 template<> inline CSSPrimitiveValue::operator ETableLayout() const
   2299 {
   2300     ASSERT(isValueID());
   2301     switch (m_value.valueID) {
   2302     case CSSValueFixed:
   2303         return TFIXED;
   2304     case CSSValueAuto:
   2305         return TAUTO;
   2306     default:
   2307         break;
   2308     }
   2309 
   2310     ASSERT_NOT_REACHED();
   2311     return TAUTO;
   2312 }
   2313 
   2314 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
   2315     : CSSValue(PrimitiveClass)
   2316 {
   2317     m_primitiveUnitType = CSS_VALUE_ID;
   2318     switch (e) {
   2319     case TASTART:
   2320         m_value.valueID = CSSValueStart;
   2321         break;
   2322     case TAEND:
   2323         m_value.valueID = CSSValueEnd;
   2324         break;
   2325     case LEFT:
   2326         m_value.valueID = CSSValueLeft;
   2327         break;
   2328     case RIGHT:
   2329         m_value.valueID = CSSValueRight;
   2330         break;
   2331     case CENTER:
   2332         m_value.valueID = CSSValueCenter;
   2333         break;
   2334     case JUSTIFY:
   2335         m_value.valueID = CSSValueJustify;
   2336         break;
   2337     case WEBKIT_LEFT:
   2338         m_value.valueID = CSSValueWebkitLeft;
   2339         break;
   2340     case WEBKIT_RIGHT:
   2341         m_value.valueID = CSSValueWebkitRight;
   2342         break;
   2343     case WEBKIT_CENTER:
   2344         m_value.valueID = CSSValueWebkitCenter;
   2345         break;
   2346     }
   2347 }
   2348 
   2349 template<> inline CSSPrimitiveValue::operator ETextAlign() const
   2350 {
   2351     ASSERT(isValueID());
   2352     switch (m_value.valueID) {
   2353     case CSSValueWebkitAuto: // Legacy -webkit-auto. Eqiuvalent to start.
   2354     case CSSValueStart:
   2355         return TASTART;
   2356     case CSSValueEnd:
   2357         return TAEND;
   2358     default:
   2359         return static_cast<ETextAlign>(m_value.valueID - CSSValueLeft);
   2360     }
   2361 }
   2362 
   2363 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAlignLast e)
   2364     : CSSValue(PrimitiveClass)
   2365 {
   2366     m_primitiveUnitType = CSS_VALUE_ID;
   2367     switch (e) {
   2368     case TextAlignLastStart:
   2369         m_value.valueID = CSSValueStart;
   2370         break;
   2371     case TextAlignLastEnd:
   2372         m_value.valueID = CSSValueEnd;
   2373         break;
   2374     case TextAlignLastLeft:
   2375         m_value.valueID = CSSValueLeft;
   2376         break;
   2377     case TextAlignLastRight:
   2378         m_value.valueID = CSSValueRight;
   2379         break;
   2380     case TextAlignLastCenter:
   2381         m_value.valueID = CSSValueCenter;
   2382         break;
   2383     case TextAlignLastJustify:
   2384         m_value.valueID = CSSValueJustify;
   2385         break;
   2386     case TextAlignLastAuto:
   2387         m_value.valueID = CSSValueAuto;
   2388         break;
   2389     }
   2390 }
   2391 
   2392 template<> inline CSSPrimitiveValue::operator TextAlignLast() const
   2393 {
   2394     ASSERT(isValueID());
   2395     switch (m_value.valueID) {
   2396     case CSSValueAuto:
   2397         return TextAlignLastAuto;
   2398     case CSSValueStart:
   2399         return TextAlignLastStart;
   2400     case CSSValueEnd:
   2401         return TextAlignLastEnd;
   2402     case CSSValueLeft:
   2403         return TextAlignLastLeft;
   2404     case CSSValueRight:
   2405         return TextAlignLastRight;
   2406     case CSSValueCenter:
   2407         return TextAlignLastCenter;
   2408     case CSSValueJustify:
   2409         return TextAlignLastJustify;
   2410     default:
   2411         break;
   2412     }
   2413 
   2414     ASSERT_NOT_REACHED();
   2415     return TextAlignLastAuto;
   2416 }
   2417 
   2418 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e)
   2419     : CSSValue(PrimitiveClass)
   2420 {
   2421     m_primitiveUnitType = CSS_VALUE_ID;
   2422     switch (e) {
   2423     case TextJustifyAuto:
   2424         m_value.valueID = CSSValueAuto;
   2425         break;
   2426     case TextJustifyNone:
   2427         m_value.valueID = CSSValueNone;
   2428         break;
   2429     case TextJustifyInterWord:
   2430         m_value.valueID = CSSValueInterWord;
   2431         break;
   2432     case TextJustifyDistribute:
   2433         m_value.valueID = CSSValueDistribute;
   2434         break;
   2435     }
   2436 }
   2437 
   2438 template<> inline CSSPrimitiveValue::operator TextJustify() const
   2439 {
   2440     switch (m_value.valueID) {
   2441     case CSSValueAuto:
   2442         return TextJustifyAuto;
   2443     case CSSValueNone:
   2444         return TextJustifyNone;
   2445     case CSSValueInterWord:
   2446         return TextJustifyInterWord;
   2447     case CSSValueDistribute:
   2448         return TextJustifyDistribute;
   2449     default:
   2450         break;
   2451     }
   2452 
   2453     ASSERT_NOT_REACHED();
   2454     return TextJustifyAuto;
   2455 }
   2456 
   2457 template<> inline CSSPrimitiveValue::operator TextDecoration() const
   2458 {
   2459     ASSERT(isValueID());
   2460     switch (m_value.valueID) {
   2461     case CSSValueNone:
   2462         return TextDecorationNone;
   2463     case CSSValueUnderline:
   2464         return TextDecorationUnderline;
   2465     case CSSValueOverline:
   2466         return TextDecorationOverline;
   2467     case CSSValueLineThrough:
   2468         return TextDecorationLineThrough;
   2469     case CSSValueBlink:
   2470         return TextDecorationBlink;
   2471     default:
   2472         break;
   2473     }
   2474 
   2475     ASSERT_NOT_REACHED();
   2476     return TextDecorationNone;
   2477 }
   2478 
   2479 template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const
   2480 {
   2481     ASSERT(isValueID());
   2482     switch (m_value.valueID) {
   2483     case CSSValueSolid:
   2484         return TextDecorationStyleSolid;
   2485     case CSSValueDouble:
   2486         return TextDecorationStyleDouble;
   2487     case CSSValueDotted:
   2488         return TextDecorationStyleDotted;
   2489     case CSSValueDashed:
   2490         return TextDecorationStyleDashed;
   2491     case CSSValueWavy:
   2492         return TextDecorationStyleWavy;
   2493     default:
   2494         break;
   2495     }
   2496 
   2497     ASSERT_NOT_REACHED();
   2498     return TextDecorationStyleSolid;
   2499 }
   2500 
   2501 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextUnderlinePosition e)
   2502     : CSSValue(PrimitiveClass)
   2503 {
   2504     m_primitiveUnitType = CSS_VALUE_ID;
   2505     switch (e) {
   2506     case TextUnderlinePositionAuto:
   2507         m_value.valueID = CSSValueAuto;
   2508         break;
   2509     case TextUnderlinePositionUnder:
   2510         m_value.valueID = CSSValueUnder;
   2511         break;
   2512     }
   2513 
   2514     // FIXME: Implement support for 'under left' and 'under right' values.
   2515 }
   2516 
   2517 template<> inline CSSPrimitiveValue::operator TextUnderlinePosition() const
   2518 {
   2519     ASSERT(isValueID());
   2520     switch (m_value.valueID) {
   2521     case CSSValueAuto:
   2522         return TextUnderlinePositionAuto;
   2523     case CSSValueUnder:
   2524         return TextUnderlinePositionUnder;
   2525     default:
   2526         break;
   2527     }
   2528 
   2529     // FIXME: Implement support for 'under left' and 'under right' values.
   2530 
   2531     ASSERT_NOT_REACHED();
   2532     return TextUnderlinePositionAuto;
   2533 }
   2534 
   2535 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
   2536     : CSSValue(PrimitiveClass)
   2537 {
   2538     m_primitiveUnitType = CSS_VALUE_ID;
   2539     switch (e) {
   2540     case TSNONE:
   2541         m_value.valueID = CSSValueNone;
   2542         break;
   2543     case TSDISC:
   2544         m_value.valueID = CSSValueDisc;
   2545         break;
   2546     case TSCIRCLE:
   2547         m_value.valueID = CSSValueCircle;
   2548         break;
   2549     case TSSQUARE:
   2550         m_value.valueID = CSSValueSquare;
   2551         break;
   2552     }
   2553 }
   2554 
   2555 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
   2556 {
   2557     ASSERT(isValueID());
   2558     switch (m_value.valueID) {
   2559     case CSSValueNone:
   2560         return TSNONE;
   2561     case CSSValueDisc:
   2562         return TSDISC;
   2563     case CSSValueCircle:
   2564         return TSCIRCLE;
   2565     case CSSValueSquare:
   2566         return TSSQUARE;
   2567     default:
   2568         break;
   2569     }
   2570 
   2571     ASSERT_NOT_REACHED();
   2572     return TSNONE;
   2573 }
   2574 
   2575 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e)
   2576     : CSSValue(PrimitiveClass)
   2577 {
   2578     m_primitiveUnitType = CSS_VALUE_ID;
   2579     switch (e) {
   2580     case CAPITALIZE:
   2581         m_value.valueID = CSSValueCapitalize;
   2582         break;
   2583     case UPPERCASE:
   2584         m_value.valueID = CSSValueUppercase;
   2585         break;
   2586     case LOWERCASE:
   2587         m_value.valueID = CSSValueLowercase;
   2588         break;
   2589     case TTNONE:
   2590         m_value.valueID = CSSValueNone;
   2591         break;
   2592     }
   2593 }
   2594 
   2595 template<> inline CSSPrimitiveValue::operator ETextTransform() const
   2596 {
   2597     ASSERT(isValueID());
   2598     switch (m_value.valueID) {
   2599     case CSSValueCapitalize:
   2600         return CAPITALIZE;
   2601     case CSSValueUppercase:
   2602         return UPPERCASE;
   2603     case CSSValueLowercase:
   2604         return LOWERCASE;
   2605     case CSSValueNone:
   2606         return TTNONE;
   2607     default:
   2608         break;
   2609     }
   2610 
   2611     ASSERT_NOT_REACHED();
   2612     return TTNONE;
   2613 }
   2614 
   2615 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
   2616     : CSSValue(PrimitiveClass)
   2617 {
   2618     m_primitiveUnitType = CSS_VALUE_ID;
   2619     switch (e) {
   2620     case UBNormal:
   2621         m_value.valueID = CSSValueNormal;
   2622         break;
   2623     case Embed:
   2624         m_value.valueID = CSSValueEmbed;
   2625         break;
   2626     case Override:
   2627         m_value.valueID = CSSValueBidiOverride;
   2628         break;
   2629     case Isolate:
   2630         m_value.valueID = CSSValueWebkitIsolate;
   2631         break;
   2632     case IsolateOverride:
   2633         m_value.valueID = CSSValueWebkitIsolateOverride;
   2634         break;
   2635     case Plaintext:
   2636         m_value.valueID = CSSValueWebkitPlaintext;
   2637         break;
   2638     }
   2639 }
   2640 
   2641 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
   2642 {
   2643     ASSERT(isValueID());
   2644     switch (m_value.valueID) {
   2645     case CSSValueNormal:
   2646         return UBNormal;
   2647     case CSSValueEmbed:
   2648         return Embed;
   2649     case CSSValueBidiOverride:
   2650         return Override;
   2651     case CSSValueWebkitIsolate:
   2652         return Isolate;
   2653     case CSSValueWebkitIsolateOverride:
   2654         return IsolateOverride;
   2655     case CSSValueWebkitPlaintext:
   2656         return Plaintext;
   2657     default:
   2658         break;
   2659     }
   2660 
   2661     ASSERT_NOT_REACHED();
   2662     return UBNormal;
   2663 }
   2664 
   2665 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e)
   2666     : CSSValue(PrimitiveClass)
   2667 {
   2668     m_primitiveUnitType = CSS_VALUE_ID;
   2669     switch (e) {
   2670     case DRAG_AUTO:
   2671         m_value.valueID = CSSValueAuto;
   2672         break;
   2673     case DRAG_NONE:
   2674         m_value.valueID = CSSValueNone;
   2675         break;
   2676     case DRAG_ELEMENT:
   2677         m_value.valueID = CSSValueElement;
   2678         break;
   2679     default:
   2680         break;
   2681     }
   2682 }
   2683 
   2684 template<> inline CSSPrimitiveValue::operator EUserDrag() const
   2685 {
   2686     ASSERT(isValueID());
   2687     switch (m_value.valueID) {
   2688     case CSSValueAuto:
   2689         return DRAG_AUTO;
   2690     case CSSValueNone:
   2691         return DRAG_NONE;
   2692     case CSSValueElement:
   2693         return DRAG_ELEMENT;
   2694     default:
   2695         break;
   2696     }
   2697 
   2698     ASSERT_NOT_REACHED();
   2699     return DRAG_AUTO;
   2700 }
   2701 
   2702 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)
   2703     : CSSValue(PrimitiveClass)
   2704 {
   2705     m_primitiveUnitType = CSS_VALUE_ID;
   2706     switch (e) {
   2707     case READ_ONLY:
   2708         m_value.valueID = CSSValueReadOnly;
   2709         break;
   2710     case READ_WRITE:
   2711         m_value.valueID = CSSValueReadWrite;
   2712         break;
   2713     case READ_WRITE_PLAINTEXT_ONLY:
   2714         m_value.valueID = CSSValueReadWritePlaintextOnly;
   2715         break;
   2716     }
   2717 }
   2718 
   2719 template<> inline CSSPrimitiveValue::operator EUserModify() const
   2720 {
   2721     ASSERT(isValueID());
   2722     switch (m_value.valueID) {
   2723     case CSSValueReadOnly:
   2724         return READ_ONLY;
   2725     case CSSValueReadWrite:
   2726         return READ_WRITE;
   2727     case CSSValueReadWritePlaintextOnly:
   2728         return READ_WRITE_PLAINTEXT_ONLY;
   2729     default:
   2730         break;
   2731     }
   2732 
   2733     ASSERT_NOT_REACHED();
   2734     return READ_ONLY;
   2735 }
   2736 
   2737 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
   2738     : CSSValue(PrimitiveClass)
   2739 {
   2740     m_primitiveUnitType = CSS_VALUE_ID;
   2741     switch (e) {
   2742     case SELECT_NONE:
   2743         m_value.valueID = CSSValueNone;
   2744         break;
   2745     case SELECT_TEXT:
   2746         m_value.valueID = CSSValueText;
   2747         break;
   2748     case SELECT_ALL:
   2749         m_value.valueID = CSSValueAll;
   2750         break;
   2751     }
   2752 }
   2753 
   2754 template<> inline CSSPrimitiveValue::operator EUserSelect() const
   2755 {
   2756     ASSERT(isValueID());
   2757     switch (m_value.valueID) {
   2758     case CSSValueAuto:
   2759         return SELECT_TEXT;
   2760     case CSSValueNone:
   2761         return SELECT_NONE;
   2762     case CSSValueText:
   2763         return SELECT_TEXT;
   2764     case CSSValueAll:
   2765         return SELECT_ALL;
   2766     default:
   2767         break;
   2768     }
   2769 
   2770     ASSERT_NOT_REACHED();
   2771     return SELECT_TEXT;
   2772 }
   2773 
   2774 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVerticalAlign a)
   2775     : CSSValue(PrimitiveClass)
   2776 {
   2777     m_primitiveUnitType = CSS_VALUE_ID;
   2778     switch (a) {
   2779     case TOP:
   2780         m_value.valueID = CSSValueTop;
   2781         break;
   2782     case BOTTOM:
   2783         m_value.valueID = CSSValueBottom;
   2784         break;
   2785     case MIDDLE:
   2786         m_value.valueID = CSSValueMiddle;
   2787         break;
   2788     case BASELINE:
   2789         m_value.valueID = CSSValueBaseline;
   2790         break;
   2791     case TEXT_BOTTOM:
   2792         m_value.valueID = CSSValueTextBottom;
   2793         break;
   2794     case TEXT_TOP:
   2795         m_value.valueID = CSSValueTextTop;
   2796         break;
   2797     case SUB:
   2798         m_value.valueID = CSSValueSub;
   2799         break;
   2800     case SUPER:
   2801         m_value.valueID = CSSValueSuper;
   2802         break;
   2803     case BASELINE_MIDDLE:
   2804         m_value.valueID = CSSValueWebkitBaselineMiddle;
   2805         break;
   2806     case LENGTH:
   2807         m_value.valueID = CSSValueInvalid;
   2808     }
   2809 }
   2810 
   2811 template<> inline CSSPrimitiveValue::operator EVerticalAlign() const
   2812 {
   2813     ASSERT(isValueID());
   2814     switch (m_value.valueID) {
   2815     case CSSValueTop:
   2816         return TOP;
   2817     case CSSValueBottom:
   2818         return BOTTOM;
   2819     case CSSValueMiddle:
   2820         return MIDDLE;
   2821     case CSSValueBaseline:
   2822         return BASELINE;
   2823     case CSSValueTextBottom:
   2824         return TEXT_BOTTOM;
   2825     case CSSValueTextTop:
   2826         return TEXT_TOP;
   2827     case CSSValueSub:
   2828         return SUB;
   2829     case CSSValueSuper:
   2830         return SUPER;
   2831     case CSSValueWebkitBaselineMiddle:
   2832         return BASELINE_MIDDLE;
   2833     default:
   2834         break;
   2835     }
   2836 
   2837     ASSERT_NOT_REACHED();
   2838     return TOP;
   2839 }
   2840 
   2841 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e)
   2842     : CSSValue(PrimitiveClass)
   2843 {
   2844     m_primitiveUnitType = CSS_VALUE_ID;
   2845     switch (e) {
   2846     case VISIBLE:
   2847         m_value.valueID = CSSValueVisible;
   2848         break;
   2849     case HIDDEN:
   2850         m_value.valueID = CSSValueHidden;
   2851         break;
   2852     case COLLAPSE:
   2853         m_value.valueID = CSSValueCollapse;
   2854         break;
   2855     }
   2856 }
   2857 
   2858 template<> inline CSSPrimitiveValue::operator EVisibility() const
   2859 {
   2860     ASSERT(isValueID());
   2861     switch (m_value.valueID) {
   2862     case CSSValueHidden:
   2863         return HIDDEN;
   2864     case CSSValueVisible:
   2865         return VISIBLE;
   2866     case CSSValueCollapse:
   2867         return COLLAPSE;
   2868     default:
   2869         break;
   2870     }
   2871 
   2872     ASSERT_NOT_REACHED();
   2873     return VISIBLE;
   2874 }
   2875 
   2876 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e)
   2877     : CSSValue(PrimitiveClass)
   2878 {
   2879     m_primitiveUnitType = CSS_VALUE_ID;
   2880     switch (e) {
   2881     case NORMAL:
   2882         m_value.valueID = CSSValueNormal;
   2883         break;
   2884     case PRE:
   2885         m_value.valueID = CSSValuePre;
   2886         break;
   2887     case PRE_WRAP:
   2888         m_value.valueID = CSSValuePreWrap;
   2889         break;
   2890     case PRE_LINE:
   2891         m_value.valueID = CSSValuePreLine;
   2892         break;
   2893     case NOWRAP:
   2894         m_value.valueID = CSSValueNowrap;
   2895         break;
   2896     case KHTML_NOWRAP:
   2897         m_value.valueID = CSSValueWebkitNowrap;
   2898         break;
   2899     }
   2900 }
   2901 
   2902 template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
   2903 {
   2904     ASSERT(isValueID());
   2905     switch (m_value.valueID) {
   2906     case CSSValueWebkitNowrap:
   2907         return KHTML_NOWRAP;
   2908     case CSSValueNowrap:
   2909         return NOWRAP;
   2910     case CSSValuePre:
   2911         return PRE;
   2912     case CSSValuePreWrap:
   2913         return PRE_WRAP;
   2914     case CSSValuePreLine:
   2915         return PRE_LINE;
   2916     case CSSValueNormal:
   2917         return NORMAL;
   2918     default:
   2919         break;
   2920     }
   2921 
   2922     ASSERT_NOT_REACHED();
   2923     return NORMAL;
   2924 }
   2925 
   2926 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e)
   2927     : CSSValue(PrimitiveClass)
   2928 {
   2929     m_primitiveUnitType = CSS_VALUE_ID;
   2930     switch (e) {
   2931     case NormalWordBreak:
   2932         m_value.valueID = CSSValueNormal;
   2933         break;
   2934     case BreakAllWordBreak:
   2935         m_value.valueID = CSSValueBreakAll;
   2936         break;
   2937     case BreakWordBreak:
   2938         m_value.valueID = CSSValueBreakWord;
   2939         break;
   2940     }
   2941 }
   2942 
   2943 template<> inline CSSPrimitiveValue::operator EWordBreak() const
   2944 {
   2945     ASSERT(isValueID());
   2946     switch (m_value.valueID) {
   2947     case CSSValueBreakAll:
   2948         return BreakAllWordBreak;
   2949     case CSSValueBreakWord:
   2950         return BreakWordBreak;
   2951     case CSSValueNormal:
   2952         return NormalWordBreak;
   2953     default:
   2954         break;
   2955     }
   2956 
   2957     ASSERT_NOT_REACHED();
   2958     return NormalWordBreak;
   2959 }
   2960 
   2961 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflowWrap e)
   2962     : CSSValue(PrimitiveClass)
   2963 {
   2964     m_primitiveUnitType = CSS_VALUE_ID;
   2965     switch (e) {
   2966     case NormalOverflowWrap:
   2967         m_value.valueID = CSSValueNormal;
   2968         break;
   2969     case BreakOverflowWrap:
   2970         m_value.valueID = CSSValueBreakWord;
   2971         break;
   2972     }
   2973 }
   2974 
   2975 template<> inline CSSPrimitiveValue::operator EOverflowWrap() const
   2976 {
   2977     ASSERT(isValueID());
   2978     switch (m_value.valueID) {
   2979     case CSSValueBreakWord:
   2980         return BreakOverflowWrap;
   2981     case CSSValueNormal:
   2982         return NormalOverflowWrap;
   2983     default:
   2984         break;
   2985     }
   2986 
   2987     ASSERT_NOT_REACHED();
   2988     return NormalOverflowWrap;
   2989 }
   2990 
   2991 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
   2992     : CSSValue(PrimitiveClass)
   2993 {
   2994     m_primitiveUnitType = CSS_VALUE_ID;
   2995     switch (e) {
   2996     case LTR:
   2997         m_value.valueID = CSSValueLtr;
   2998         break;
   2999     case RTL:
   3000         m_value.valueID = CSSValueRtl;
   3001         break;
   3002     }
   3003 }
   3004 
   3005 template<> inline CSSPrimitiveValue::operator TextDirection() const
   3006 {
   3007     ASSERT(isValueID());
   3008     switch (m_value.valueID) {
   3009     case CSSValueLtr:
   3010         return LTR;
   3011     case CSSValueRtl:
   3012         return RTL;
   3013     default:
   3014         break;
   3015     }
   3016 
   3017     ASSERT_NOT_REACHED();
   3018     return LTR;
   3019 }
   3020 
   3021 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e)
   3022     : CSSValue(PrimitiveClass)
   3023 {
   3024     m_primitiveUnitType = CSS_VALUE_ID;
   3025     switch (e) {
   3026     case TopToBottomWritingMode:
   3027         m_value.valueID = CSSValueHorizontalTb;
   3028         break;
   3029     case RightToLeftWritingMode:
   3030         m_value.valueID = CSSValueVerticalRl;
   3031         break;
   3032     case LeftToRightWritingMode:
   3033         m_value.valueID = CSSValueVerticalLr;
   3034         break;
   3035     case BottomToTopWritingMode:
   3036         m_value.valueID = CSSValueHorizontalBt;
   3037         break;
   3038     }
   3039 }
   3040 
   3041 template<> inline CSSPrimitiveValue::operator WritingMode() const
   3042 {
   3043     ASSERT(isValueID());
   3044     switch (m_value.valueID) {
   3045     case CSSValueHorizontalTb:
   3046         return TopToBottomWritingMode;
   3047     case CSSValueVerticalRl:
   3048         return RightToLeftWritingMode;
   3049     case CSSValueVerticalLr:
   3050         return LeftToRightWritingMode;
   3051     case CSSValueHorizontalBt:
   3052         return BottomToTopWritingMode;
   3053     default:
   3054         break;
   3055     }
   3056 
   3057     ASSERT_NOT_REACHED();
   3058     return TopToBottomWritingMode;
   3059 }
   3060 
   3061 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e)
   3062     : CSSValue(PrimitiveClass)
   3063 {
   3064     m_primitiveUnitType = CSS_VALUE_ID;
   3065     switch (e) {
   3066     case TextCombineNone:
   3067         m_value.valueID = CSSValueNone;
   3068         break;
   3069     case TextCombineHorizontal:
   3070         m_value.valueID = CSSValueHorizontal;
   3071         break;
   3072     }
   3073 }
   3074 
   3075 template<> inline CSSPrimitiveValue::operator TextCombine() const
   3076 {
   3077     ASSERT(isValueID());
   3078     switch (m_value.valueID) {
   3079     case CSSValueNone:
   3080         return TextCombineNone;
   3081     case CSSValueHorizontal:
   3082         return TextCombineHorizontal;
   3083     default:
   3084         break;
   3085     }
   3086 
   3087     ASSERT_NOT_REACHED();
   3088     return TextCombineNone;
   3089 }
   3090 
   3091 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position)
   3092     : CSSValue(PrimitiveClass)
   3093 {
   3094     m_primitiveUnitType = CSS_VALUE_ID;
   3095     switch (position) {
   3096     case RubyPositionBefore:
   3097         m_value.valueID = CSSValueBefore;
   3098         break;
   3099     case RubyPositionAfter:
   3100         m_value.valueID = CSSValueAfter;
   3101         break;
   3102     }
   3103 }
   3104 
   3105 template<> inline CSSPrimitiveValue::operator RubyPosition() const
   3106 {
   3107     ASSERT(isValueID());
   3108     switch (m_value.valueID) {
   3109     case CSSValueBefore:
   3110         return RubyPositionBefore;
   3111     case CSSValueAfter:
   3112         return RubyPositionAfter;
   3113     default:
   3114         break;
   3115     }
   3116 
   3117     ASSERT_NOT_REACHED();
   3118     return RubyPositionBefore;
   3119 }
   3120 
   3121 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position)
   3122     : CSSValue(PrimitiveClass)
   3123 {
   3124     m_primitiveUnitType = CSS_VALUE_ID;
   3125     switch (position) {
   3126     case TextEmphasisPositionOver:
   3127         m_value.valueID = CSSValueOver;
   3128         break;
   3129     case TextEmphasisPositionUnder:
   3130         m_value.valueID = CSSValueUnder;
   3131         break;
   3132     }
   3133 }
   3134 
   3135 template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const
   3136 {
   3137     ASSERT(isValueID());
   3138     switch (m_value.valueID) {
   3139     case CSSValueOver:
   3140         return TextEmphasisPositionOver;
   3141     case CSSValueUnder:
   3142         return TextEmphasisPositionUnder;
   3143     default:
   3144         break;
   3145     }
   3146 
   3147     ASSERT_NOT_REACHED();
   3148     return TextEmphasisPositionOver;
   3149 }
   3150 
   3151 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow)
   3152     : CSSValue(PrimitiveClass)
   3153 {
   3154     m_primitiveUnitType = CSS_VALUE_ID;
   3155     switch (overflow) {
   3156     case TextOverflowClip:
   3157         m_value.valueID = CSSValueClip;
   3158         break;
   3159     case TextOverflowEllipsis:
   3160         m_value.valueID = CSSValueEllipsis;
   3161         break;
   3162     }
   3163 }
   3164 
   3165 template<> inline CSSPrimitiveValue::operator TextOverflow() const
   3166 {
   3167     ASSERT(isValueID());
   3168     switch (m_value.valueID) {
   3169     case CSSValueClip:
   3170         return TextOverflowClip;
   3171     case CSSValueEllipsis:
   3172         return TextOverflowEllipsis;
   3173     default:
   3174         break;
   3175     }
   3176 
   3177     ASSERT_NOT_REACHED();
   3178     return TextOverflowClip;
   3179 }
   3180 
   3181 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
   3182     : CSSValue(PrimitiveClass)
   3183 {
   3184     m_primitiveUnitType = CSS_VALUE_ID;
   3185     switch (fill) {
   3186     case TextEmphasisFillFilled:
   3187         m_value.valueID = CSSValueFilled;
   3188         break;
   3189     case TextEmphasisFillOpen:
   3190         m_value.valueID = CSSValueOpen;
   3191         break;
   3192     }
   3193 }
   3194 
   3195 template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
   3196 {
   3197     ASSERT(isValueID());
   3198     switch (m_value.valueID) {
   3199     case CSSValueFilled:
   3200         return TextEmphasisFillFilled;
   3201     case CSSValueOpen:
   3202         return TextEmphasisFillOpen;
   3203     default:
   3204         break;
   3205     }
   3206 
   3207     ASSERT_NOT_REACHED();
   3208     return TextEmphasisFillFilled;
   3209 }
   3210 
   3211 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark)
   3212     : CSSValue(PrimitiveClass)
   3213 {
   3214     m_primitiveUnitType = CSS_VALUE_ID;
   3215     switch (mark) {
   3216     case TextEmphasisMarkDot:
   3217         m_value.valueID = CSSValueDot;
   3218         break;
   3219     case TextEmphasisMarkCircle:
   3220         m_value.valueID = CSSValueCircle;
   3221         break;
   3222     case TextEmphasisMarkDoubleCircle:
   3223         m_value.valueID = CSSValueDoubleCircle;
   3224         break;
   3225     case TextEmphasisMarkTriangle:
   3226         m_value.valueID = CSSValueTriangle;
   3227         break;
   3228     case TextEmphasisMarkSesame:
   3229         m_value.valueID = CSSValueSesame;
   3230         break;
   3231     case TextEmphasisMarkNone:
   3232     case TextEmphasisMarkAuto:
   3233     case TextEmphasisMarkCustom:
   3234         ASSERT_NOT_REACHED();
   3235         m_value.valueID = CSSValueNone;
   3236         break;
   3237     }
   3238 }
   3239 
   3240 template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
   3241 {
   3242     ASSERT(isValueID());
   3243     switch (m_value.valueID) {
   3244     case CSSValueNone:
   3245         return TextEmphasisMarkNone;
   3246     case CSSValueDot:
   3247         return TextEmphasisMarkDot;
   3248     case CSSValueCircle:
   3249         return TextEmphasisMarkCircle;
   3250     case CSSValueDoubleCircle:
   3251         return TextEmphasisMarkDoubleCircle;
   3252     case CSSValueTriangle:
   3253         return TextEmphasisMarkTriangle;
   3254     case CSSValueSesame:
   3255         return TextEmphasisMarkSesame;
   3256     default:
   3257         break;
   3258     }
   3259 
   3260     ASSERT_NOT_REACHED();
   3261     return TextEmphasisMarkNone;
   3262 }
   3263 
   3264 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e)
   3265     : CSSValue(PrimitiveClass)
   3266 {
   3267     m_primitiveUnitType = CSS_VALUE_ID;
   3268     switch (e) {
   3269     case TextOrientationSideways:
   3270         m_value.valueID = CSSValueSideways;
   3271         break;
   3272     case TextOrientationSidewaysRight:
   3273         m_value.valueID = CSSValueSidewaysRight;
   3274         break;
   3275     case TextOrientationVerticalRight:
   3276         m_value.valueID = CSSValueVerticalRight;
   3277         break;
   3278     case TextOrientationUpright:
   3279         m_value.valueID = CSSValueUpright;
   3280         break;
   3281     }
   3282 }
   3283 
   3284 template<> inline CSSPrimitiveValue::operator TextOrientation() const
   3285 {
   3286     ASSERT(isValueID());
   3287     switch (m_value.valueID) {
   3288     case CSSValueSideways:
   3289         return TextOrientationSideways;
   3290     case CSSValueSidewaysRight:
   3291         return TextOrientationSidewaysRight;
   3292     case CSSValueVerticalRight:
   3293         return TextOrientationVerticalRight;
   3294     case CSSValueUpright:
   3295         return TextOrientationUpright;
   3296     default:
   3297         break;
   3298     }
   3299 
   3300     ASSERT_NOT_REACHED();
   3301     return TextOrientationVerticalRight;
   3302 }
   3303 
   3304 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
   3305     : CSSValue(PrimitiveClass)
   3306 {
   3307     m_primitiveUnitType = CSS_VALUE_ID;
   3308     switch (e) {
   3309     case PE_NONE:
   3310         m_value.valueID = CSSValueNone;
   3311         break;
   3312     case PE_STROKE:
   3313         m_value.valueID = CSSValueStroke;
   3314         break;
   3315     case PE_FILL:
   3316         m_value.valueID = CSSValueFill;
   3317         break;
   3318     case PE_PAINTED:
   3319         m_value.valueID = CSSValuePainted;
   3320         break;
   3321     case PE_VISIBLE:
   3322         m_value.valueID = CSSValueVisible;
   3323         break;
   3324     case PE_VISIBLE_STROKE:
   3325         m_value.valueID = CSSValueVisiblestroke;
   3326         break;
   3327     case PE_VISIBLE_FILL:
   3328         m_value.valueID = CSSValueVisiblefill;
   3329         break;
   3330     case PE_VISIBLE_PAINTED:
   3331         m_value.valueID = CSSValueVisiblepainted;
   3332         break;
   3333     case PE_AUTO:
   3334         m_value.valueID = CSSValueAuto;
   3335         break;
   3336     case PE_ALL:
   3337         m_value.valueID = CSSValueAll;
   3338         break;
   3339     case PE_BOUNDINGBOX:
   3340         m_value.valueID = CSSValueBoundingBox;
   3341         break;
   3342     }
   3343 }
   3344 
   3345 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
   3346 {
   3347     ASSERT(isValueID());
   3348     switch (m_value.valueID) {
   3349     case CSSValueAll:
   3350         return PE_ALL;
   3351     case CSSValueAuto:
   3352         return PE_AUTO;
   3353     case CSSValueNone:
   3354         return PE_NONE;
   3355     case CSSValueVisiblepainted:
   3356         return PE_VISIBLE_PAINTED;
   3357     case CSSValueVisiblefill:
   3358         return PE_VISIBLE_FILL;
   3359     case CSSValueVisiblestroke:
   3360         return PE_VISIBLE_STROKE;
   3361     case CSSValueVisible:
   3362         return PE_VISIBLE;
   3363     case CSSValuePainted:
   3364         return PE_PAINTED;
   3365     case CSSValueFill:
   3366         return PE_FILL;
   3367     case CSSValueStroke:
   3368         return PE_STROKE;
   3369     case CSSValueBoundingBox:
   3370         return PE_BOUNDINGBOX;
   3371     default:
   3372         break;
   3373     }
   3374 
   3375     ASSERT_NOT_REACHED();
   3376     return PE_ALL;
   3377 }
   3378 
   3379 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning)
   3380     : CSSValue(PrimitiveClass)
   3381 {
   3382     m_primitiveUnitType = CSS_VALUE_ID;
   3383     switch (kerning) {
   3384     case FontDescription::AutoKerning:
   3385         m_value.valueID = CSSValueAuto;
   3386         return;
   3387     case FontDescription::NormalKerning:
   3388         m_value.valueID = CSSValueNormal;
   3389         return;
   3390     case FontDescription::NoneKerning:
   3391         m_value.valueID = CSSValueNone;
   3392         return;
   3393     }
   3394 
   3395     ASSERT_NOT_REACHED();
   3396     m_value.valueID = CSSValueAuto;
   3397 }
   3398 
   3399 template<> inline CSSPrimitiveValue::operator FontDescription::Kerning() const
   3400 {
   3401     ASSERT(isValueID());
   3402     switch (m_value.valueID) {
   3403     case CSSValueAuto:
   3404         return FontDescription::AutoKerning;
   3405     case CSSValueNormal:
   3406         return FontDescription::NormalKerning;
   3407     case CSSValueNone:
   3408         return FontDescription::NoneKerning;
   3409     default:
   3410         break;
   3411     }
   3412 
   3413     ASSERT_NOT_REACHED();
   3414     return FontDescription::AutoKerning;
   3415 }
   3416 
   3417 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ObjectFit fit)
   3418     : CSSValue(PrimitiveClass)
   3419 {
   3420     m_primitiveUnitType = CSS_VALUE_ID;
   3421     switch (fit) {
   3422     case ObjectFitFill:
   3423         m_value.valueID = CSSValueFill;
   3424         break;
   3425     case ObjectFitContain:
   3426         m_value.valueID = CSSValueContain;
   3427         break;
   3428     case ObjectFitCover:
   3429         m_value.valueID = CSSValueCover;
   3430         break;
   3431     case ObjectFitNone:
   3432         m_value.valueID = CSSValueNone;
   3433         break;
   3434     case ObjectFitScaleDown:
   3435         m_value.valueID = CSSValueScaleDown;
   3436         break;
   3437     }
   3438 }
   3439 
   3440 template<> inline CSSPrimitiveValue::operator ObjectFit() const
   3441 {
   3442     switch (m_value.valueID) {
   3443     case CSSValueFill:
   3444         return ObjectFitFill;
   3445     case CSSValueContain:
   3446         return ObjectFitContain;
   3447     case CSSValueCover:
   3448         return ObjectFitCover;
   3449     case CSSValueNone:
   3450         return ObjectFitNone;
   3451     case CSSValueScaleDown:
   3452         return ObjectFitScaleDown;
   3453     default:
   3454         ASSERT_NOT_REACHED();
   3455         return ObjectFitFill;
   3456     }
   3457 }
   3458 
   3459 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillSizeType fillSize)
   3460     : CSSValue(PrimitiveClass)
   3461 {
   3462     m_primitiveUnitType = CSS_VALUE_ID;
   3463     switch (fillSize) {
   3464     case Contain:
   3465         m_value.valueID = CSSValueContain;
   3466         break;
   3467     case Cover:
   3468         m_value.valueID = CSSValueCover;
   3469         break;
   3470     case SizeNone:
   3471         m_value.valueID = CSSValueNone;
   3472         break;
   3473     case SizeLength:
   3474     default:
   3475         ASSERT_NOT_REACHED();
   3476     }
   3477 }
   3478 
   3479 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
   3480     : CSSValue(PrimitiveClass)
   3481 {
   3482     m_primitiveUnitType = CSS_VALUE_ID;
   3483     switch (smoothing) {
   3484     case AutoSmoothing:
   3485         m_value.valueID = CSSValueAuto;
   3486         return;
   3487     case NoSmoothing:
   3488         m_value.valueID = CSSValueNone;
   3489         return;
   3490     case Antialiased:
   3491         m_value.valueID = CSSValueAntialiased;
   3492         return;
   3493     case SubpixelAntialiased:
   3494         m_value.valueID = CSSValueSubpixelAntialiased;
   3495         return;
   3496     }
   3497 
   3498     ASSERT_NOT_REACHED();
   3499     m_value.valueID = CSSValueAuto;
   3500 }
   3501 
   3502 template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
   3503 {
   3504     ASSERT(isValueID());
   3505     switch (m_value.valueID) {
   3506     case CSSValueAuto:
   3507         return AutoSmoothing;
   3508     case CSSValueNone:
   3509         return NoSmoothing;
   3510     case CSSValueAntialiased:
   3511         return Antialiased;
   3512     case CSSValueSubpixelAntialiased:
   3513         return SubpixelAntialiased;
   3514     default:
   3515         break;
   3516     }
   3517 
   3518     ASSERT_NOT_REACHED();
   3519     return AutoSmoothing;
   3520 }
   3521 
   3522 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontWeight weight)
   3523     : CSSValue(PrimitiveClass)
   3524 {
   3525     m_primitiveUnitType = CSS_VALUE_ID;
   3526     switch (weight) {
   3527     case FontWeight900:
   3528         m_value.valueID = CSSValue900;
   3529         return;
   3530     case FontWeight800:
   3531         m_value.valueID = CSSValue800;
   3532         return;
   3533     case FontWeight700:
   3534         m_value.valueID = CSSValue700;
   3535         return;
   3536     case FontWeight600:
   3537         m_value.valueID = CSSValue600;
   3538         return;
   3539     case FontWeight500:
   3540         m_value.valueID = CSSValue500;
   3541         return;
   3542     case FontWeight400:
   3543         m_value.valueID = CSSValue400;
   3544         return;
   3545     case FontWeight300:
   3546         m_value.valueID = CSSValue300;
   3547         return;
   3548     case FontWeight200:
   3549         m_value.valueID = CSSValue200;
   3550         return;
   3551     case FontWeight100:
   3552         m_value.valueID = CSSValue100;
   3553         return;
   3554     }
   3555 
   3556     ASSERT_NOT_REACHED();
   3557     m_value.valueID = CSSValueNormal;
   3558 }
   3559 
   3560 template<> inline CSSPrimitiveValue::operator FontWeight() const
   3561 {
   3562     ASSERT(isValueID());
   3563     switch (m_value.valueID) {
   3564     case CSSValueBold:
   3565         return FontWeightBold;
   3566     case CSSValueNormal:
   3567         return FontWeightNormal;
   3568     case CSSValue900:
   3569         return FontWeight900;
   3570     case CSSValue800:
   3571         return FontWeight800;
   3572     case CSSValue700:
   3573         return FontWeight700;
   3574     case CSSValue600:
   3575         return FontWeight600;
   3576     case CSSValue500:
   3577         return FontWeight500;
   3578     case CSSValue400:
   3579         return FontWeight400;
   3580     case CSSValue300:
   3581         return FontWeight300;
   3582     case CSSValue200:
   3583         return FontWeight200;
   3584     case CSSValue100:
   3585         return FontWeight100;
   3586     default:
   3587         break;
   3588     }
   3589 
   3590     ASSERT_NOT_REACHED();
   3591     return FontWeightNormal;
   3592 }
   3593 
   3594 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontItalic italic)
   3595     : CSSValue(PrimitiveClass)
   3596 {
   3597     m_primitiveUnitType = CSS_VALUE_ID;
   3598     switch (italic) {
   3599     case FontItalicOff:
   3600         m_value.valueID = CSSValueNormal;
   3601         return;
   3602     case FontItalicOn:
   3603         m_value.valueID = CSSValueItalic;
   3604         return;
   3605     }
   3606 
   3607     ASSERT_NOT_REACHED();
   3608     m_value.valueID = CSSValueNormal;
   3609 }
   3610 
   3611 template<> inline CSSPrimitiveValue::operator FontItalic() const
   3612 {
   3613     ASSERT(isValueID());
   3614     switch (m_value.valueID) {
   3615     case CSSValueOblique:
   3616     // FIXME: oblique is the same as italic for the moment...
   3617     case CSSValueItalic:
   3618         return FontItalicOn;
   3619     case CSSValueNormal:
   3620         return FontItalicOff;
   3621     default:
   3622         break;
   3623     }
   3624     ASSERT_NOT_REACHED();
   3625     return FontItalicOff;
   3626 }
   3627 
   3628 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
   3629     : CSSValue(PrimitiveClass)
   3630 {
   3631     m_primitiveUnitType = CSS_VALUE_ID;
   3632     switch (smallCaps) {
   3633     case FontSmallCapsOff:
   3634         m_value.valueID = CSSValueNormal;
   3635         return;
   3636     case FontSmallCapsOn:
   3637         m_value.valueID = CSSValueSmallCaps;
   3638         return;
   3639     }
   3640 
   3641     ASSERT_NOT_REACHED();
   3642     m_value.valueID = CSSValueNormal;
   3643 }
   3644 
   3645 template<> inline CSSPrimitiveValue::operator FontSmallCaps() const
   3646 {
   3647     ASSERT(isValueID());
   3648     switch (m_value.valueID) {
   3649     case CSSValueSmallCaps:
   3650         return FontSmallCapsOn;
   3651     case CSSValueNormal:
   3652         return FontSmallCapsOff;
   3653     default:
   3654         break;
   3655     }
   3656     ASSERT_NOT_REACHED();
   3657     return FontSmallCapsOff;
   3658 }
   3659 
   3660 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
   3661     : CSSValue(PrimitiveClass)
   3662 {
   3663     m_primitiveUnitType = CSS_VALUE_ID;
   3664     switch (e) {
   3665     case AutoTextRendering:
   3666         m_value.valueID = CSSValueAuto;
   3667         break;
   3668     case OptimizeSpeed:
   3669         m_value.valueID = CSSValueOptimizespeed;
   3670         break;
   3671     case OptimizeLegibility:
   3672         m_value.valueID = CSSValueOptimizelegibility;
   3673         break;
   3674     case GeometricPrecision:
   3675         m_value.valueID = CSSValueGeometricprecision;
   3676         break;
   3677     }
   3678 }
   3679 
   3680 template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
   3681 {
   3682     ASSERT(isValueID());
   3683     switch (m_value.valueID) {
   3684     case CSSValueAuto:
   3685         return AutoTextRendering;
   3686     case CSSValueOptimizespeed:
   3687         return OptimizeSpeed;
   3688     case CSSValueOptimizelegibility:
   3689         return OptimizeLegibility;
   3690     case CSSValueGeometricprecision:
   3691         return GeometricPrecision;
   3692     default:
   3693         break;
   3694     }
   3695 
   3696     ASSERT_NOT_REACHED();
   3697     return AutoTextRendering;
   3698 }
   3699 
   3700 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineSnap gridSnap)
   3701     : CSSValue(PrimitiveClass)
   3702 {
   3703     m_primitiveUnitType = CSS_VALUE_ID;
   3704     switch (gridSnap) {
   3705     case LineSnapNone:
   3706         m_value.valueID = CSSValueNone;
   3707         break;
   3708     case LineSnapBaseline:
   3709         m_value.valueID = CSSValueBaseline;
   3710         break;
   3711     case LineSnapContain:
   3712         m_value.valueID = CSSValueContain;
   3713         break;
   3714     }
   3715 }
   3716 
   3717 template<> inline CSSPrimitiveValue::operator LineSnap() const
   3718 {
   3719     ASSERT(isValueID());
   3720     switch (m_value.valueID) {
   3721     case CSSValueNone:
   3722         return LineSnapNone;
   3723     case CSSValueBaseline:
   3724         return LineSnapBaseline;
   3725     case CSSValueContain:
   3726         return LineSnapContain;
   3727     default:
   3728         break;
   3729     }
   3730 
   3731     ASSERT_NOT_REACHED();
   3732     return LineSnapNone;
   3733 }
   3734 
   3735 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineAlign lineAlign)
   3736     : CSSValue(PrimitiveClass)
   3737 {
   3738     m_primitiveUnitType = CSS_VALUE_ID;
   3739     switch (lineAlign) {
   3740     case LineAlignNone:
   3741         m_value.valueID = CSSValueNone;
   3742         break;
   3743     case LineAlignEdges:
   3744         m_value.valueID = CSSValueEdges;
   3745         break;
   3746     }
   3747 }
   3748 
   3749 template<> inline CSSPrimitiveValue::operator LineAlign() const
   3750 {
   3751     ASSERT(isValueID());
   3752     switch (m_value.valueID) {
   3753     case CSSValueNone:
   3754         return LineAlignNone;
   3755     case CSSValueEdges:
   3756         return LineAlignEdges;
   3757     default:
   3758         break;
   3759     }
   3760 
   3761     ASSERT_NOT_REACHED();
   3762     return LineAlignNone;
   3763 }
   3764 
   3765 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e)
   3766     : CSSValue(PrimitiveClass)
   3767 {
   3768     m_primitiveUnitType = CSS_VALUE_ID;
   3769     switch (e) {
   3770     case SpeakNone:
   3771         m_value.valueID = CSSValueNone;
   3772         break;
   3773     case SpeakNormal:
   3774         m_value.valueID = CSSValueNormal;
   3775         break;
   3776     case SpeakSpellOut:
   3777         m_value.valueID = CSSValueSpellOut;
   3778         break;
   3779     case SpeakDigits:
   3780         m_value.valueID = CSSValueDigits;
   3781         break;
   3782     case SpeakLiteralPunctuation:
   3783         m_value.valueID = CSSValueLiteralPunctuation;
   3784         break;
   3785     case SpeakNoPunctuation:
   3786         m_value.valueID = CSSValueNoPunctuation;
   3787         break;
   3788     }
   3789 }
   3790 
   3791 template<> inline CSSPrimitiveValue::operator Order() const
   3792 {
   3793     ASSERT(isValueID());
   3794     switch (m_value.valueID) {
   3795     case CSSValueLogical:
   3796         return LogicalOrder;
   3797     case CSSValueVisual:
   3798         return VisualOrder;
   3799     default:
   3800         break;
   3801     }
   3802 
   3803     ASSERT_NOT_REACHED();
   3804     return LogicalOrder;
   3805 }
   3806 
   3807 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e)
   3808     : CSSValue(PrimitiveClass)
   3809 {
   3810     m_primitiveUnitType = CSS_VALUE_ID;
   3811     switch (e) {
   3812     case LogicalOrder:
   3813         m_value.valueID = CSSValueLogical;
   3814         break;
   3815     case VisualOrder:
   3816         m_value.valueID = CSSValueVisual;
   3817         break;
   3818     }
   3819 }
   3820 
   3821 template<> inline CSSPrimitiveValue::operator ESpeak() const
   3822 {
   3823     ASSERT(isValueID());
   3824     switch (m_value.valueID) {
   3825     case CSSValueNone:
   3826         return SpeakNone;
   3827     case CSSValueNormal:
   3828         return SpeakNormal;
   3829     case CSSValueSpellOut:
   3830         return SpeakSpellOut;
   3831     case CSSValueDigits:
   3832         return SpeakDigits;
   3833     case CSSValueLiteralPunctuation:
   3834         return SpeakLiteralPunctuation;
   3835     case CSSValueNoPunctuation:
   3836         return SpeakNoPunctuation;
   3837     default:
   3838         break;
   3839     }
   3840 
   3841     ASSERT_NOT_REACHED();
   3842     return SpeakNormal;
   3843 }
   3844 
   3845 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(blink::WebBlendMode blendMode)
   3846     : CSSValue(PrimitiveClass)
   3847 {
   3848     m_primitiveUnitType = CSS_VALUE_ID;
   3849     switch (blendMode) {
   3850     case blink::WebBlendModeNormal:
   3851         m_value.valueID = CSSValueNormal;
   3852         break;
   3853     case blink::WebBlendModeMultiply:
   3854         m_value.valueID = CSSValueMultiply;
   3855         break;
   3856     case blink::WebBlendModeScreen:
   3857         m_value.valueID = CSSValueScreen;
   3858         break;
   3859     case blink::WebBlendModeOverlay:
   3860         m_value.valueID = CSSValueOverlay;
   3861         break;
   3862     case blink::WebBlendModeDarken:
   3863         m_value.valueID = CSSValueDarken;
   3864         break;
   3865     case blink::WebBlendModeLighten:
   3866         m_value.valueID = CSSValueLighten;
   3867         break;
   3868     case blink::WebBlendModeColorDodge:
   3869         m_value.valueID = CSSValueColorDodge;
   3870         break;
   3871     case blink::WebBlendModeColorBurn:
   3872         m_value.valueID = CSSValueColorBurn;
   3873         break;
   3874     case blink::WebBlendModeHardLight:
   3875         m_value.valueID = CSSValueHardLight;
   3876         break;
   3877     case blink::WebBlendModeSoftLight:
   3878         m_value.valueID = CSSValueSoftLight;
   3879         break;
   3880     case blink::WebBlendModeDifference:
   3881         m_value.valueID = CSSValueDifference;
   3882         break;
   3883     case blink::WebBlendModeExclusion:
   3884         m_value.valueID = CSSValueExclusion;
   3885         break;
   3886     case blink::WebBlendModeHue:
   3887         m_value.valueID = CSSValueHue;
   3888         break;
   3889     case blink::WebBlendModeSaturation:
   3890         m_value.valueID = CSSValueSaturation;
   3891         break;
   3892     case blink::WebBlendModeColor:
   3893         m_value.valueID = CSSValueColor;
   3894         break;
   3895     case blink::WebBlendModeLuminosity:
   3896         m_value.valueID = CSSValueLuminosity;
   3897         break;
   3898     }
   3899 }
   3900 
   3901 template<> inline CSSPrimitiveValue::operator blink::WebBlendMode() const
   3902 {
   3903     ASSERT(isValueID());
   3904     switch (m_value.valueID) {
   3905     case CSSValueNormal:
   3906         return blink::WebBlendModeNormal;
   3907     case CSSValueMultiply:
   3908         return blink::WebBlendModeMultiply;
   3909     case CSSValueScreen:
   3910         return blink::WebBlendModeScreen;
   3911     case CSSValueOverlay:
   3912         return blink::WebBlendModeOverlay;
   3913     case CSSValueDarken:
   3914         return blink::WebBlendModeDarken;
   3915     case CSSValueLighten:
   3916         return blink::WebBlendModeLighten;
   3917     case CSSValueColorDodge:
   3918         return blink::WebBlendModeColorDodge;
   3919     case CSSValueColorBurn:
   3920         return blink::WebBlendModeColorBurn;
   3921     case CSSValueHardLight:
   3922         return blink::WebBlendModeHardLight;
   3923     case CSSValueSoftLight:
   3924         return blink::WebBlendModeSoftLight;
   3925     case CSSValueDifference:
   3926         return blink::WebBlendModeDifference;
   3927     case CSSValueExclusion:
   3928         return blink::WebBlendModeExclusion;
   3929     case CSSValueHue:
   3930         return blink::WebBlendModeHue;
   3931     case CSSValueSaturation:
   3932         return blink::WebBlendModeSaturation;
   3933     case CSSValueColor:
   3934         return blink::WebBlendModeColor;
   3935     case CSSValueLuminosity:
   3936         return blink::WebBlendModeLuminosity;
   3937     default:
   3938         break;
   3939     }
   3940 
   3941     ASSERT_NOT_REACHED();
   3942     return blink::WebBlendModeNormal;
   3943 }
   3944 
   3945 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
   3946     : CSSValue(PrimitiveClass)
   3947 {
   3948     m_primitiveUnitType = CSS_VALUE_ID;
   3949     switch (e) {
   3950     case ButtCap:
   3951         m_value.valueID = CSSValueButt;
   3952         break;
   3953     case RoundCap:
   3954         m_value.valueID = CSSValueRound;
   3955         break;
   3956     case SquareCap:
   3957         m_value.valueID = CSSValueSquare;
   3958         break;
   3959     }
   3960 }
   3961 
   3962 template<> inline CSSPrimitiveValue::operator LineCap() const
   3963 {
   3964     ASSERT(isValueID());
   3965     switch (m_value.valueID) {
   3966     case CSSValueButt:
   3967         return ButtCap;
   3968     case CSSValueRound:
   3969         return RoundCap;
   3970     case CSSValueSquare:
   3971         return SquareCap;
   3972     default:
   3973         break;
   3974     }
   3975 
   3976     ASSERT_NOT_REACHED();
   3977     return ButtCap;
   3978 }
   3979 
   3980 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
   3981     : CSSValue(PrimitiveClass)
   3982 {
   3983     m_primitiveUnitType = CSS_VALUE_ID;
   3984     switch (e) {
   3985     case MiterJoin:
   3986         m_value.valueID = CSSValueMiter;
   3987         break;
   3988     case RoundJoin:
   3989         m_value.valueID = CSSValueRound;
   3990         break;
   3991     case BevelJoin:
   3992         m_value.valueID = CSSValueBevel;
   3993         break;
   3994     }
   3995 }
   3996 
   3997 template<> inline CSSPrimitiveValue::operator LineJoin() const
   3998 {
   3999     ASSERT(isValueID());
   4000     switch (m_value.valueID) {
   4001     case CSSValueMiter:
   4002         return MiterJoin;
   4003     case CSSValueRound:
   4004         return RoundJoin;
   4005     case CSSValueBevel:
   4006         return BevelJoin;
   4007     default:
   4008         break;
   4009     }
   4010 
   4011     ASSERT_NOT_REACHED();
   4012     return MiterJoin;
   4013 }
   4014 
   4015 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
   4016     : CSSValue(PrimitiveClass)
   4017 {
   4018     m_primitiveUnitType = CSS_VALUE_ID;
   4019     switch (e) {
   4020     case RULE_NONZERO:
   4021         m_value.valueID = CSSValueNonzero;
   4022         break;
   4023     case RULE_EVENODD:
   4024         m_value.valueID = CSSValueEvenodd;
   4025         break;
   4026     }
   4027 }
   4028 
   4029 template<> inline CSSPrimitiveValue::operator WindRule() const
   4030 {
   4031     ASSERT(isValueID());
   4032     switch (m_value.valueID) {
   4033     case CSSValueNonzero:
   4034         return RULE_NONZERO;
   4035     case CSSValueEvenodd:
   4036         return RULE_EVENODD;
   4037     default:
   4038         break;
   4039     }
   4040 
   4041     ASSERT_NOT_REACHED();
   4042     return RULE_NONZERO;
   4043 }
   4044 
   4045 
   4046 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e)
   4047     : CSSValue(PrimitiveClass)
   4048 {
   4049     m_primitiveUnitType = CSS_VALUE_ID;
   4050     switch (e) {
   4051     case AB_AUTO:
   4052         m_value.valueID = CSSValueAuto;
   4053         break;
   4054     case AB_BASELINE:
   4055         m_value.valueID = CSSValueBaseline;
   4056         break;
   4057     case AB_BEFORE_EDGE:
   4058         m_value.valueID = CSSValueBeforeEdge;
   4059         break;
   4060     case AB_TEXT_BEFORE_EDGE:
   4061         m_value.valueID = CSSValueTextBeforeEdge;
   4062         break;
   4063     case AB_MIDDLE:
   4064         m_value.valueID = CSSValueMiddle;
   4065         break;
   4066     case AB_CENTRAL:
   4067         m_value.valueID = CSSValueCentral;
   4068         break;
   4069     case AB_AFTER_EDGE:
   4070         m_value.valueID = CSSValueAfterEdge;
   4071         break;
   4072     case AB_TEXT_AFTER_EDGE:
   4073         m_value.valueID = CSSValueTextAfterEdge;
   4074         break;
   4075     case AB_IDEOGRAPHIC:
   4076         m_value.valueID = CSSValueIdeographic;
   4077         break;
   4078     case AB_ALPHABETIC:
   4079         m_value.valueID = CSSValueAlphabetic;
   4080         break;
   4081     case AB_HANGING:
   4082         m_value.valueID = CSSValueHanging;
   4083         break;
   4084     case AB_MATHEMATICAL:
   4085         m_value.valueID = CSSValueMathematical;
   4086         break;
   4087     }
   4088 }
   4089 
   4090 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
   4091 {
   4092     ASSERT(isValueID());
   4093     switch (m_value.valueID) {
   4094     case CSSValueAuto:
   4095         return AB_AUTO;
   4096     case CSSValueBaseline:
   4097         return AB_BASELINE;
   4098     case CSSValueBeforeEdge:
   4099         return AB_BEFORE_EDGE;
   4100     case CSSValueTextBeforeEdge:
   4101         return AB_TEXT_BEFORE_EDGE;
   4102     case CSSValueMiddle:
   4103         return AB_MIDDLE;
   4104     case CSSValueCentral:
   4105         return AB_CENTRAL;
   4106     case CSSValueAfterEdge:
   4107         return AB_AFTER_EDGE;
   4108     case CSSValueTextAfterEdge:
   4109         return AB_TEXT_AFTER_EDGE;
   4110     case CSSValueIdeographic:
   4111         return AB_IDEOGRAPHIC;
   4112     case CSSValueAlphabetic:
   4113         return AB_ALPHABETIC;
   4114     case CSSValueHanging:
   4115         return AB_HANGING;
   4116     case CSSValueMathematical:
   4117         return AB_MATHEMATICAL;
   4118     default:
   4119         break;
   4120     }
   4121 
   4122     ASSERT_NOT_REACHED();
   4123     return AB_AUTO;
   4124 }
   4125 
   4126 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderCollapse e)
   4127     : CSSValue(PrimitiveClass)
   4128 {
   4129     m_primitiveUnitType = CSS_VALUE_ID;
   4130     switch (e) {
   4131     case BSEPARATE:
   4132         m_value.valueID = CSSValueSeparate;
   4133         break;
   4134     case BCOLLAPSE:
   4135         m_value.valueID = CSSValueCollapse;
   4136         break;
   4137     }
   4138 }
   4139 
   4140 template<> inline CSSPrimitiveValue::operator EBorderCollapse() const
   4141 {
   4142     ASSERT(isValueID());
   4143     switch (m_value.valueID) {
   4144     case CSSValueSeparate:
   4145         return BSEPARATE;
   4146     case CSSValueCollapse:
   4147         return BCOLLAPSE;
   4148     default:
   4149         break;
   4150     }
   4151 
   4152     ASSERT_NOT_REACHED();
   4153     return BSEPARATE;
   4154 }
   4155 
   4156 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderFit e)
   4157     : CSSValue(PrimitiveClass)
   4158 {
   4159     m_primitiveUnitType = CSS_VALUE_ID;
   4160     switch (e) {
   4161     case BorderFitBorder:
   4162         m_value.valueID = CSSValueBorder;
   4163         break;
   4164     case BorderFitLines:
   4165         m_value.valueID = CSSValueLines;
   4166         break;
   4167     }
   4168 }
   4169 
   4170 template<> inline CSSPrimitiveValue::operator EBorderFit() const
   4171 {
   4172     ASSERT(isValueID());
   4173     switch (m_value.valueID) {
   4174     case CSSValueBorder:
   4175         return BorderFitBorder;
   4176     case CSSValueLines:
   4177         return BorderFitLines;
   4178     default:
   4179         break;
   4180     }
   4181 
   4182     ASSERT_NOT_REACHED();
   4183     return BorderFitLines;
   4184 }
   4185 
   4186 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
   4187     : CSSValue(PrimitiveClass)
   4188 {
   4189     m_primitiveUnitType = CSS_VALUE_ID;
   4190     switch (e) {
   4191     case ImageRenderingAuto:
   4192         m_value.valueID = CSSValueAuto;
   4193         break;
   4194     case ImageRenderingOptimizeSpeed:
   4195         m_value.valueID = CSSValueOptimizespeed;
   4196         break;
   4197     case ImageRenderingOptimizeQuality:
   4198         m_value.valueID = CSSValueOptimizequality;
   4199         break;
   4200     case ImageRenderingOptimizeContrast:
   4201         m_value.valueID = CSSValueWebkitOptimizeContrast;
   4202         break;
   4203     }
   4204 }
   4205 
   4206 template<> inline CSSPrimitiveValue::operator EImageRendering() const
   4207 {
   4208     ASSERT(isValueID());
   4209     switch (m_value.valueID) {
   4210     case CSSValueAuto:
   4211         return ImageRenderingAuto;
   4212     case CSSValueOptimizespeed:
   4213         return ImageRenderingOptimizeSpeed;
   4214     case CSSValueOptimizequality:
   4215         return ImageRenderingOptimizeQuality;
   4216     case CSSValueWebkitOptimizeContrast:
   4217         return ImageRenderingOptimizeContrast;
   4218     default:
   4219         break;
   4220     }
   4221 
   4222     ASSERT_NOT_REACHED();
   4223     return ImageRenderingAuto;
   4224 }
   4225 
   4226 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETransformStyle3D e)
   4227     : CSSValue(PrimitiveClass)
   4228 {
   4229     m_primitiveUnitType = CSS_VALUE_ID;
   4230     switch (e) {
   4231     case TransformStyle3DFlat:
   4232         m_value.valueID = CSSValueFlat;
   4233         break;
   4234     case TransformStyle3DPreserve3D:
   4235         m_value.valueID = CSSValuePreserve3d;
   4236         break;
   4237     }
   4238 }
   4239 
   4240 template<> inline CSSPrimitiveValue::operator ETransformStyle3D() const
   4241 {
   4242     ASSERT(isValueID());
   4243     switch (m_value.valueID) {
   4244     case CSSValueFlat:
   4245         return TransformStyle3DFlat;
   4246     case CSSValuePreserve3d:
   4247         return TransformStyle3DPreserve3D;
   4248     default:
   4249         break;
   4250     }
   4251 
   4252     ASSERT_NOT_REACHED();
   4253     return TransformStyle3DFlat;
   4254 }
   4255 
   4256 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnAxis e)
   4257     : CSSValue(PrimitiveClass)
   4258 {
   4259     m_primitiveUnitType = CSS_VALUE_ID;
   4260     switch (e) {
   4261     case HorizontalColumnAxis:
   4262         m_value.valueID = CSSValueHorizontal;
   4263         break;
   4264     case VerticalColumnAxis:
   4265         m_value.valueID = CSSValueVertical;
   4266         break;
   4267     case AutoColumnAxis:
   4268         m_value.valueID = CSSValueAuto;
   4269         break;
   4270     }
   4271 }
   4272 
   4273 template<> inline CSSPrimitiveValue::operator ColumnAxis() const
   4274 {
   4275     ASSERT(isValueID());
   4276     switch (m_value.valueID) {
   4277     case CSSValueHorizontal:
   4278         return HorizontalColumnAxis;
   4279     case CSSValueVertical:
   4280         return VerticalColumnAxis;
   4281     case CSSValueAuto:
   4282         return AutoColumnAxis;
   4283     default:
   4284         break;
   4285     }
   4286 
   4287     ASSERT_NOT_REACHED();
   4288     return AutoColumnAxis;
   4289 }
   4290 
   4291 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnProgression e)
   4292     : CSSValue(PrimitiveClass)
   4293 {
   4294     m_primitiveUnitType = CSS_VALUE_ID;
   4295     switch (e) {
   4296     case NormalColumnProgression:
   4297         m_value.valueID = CSSValueNormal;
   4298         break;
   4299     case ReverseColumnProgression:
   4300         m_value.valueID = CSSValueReverse;
   4301         break;
   4302     }
   4303 }
   4304 
   4305 template<> inline CSSPrimitiveValue::operator ColumnProgression() const
   4306 {
   4307     ASSERT(isValueID());
   4308     switch (m_value.valueID) {
   4309     case CSSValueNormal:
   4310         return NormalColumnProgression;
   4311     case CSSValueReverse:
   4312         return ReverseColumnProgression;
   4313     default:
   4314         break;
   4315     }
   4316 
   4317     ASSERT_NOT_REACHED();
   4318     return NormalColumnProgression;
   4319 }
   4320 
   4321 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WrapFlow wrapFlow)
   4322 : CSSValue(PrimitiveClass)
   4323 {
   4324     m_primitiveUnitType = CSS_VALUE_ID;
   4325     switch (wrapFlow) {
   4326     case WrapFlowAuto:
   4327         m_value.valueID = CSSValueAuto;
   4328         break;
   4329     case WrapFlowBoth:
   4330         m_value.valueID = CSSValueBoth;
   4331         break;
   4332     case WrapFlowStart:
   4333         m_value.valueID = CSSValueStart;
   4334         break;
   4335     case WrapFlowEnd:
   4336         m_value.valueID = CSSValueEnd;
   4337         break;
   4338     case WrapFlowMaximum:
   4339         m_value.valueID = CSSValueMaximum;
   4340         break;
   4341     case WrapFlowClear:
   4342         m_value.valueID = CSSValueClear;
   4343         break;
   4344     }
   4345 }
   4346 
   4347 template<> inline CSSPrimitiveValue::operator WrapFlow() const
   4348 {
   4349     ASSERT(isValueID());
   4350     switch (m_value.valueID) {
   4351     case CSSValueAuto:
   4352         return WrapFlowAuto;
   4353     case CSSValueBoth:
   4354         return WrapFlowBoth;
   4355     case CSSValueStart:
   4356         return WrapFlowStart;
   4357     case CSSValueEnd:
   4358         return WrapFlowEnd;
   4359     case CSSValueMaximum:
   4360         return WrapFlowMaximum;
   4361     case CSSValueClear:
   4362         return WrapFlowClear;
   4363     default:
   4364         break;
   4365     }
   4366 
   4367     ASSERT_NOT_REACHED();
   4368     return WrapFlowAuto;
   4369 }
   4370 
   4371 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WrapThrough wrapThrough)
   4372 : CSSValue(PrimitiveClass)
   4373 {
   4374     m_primitiveUnitType = CSS_VALUE_ID;
   4375     switch (wrapThrough) {
   4376     case WrapThroughWrap:
   4377         m_value.valueID = CSSValueWrap;
   4378         break;
   4379     case WrapThroughNone:
   4380         m_value.valueID = CSSValueNone;
   4381         break;
   4382     }
   4383 }
   4384 
   4385 template<> inline CSSPrimitiveValue::operator WrapThrough() const
   4386 {
   4387     ASSERT(isValueID());
   4388     switch (m_value.valueID) {
   4389     case CSSValueWrap:
   4390         return WrapThroughWrap;
   4391     case CSSValueNone:
   4392         return WrapThroughNone;
   4393     default:
   4394         break;
   4395     }
   4396 
   4397     ASSERT_NOT_REACHED();
   4398     return WrapThroughWrap;
   4399 }
   4400 
   4401 template<> inline CSSPrimitiveValue::operator GridAutoFlow() const
   4402 {
   4403     ASSERT(isValueID());
   4404     switch (m_value.valueID) {
   4405     case CSSValueNone:
   4406         return AutoFlowNone;
   4407     case CSSValueColumn:
   4408         return AutoFlowColumn;
   4409     case CSSValueRow:
   4410         return AutoFlowRow;
   4411     default:
   4412         break;
   4413     }
   4414 
   4415     ASSERT_NOT_REACHED();
   4416     return AutoFlowNone;
   4417 
   4418 }
   4419 
   4420 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(GridAutoFlow flow)
   4421     : CSSValue(PrimitiveClass)
   4422 {
   4423     m_primitiveUnitType = CSS_VALUE_ID;
   4424     switch (flow) {
   4425     case AutoFlowNone:
   4426         m_value.valueID = CSSValueNone;
   4427         break;
   4428     case AutoFlowColumn:
   4429         m_value.valueID = CSSValueColumn;
   4430         break;
   4431     case AutoFlowRow:
   4432         m_value.valueID = CSSValueRow;
   4433         break;
   4434     }
   4435 }
   4436 
   4437 enum LengthConversion {
   4438     AnyConversion = ~0,
   4439     FixedConversion = 1 << 0,
   4440     AutoConversion = 1 << 1,
   4441     PercentConversion = 1 << 2,
   4442 };
   4443 
   4444 template<int supported> Length CSSPrimitiveValue::convertToLength(const CSSToLengthConversionData& conversionData)
   4445 {
   4446     ASSERT(!hasVariableReference());
   4447     if ((supported & FixedConversion) && isLength())
   4448         return computeLength<Length>(conversionData);
   4449     if ((supported & PercentConversion) && isPercentage())
   4450         return Length(getDoubleValue(), Percent);
   4451     if ((supported & AutoConversion) && getValueID() == CSSValueAuto)
   4452         return Length(Auto);
   4453     if ((supported & FixedConversion) && (supported & PercentConversion) && isCalculated())
   4454         return Length(cssCalcValue()->toCalcValue(conversionData));
   4455     if ((supported & FixedConversion) && isViewportPercentageLength())
   4456         return viewportPercentageLength();
   4457     return Length(Undefined);
   4458 }
   4459 
   4460 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e)
   4461     : CSSValue(PrimitiveClass)
   4462 {
   4463     m_primitiveUnitType = CSS_VALUE_ID;
   4464     switch (e) {
   4465     case BR_AUTO:
   4466         m_value.valueID = CSSValueAuto;
   4467         break;
   4468     case BR_DYNAMIC:
   4469         m_value.valueID = CSSValueDynamic;
   4470         break;
   4471     case BR_STATIC:
   4472         m_value.valueID = CSSValueStatic;
   4473         break;
   4474     }
   4475 }
   4476 
   4477 template<> inline CSSPrimitiveValue::operator EBufferedRendering() const
   4478 {
   4479     ASSERT(isValueID());
   4480     switch (m_value.valueID) {
   4481     case CSSValueAuto:
   4482         return BR_AUTO;
   4483     case CSSValueDynamic:
   4484         return BR_DYNAMIC;
   4485     case CSSValueStatic:
   4486         return BR_STATIC;
   4487     default:
   4488         break;
   4489     }
   4490 
   4491     ASSERT_NOT_REACHED();
   4492     return BR_AUTO;
   4493 }
   4494 
   4495 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
   4496     : CSSValue(PrimitiveClass)
   4497 {
   4498     m_primitiveUnitType = CSS_VALUE_ID;
   4499     switch (e) {
   4500     case CI_AUTO:
   4501         m_value.valueID = CSSValueAuto;
   4502         break;
   4503     case CI_SRGB:
   4504         m_value.valueID = CSSValueSrgb;
   4505         break;
   4506     case CI_LINEARRGB:
   4507         m_value.valueID = CSSValueLinearrgb;
   4508         break;
   4509     }
   4510 }
   4511 
   4512 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
   4513 {
   4514     ASSERT(isValueID());
   4515     switch (m_value.valueID) {
   4516     case CSSValueSrgb:
   4517         return CI_SRGB;
   4518     case CSSValueLinearrgb:
   4519         return CI_LINEARRGB;
   4520     case CSSValueAuto:
   4521         return CI_AUTO;
   4522     default:
   4523         break;
   4524     }
   4525 
   4526     ASSERT_NOT_REACHED();
   4527     return CI_AUTO;
   4528 }
   4529 
   4530 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e)
   4531     : CSSValue(PrimitiveClass)
   4532 {
   4533     m_primitiveUnitType = CSS_VALUE_ID;
   4534     switch (e) {
   4535     case CR_AUTO:
   4536         m_value.valueID = CSSValueAuto;
   4537         break;
   4538     case CR_OPTIMIZESPEED:
   4539         m_value.valueID = CSSValueOptimizespeed;
   4540         break;
   4541     case CR_OPTIMIZEQUALITY:
   4542         m_value.valueID = CSSValueOptimizequality;
   4543         break;
   4544     }
   4545 }
   4546 
   4547 template<> inline CSSPrimitiveValue::operator EColorRendering() const
   4548 {
   4549     ASSERT(isValueID());
   4550     switch (m_value.valueID) {
   4551     case CSSValueOptimizespeed:
   4552         return CR_OPTIMIZESPEED;
   4553     case CSSValueOptimizequality:
   4554         return CR_OPTIMIZEQUALITY;
   4555     case CSSValueAuto:
   4556         return CR_AUTO;
   4557     default:
   4558         break;
   4559     }
   4560 
   4561     ASSERT_NOT_REACHED();
   4562     return CR_AUTO;
   4563 }
   4564 
   4565 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e)
   4566     : CSSValue(PrimitiveClass)
   4567 {
   4568     m_primitiveUnitType = CSS_VALUE_ID;
   4569     switch (e) {
   4570     case DB_AUTO:
   4571         m_value.valueID = CSSValueAuto;
   4572         break;
   4573     case DB_USE_SCRIPT:
   4574         m_value.valueID = CSSValueUseScript;
   4575         break;
   4576     case DB_NO_CHANGE:
   4577         m_value.valueID = CSSValueNoChange;
   4578         break;
   4579     case DB_RESET_SIZE:
   4580         m_value.valueID = CSSValueResetSize;
   4581         break;
   4582     case DB_CENTRAL:
   4583         m_value.valueID = CSSValueCentral;
   4584         break;
   4585     case DB_MIDDLE:
   4586         m_value.valueID = CSSValueMiddle;
   4587         break;
   4588     case DB_TEXT_BEFORE_EDGE:
   4589         m_value.valueID = CSSValueTextBeforeEdge;
   4590         break;
   4591     case DB_TEXT_AFTER_EDGE:
   4592         m_value.valueID = CSSValueTextAfterEdge;
   4593         break;
   4594     case DB_IDEOGRAPHIC:
   4595         m_value.valueID = CSSValueIdeographic;
   4596         break;
   4597     case DB_ALPHABETIC:
   4598         m_value.valueID = CSSValueAlphabetic;
   4599         break;
   4600     case DB_HANGING:
   4601         m_value.valueID = CSSValueHanging;
   4602         break;
   4603     case DB_MATHEMATICAL:
   4604         m_value.valueID = CSSValueMathematical;
   4605         break;
   4606     }
   4607 }
   4608 
   4609 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
   4610 {
   4611     ASSERT(isValueID());
   4612     switch (m_value.valueID) {
   4613     case CSSValueAuto:
   4614         return DB_AUTO;
   4615     case CSSValueUseScript:
   4616         return DB_USE_SCRIPT;
   4617     case CSSValueNoChange:
   4618         return DB_NO_CHANGE;
   4619     case CSSValueResetSize:
   4620         return DB_RESET_SIZE;
   4621     case CSSValueIdeographic:
   4622         return DB_IDEOGRAPHIC;
   4623     case CSSValueAlphabetic:
   4624         return DB_ALPHABETIC;
   4625     case CSSValueHanging:
   4626         return DB_HANGING;
   4627     case CSSValueMathematical:
   4628         return DB_MATHEMATICAL;
   4629     case CSSValueCentral:
   4630         return DB_CENTRAL;
   4631     case CSSValueMiddle:
   4632         return DB_MIDDLE;
   4633     case CSSValueTextAfterEdge:
   4634         return DB_TEXT_AFTER_EDGE;
   4635     case CSSValueTextBeforeEdge:
   4636         return DB_TEXT_BEFORE_EDGE;
   4637     default:
   4638         break;
   4639     }
   4640 
   4641     ASSERT_NOT_REACHED();
   4642     return DB_AUTO;
   4643 }
   4644 
   4645 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e)
   4646     : CSSValue(PrimitiveClass)
   4647 {
   4648     m_primitiveUnitType = CSS_VALUE_ID;
   4649     switch (e) {
   4650     case SR_AUTO:
   4651         m_value.valueID = CSSValueAuto;
   4652         break;
   4653     case SR_OPTIMIZESPEED:
   4654         m_value.valueID = CSSValueOptimizespeed;
   4655         break;
   4656     case SR_CRISPEDGES:
   4657         m_value.valueID = CSSValueCrispedges;
   4658         break;
   4659     case SR_GEOMETRICPRECISION:
   4660         m_value.valueID = CSSValueGeometricprecision;
   4661         break;
   4662     }
   4663 }
   4664 
   4665 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
   4666 {
   4667     ASSERT(isValueID());
   4668     switch (m_value.valueID) {
   4669     case CSSValueAuto:
   4670         return SR_AUTO;
   4671     case CSSValueOptimizespeed:
   4672         return SR_OPTIMIZESPEED;
   4673     case CSSValueCrispedges:
   4674         return SR_CRISPEDGES;
   4675     case CSSValueGeometricprecision:
   4676         return SR_GEOMETRICPRECISION;
   4677     default:
   4678         break;
   4679     }
   4680 
   4681     ASSERT_NOT_REACHED();
   4682     return SR_AUTO;
   4683 }
   4684 
   4685 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e)
   4686     : CSSValue(PrimitiveClass)
   4687 {
   4688     m_primitiveUnitType = CSS_VALUE_ID;
   4689     switch (e) {
   4690     case TA_START:
   4691         m_value.valueID = CSSValueStart;
   4692         break;
   4693     case TA_MIDDLE:
   4694         m_value.valueID = CSSValueMiddle;
   4695         break;
   4696     case TA_END:
   4697         m_value.valueID = CSSValueEnd;
   4698         break;
   4699     }
   4700 }
   4701 
   4702 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
   4703 {
   4704     ASSERT(isValueID());
   4705     switch (m_value.valueID) {
   4706     case CSSValueStart:
   4707         return TA_START;
   4708     case CSSValueMiddle:
   4709         return TA_MIDDLE;
   4710     case CSSValueEnd:
   4711         return TA_END;
   4712     default:
   4713         break;
   4714     }
   4715 
   4716     ASSERT_NOT_REACHED();
   4717     return TA_START;
   4718 }
   4719 
   4720 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SVGWritingMode e)
   4721     : CSSValue(PrimitiveClass)
   4722 {
   4723     m_primitiveUnitType = CSS_VALUE_ID;
   4724     switch (e) {
   4725     case WM_LRTB:
   4726         m_value.valueID = CSSValueLrTb;
   4727         break;
   4728     case WM_LR:
   4729         m_value.valueID = CSSValueLr;
   4730         break;
   4731     case WM_RLTB:
   4732         m_value.valueID = CSSValueRlTb;
   4733         break;
   4734     case WM_RL:
   4735         m_value.valueID = CSSValueRl;
   4736         break;
   4737     case WM_TBRL:
   4738         m_value.valueID = CSSValueTbRl;
   4739         break;
   4740     case WM_TB:
   4741         m_value.valueID = CSSValueTb;
   4742         break;
   4743     }
   4744 }
   4745 
   4746 template<> inline CSSPrimitiveValue::operator SVGWritingMode() const
   4747 {
   4748     ASSERT(isValueID());
   4749     switch (m_value.valueID) {
   4750     case CSSValueLrTb:
   4751         return WM_LRTB;
   4752     case CSSValueLr:
   4753         return WM_LR;
   4754     case CSSValueRlTb:
   4755         return WM_RLTB;
   4756     case CSSValueRl:
   4757         return WM_RL;
   4758     case CSSValueTbRl:
   4759         return WM_TBRL;
   4760     case CSSValueTb:
   4761         return WM_TB;
   4762     default:
   4763         break;
   4764     }
   4765 
   4766     ASSERT_NOT_REACHED();
   4767     return WM_LRTB;
   4768 }
   4769 
   4770 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e)
   4771     : CSSValue(PrimitiveClass)
   4772 {
   4773     m_primitiveUnitType = CSS_VALUE_ID;
   4774     switch (e) {
   4775     case VE_NONE:
   4776         m_value.valueID = CSSValueNone;
   4777         break;
   4778     case VE_NON_SCALING_STROKE:
   4779         m_value.valueID = CSSValueNonScalingStroke;
   4780         break;
   4781     }
   4782 }
   4783 
   4784 template<> inline CSSPrimitiveValue::operator EVectorEffect() const
   4785 {
   4786     ASSERT(isValueID());
   4787     switch (m_value.valueID) {
   4788     case CSSValueNone:
   4789         return VE_NONE;
   4790     case CSSValueNonScalingStroke:
   4791         return VE_NON_SCALING_STROKE;
   4792     default:
   4793         break;
   4794     }
   4795 
   4796     ASSERT_NOT_REACHED();
   4797     return VE_NONE;
   4798 }
   4799 
   4800 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPaintOrderType e)
   4801     : CSSValue(PrimitiveClass)
   4802 {
   4803     m_primitiveUnitType = CSS_VALUE_ID;
   4804     switch (e) {
   4805     case PT_FILL:
   4806         m_value.valueID = CSSValueFill;
   4807         break;
   4808     case PT_STROKE:
   4809         m_value.valueID = CSSValueStroke;
   4810         break;
   4811     case PT_MARKERS:
   4812         m_value.valueID = CSSValueMarkers;
   4813         break;
   4814     default:
   4815         ASSERT_NOT_REACHED();
   4816         m_value.valueID = CSSValueFill;
   4817         break;
   4818     }
   4819 }
   4820 
   4821 template<> inline CSSPrimitiveValue::operator EPaintOrderType() const
   4822 {
   4823     ASSERT(isValueID());
   4824     switch (m_value.valueID) {
   4825     case CSSValueFill:
   4826         return PT_FILL;
   4827     case CSSValueStroke:
   4828         return PT_STROKE;
   4829     case CSSValueMarkers:
   4830         return PT_MARKERS;
   4831     default:
   4832         break;
   4833     }
   4834 
   4835     ASSERT_NOT_REACHED();
   4836     return PT_NONE;
   4837 }
   4838 
   4839 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMaskType e)
   4840     : CSSValue(PrimitiveClass)
   4841 {
   4842     m_primitiveUnitType = CSS_VALUE_ID;
   4843     switch (e) {
   4844     case MT_LUMINANCE:
   4845         m_value.valueID = CSSValueLuminance;
   4846         break;
   4847     case MT_ALPHA:
   4848         m_value.valueID = CSSValueAlpha;
   4849         break;
   4850     }
   4851 }
   4852 
   4853 template<> inline CSSPrimitiveValue::operator EMaskType() const
   4854 {
   4855     ASSERT(isValueID());
   4856     switch (m_value.valueID) {
   4857     case CSSValueLuminance:
   4858         return MT_LUMINANCE;
   4859     case CSSValueAlpha:
   4860         return MT_ALPHA;
   4861     default:
   4862         break;
   4863     }
   4864 
   4865     ASSERT_NOT_REACHED();
   4866     return MT_LUMINANCE;
   4867 }
   4868 
   4869 template<> inline CSSPrimitiveValue::operator TouchAction() const
   4870 {
   4871     ASSERT(isValueID());
   4872     switch (m_value.valueID) {
   4873     case CSSValueNone:
   4874         return TouchActionNone;
   4875     case CSSValueAuto:
   4876         return TouchActionAuto;
   4877     case CSSValuePanX:
   4878         return TouchActionPanX;
   4879     case CSSValuePanY:
   4880         return TouchActionPanY;
   4881     default:
   4882         break;
   4883     }
   4884 
   4885     ASSERT_NOT_REACHED();
   4886     return TouchActionNone;
   4887 }
   4888 
   4889 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EIsolation i)
   4890     : CSSValue(PrimitiveClass)
   4891 {
   4892     m_primitiveUnitType = CSS_VALUE_ID;
   4893     switch (i) {
   4894     case IsolationAuto:
   4895         m_value.valueID = CSSValueAuto;
   4896         break;
   4897     case IsolationIsolate:
   4898         m_value.valueID = CSSValueIsolate;
   4899         break;
   4900     }
   4901 }
   4902 
   4903 template<> inline CSSPrimitiveValue::operator EIsolation() const
   4904 {
   4905     ASSERT(isValueID());
   4906     switch (m_value.valueID) {
   4907     case CSSValueAuto:
   4908         return IsolationAuto;
   4909     case CSSValueIsolate:
   4910         return IsolationIsolate;
   4911     default:
   4912         break;
   4913     }
   4914 
   4915     ASSERT_NOT_REACHED();
   4916     return IsolationAuto;
   4917 }
   4918 
   4919 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchActionDelay t)
   4920     : CSSValue(PrimitiveClass)
   4921 {
   4922     m_primitiveUnitType = CSS_VALUE_ID;
   4923     switch (t) {
   4924     case TouchActionDelayNone:
   4925         m_value.valueID = CSSValueNone;
   4926         break;
   4927     case TouchActionDelayScript:
   4928         m_value.valueID = CSSValueScript;
   4929         break;
   4930     }
   4931 }
   4932 
   4933 template<> inline CSSPrimitiveValue::operator TouchActionDelay() const
   4934 {
   4935     switch (m_value.valueID) {
   4936     case CSSValueNone:
   4937         return TouchActionDelayNone;
   4938     case CSSValueScript:
   4939         return TouchActionDelayScript;
   4940     default:
   4941         break;
   4942     }
   4943 
   4944     ASSERT_NOT_REACHED();
   4945     return TouchActionDelayNone;
   4946 }
   4947 
   4948 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LayoutBox layoutBox)
   4949     : CSSValue(PrimitiveClass)
   4950 {
   4951     m_primitiveUnitType = CSS_VALUE_ID;
   4952     switch (layoutBox) {
   4953     case MarginBox:
   4954         m_value.valueID = CSSValueMarginBox;
   4955         break;
   4956     case BorderBox:
   4957         m_value.valueID = CSSValueBorderBox;
   4958         break;
   4959     case PaddingBox:
   4960         m_value.valueID = CSSValuePaddingBox;
   4961         break;
   4962     case ContentBox:
   4963         m_value.valueID = CSSValueContentBox;
   4964         break;
   4965     }
   4966 }
   4967 
   4968 template<> inline CSSPrimitiveValue::operator LayoutBox() const
   4969 {
   4970     switch (getValueID()) {
   4971     case CSSValueMarginBox:
   4972         return MarginBox;
   4973     case CSSValueBorderBox:
   4974         return BorderBox;
   4975     case CSSValuePaddingBox:
   4976         return PaddingBox;
   4977     case CSSValueContentBox:
   4978         return ContentBox;
   4979     default:
   4980         break;
   4981     }
   4982     ASSERT_NOT_REACHED();
   4983     return ContentBox;
   4984 }
   4985 
   4986 }
   4987 
   4988 #endif
   4989