Oilpan: fix build after r202625.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / css / CSSPrimitiveValueMappings.h
blobffc899ddf67ff4f27940929bb8f6d2cc292078b5
1 /*
2 * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>.
3 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
5 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
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.
30 #ifndef CSSPrimitiveValueMappings_h
31 #define CSSPrimitiveValueMappings_h
33 #include "core/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/style/ComputedStyleConstants.h"
39 #include "core/style/SVGComputedStyleDefs.h"
40 #include "core/style/LineClampValue.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/scroll/ScrollableArea.h"
49 #include "platform/text/TextDirection.h"
50 #include "platform/text/TextRun.h"
51 #include "platform/text/UnicodeBidi.h"
52 #include "platform/text/WritingMode.h"
53 #include "public/platform/WebBlendMode.h"
54 #include "wtf/MathExtras.h"
56 namespace blink {
58 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i)
59 : CSSValue(PrimitiveClass)
61 init(UnitType::Number);
62 m_value.num = static_cast<double>(i);
65 template<> inline CSSPrimitiveValue::operator short() const
67 ASSERT(isNumber());
68 return clampTo<short>(getDoubleValue());
71 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(unsigned short i)
72 : CSSValue(PrimitiveClass)
74 init(UnitType::Number);
75 m_value.num = static_cast<double>(i);
78 template<> inline CSSPrimitiveValue::operator unsigned short() const
80 ASSERT(isNumber());
81 return clampTo<unsigned short>(getDoubleValue());
84 template<> inline CSSPrimitiveValue::operator int() const
86 ASSERT(isNumber());
87 return clampTo<int>(getDoubleValue());
90 template<> inline CSSPrimitiveValue::operator unsigned() const
92 ASSERT(isNumber());
93 return clampTo<unsigned>(getDoubleValue());
97 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(float i)
98 : CSSValue(PrimitiveClass)
100 init(UnitType::Number);
101 m_value.num = static_cast<double>(i);
104 template<> inline CSSPrimitiveValue::operator float() const
106 ASSERT(isNumber());
107 return clampTo<float>(getDoubleValue());
110 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineClampValue i)
111 : CSSValue(PrimitiveClass)
113 init(i.isPercentage() ? UnitType::Percentage : UnitType::Number);
114 m_value.num = static_cast<double>(i.value());
117 template<> inline CSSPrimitiveValue::operator LineClampValue() const
119 if (type() == UnitType::Number)
120 return LineClampValue(clampTo<int>(m_value.num), LineClampLineCount);
122 if (type() == UnitType::Percentage)
123 return LineClampValue(clampTo<int>(m_value.num), LineClampPercentage);
125 ASSERT_NOT_REACHED();
126 return LineClampValue();
129 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSReflectionDirection e)
130 : CSSValue(PrimitiveClass)
132 init(UnitType::ValueID);
133 switch (e) {
134 case ReflectionAbove:
135 m_value.valueID = CSSValueAbove;
136 break;
137 case ReflectionBelow:
138 m_value.valueID = CSSValueBelow;
139 break;
140 case ReflectionLeft:
141 m_value.valueID = CSSValueLeft;
142 break;
143 case ReflectionRight:
144 m_value.valueID = CSSValueRight;
148 template<> inline CSSPrimitiveValue::operator CSSReflectionDirection() const
150 ASSERT(isValueID());
151 switch (m_value.valueID) {
152 case CSSValueAbove:
153 return ReflectionAbove;
154 case CSSValueBelow:
155 return ReflectionBelow;
156 case CSSValueLeft:
157 return ReflectionLeft;
158 case CSSValueRight:
159 return ReflectionRight;
160 default:
161 break;
164 ASSERT_NOT_REACHED();
165 return ReflectionBelow;
168 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill)
169 : CSSValue(PrimitiveClass)
171 init(UnitType::ValueID);
172 switch (columnFill) {
173 case ColumnFillAuto:
174 m_value.valueID = CSSValueAuto;
175 break;
176 case ColumnFillBalance:
177 m_value.valueID = CSSValueBalance;
178 break;
182 template<> inline CSSPrimitiveValue::operator ColumnFill() const
184 if (type() == UnitType::ValueID) {
185 if (m_value.valueID == CSSValueBalance)
186 return ColumnFillBalance;
187 if (m_value.valueID == CSSValueAuto)
188 return ColumnFillAuto;
190 ASSERT_NOT_REACHED();
191 return ColumnFillBalance;
194 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
195 : CSSValue(PrimitiveClass)
197 init(UnitType::ValueID);
198 switch (columnSpan) {
199 case ColumnSpanAll:
200 m_value.valueID = CSSValueAll;
201 break;
202 case ColumnSpanNone:
203 m_value.valueID = CSSValueNone;
204 break;
208 template<> inline CSSPrimitiveValue::operator ColumnSpan() const
210 // Map 1 to none for compatibility reasons.
211 if (type() == UnitType::Number && m_value.num == 1)
212 return ColumnSpanNone;
214 ASSERT(isValueID());
215 switch (m_value.valueID) {
216 case CSSValueAll:
217 return ColumnSpanAll;
218 case CSSValueNone:
219 return ColumnSpanNone;
220 default:
221 break;
224 ASSERT_NOT_REACHED();
225 return ColumnSpanNone;
229 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PrintColorAdjust value)
230 : CSSValue(PrimitiveClass)
232 init(UnitType::ValueID);
233 switch (value) {
234 case PrintColorAdjustExact:
235 m_value.valueID = CSSValueExact;
236 break;
237 case PrintColorAdjustEconomy:
238 m_value.valueID = CSSValueEconomy;
239 break;
243 template<> inline CSSPrimitiveValue::operator PrintColorAdjust() const
245 ASSERT(isValueID());
246 switch (m_value.valueID) {
247 case CSSValueEconomy:
248 return PrintColorAdjustEconomy;
249 case CSSValueExact:
250 return PrintColorAdjustExact;
251 default:
252 break;
255 ASSERT_NOT_REACHED();
256 return PrintColorAdjustEconomy;
260 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
261 : CSSValue(PrimitiveClass)
263 init(UnitType::ValueID);
264 switch (e) {
265 case BNONE:
266 m_value.valueID = CSSValueNone;
267 break;
268 case BHIDDEN:
269 m_value.valueID = CSSValueHidden;
270 break;
271 case INSET:
272 m_value.valueID = CSSValueInset;
273 break;
274 case GROOVE:
275 m_value.valueID = CSSValueGroove;
276 break;
277 case RIDGE:
278 m_value.valueID = CSSValueRidge;
279 break;
280 case OUTSET:
281 m_value.valueID = CSSValueOutset;
282 break;
283 case DOTTED:
284 m_value.valueID = CSSValueDotted;
285 break;
286 case DASHED:
287 m_value.valueID = CSSValueDashed;
288 break;
289 case SOLID:
290 m_value.valueID = CSSValueSolid;
291 break;
292 case DOUBLE:
293 m_value.valueID = CSSValueDouble;
294 break;
298 template<> inline CSSPrimitiveValue::operator EBorderStyle() const
300 ASSERT(isValueID());
301 if (m_value.valueID == CSSValueAuto) // Valid for CSS outline-style
302 return DOTTED;
303 return (EBorderStyle)(m_value.valueID - CSSValueNone);
306 template<> inline CSSPrimitiveValue::operator OutlineIsAuto() const
308 if (m_value.valueID == CSSValueAuto)
309 return AUTO_ON;
310 return AUTO_OFF;
313 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
314 : CSSValue(PrimitiveClass)
316 init(UnitType::ValueID);
317 switch (e) {
318 case CompositeClear:
319 m_value.valueID = CSSValueClear;
320 break;
321 case CompositeCopy:
322 m_value.valueID = CSSValueCopy;
323 break;
324 case CompositeSourceOver:
325 m_value.valueID = CSSValueSourceOver;
326 break;
327 case CompositeSourceIn:
328 m_value.valueID = CSSValueSourceIn;
329 break;
330 case CompositeSourceOut:
331 m_value.valueID = CSSValueSourceOut;
332 break;
333 case CompositeSourceAtop:
334 m_value.valueID = CSSValueSourceAtop;
335 break;
336 case CompositeDestinationOver:
337 m_value.valueID = CSSValueDestinationOver;
338 break;
339 case CompositeDestinationIn:
340 m_value.valueID = CSSValueDestinationIn;
341 break;
342 case CompositeDestinationOut:
343 m_value.valueID = CSSValueDestinationOut;
344 break;
345 case CompositeDestinationAtop:
346 m_value.valueID = CSSValueDestinationAtop;
347 break;
348 case CompositeXOR:
349 m_value.valueID = CSSValueXor;
350 break;
351 case CompositePlusLighter:
352 m_value.valueID = CSSValuePlusLighter;
353 break;
354 default:
355 ASSERT_NOT_REACHED();
356 break;
360 template<> inline CSSPrimitiveValue::operator CompositeOperator() const
362 ASSERT(isValueID());
363 switch (m_value.valueID) {
364 case CSSValueClear:
365 return CompositeClear;
366 case CSSValueCopy:
367 return CompositeCopy;
368 case CSSValueSourceOver:
369 return CompositeSourceOver;
370 case CSSValueSourceIn:
371 return CompositeSourceIn;
372 case CSSValueSourceOut:
373 return CompositeSourceOut;
374 case CSSValueSourceAtop:
375 return CompositeSourceAtop;
376 case CSSValueDestinationOver:
377 return CompositeDestinationOver;
378 case CSSValueDestinationIn:
379 return CompositeDestinationIn;
380 case CSSValueDestinationOut:
381 return CompositeDestinationOut;
382 case CSSValueDestinationAtop:
383 return CompositeDestinationAtop;
384 case CSSValueXor:
385 return CompositeXOR;
386 case CSSValuePlusLighter:
387 return CompositePlusLighter;
388 default:
389 break;
392 ASSERT_NOT_REACHED();
393 return CompositeClear;
396 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
397 : CSSValue(PrimitiveClass)
399 init(UnitType::ValueID);
400 switch (e) {
401 case NoControlPart:
402 m_value.valueID = CSSValueNone;
403 break;
404 case CheckboxPart:
405 m_value.valueID = CSSValueCheckbox;
406 break;
407 case RadioPart:
408 m_value.valueID = CSSValueRadio;
409 break;
410 case PushButtonPart:
411 m_value.valueID = CSSValuePushButton;
412 break;
413 case SquareButtonPart:
414 m_value.valueID = CSSValueSquareButton;
415 break;
416 case ButtonPart:
417 m_value.valueID = CSSValueButton;
418 break;
419 case ButtonBevelPart:
420 m_value.valueID = CSSValueButtonBevel;
421 break;
422 case InnerSpinButtonPart:
423 m_value.valueID = CSSValueInnerSpinButton;
424 break;
425 case ListboxPart:
426 m_value.valueID = CSSValueListbox;
427 break;
428 case ListItemPart:
429 m_value.valueID = CSSValueListitem;
430 break;
431 case MediaEnterFullscreenButtonPart:
432 m_value.valueID = CSSValueMediaEnterFullscreenButton;
433 break;
434 case MediaExitFullscreenButtonPart:
435 m_value.valueID = CSSValueMediaExitFullscreenButton;
436 break;
437 case MediaPlayButtonPart:
438 m_value.valueID = CSSValueMediaPlayButton;
439 break;
440 case MediaOverlayPlayButtonPart:
441 m_value.valueID = CSSValueMediaOverlayPlayButton;
442 break;
443 case MediaMuteButtonPart:
444 m_value.valueID = CSSValueMediaMuteButton;
445 break;
446 case MediaToggleClosedCaptionsButtonPart:
447 m_value.valueID = CSSValueMediaToggleClosedCaptionsButton;
448 break;
449 case MediaCastOffButtonPart:
450 m_value.valueID = CSSValueInternalMediaCastOffButton;
451 break;
452 case MediaOverlayCastOffButtonPart:
453 m_value.valueID = CSSValueInternalMediaOverlayCastOffButton;
454 break;
455 case MediaSliderPart:
456 m_value.valueID = CSSValueMediaSlider;
457 break;
458 case MediaSliderThumbPart:
459 m_value.valueID = CSSValueMediaSliderthumb;
460 break;
461 case MediaVolumeSliderContainerPart:
462 m_value.valueID = CSSValueMediaVolumeSliderContainer;
463 break;
464 case MediaVolumeSliderPart:
465 m_value.valueID = CSSValueMediaVolumeSlider;
466 break;
467 case MediaVolumeSliderThumbPart:
468 m_value.valueID = CSSValueMediaVolumeSliderthumb;
469 break;
470 case MediaControlsBackgroundPart:
471 m_value.valueID = CSSValueMediaControlsBackground;
472 break;
473 case MediaControlsFullscreenBackgroundPart:
474 m_value.valueID = CSSValueMediaControlsFullscreenBackground;
475 break;
476 case MediaFullScreenVolumeSliderPart:
477 m_value.valueID = CSSValueMediaFullscreenVolumeSlider;
478 break;
479 case MediaFullScreenVolumeSliderThumbPart:
480 m_value.valueID = CSSValueMediaFullscreenVolumeSliderThumb;
481 break;
482 case MediaCurrentTimePart:
483 m_value.valueID = CSSValueMediaCurrentTimeDisplay;
484 break;
485 case MediaTimeRemainingPart:
486 m_value.valueID = CSSValueMediaTimeRemainingDisplay;
487 break;
488 case MenulistPart:
489 m_value.valueID = CSSValueMenulist;
490 break;
491 case MenulistButtonPart:
492 m_value.valueID = CSSValueMenulistButton;
493 break;
494 case MenulistTextPart:
495 m_value.valueID = CSSValueMenulistText;
496 break;
497 case MenulistTextFieldPart:
498 m_value.valueID = CSSValueMenulistTextfield;
499 break;
500 case MeterPart:
501 m_value.valueID = CSSValueMeter;
502 break;
503 case RelevancyLevelIndicatorPart:
504 m_value.valueID = CSSValueRelevancyLevelIndicator;
505 break;
506 case ContinuousCapacityLevelIndicatorPart:
507 m_value.valueID = CSSValueContinuousCapacityLevelIndicator;
508 break;
509 case DiscreteCapacityLevelIndicatorPart:
510 m_value.valueID = CSSValueDiscreteCapacityLevelIndicator;
511 break;
512 case RatingLevelIndicatorPart:
513 m_value.valueID = CSSValueRatingLevelIndicator;
514 break;
515 case ProgressBarPart:
516 m_value.valueID = CSSValueProgressBar;
517 break;
518 case ProgressBarValuePart:
519 m_value.valueID = CSSValueProgressBarValue;
520 break;
521 case SliderHorizontalPart:
522 m_value.valueID = CSSValueSliderHorizontal;
523 break;
524 case SliderVerticalPart:
525 m_value.valueID = CSSValueSliderVertical;
526 break;
527 case SliderThumbHorizontalPart:
528 m_value.valueID = CSSValueSliderthumbHorizontal;
529 break;
530 case SliderThumbVerticalPart:
531 m_value.valueID = CSSValueSliderthumbVertical;
532 break;
533 case CaretPart:
534 m_value.valueID = CSSValueCaret;
535 break;
536 case SearchFieldPart:
537 m_value.valueID = CSSValueSearchfield;
538 break;
539 case SearchFieldDecorationPart:
540 m_value.valueID = CSSValueSearchfieldDecoration;
541 break;
542 case SearchFieldResultsDecorationPart:
543 m_value.valueID = CSSValueSearchfieldResultsDecoration;
544 break;
545 case SearchFieldCancelButtonPart:
546 m_value.valueID = CSSValueSearchfieldCancelButton;
547 break;
548 case TextFieldPart:
549 m_value.valueID = CSSValueTextfield;
550 break;
551 case TextAreaPart:
552 m_value.valueID = CSSValueTextarea;
553 break;
554 case CapsLockIndicatorPart:
555 m_value.valueID = CSSValueCapsLockIndicator;
556 break;
560 template<> inline CSSPrimitiveValue::operator ControlPart() const
562 ASSERT(isValueID());
563 if (m_value.valueID == CSSValueNone)
564 return NoControlPart;
565 return ControlPart(m_value.valueID - CSSValueCheckbox + 1);
568 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBackfaceVisibility e)
569 : CSSValue(PrimitiveClass)
571 init(UnitType::ValueID);
572 switch (e) {
573 case BackfaceVisibilityVisible:
574 m_value.valueID = CSSValueVisible;
575 break;
576 case BackfaceVisibilityHidden:
577 m_value.valueID = CSSValueHidden;
578 break;
582 template<> inline CSSPrimitiveValue::operator EBackfaceVisibility() const
584 ASSERT(isValueID());
585 switch (m_value.valueID) {
586 case CSSValueVisible:
587 return BackfaceVisibilityVisible;
588 case CSSValueHidden:
589 return BackfaceVisibilityHidden;
590 default:
591 break;
594 ASSERT_NOT_REACHED();
595 return BackfaceVisibilityHidden;
599 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e)
600 : CSSValue(PrimitiveClass)
602 init(UnitType::ValueID);
603 switch (e) {
604 case ScrollBackgroundAttachment:
605 m_value.valueID = CSSValueScroll;
606 break;
607 case LocalBackgroundAttachment:
608 m_value.valueID = CSSValueLocal;
609 break;
610 case FixedBackgroundAttachment:
611 m_value.valueID = CSSValueFixed;
612 break;
616 template<> inline CSSPrimitiveValue::operator EFillAttachment() const
618 ASSERT(isValueID());
619 switch (m_value.valueID) {
620 case CSSValueScroll:
621 return ScrollBackgroundAttachment;
622 case CSSValueLocal:
623 return LocalBackgroundAttachment;
624 case CSSValueFixed:
625 return FixedBackgroundAttachment;
626 default:
627 break;
630 ASSERT_NOT_REACHED();
631 return ScrollBackgroundAttachment;
634 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
635 : CSSValue(PrimitiveClass)
637 init(UnitType::ValueID);
638 switch (e) {
639 case BorderFillBox:
640 m_value.valueID = CSSValueBorderBox;
641 break;
642 case PaddingFillBox:
643 m_value.valueID = CSSValuePaddingBox;
644 break;
645 case ContentFillBox:
646 m_value.valueID = CSSValueContentBox;
647 break;
648 case TextFillBox:
649 m_value.valueID = CSSValueText;
650 break;
654 template<> inline CSSPrimitiveValue::operator EFillBox() const
656 ASSERT(isValueID());
657 switch (m_value.valueID) {
658 case CSSValueBorder:
659 case CSSValueBorderBox:
660 return BorderFillBox;
661 case CSSValuePadding:
662 case CSSValuePaddingBox:
663 return PaddingFillBox;
664 case CSSValueContent:
665 case CSSValueContentBox:
666 return ContentFillBox;
667 case CSSValueText:
668 case CSSValueWebkitText:
669 return TextFillBox;
670 default:
671 break;
674 ASSERT_NOT_REACHED();
675 return BorderFillBox;
678 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)
679 : CSSValue(PrimitiveClass)
681 init(UnitType::ValueID);
682 switch (e) {
683 case RepeatFill:
684 m_value.valueID = CSSValueRepeat;
685 break;
686 case NoRepeatFill:
687 m_value.valueID = CSSValueNoRepeat;
688 break;
689 case RoundFill:
690 m_value.valueID = CSSValueRound;
691 break;
692 case SpaceFill:
693 m_value.valueID = CSSValueSpace;
694 break;
698 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
700 ASSERT(isValueID());
701 switch (m_value.valueID) {
702 case CSSValueRepeat:
703 return RepeatFill;
704 case CSSValueNoRepeat:
705 return NoRepeatFill;
706 case CSSValueRound:
707 return RoundFill;
708 case CSSValueSpace:
709 return SpaceFill;
710 default:
711 break;
714 ASSERT_NOT_REACHED();
715 return RepeatFill;
718 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxPack e)
719 : CSSValue(PrimitiveClass)
721 init(UnitType::ValueID);
722 switch (e) {
723 case Start:
724 m_value.valueID = CSSValueStart;
725 break;
726 case Center:
727 m_value.valueID = CSSValueCenter;
728 break;
729 case End:
730 m_value.valueID = CSSValueEnd;
731 break;
732 case Justify:
733 m_value.valueID = CSSValueJustify;
734 break;
738 template<> inline CSSPrimitiveValue::operator EBoxPack() const
740 ASSERT(isValueID());
741 switch (m_value.valueID) {
742 case CSSValueStart:
743 return Start;
744 case CSSValueEnd:
745 return End;
746 case CSSValueCenter:
747 return Center;
748 case CSSValueJustify:
749 return Justify;
750 default:
751 break;
754 ASSERT_NOT_REACHED();
755 return Justify;
758 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)
759 : CSSValue(PrimitiveClass)
761 init(UnitType::ValueID);
762 switch (e) {
763 case BSTRETCH:
764 m_value.valueID = CSSValueStretch;
765 break;
766 case BSTART:
767 m_value.valueID = CSSValueStart;
768 break;
769 case BCENTER:
770 m_value.valueID = CSSValueCenter;
771 break;
772 case BEND:
773 m_value.valueID = CSSValueEnd;
774 break;
775 case BBASELINE:
776 m_value.valueID = CSSValueBaseline;
777 break;
781 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
783 ASSERT(isValueID());
784 switch (m_value.valueID) {
785 case CSSValueStretch:
786 return BSTRETCH;
787 case CSSValueStart:
788 return BSTART;
789 case CSSValueEnd:
790 return BEND;
791 case CSSValueCenter:
792 return BCENTER;
793 case CSSValueBaseline:
794 return BBASELINE;
795 default:
796 break;
799 ASSERT_NOT_REACHED();
800 return BSTRETCH;
803 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDecorationBreak e)
804 : CSSValue(PrimitiveClass)
806 init(UnitType::ValueID);
807 switch (e) {
808 case DSLICE:
809 m_value.valueID = CSSValueSlice;
810 break;
811 case DCLONE:
812 m_value.valueID = CSSValueClone;
813 break;
817 template<> inline CSSPrimitiveValue::operator EBoxDecorationBreak() const
819 ASSERT(isValueID());
820 switch (m_value.valueID) {
821 case CSSValueSlice:
822 return DSLICE;
823 case CSSValueClone:
824 return DCLONE;
825 default:
826 break;
829 ASSERT_NOT_REACHED();
830 return DSLICE;
833 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BackgroundEdgeOrigin e)
834 : CSSValue(PrimitiveClass)
836 init(UnitType::ValueID);
837 switch (e) {
838 case TopEdge:
839 m_value.valueID = CSSValueTop;
840 break;
841 case RightEdge:
842 m_value.valueID = CSSValueRight;
843 break;
844 case BottomEdge:
845 m_value.valueID = CSSValueBottom;
846 break;
847 case LeftEdge:
848 m_value.valueID = CSSValueLeft;
849 break;
853 template<> inline CSSPrimitiveValue::operator BackgroundEdgeOrigin() const
855 ASSERT(isValueID());
856 switch (m_value.valueID) {
857 case CSSValueTop:
858 return TopEdge;
859 case CSSValueRight:
860 return RightEdge;
861 case CSSValueBottom:
862 return BottomEdge;
863 case CSSValueLeft:
864 return LeftEdge;
865 default:
866 break;
869 ASSERT_NOT_REACHED();
870 return TopEdge;
873 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxSizing e)
874 : CSSValue(PrimitiveClass)
876 init(UnitType::ValueID);
877 switch (e) {
878 case BORDER_BOX:
879 m_value.valueID = CSSValueBorderBox;
880 break;
881 case CONTENT_BOX:
882 m_value.valueID = CSSValueContentBox;
883 break;
887 template<> inline CSSPrimitiveValue::operator EBoxSizing() const
889 ASSERT(isValueID());
890 switch (m_value.valueID) {
891 case CSSValueBorderBox:
892 return BORDER_BOX;
893 case CSSValueContentBox:
894 return CONTENT_BOX;
895 default:
896 break;
899 ASSERT_NOT_REACHED();
900 return BORDER_BOX;
903 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
904 : CSSValue(PrimitiveClass)
906 init(UnitType::ValueID);
907 switch (e) {
908 case BNORMAL:
909 m_value.valueID = CSSValueNormal;
910 break;
911 case BREVERSE:
912 m_value.valueID = CSSValueReverse;
913 break;
917 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
919 ASSERT(isValueID());
920 switch (m_value.valueID) {
921 case CSSValueNormal:
922 return BNORMAL;
923 case CSSValueReverse:
924 return BREVERSE;
925 default:
926 break;
929 ASSERT_NOT_REACHED();
930 return BNORMAL;
933 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)
934 : CSSValue(PrimitiveClass)
936 init(UnitType::ValueID);
937 switch (e) {
938 case SINGLE:
939 m_value.valueID = CSSValueSingle;
940 break;
941 case MULTIPLE:
942 m_value.valueID = CSSValueMultiple;
943 break;
947 template<> inline CSSPrimitiveValue::operator EBoxLines() const
949 ASSERT(isValueID());
950 switch (m_value.valueID) {
951 case CSSValueSingle:
952 return SINGLE;
953 case CSSValueMultiple:
954 return MULTIPLE;
955 default:
956 break;
959 ASSERT_NOT_REACHED();
960 return SINGLE;
963 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)
964 : CSSValue(PrimitiveClass)
966 init(UnitType::ValueID);
967 switch (e) {
968 case HORIZONTAL:
969 m_value.valueID = CSSValueHorizontal;
970 break;
971 case VERTICAL:
972 m_value.valueID = CSSValueVertical;
973 break;
977 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
979 ASSERT(isValueID());
980 switch (m_value.valueID) {
981 case CSSValueHorizontal:
982 case CSSValueInlineAxis:
983 return HORIZONTAL;
984 case CSSValueVertical:
985 case CSSValueBlockAxis:
986 return VERTICAL;
987 default:
988 break;
991 ASSERT_NOT_REACHED();
992 return HORIZONTAL;
995 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)
996 : CSSValue(PrimitiveClass)
998 init(UnitType::ValueID);
999 switch (e) {
1000 case CAPLEFT:
1001 m_value.valueID = CSSValueLeft;
1002 break;
1003 case CAPRIGHT:
1004 m_value.valueID = CSSValueRight;
1005 break;
1006 case CAPTOP:
1007 m_value.valueID = CSSValueTop;
1008 break;
1009 case CAPBOTTOM:
1010 m_value.valueID = CSSValueBottom;
1011 break;
1015 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
1017 ASSERT(isValueID());
1018 switch (m_value.valueID) {
1019 case CSSValueLeft:
1020 return CAPLEFT;
1021 case CSSValueRight:
1022 return CAPRIGHT;
1023 case CSSValueTop:
1024 return CAPTOP;
1025 case CSSValueBottom:
1026 return CAPBOTTOM;
1027 default:
1028 break;
1031 ASSERT_NOT_REACHED();
1032 return CAPTOP;
1035 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)
1036 : CSSValue(PrimitiveClass)
1038 init(UnitType::ValueID);
1039 switch (e) {
1040 case CNONE:
1041 m_value.valueID = CSSValueNone;
1042 break;
1043 case CLEFT:
1044 m_value.valueID = CSSValueLeft;
1045 break;
1046 case CRIGHT:
1047 m_value.valueID = CSSValueRight;
1048 break;
1049 case CBOTH:
1050 m_value.valueID = CSSValueBoth;
1051 break;
1055 template<> inline CSSPrimitiveValue::operator EClear() const
1057 ASSERT(isValueID());
1058 switch (m_value.valueID) {
1059 case CSSValueNone:
1060 return CNONE;
1061 case CSSValueLeft:
1062 return CLEFT;
1063 case CSSValueRight:
1064 return CRIGHT;
1065 case CSSValueBoth:
1066 return CBOTH;
1067 default:
1068 break;
1071 ASSERT_NOT_REACHED();
1072 return CNONE;
1075 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e)
1076 : CSSValue(PrimitiveClass)
1078 init(UnitType::ValueID);
1079 switch (e) {
1080 case CURSOR_AUTO:
1081 m_value.valueID = CSSValueAuto;
1082 break;
1083 case CURSOR_CROSS:
1084 m_value.valueID = CSSValueCrosshair;
1085 break;
1086 case CURSOR_DEFAULT:
1087 m_value.valueID = CSSValueDefault;
1088 break;
1089 case CURSOR_POINTER:
1090 m_value.valueID = CSSValuePointer;
1091 break;
1092 case CURSOR_MOVE:
1093 m_value.valueID = CSSValueMove;
1094 break;
1095 case CURSOR_CELL:
1096 m_value.valueID = CSSValueCell;
1097 break;
1098 case CURSOR_VERTICAL_TEXT:
1099 m_value.valueID = CSSValueVerticalText;
1100 break;
1101 case CURSOR_CONTEXT_MENU:
1102 m_value.valueID = CSSValueContextMenu;
1103 break;
1104 case CURSOR_ALIAS:
1105 m_value.valueID = CSSValueAlias;
1106 break;
1107 case CURSOR_COPY:
1108 m_value.valueID = CSSValueCopy;
1109 break;
1110 case CURSOR_NONE:
1111 m_value.valueID = CSSValueNone;
1112 break;
1113 case CURSOR_PROGRESS:
1114 m_value.valueID = CSSValueProgress;
1115 break;
1116 case CURSOR_NO_DROP:
1117 m_value.valueID = CSSValueNoDrop;
1118 break;
1119 case CURSOR_NOT_ALLOWED:
1120 m_value.valueID = CSSValueNotAllowed;
1121 break;
1122 case CURSOR_ZOOM_IN:
1123 m_value.valueID = CSSValueZoomIn;
1124 break;
1125 case CURSOR_ZOOM_OUT:
1126 m_value.valueID = CSSValueZoomOut;
1127 break;
1128 case CURSOR_E_RESIZE:
1129 m_value.valueID = CSSValueEResize;
1130 break;
1131 case CURSOR_NE_RESIZE:
1132 m_value.valueID = CSSValueNeResize;
1133 break;
1134 case CURSOR_NW_RESIZE:
1135 m_value.valueID = CSSValueNwResize;
1136 break;
1137 case CURSOR_N_RESIZE:
1138 m_value.valueID = CSSValueNResize;
1139 break;
1140 case CURSOR_SE_RESIZE:
1141 m_value.valueID = CSSValueSeResize;
1142 break;
1143 case CURSOR_SW_RESIZE:
1144 m_value.valueID = CSSValueSwResize;
1145 break;
1146 case CURSOR_S_RESIZE:
1147 m_value.valueID = CSSValueSResize;
1148 break;
1149 case CURSOR_W_RESIZE:
1150 m_value.valueID = CSSValueWResize;
1151 break;
1152 case CURSOR_EW_RESIZE:
1153 m_value.valueID = CSSValueEwResize;
1154 break;
1155 case CURSOR_NS_RESIZE:
1156 m_value.valueID = CSSValueNsResize;
1157 break;
1158 case CURSOR_NESW_RESIZE:
1159 m_value.valueID = CSSValueNeswResize;
1160 break;
1161 case CURSOR_NWSE_RESIZE:
1162 m_value.valueID = CSSValueNwseResize;
1163 break;
1164 case CURSOR_COL_RESIZE:
1165 m_value.valueID = CSSValueColResize;
1166 break;
1167 case CURSOR_ROW_RESIZE:
1168 m_value.valueID = CSSValueRowResize;
1169 break;
1170 case CURSOR_TEXT:
1171 m_value.valueID = CSSValueText;
1172 break;
1173 case CURSOR_WAIT:
1174 m_value.valueID = CSSValueWait;
1175 break;
1176 case CURSOR_HELP:
1177 m_value.valueID = CSSValueHelp;
1178 break;
1179 case CURSOR_ALL_SCROLL:
1180 m_value.valueID = CSSValueAllScroll;
1181 break;
1182 case CURSOR_WEBKIT_GRAB:
1183 m_value.valueID = CSSValueWebkitGrab;
1184 break;
1185 case CURSOR_WEBKIT_GRABBING:
1186 m_value.valueID = CSSValueWebkitGrabbing;
1187 break;
1191 template<> inline CSSPrimitiveValue::operator ECursor() const
1193 ASSERT(isValueID());
1194 switch (m_value.valueID) {
1195 case CSSValueCopy:
1196 return CURSOR_COPY;
1197 case CSSValueWebkitZoomIn:
1198 return CURSOR_ZOOM_IN;
1199 case CSSValueWebkitZoomOut:
1200 return CURSOR_ZOOM_OUT;
1201 case CSSValueNone:
1202 return CURSOR_NONE;
1203 default:
1204 return static_cast<ECursor>(m_value.valueID - CSSValueAuto);
1208 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e)
1209 : CSSValue(PrimitiveClass)
1211 init(UnitType::ValueID);
1212 switch (e) {
1213 case INLINE:
1214 m_value.valueID = CSSValueInline;
1215 break;
1216 case BLOCK:
1217 m_value.valueID = CSSValueBlock;
1218 break;
1219 case LIST_ITEM:
1220 m_value.valueID = CSSValueListItem;
1221 break;
1222 case INLINE_BLOCK:
1223 m_value.valueID = CSSValueInlineBlock;
1224 break;
1225 case TABLE:
1226 m_value.valueID = CSSValueTable;
1227 break;
1228 case INLINE_TABLE:
1229 m_value.valueID = CSSValueInlineTable;
1230 break;
1231 case TABLE_ROW_GROUP:
1232 m_value.valueID = CSSValueTableRowGroup;
1233 break;
1234 case TABLE_HEADER_GROUP:
1235 m_value.valueID = CSSValueTableHeaderGroup;
1236 break;
1237 case TABLE_FOOTER_GROUP:
1238 m_value.valueID = CSSValueTableFooterGroup;
1239 break;
1240 case TABLE_ROW:
1241 m_value.valueID = CSSValueTableRow;
1242 break;
1243 case TABLE_COLUMN_GROUP:
1244 m_value.valueID = CSSValueTableColumnGroup;
1245 break;
1246 case TABLE_COLUMN:
1247 m_value.valueID = CSSValueTableColumn;
1248 break;
1249 case TABLE_CELL:
1250 m_value.valueID = CSSValueTableCell;
1251 break;
1252 case TABLE_CAPTION:
1253 m_value.valueID = CSSValueTableCaption;
1254 break;
1255 case BOX:
1256 m_value.valueID = CSSValueWebkitBox;
1257 break;
1258 case INLINE_BOX:
1259 m_value.valueID = CSSValueWebkitInlineBox;
1260 break;
1261 case FLEX:
1262 m_value.valueID = CSSValueFlex;
1263 break;
1264 case INLINE_FLEX:
1265 m_value.valueID = CSSValueInlineFlex;
1266 break;
1267 case GRID:
1268 m_value.valueID = CSSValueGrid;
1269 break;
1270 case INLINE_GRID:
1271 m_value.valueID = CSSValueInlineGrid;
1272 break;
1273 case NONE:
1274 m_value.valueID = CSSValueNone;
1275 break;
1279 template<> inline CSSPrimitiveValue::operator EDisplay() const
1281 ASSERT(isValueID());
1282 if (m_value.valueID == CSSValueNone)
1283 return NONE;
1285 if (m_value.valueID == CSSValueWebkitFlex)
1286 return FLEX;
1287 if (m_value.valueID == CSSValueWebkitInlineFlex)
1288 return INLINE_FLEX;
1290 EDisplay display = static_cast<EDisplay>(m_value.valueID - CSSValueInline);
1291 ASSERT(display >= INLINE && display <= NONE);
1292 return display;
1295 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e)
1296 : CSSValue(PrimitiveClass)
1298 init(UnitType::ValueID);
1299 switch (e) {
1300 case SHOW:
1301 m_value.valueID = CSSValueShow;
1302 break;
1303 case HIDE:
1304 m_value.valueID = CSSValueHide;
1305 break;
1309 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
1311 ASSERT(isValueID());
1312 switch (m_value.valueID) {
1313 case CSSValueShow:
1314 return SHOW;
1315 case CSSValueHide:
1316 return HIDE;
1317 default:
1318 break;
1321 ASSERT_NOT_REACHED();
1322 return SHOW;
1325 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e)
1326 : CSSValue(PrimitiveClass)
1328 init(UnitType::ValueID);
1329 switch (e) {
1330 case FlowRow:
1331 m_value.valueID = CSSValueRow;
1332 break;
1333 case FlowRowReverse:
1334 m_value.valueID = CSSValueRowReverse;
1335 break;
1336 case FlowColumn:
1337 m_value.valueID = CSSValueColumn;
1338 break;
1339 case FlowColumnReverse:
1340 m_value.valueID = CSSValueColumnReverse;
1341 break;
1345 template<> inline CSSPrimitiveValue::operator EFlexDirection() const
1347 ASSERT(isValueID());
1348 switch (m_value.valueID) {
1349 case CSSValueRow:
1350 return FlowRow;
1351 case CSSValueRowReverse:
1352 return FlowRowReverse;
1353 case CSSValueColumn:
1354 return FlowColumn;
1355 case CSSValueColumnReverse:
1356 return FlowColumnReverse;
1357 default:
1358 break;
1361 ASSERT_NOT_REACHED();
1362 return FlowRow;
1365 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexWrap e)
1366 : CSSValue(PrimitiveClass)
1368 init(UnitType::ValueID);
1369 switch (e) {
1370 case FlexNoWrap:
1371 m_value.valueID = CSSValueNowrap;
1372 break;
1373 case FlexWrap:
1374 m_value.valueID = CSSValueWrap;
1375 break;
1376 case FlexWrapReverse:
1377 m_value.valueID = CSSValueWrapReverse;
1378 break;
1382 template<> inline CSSPrimitiveValue::operator EFlexWrap() const
1384 ASSERT(isValueID());
1385 switch (m_value.valueID) {
1386 case CSSValueNowrap:
1387 return FlexNoWrap;
1388 case CSSValueWrap:
1389 return FlexWrap;
1390 case CSSValueWrapReverse:
1391 return FlexWrapReverse;
1392 default:
1393 break;
1396 ASSERT_NOT_REACHED();
1397 return FlexNoWrap;
1400 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
1401 : CSSValue(PrimitiveClass)
1403 init(UnitType::ValueID);
1404 switch (e) {
1405 case NoFloat:
1406 m_value.valueID = CSSValueNone;
1407 break;
1408 case LeftFloat:
1409 m_value.valueID = CSSValueLeft;
1410 break;
1411 case RightFloat:
1412 m_value.valueID = CSSValueRight;
1413 break;
1417 template<> inline CSSPrimitiveValue::operator EFloat() const
1419 ASSERT(isValueID());
1420 switch (m_value.valueID) {
1421 case CSSValueLeft:
1422 return LeftFloat;
1423 case CSSValueRight:
1424 return RightFloat;
1425 case CSSValueNone:
1426 return NoFloat;
1427 default:
1428 break;
1431 ASSERT_NOT_REACHED();
1432 return NoFloat;
1435 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineBreak e)
1436 : CSSValue(PrimitiveClass)
1438 init(UnitType::ValueID);
1439 switch (e) {
1440 case LineBreakAuto:
1441 m_value.valueID = CSSValueAuto;
1442 break;
1443 case LineBreakLoose:
1444 m_value.valueID = CSSValueLoose;
1445 break;
1446 case LineBreakNormal:
1447 m_value.valueID = CSSValueNormal;
1448 break;
1449 case LineBreakStrict:
1450 m_value.valueID = CSSValueStrict;
1451 break;
1452 case LineBreakAfterWhiteSpace:
1453 m_value.valueID = CSSValueAfterWhiteSpace;
1454 break;
1458 template<> inline CSSPrimitiveValue::operator LineBreak() const
1460 ASSERT(isValueID());
1461 switch (m_value.valueID) {
1462 case CSSValueAuto:
1463 return LineBreakAuto;
1464 case CSSValueLoose:
1465 return LineBreakLoose;
1466 case CSSValueNormal:
1467 return LineBreakNormal;
1468 case CSSValueStrict:
1469 return LineBreakStrict;
1470 case CSSValueAfterWhiteSpace:
1471 return LineBreakAfterWhiteSpace;
1472 default:
1473 break;
1476 ASSERT_NOT_REACHED();
1477 return LineBreakAuto;
1480 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
1481 : CSSValue(PrimitiveClass)
1483 init(UnitType::ValueID);
1484 switch (e) {
1485 case OUTSIDE:
1486 m_value.valueID = CSSValueOutside;
1487 break;
1488 case INSIDE:
1489 m_value.valueID = CSSValueInside;
1490 break;
1494 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
1496 ASSERT(isValueID());
1497 switch (m_value.valueID) {
1498 case CSSValueOutside:
1499 return OUTSIDE;
1500 case CSSValueInside:
1501 return INSIDE;
1502 default:
1503 break;
1506 ASSERT_NOT_REACHED();
1507 return OUTSIDE;
1510 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
1511 : CSSValue(PrimitiveClass)
1513 init(UnitType::ValueID);
1514 switch (e) {
1515 case ArabicIndic:
1516 m_value.valueID = CSSValueArabicIndic;
1517 break;
1518 case Armenian:
1519 m_value.valueID = CSSValueArmenian;
1520 break;
1521 case Bengali:
1522 m_value.valueID = CSSValueBengali;
1523 break;
1524 case Cambodian:
1525 m_value.valueID = CSSValueCambodian;
1526 break;
1527 case Circle:
1528 m_value.valueID = CSSValueCircle;
1529 break;
1530 case CjkEarthlyBranch:
1531 m_value.valueID = CSSValueCjkEarthlyBranch;
1532 break;
1533 case CjkHeavenlyStem:
1534 m_value.valueID = CSSValueCjkHeavenlyStem;
1535 break;
1536 case CJKIdeographic:
1537 m_value.valueID = CSSValueCjkIdeographic;
1538 break;
1539 case DecimalLeadingZero:
1540 m_value.valueID = CSSValueDecimalLeadingZero;
1541 break;
1542 case DecimalListStyle:
1543 m_value.valueID = CSSValueDecimal;
1544 break;
1545 case Devanagari:
1546 m_value.valueID = CSSValueDevanagari;
1547 break;
1548 case Disc:
1549 m_value.valueID = CSSValueDisc;
1550 break;
1551 case EthiopicHalehame:
1552 m_value.valueID = CSSValueEthiopicHalehame;
1553 break;
1554 case EthiopicHalehameAm:
1555 m_value.valueID = CSSValueEthiopicHalehameAm;
1556 break;
1557 case EthiopicHalehameTiEt:
1558 m_value.valueID = CSSValueEthiopicHalehameTiEt;
1559 break;
1560 case EthiopicHalehameTiEr:
1561 m_value.valueID = CSSValueEthiopicHalehameTiEr;
1562 break;
1563 case Georgian:
1564 m_value.valueID = CSSValueGeorgian;
1565 break;
1566 case Gujarati:
1567 m_value.valueID = CSSValueGujarati;
1568 break;
1569 case Gurmukhi:
1570 m_value.valueID = CSSValueGurmukhi;
1571 break;
1572 case Hangul:
1573 m_value.valueID = CSSValueHangul;
1574 break;
1575 case HangulConsonant:
1576 m_value.valueID = CSSValueHangulConsonant;
1577 break;
1578 case KoreanHangulFormal:
1579 m_value.valueID = CSSValueKoreanHangulFormal;
1580 break;
1581 case KoreanHanjaFormal:
1582 m_value.valueID = CSSValueKoreanHanjaFormal;
1583 break;
1584 case KoreanHanjaInformal:
1585 m_value.valueID = CSSValueKoreanHanjaInformal;
1586 break;
1587 case Hebrew:
1588 m_value.valueID = CSSValueHebrew;
1589 break;
1590 case Hiragana:
1591 m_value.valueID = CSSValueHiragana;
1592 break;
1593 case HiraganaIroha:
1594 m_value.valueID = CSSValueHiraganaIroha;
1595 break;
1596 case Kannada:
1597 m_value.valueID = CSSValueKannada;
1598 break;
1599 case Katakana:
1600 m_value.valueID = CSSValueKatakana;
1601 break;
1602 case KatakanaIroha:
1603 m_value.valueID = CSSValueKatakanaIroha;
1604 break;
1605 case Khmer:
1606 m_value.valueID = CSSValueKhmer;
1607 break;
1608 case Lao:
1609 m_value.valueID = CSSValueLao;
1610 break;
1611 case LowerAlpha:
1612 m_value.valueID = CSSValueLowerAlpha;
1613 break;
1614 case LowerArmenian:
1615 m_value.valueID = CSSValueLowerArmenian;
1616 break;
1617 case LowerGreek:
1618 m_value.valueID = CSSValueLowerGreek;
1619 break;
1620 case LowerLatin:
1621 m_value.valueID = CSSValueLowerLatin;
1622 break;
1623 case LowerRoman:
1624 m_value.valueID = CSSValueLowerRoman;
1625 break;
1626 case Malayalam:
1627 m_value.valueID = CSSValueMalayalam;
1628 break;
1629 case Mongolian:
1630 m_value.valueID = CSSValueMongolian;
1631 break;
1632 case Myanmar:
1633 m_value.valueID = CSSValueMyanmar;
1634 break;
1635 case NoneListStyle:
1636 m_value.valueID = CSSValueNone;
1637 break;
1638 case Oriya:
1639 m_value.valueID = CSSValueOriya;
1640 break;
1641 case Persian:
1642 m_value.valueID = CSSValuePersian;
1643 break;
1644 case SimpChineseFormal:
1645 m_value.valueID = CSSValueSimpChineseFormal;
1646 break;
1647 case SimpChineseInformal:
1648 m_value.valueID = CSSValueSimpChineseInformal;
1649 break;
1650 case Square:
1651 m_value.valueID = CSSValueSquare;
1652 break;
1653 case Telugu:
1654 m_value.valueID = CSSValueTelugu;
1655 break;
1656 case Thai:
1657 m_value.valueID = CSSValueThai;
1658 break;
1659 case Tibetan:
1660 m_value.valueID = CSSValueTibetan;
1661 break;
1662 case TradChineseFormal:
1663 m_value.valueID = CSSValueTradChineseFormal;
1664 break;
1665 case TradChineseInformal:
1666 m_value.valueID = CSSValueTradChineseInformal;
1667 break;
1668 case UpperAlpha:
1669 m_value.valueID = CSSValueUpperAlpha;
1670 break;
1671 case UpperArmenian:
1672 m_value.valueID = CSSValueUpperArmenian;
1673 break;
1674 case UpperLatin:
1675 m_value.valueID = CSSValueUpperLatin;
1676 break;
1677 case UpperRoman:
1678 m_value.valueID = CSSValueUpperRoman;
1679 break;
1680 case Urdu:
1681 m_value.valueID = CSSValueUrdu;
1682 break;
1686 template<> inline CSSPrimitiveValue::operator EListStyleType() const
1688 ASSERT(isValueID());
1689 switch (m_value.valueID) {
1690 case CSSValueNone:
1691 return NoneListStyle;
1692 default:
1693 return static_cast<EListStyleType>(m_value.valueID - CSSValueDisc);
1697 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e)
1698 : CSSValue(PrimitiveClass)
1700 init(UnitType::ValueID);
1701 switch (e) {
1702 case MCOLLAPSE:
1703 m_value.valueID = CSSValueCollapse;
1704 break;
1705 case MSEPARATE:
1706 m_value.valueID = CSSValueSeparate;
1707 break;
1708 case MDISCARD:
1709 m_value.valueID = CSSValueDiscard;
1710 break;
1714 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
1716 ASSERT(isValueID());
1717 switch (m_value.valueID) {
1718 case CSSValueCollapse:
1719 return MCOLLAPSE;
1720 case CSSValueSeparate:
1721 return MSEPARATE;
1722 case CSSValueDiscard:
1723 return MDISCARD;
1724 default:
1725 break;
1728 ASSERT_NOT_REACHED();
1729 return MCOLLAPSE;
1732 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e)
1733 : CSSValue(PrimitiveClass)
1735 init(UnitType::ValueID);
1736 switch (e) {
1737 case OVISIBLE:
1738 m_value.valueID = CSSValueVisible;
1739 break;
1740 case OHIDDEN:
1741 m_value.valueID = CSSValueHidden;
1742 break;
1743 case OSCROLL:
1744 m_value.valueID = CSSValueScroll;
1745 break;
1746 case OAUTO:
1747 m_value.valueID = CSSValueAuto;
1748 break;
1749 case OOVERLAY:
1750 m_value.valueID = CSSValueOverlay;
1751 break;
1752 case OPAGEDX:
1753 m_value.valueID = CSSValueWebkitPagedX;
1754 break;
1755 case OPAGEDY:
1756 m_value.valueID = CSSValueWebkitPagedY;
1757 break;
1761 template<> inline CSSPrimitiveValue::operator EOverflow() const
1763 ASSERT(isValueID());
1764 switch (m_value.valueID) {
1765 case CSSValueVisible:
1766 return OVISIBLE;
1767 case CSSValueHidden:
1768 return OHIDDEN;
1769 case CSSValueScroll:
1770 return OSCROLL;
1771 case CSSValueAuto:
1772 return OAUTO;
1773 case CSSValueOverlay:
1774 return OOVERLAY;
1775 case CSSValueWebkitPagedX:
1776 return OPAGEDX;
1777 case CSSValueWebkitPagedY:
1778 return OPAGEDY;
1779 default:
1780 break;
1783 ASSERT_NOT_REACHED();
1784 return OVISIBLE;
1787 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
1788 : CSSValue(PrimitiveClass)
1790 init(UnitType::ValueID);
1791 switch (e) {
1792 case PBAUTO:
1793 m_value.valueID = CSSValueAuto;
1794 break;
1795 case PBALWAYS:
1796 m_value.valueID = CSSValueAlways;
1797 break;
1798 case PBAVOID:
1799 m_value.valueID = CSSValueAvoid;
1800 break;
1804 template<> inline CSSPrimitiveValue::operator EPageBreak() const
1806 ASSERT(isValueID());
1807 switch (m_value.valueID) {
1808 case CSSValueAuto:
1809 return PBAUTO;
1810 case CSSValueLeft:
1811 case CSSValueRight:
1812 case CSSValueAlways:
1813 return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always."
1814 case CSSValueAvoid:
1815 return PBAVOID;
1816 default:
1817 break;
1820 ASSERT_NOT_REACHED();
1821 return PBAUTO;
1824 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
1825 : CSSValue(PrimitiveClass)
1827 init(UnitType::ValueID);
1828 switch (e) {
1829 case StaticPosition:
1830 m_value.valueID = CSSValueStatic;
1831 break;
1832 case RelativePosition:
1833 m_value.valueID = CSSValueRelative;
1834 break;
1835 case AbsolutePosition:
1836 m_value.valueID = CSSValueAbsolute;
1837 break;
1838 case FixedPosition:
1839 m_value.valueID = CSSValueFixed;
1840 break;
1841 case StickyPosition:
1842 m_value.valueID = CSSValueSticky;
1843 break;
1847 template<> inline CSSPrimitiveValue::operator EPosition() const
1849 ASSERT(isValueID());
1850 switch (m_value.valueID) {
1851 case CSSValueStatic:
1852 return StaticPosition;
1853 case CSSValueRelative:
1854 return RelativePosition;
1855 case CSSValueAbsolute:
1856 return AbsolutePosition;
1857 case CSSValueFixed:
1858 return FixedPosition;
1859 case CSSValueSticky:
1860 return StickyPosition;
1861 default:
1862 break;
1865 ASSERT_NOT_REACHED();
1866 return StaticPosition;
1869 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e)
1870 : CSSValue(PrimitiveClass)
1872 init(UnitType::ValueID);
1873 switch (e) {
1874 case RESIZE_BOTH:
1875 m_value.valueID = CSSValueBoth;
1876 break;
1877 case RESIZE_HORIZONTAL:
1878 m_value.valueID = CSSValueHorizontal;
1879 break;
1880 case RESIZE_VERTICAL:
1881 m_value.valueID = CSSValueVertical;
1882 break;
1883 case RESIZE_NONE:
1884 m_value.valueID = CSSValueNone;
1885 break;
1889 template<> inline CSSPrimitiveValue::operator EResize() const
1891 ASSERT(isValueID());
1892 switch (m_value.valueID) {
1893 case CSSValueBoth:
1894 return RESIZE_BOTH;
1895 case CSSValueHorizontal:
1896 return RESIZE_HORIZONTAL;
1897 case CSSValueVertical:
1898 return RESIZE_VERTICAL;
1899 case CSSValueAuto:
1900 ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
1901 return RESIZE_NONE;
1902 case CSSValueNone:
1903 return RESIZE_NONE;
1904 default:
1905 break;
1908 ASSERT_NOT_REACHED();
1909 return RESIZE_NONE;
1912 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e)
1913 : CSSValue(PrimitiveClass)
1915 init(UnitType::ValueID);
1916 switch (e) {
1917 case TAUTO:
1918 m_value.valueID = CSSValueAuto;
1919 break;
1920 case TFIXED:
1921 m_value.valueID = CSSValueFixed;
1922 break;
1926 template<> inline CSSPrimitiveValue::operator ETableLayout() const
1928 ASSERT(isValueID());
1929 switch (m_value.valueID) {
1930 case CSSValueFixed:
1931 return TFIXED;
1932 case CSSValueAuto:
1933 return TAUTO;
1934 default:
1935 break;
1938 ASSERT_NOT_REACHED();
1939 return TAUTO;
1942 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
1943 : CSSValue(PrimitiveClass)
1945 init(UnitType::ValueID);
1946 switch (e) {
1947 case TASTART:
1948 m_value.valueID = CSSValueStart;
1949 break;
1950 case TAEND:
1951 m_value.valueID = CSSValueEnd;
1952 break;
1953 case LEFT:
1954 m_value.valueID = CSSValueLeft;
1955 break;
1956 case RIGHT:
1957 m_value.valueID = CSSValueRight;
1958 break;
1959 case CENTER:
1960 m_value.valueID = CSSValueCenter;
1961 break;
1962 case JUSTIFY:
1963 m_value.valueID = CSSValueJustify;
1964 break;
1965 case WEBKIT_LEFT:
1966 m_value.valueID = CSSValueWebkitLeft;
1967 break;
1968 case WEBKIT_RIGHT:
1969 m_value.valueID = CSSValueWebkitRight;
1970 break;
1971 case WEBKIT_CENTER:
1972 m_value.valueID = CSSValueWebkitCenter;
1973 break;
1977 template<> inline CSSPrimitiveValue::operator ETextAlign() const
1979 ASSERT(isValueID());
1980 switch (m_value.valueID) {
1981 case CSSValueWebkitAuto: // Legacy -webkit-auto. Eqiuvalent to start.
1982 case CSSValueStart:
1983 return TASTART;
1984 case CSSValueEnd:
1985 return TAEND;
1986 default:
1987 return static_cast<ETextAlign>(m_value.valueID - CSSValueLeft);
1991 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAlignLast e)
1992 : CSSValue(PrimitiveClass)
1994 init(UnitType::ValueID);
1995 switch (e) {
1996 case TextAlignLastStart:
1997 m_value.valueID = CSSValueStart;
1998 break;
1999 case TextAlignLastEnd:
2000 m_value.valueID = CSSValueEnd;
2001 break;
2002 case TextAlignLastLeft:
2003 m_value.valueID = CSSValueLeft;
2004 break;
2005 case TextAlignLastRight:
2006 m_value.valueID = CSSValueRight;
2007 break;
2008 case TextAlignLastCenter:
2009 m_value.valueID = CSSValueCenter;
2010 break;
2011 case TextAlignLastJustify:
2012 m_value.valueID = CSSValueJustify;
2013 break;
2014 case TextAlignLastAuto:
2015 m_value.valueID = CSSValueAuto;
2016 break;
2020 template<> inline CSSPrimitiveValue::operator TextAlignLast() const
2022 ASSERT(isValueID());
2023 switch (m_value.valueID) {
2024 case CSSValueAuto:
2025 return TextAlignLastAuto;
2026 case CSSValueStart:
2027 return TextAlignLastStart;
2028 case CSSValueEnd:
2029 return TextAlignLastEnd;
2030 case CSSValueLeft:
2031 return TextAlignLastLeft;
2032 case CSSValueRight:
2033 return TextAlignLastRight;
2034 case CSSValueCenter:
2035 return TextAlignLastCenter;
2036 case CSSValueJustify:
2037 return TextAlignLastJustify;
2038 default:
2039 break;
2042 ASSERT_NOT_REACHED();
2043 return TextAlignLastAuto;
2046 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e)
2047 : CSSValue(PrimitiveClass)
2049 init(UnitType::ValueID);
2050 switch (e) {
2051 case TextJustifyAuto:
2052 m_value.valueID = CSSValueAuto;
2053 break;
2054 case TextJustifyNone:
2055 m_value.valueID = CSSValueNone;
2056 break;
2057 case TextJustifyInterWord:
2058 m_value.valueID = CSSValueInterWord;
2059 break;
2060 case TextJustifyDistribute:
2061 m_value.valueID = CSSValueDistribute;
2062 break;
2066 template<> inline CSSPrimitiveValue::operator TextJustify() const
2068 switch (m_value.valueID) {
2069 case CSSValueAuto:
2070 return TextJustifyAuto;
2071 case CSSValueNone:
2072 return TextJustifyNone;
2073 case CSSValueInterWord:
2074 return TextJustifyInterWord;
2075 case CSSValueDistribute:
2076 return TextJustifyDistribute;
2077 default:
2078 break;
2081 ASSERT_NOT_REACHED();
2082 return TextJustifyAuto;
2085 template<> inline CSSPrimitiveValue::operator TextDecoration() const
2087 ASSERT(isValueID());
2088 switch (m_value.valueID) {
2089 case CSSValueNone:
2090 return TextDecorationNone;
2091 case CSSValueUnderline:
2092 return TextDecorationUnderline;
2093 case CSSValueOverline:
2094 return TextDecorationOverline;
2095 case CSSValueLineThrough:
2096 return TextDecorationLineThrough;
2097 case CSSValueBlink:
2098 return TextDecorationBlink;
2099 default:
2100 break;
2103 ASSERT_NOT_REACHED();
2104 return TextDecorationNone;
2107 template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const
2109 ASSERT(isValueID());
2110 switch (m_value.valueID) {
2111 case CSSValueSolid:
2112 return TextDecorationStyleSolid;
2113 case CSSValueDouble:
2114 return TextDecorationStyleDouble;
2115 case CSSValueDotted:
2116 return TextDecorationStyleDotted;
2117 case CSSValueDashed:
2118 return TextDecorationStyleDashed;
2119 case CSSValueWavy:
2120 return TextDecorationStyleWavy;
2121 default:
2122 break;
2125 ASSERT_NOT_REACHED();
2126 return TextDecorationStyleSolid;
2129 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextUnderlinePosition e)
2130 : CSSValue(PrimitiveClass)
2132 init(UnitType::ValueID);
2133 switch (e) {
2134 case TextUnderlinePositionAuto:
2135 m_value.valueID = CSSValueAuto;
2136 break;
2137 case TextUnderlinePositionUnder:
2138 m_value.valueID = CSSValueUnder;
2139 break;
2142 // FIXME: Implement support for 'under left' and 'under right' values.
2145 template<> inline CSSPrimitiveValue::operator TextUnderlinePosition() const
2147 ASSERT(isValueID());
2148 switch (m_value.valueID) {
2149 case CSSValueAuto:
2150 return TextUnderlinePositionAuto;
2151 case CSSValueUnder:
2152 return TextUnderlinePositionUnder;
2153 default:
2154 break;
2157 // FIXME: Implement support for 'under left' and 'under right' values.
2159 ASSERT_NOT_REACHED();
2160 return TextUnderlinePositionAuto;
2163 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
2164 : CSSValue(PrimitiveClass)
2166 init(UnitType::ValueID);
2167 switch (e) {
2168 case TSNONE:
2169 m_value.valueID = CSSValueNone;
2170 break;
2171 case TSDISC:
2172 m_value.valueID = CSSValueDisc;
2173 break;
2174 case TSCIRCLE:
2175 m_value.valueID = CSSValueCircle;
2176 break;
2177 case TSSQUARE:
2178 m_value.valueID = CSSValueSquare;
2179 break;
2183 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
2185 ASSERT(isValueID());
2186 switch (m_value.valueID) {
2187 case CSSValueNone:
2188 return TSNONE;
2189 case CSSValueDisc:
2190 return TSDISC;
2191 case CSSValueCircle:
2192 return TSCIRCLE;
2193 case CSSValueSquare:
2194 return TSSQUARE;
2195 default:
2196 break;
2199 ASSERT_NOT_REACHED();
2200 return TSNONE;
2203 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e)
2204 : CSSValue(PrimitiveClass)
2206 init(UnitType::ValueID);
2207 switch (e) {
2208 case CAPITALIZE:
2209 m_value.valueID = CSSValueCapitalize;
2210 break;
2211 case UPPERCASE:
2212 m_value.valueID = CSSValueUppercase;
2213 break;
2214 case LOWERCASE:
2215 m_value.valueID = CSSValueLowercase;
2216 break;
2217 case TTNONE:
2218 m_value.valueID = CSSValueNone;
2219 break;
2223 template<> inline CSSPrimitiveValue::operator ETextTransform() const
2225 ASSERT(isValueID());
2226 switch (m_value.valueID) {
2227 case CSSValueCapitalize:
2228 return CAPITALIZE;
2229 case CSSValueUppercase:
2230 return UPPERCASE;
2231 case CSSValueLowercase:
2232 return LOWERCASE;
2233 case CSSValueNone:
2234 return TTNONE;
2235 default:
2236 break;
2239 ASSERT_NOT_REACHED();
2240 return TTNONE;
2243 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
2244 : CSSValue(PrimitiveClass)
2246 init(UnitType::ValueID);
2247 switch (e) {
2248 case UBNormal:
2249 m_value.valueID = CSSValueNormal;
2250 break;
2251 case Embed:
2252 m_value.valueID = CSSValueEmbed;
2253 break;
2254 case Override:
2255 m_value.valueID = CSSValueBidiOverride;
2256 break;
2257 case Isolate:
2258 m_value.valueID = CSSValueWebkitIsolate;
2259 break;
2260 case IsolateOverride:
2261 m_value.valueID = CSSValueWebkitIsolateOverride;
2262 break;
2263 case Plaintext:
2264 m_value.valueID = CSSValueWebkitPlaintext;
2265 break;
2269 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
2271 ASSERT(isValueID());
2272 switch (m_value.valueID) {
2273 case CSSValueNormal:
2274 return UBNormal;
2275 case CSSValueEmbed:
2276 return Embed;
2277 case CSSValueBidiOverride:
2278 return Override;
2279 case CSSValueWebkitIsolate:
2280 return Isolate;
2281 case CSSValueWebkitIsolateOverride:
2282 return IsolateOverride;
2283 case CSSValueWebkitPlaintext:
2284 return Plaintext;
2285 default:
2286 break;
2289 ASSERT_NOT_REACHED();
2290 return UBNormal;
2293 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e)
2294 : CSSValue(PrimitiveClass)
2296 init(UnitType::ValueID);
2297 switch (e) {
2298 case DRAG_AUTO:
2299 m_value.valueID = CSSValueAuto;
2300 break;
2301 case DRAG_NONE:
2302 m_value.valueID = CSSValueNone;
2303 break;
2304 case DRAG_ELEMENT:
2305 m_value.valueID = CSSValueElement;
2306 break;
2307 default:
2308 break;
2312 template<> inline CSSPrimitiveValue::operator EUserDrag() const
2314 ASSERT(isValueID());
2315 switch (m_value.valueID) {
2316 case CSSValueAuto:
2317 return DRAG_AUTO;
2318 case CSSValueNone:
2319 return DRAG_NONE;
2320 case CSSValueElement:
2321 return DRAG_ELEMENT;
2322 default:
2323 break;
2326 ASSERT_NOT_REACHED();
2327 return DRAG_AUTO;
2330 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)
2331 : CSSValue(PrimitiveClass)
2333 init(UnitType::ValueID);
2334 switch (e) {
2335 case READ_ONLY:
2336 m_value.valueID = CSSValueReadOnly;
2337 break;
2338 case READ_WRITE:
2339 m_value.valueID = CSSValueReadWrite;
2340 break;
2341 case READ_WRITE_PLAINTEXT_ONLY:
2342 m_value.valueID = CSSValueReadWritePlaintextOnly;
2343 break;
2347 template<> inline CSSPrimitiveValue::operator EUserModify() const
2349 ASSERT(isValueID());
2350 switch (m_value.valueID) {
2351 case CSSValueReadOnly:
2352 return READ_ONLY;
2353 case CSSValueReadWrite:
2354 return READ_WRITE;
2355 case CSSValueReadWritePlaintextOnly:
2356 return READ_WRITE_PLAINTEXT_ONLY;
2357 default:
2358 break;
2361 ASSERT_NOT_REACHED();
2362 return READ_ONLY;
2365 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
2366 : CSSValue(PrimitiveClass)
2368 init(UnitType::ValueID);
2369 switch (e) {
2370 case SELECT_NONE:
2371 m_value.valueID = CSSValueNone;
2372 break;
2373 case SELECT_TEXT:
2374 m_value.valueID = CSSValueText;
2375 break;
2376 case SELECT_ALL:
2377 m_value.valueID = CSSValueAll;
2378 break;
2382 template<> inline CSSPrimitiveValue::operator EUserSelect() const
2384 ASSERT(isValueID());
2385 switch (m_value.valueID) {
2386 case CSSValueAuto:
2387 return SELECT_TEXT;
2388 case CSSValueNone:
2389 return SELECT_NONE;
2390 case CSSValueText:
2391 return SELECT_TEXT;
2392 case CSSValueAll:
2393 return SELECT_ALL;
2394 default:
2395 break;
2398 ASSERT_NOT_REACHED();
2399 return SELECT_TEXT;
2402 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVerticalAlign a)
2403 : CSSValue(PrimitiveClass)
2405 init(UnitType::ValueID);
2406 switch (a) {
2407 case TOP:
2408 m_value.valueID = CSSValueTop;
2409 break;
2410 case BOTTOM:
2411 m_value.valueID = CSSValueBottom;
2412 break;
2413 case MIDDLE:
2414 m_value.valueID = CSSValueMiddle;
2415 break;
2416 case BASELINE:
2417 m_value.valueID = CSSValueBaseline;
2418 break;
2419 case TEXT_BOTTOM:
2420 m_value.valueID = CSSValueTextBottom;
2421 break;
2422 case TEXT_TOP:
2423 m_value.valueID = CSSValueTextTop;
2424 break;
2425 case SUB:
2426 m_value.valueID = CSSValueSub;
2427 break;
2428 case SUPER:
2429 m_value.valueID = CSSValueSuper;
2430 break;
2431 case BASELINE_MIDDLE:
2432 m_value.valueID = CSSValueWebkitBaselineMiddle;
2433 break;
2434 case LENGTH:
2435 m_value.valueID = CSSValueInvalid;
2439 template<> inline CSSPrimitiveValue::operator EVerticalAlign() const
2441 ASSERT(isValueID());
2442 switch (m_value.valueID) {
2443 case CSSValueTop:
2444 return TOP;
2445 case CSSValueBottom:
2446 return BOTTOM;
2447 case CSSValueMiddle:
2448 return MIDDLE;
2449 case CSSValueBaseline:
2450 return BASELINE;
2451 case CSSValueTextBottom:
2452 return TEXT_BOTTOM;
2453 case CSSValueTextTop:
2454 return TEXT_TOP;
2455 case CSSValueSub:
2456 return SUB;
2457 case CSSValueSuper:
2458 return SUPER;
2459 case CSSValueWebkitBaselineMiddle:
2460 return BASELINE_MIDDLE;
2461 default:
2462 break;
2465 ASSERT_NOT_REACHED();
2466 return TOP;
2469 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e)
2470 : CSSValue(PrimitiveClass)
2472 init(UnitType::ValueID);
2473 switch (e) {
2474 case VISIBLE:
2475 m_value.valueID = CSSValueVisible;
2476 break;
2477 case HIDDEN:
2478 m_value.valueID = CSSValueHidden;
2479 break;
2480 case COLLAPSE:
2481 m_value.valueID = CSSValueCollapse;
2482 break;
2486 template<> inline CSSPrimitiveValue::operator EVisibility() const
2488 ASSERT(isValueID());
2489 switch (m_value.valueID) {
2490 case CSSValueHidden:
2491 return HIDDEN;
2492 case CSSValueVisible:
2493 return VISIBLE;
2494 case CSSValueCollapse:
2495 return COLLAPSE;
2496 default:
2497 break;
2500 ASSERT_NOT_REACHED();
2501 return VISIBLE;
2504 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e)
2505 : CSSValue(PrimitiveClass)
2507 init(UnitType::ValueID);
2508 switch (e) {
2509 case NORMAL:
2510 m_value.valueID = CSSValueNormal;
2511 break;
2512 case PRE:
2513 m_value.valueID = CSSValuePre;
2514 break;
2515 case PRE_WRAP:
2516 m_value.valueID = CSSValuePreWrap;
2517 break;
2518 case PRE_LINE:
2519 m_value.valueID = CSSValuePreLine;
2520 break;
2521 case NOWRAP:
2522 m_value.valueID = CSSValueNowrap;
2523 break;
2524 case KHTML_NOWRAP:
2525 m_value.valueID = CSSValueWebkitNowrap;
2526 break;
2530 template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
2532 ASSERT(isValueID());
2533 switch (m_value.valueID) {
2534 case CSSValueWebkitNowrap:
2535 return KHTML_NOWRAP;
2536 case CSSValueNowrap:
2537 return NOWRAP;
2538 case CSSValuePre:
2539 return PRE;
2540 case CSSValuePreWrap:
2541 return PRE_WRAP;
2542 case CSSValuePreLine:
2543 return PRE_LINE;
2544 case CSSValueNormal:
2545 return NORMAL;
2546 default:
2547 break;
2550 ASSERT_NOT_REACHED();
2551 return NORMAL;
2554 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e)
2555 : CSSValue(PrimitiveClass)
2557 init(UnitType::ValueID);
2558 switch (e) {
2559 case NormalWordBreak:
2560 m_value.valueID = CSSValueNormal;
2561 break;
2562 case BreakAllWordBreak:
2563 m_value.valueID = CSSValueBreakAll;
2564 break;
2565 case BreakWordBreak:
2566 m_value.valueID = CSSValueBreakWord;
2567 break;
2568 case KeepAllWordBreak:
2569 m_value.valueID = CSSValueKeepAll;
2570 break;
2574 template<> inline CSSPrimitiveValue::operator EWordBreak() const
2576 ASSERT(isValueID());
2577 switch (m_value.valueID) {
2578 case CSSValueBreakAll:
2579 return BreakAllWordBreak;
2580 case CSSValueBreakWord:
2581 return BreakWordBreak;
2582 case CSSValueNormal:
2583 return NormalWordBreak;
2584 case CSSValueKeepAll:
2585 return KeepAllWordBreak;
2586 default:
2587 break;
2590 ASSERT_NOT_REACHED();
2591 return NormalWordBreak;
2594 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflowWrap e)
2595 : CSSValue(PrimitiveClass)
2597 init(UnitType::ValueID);
2598 switch (e) {
2599 case NormalOverflowWrap:
2600 m_value.valueID = CSSValueNormal;
2601 break;
2602 case BreakOverflowWrap:
2603 m_value.valueID = CSSValueBreakWord;
2604 break;
2608 template<> inline CSSPrimitiveValue::operator EOverflowWrap() const
2610 ASSERT(isValueID());
2611 switch (m_value.valueID) {
2612 case CSSValueBreakWord:
2613 return BreakOverflowWrap;
2614 case CSSValueNormal:
2615 return NormalOverflowWrap;
2616 default:
2617 break;
2620 ASSERT_NOT_REACHED();
2621 return NormalOverflowWrap;
2624 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
2625 : CSSValue(PrimitiveClass)
2627 init(UnitType::ValueID);
2628 switch (e) {
2629 case LTR:
2630 m_value.valueID = CSSValueLtr;
2631 break;
2632 case RTL:
2633 m_value.valueID = CSSValueRtl;
2634 break;
2638 template<> inline CSSPrimitiveValue::operator TextDirection() const
2640 ASSERT(isValueID());
2641 switch (m_value.valueID) {
2642 case CSSValueLtr:
2643 return LTR;
2644 case CSSValueRtl:
2645 return RTL;
2646 default:
2647 break;
2650 ASSERT_NOT_REACHED();
2651 return LTR;
2654 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e)
2655 : CSSValue(PrimitiveClass)
2657 init(UnitType::ValueID);
2658 switch (e) {
2659 case TopToBottomWritingMode:
2660 m_value.valueID = CSSValueHorizontalTb;
2661 break;
2662 case RightToLeftWritingMode:
2663 m_value.valueID = CSSValueVerticalRl;
2664 break;
2665 case LeftToRightWritingMode:
2666 m_value.valueID = CSSValueVerticalLr;
2667 break;
2668 case BottomToTopWritingMode:
2669 m_value.valueID = CSSValueHorizontalBt;
2670 break;
2674 template<> inline CSSPrimitiveValue::operator WritingMode() const
2676 ASSERT(isValueID());
2677 switch (m_value.valueID) {
2678 case CSSValueHorizontalTb:
2679 return TopToBottomWritingMode;
2680 case CSSValueVerticalRl:
2681 return RightToLeftWritingMode;
2682 case CSSValueVerticalLr:
2683 return LeftToRightWritingMode;
2684 case CSSValueHorizontalBt:
2685 return BottomToTopWritingMode;
2686 default:
2687 break;
2690 ASSERT_NOT_REACHED();
2691 return TopToBottomWritingMode;
2694 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e)
2695 : CSSValue(PrimitiveClass)
2697 init(UnitType::ValueID);
2698 switch (e) {
2699 case TextCombineNone:
2700 m_value.valueID = CSSValueNone;
2701 break;
2702 case TextCombineHorizontal:
2703 m_value.valueID = CSSValueHorizontal;
2704 break;
2708 template<> inline CSSPrimitiveValue::operator TextCombine() const
2710 ASSERT(isValueID());
2711 switch (m_value.valueID) {
2712 case CSSValueNone:
2713 return TextCombineNone;
2714 case CSSValueHorizontal:
2715 return TextCombineHorizontal;
2716 default:
2717 break;
2720 ASSERT_NOT_REACHED();
2721 return TextCombineNone;
2724 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position)
2725 : CSSValue(PrimitiveClass)
2727 init(UnitType::ValueID);
2728 switch (position) {
2729 case RubyPositionBefore:
2730 m_value.valueID = CSSValueBefore;
2731 break;
2732 case RubyPositionAfter:
2733 m_value.valueID = CSSValueAfter;
2734 break;
2738 template<> inline CSSPrimitiveValue::operator RubyPosition() const
2740 ASSERT(isValueID());
2741 switch (m_value.valueID) {
2742 case CSSValueBefore:
2743 return RubyPositionBefore;
2744 case CSSValueAfter:
2745 return RubyPositionAfter;
2746 default:
2747 break;
2750 ASSERT_NOT_REACHED();
2751 return RubyPositionBefore;
2754 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position)
2755 : CSSValue(PrimitiveClass)
2757 init(UnitType::ValueID);
2758 switch (position) {
2759 case TextEmphasisPositionOver:
2760 m_value.valueID = CSSValueOver;
2761 break;
2762 case TextEmphasisPositionUnder:
2763 m_value.valueID = CSSValueUnder;
2764 break;
2768 template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const
2770 ASSERT(isValueID());
2771 switch (m_value.valueID) {
2772 case CSSValueOver:
2773 return TextEmphasisPositionOver;
2774 case CSSValueUnder:
2775 return TextEmphasisPositionUnder;
2776 default:
2777 break;
2780 ASSERT_NOT_REACHED();
2781 return TextEmphasisPositionOver;
2784 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow)
2785 : CSSValue(PrimitiveClass)
2787 init(UnitType::ValueID);
2788 switch (overflow) {
2789 case TextOverflowClip:
2790 m_value.valueID = CSSValueClip;
2791 break;
2792 case TextOverflowEllipsis:
2793 m_value.valueID = CSSValueEllipsis;
2794 break;
2798 template<> inline CSSPrimitiveValue::operator TextOverflow() const
2800 ASSERT(isValueID());
2801 switch (m_value.valueID) {
2802 case CSSValueClip:
2803 return TextOverflowClip;
2804 case CSSValueEllipsis:
2805 return TextOverflowEllipsis;
2806 default:
2807 break;
2810 ASSERT_NOT_REACHED();
2811 return TextOverflowClip;
2814 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill)
2815 : CSSValue(PrimitiveClass)
2817 init(UnitType::ValueID);
2818 switch (fill) {
2819 case TextEmphasisFillFilled:
2820 m_value.valueID = CSSValueFilled;
2821 break;
2822 case TextEmphasisFillOpen:
2823 m_value.valueID = CSSValueOpen;
2824 break;
2828 template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
2830 ASSERT(isValueID());
2831 switch (m_value.valueID) {
2832 case CSSValueFilled:
2833 return TextEmphasisFillFilled;
2834 case CSSValueOpen:
2835 return TextEmphasisFillOpen;
2836 default:
2837 break;
2840 ASSERT_NOT_REACHED();
2841 return TextEmphasisFillFilled;
2844 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark)
2845 : CSSValue(PrimitiveClass)
2847 init(UnitType::ValueID);
2848 switch (mark) {
2849 case TextEmphasisMarkDot:
2850 m_value.valueID = CSSValueDot;
2851 break;
2852 case TextEmphasisMarkCircle:
2853 m_value.valueID = CSSValueCircle;
2854 break;
2855 case TextEmphasisMarkDoubleCircle:
2856 m_value.valueID = CSSValueDoubleCircle;
2857 break;
2858 case TextEmphasisMarkTriangle:
2859 m_value.valueID = CSSValueTriangle;
2860 break;
2861 case TextEmphasisMarkSesame:
2862 m_value.valueID = CSSValueSesame;
2863 break;
2864 case TextEmphasisMarkNone:
2865 case TextEmphasisMarkAuto:
2866 case TextEmphasisMarkCustom:
2867 ASSERT_NOT_REACHED();
2868 m_value.valueID = CSSValueNone;
2869 break;
2873 template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
2875 ASSERT(isValueID());
2876 switch (m_value.valueID) {
2877 case CSSValueNone:
2878 return TextEmphasisMarkNone;
2879 case CSSValueDot:
2880 return TextEmphasisMarkDot;
2881 case CSSValueCircle:
2882 return TextEmphasisMarkCircle;
2883 case CSSValueDoubleCircle:
2884 return TextEmphasisMarkDoubleCircle;
2885 case CSSValueTriangle:
2886 return TextEmphasisMarkTriangle;
2887 case CSSValueSesame:
2888 return TextEmphasisMarkSesame;
2889 default:
2890 break;
2893 ASSERT_NOT_REACHED();
2894 return TextEmphasisMarkNone;
2897 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e)
2898 : CSSValue(PrimitiveClass)
2900 init(UnitType::ValueID);
2901 switch (e) {
2902 case TextOrientationSideways:
2903 m_value.valueID = CSSValueSideways;
2904 break;
2905 case TextOrientationSidewaysRight:
2906 m_value.valueID = CSSValueSidewaysRight;
2907 break;
2908 case TextOrientationVerticalRight:
2909 m_value.valueID = CSSValueVerticalRight;
2910 break;
2911 case TextOrientationUpright:
2912 m_value.valueID = CSSValueUpright;
2913 break;
2917 template<> inline CSSPrimitiveValue::operator TextOrientation() const
2919 ASSERT(isValueID());
2920 switch (m_value.valueID) {
2921 case CSSValueSideways:
2922 return TextOrientationSideways;
2923 case CSSValueSidewaysRight:
2924 return TextOrientationSidewaysRight;
2925 case CSSValueVerticalRight:
2926 return TextOrientationVerticalRight;
2927 case CSSValueUpright:
2928 return TextOrientationUpright;
2929 default:
2930 break;
2933 ASSERT_NOT_REACHED();
2934 return TextOrientationVerticalRight;
2937 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
2938 : CSSValue(PrimitiveClass)
2940 init(UnitType::ValueID);
2941 switch (e) {
2942 case PE_NONE:
2943 m_value.valueID = CSSValueNone;
2944 break;
2945 case PE_STROKE:
2946 m_value.valueID = CSSValueStroke;
2947 break;
2948 case PE_FILL:
2949 m_value.valueID = CSSValueFill;
2950 break;
2951 case PE_PAINTED:
2952 m_value.valueID = CSSValuePainted;
2953 break;
2954 case PE_VISIBLE:
2955 m_value.valueID = CSSValueVisible;
2956 break;
2957 case PE_VISIBLE_STROKE:
2958 m_value.valueID = CSSValueVisibleStroke;
2959 break;
2960 case PE_VISIBLE_FILL:
2961 m_value.valueID = CSSValueVisibleFill;
2962 break;
2963 case PE_VISIBLE_PAINTED:
2964 m_value.valueID = CSSValueVisiblePainted;
2965 break;
2966 case PE_AUTO:
2967 m_value.valueID = CSSValueAuto;
2968 break;
2969 case PE_ALL:
2970 m_value.valueID = CSSValueAll;
2971 break;
2972 case PE_BOUNDINGBOX:
2973 m_value.valueID = CSSValueBoundingBox;
2974 break;
2978 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
2980 ASSERT(isValueID());
2981 switch (m_value.valueID) {
2982 case CSSValueAll:
2983 return PE_ALL;
2984 case CSSValueAuto:
2985 return PE_AUTO;
2986 case CSSValueNone:
2987 return PE_NONE;
2988 case CSSValueVisiblePainted:
2989 return PE_VISIBLE_PAINTED;
2990 case CSSValueVisibleFill:
2991 return PE_VISIBLE_FILL;
2992 case CSSValueVisibleStroke:
2993 return PE_VISIBLE_STROKE;
2994 case CSSValueVisible:
2995 return PE_VISIBLE;
2996 case CSSValuePainted:
2997 return PE_PAINTED;
2998 case CSSValueFill:
2999 return PE_FILL;
3000 case CSSValueStroke:
3001 return PE_STROKE;
3002 case CSSValueBoundingBox:
3003 return PE_BOUNDINGBOX;
3004 default:
3005 break;
3008 ASSERT_NOT_REACHED();
3009 return PE_ALL;
3012 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning)
3013 : CSSValue(PrimitiveClass)
3015 init(UnitType::ValueID);
3016 switch (kerning) {
3017 case FontDescription::AutoKerning:
3018 m_value.valueID = CSSValueAuto;
3019 return;
3020 case FontDescription::NormalKerning:
3021 m_value.valueID = CSSValueNormal;
3022 return;
3023 case FontDescription::NoneKerning:
3024 m_value.valueID = CSSValueNone;
3025 return;
3028 ASSERT_NOT_REACHED();
3029 m_value.valueID = CSSValueAuto;
3032 template<> inline CSSPrimitiveValue::operator FontDescription::Kerning() const
3034 ASSERT(isValueID());
3035 switch (m_value.valueID) {
3036 case CSSValueAuto:
3037 return FontDescription::AutoKerning;
3038 case CSSValueNormal:
3039 return FontDescription::NormalKerning;
3040 case CSSValueNone:
3041 return FontDescription::NoneKerning;
3042 default:
3043 break;
3046 ASSERT_NOT_REACHED();
3047 return FontDescription::AutoKerning;
3050 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ObjectFit fit)
3051 : CSSValue(PrimitiveClass)
3053 init(UnitType::ValueID);
3054 switch (fit) {
3055 case ObjectFitFill:
3056 m_value.valueID = CSSValueFill;
3057 break;
3058 case ObjectFitContain:
3059 m_value.valueID = CSSValueContain;
3060 break;
3061 case ObjectFitCover:
3062 m_value.valueID = CSSValueCover;
3063 break;
3064 case ObjectFitNone:
3065 m_value.valueID = CSSValueNone;
3066 break;
3067 case ObjectFitScaleDown:
3068 m_value.valueID = CSSValueScaleDown;
3069 break;
3073 template<> inline CSSPrimitiveValue::operator ObjectFit() const
3075 switch (m_value.valueID) {
3076 case CSSValueFill:
3077 return ObjectFitFill;
3078 case CSSValueContain:
3079 return ObjectFitContain;
3080 case CSSValueCover:
3081 return ObjectFitCover;
3082 case CSSValueNone:
3083 return ObjectFitNone;
3084 case CSSValueScaleDown:
3085 return ObjectFitScaleDown;
3086 default:
3087 ASSERT_NOT_REACHED();
3088 return ObjectFitFill;
3092 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillSizeType fillSize)
3093 : CSSValue(PrimitiveClass)
3095 init(UnitType::ValueID);
3096 switch (fillSize) {
3097 case Contain:
3098 m_value.valueID = CSSValueContain;
3099 break;
3100 case Cover:
3101 m_value.valueID = CSSValueCover;
3102 break;
3103 case SizeNone:
3104 m_value.valueID = CSSValueNone;
3105 break;
3106 case SizeLength:
3107 default:
3108 ASSERT_NOT_REACHED();
3112 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
3113 : CSSValue(PrimitiveClass)
3115 init(UnitType::ValueID);
3116 switch (smoothing) {
3117 case AutoSmoothing:
3118 m_value.valueID = CSSValueAuto;
3119 return;
3120 case NoSmoothing:
3121 m_value.valueID = CSSValueNone;
3122 return;
3123 case Antialiased:
3124 m_value.valueID = CSSValueAntialiased;
3125 return;
3126 case SubpixelAntialiased:
3127 m_value.valueID = CSSValueSubpixelAntialiased;
3128 return;
3131 ASSERT_NOT_REACHED();
3132 m_value.valueID = CSSValueAuto;
3135 template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
3137 ASSERT(isValueID());
3138 switch (m_value.valueID) {
3139 case CSSValueAuto:
3140 return AutoSmoothing;
3141 case CSSValueNone:
3142 return NoSmoothing;
3143 case CSSValueAntialiased:
3144 return Antialiased;
3145 case CSSValueSubpixelAntialiased:
3146 return SubpixelAntialiased;
3147 default:
3148 break;
3151 ASSERT_NOT_REACHED();
3152 return AutoSmoothing;
3155 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontWeight weight)
3156 : CSSValue(PrimitiveClass)
3158 init(UnitType::ValueID);
3159 switch (weight) {
3160 case FontWeight900:
3161 m_value.valueID = CSSValue900;
3162 return;
3163 case FontWeight800:
3164 m_value.valueID = CSSValue800;
3165 return;
3166 case FontWeight700:
3167 m_value.valueID = CSSValueBold;
3168 return;
3169 case FontWeight600:
3170 m_value.valueID = CSSValue600;
3171 return;
3172 case FontWeight500:
3173 m_value.valueID = CSSValue500;
3174 return;
3175 case FontWeight400:
3176 m_value.valueID = CSSValueNormal;
3177 return;
3178 case FontWeight300:
3179 m_value.valueID = CSSValue300;
3180 return;
3181 case FontWeight200:
3182 m_value.valueID = CSSValue200;
3183 return;
3184 case FontWeight100:
3185 m_value.valueID = CSSValue100;
3186 return;
3189 ASSERT_NOT_REACHED();
3190 m_value.valueID = CSSValueNormal;
3193 template<> inline CSSPrimitiveValue::operator FontWeight() const
3195 ASSERT(isValueID());
3196 switch (m_value.valueID) {
3197 case CSSValueBold:
3198 return FontWeightBold;
3199 case CSSValueNormal:
3200 return FontWeightNormal;
3201 case CSSValue900:
3202 return FontWeight900;
3203 case CSSValue800:
3204 return FontWeight800;
3205 case CSSValue700:
3206 return FontWeight700;
3207 case CSSValue600:
3208 return FontWeight600;
3209 case CSSValue500:
3210 return FontWeight500;
3211 case CSSValue400:
3212 return FontWeight400;
3213 case CSSValue300:
3214 return FontWeight300;
3215 case CSSValue200:
3216 return FontWeight200;
3217 case CSSValue100:
3218 return FontWeight100;
3219 default:
3220 break;
3223 ASSERT_NOT_REACHED();
3224 return FontWeightNormal;
3227 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontStyle italic)
3228 : CSSValue(PrimitiveClass)
3230 init(UnitType::ValueID);
3231 switch (italic) {
3232 case FontStyleNormal:
3233 m_value.valueID = CSSValueNormal;
3234 return;
3235 case FontStyleOblique:
3236 m_value.valueID = CSSValueOblique;
3237 return;
3238 case FontStyleItalic:
3239 m_value.valueID = CSSValueItalic;
3240 return;
3243 ASSERT_NOT_REACHED();
3244 m_value.valueID = CSSValueNormal;
3247 template<> inline CSSPrimitiveValue::operator FontStyle() const
3249 ASSERT(isValueID());
3250 switch (m_value.valueID) {
3251 case CSSValueOblique:
3252 return FontStyleOblique;
3253 case CSSValueItalic:
3254 return FontStyleItalic;
3255 case CSSValueNormal:
3256 return FontStyleNormal;
3257 default:
3258 break;
3260 ASSERT_NOT_REACHED();
3261 return FontStyleNormal;
3264 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontStretch stretch)
3265 : CSSValue(PrimitiveClass)
3267 init(UnitType::ValueID);
3268 switch (stretch) {
3269 case FontStretchUltraCondensed:
3270 m_value.valueID = CSSValueUltraCondensed;
3271 return;
3272 case FontStretchExtraCondensed:
3273 m_value.valueID = CSSValueExtraCondensed;
3274 return;
3275 case FontStretchCondensed:
3276 m_value.valueID = CSSValueCondensed;
3277 return;
3278 case FontStretchSemiCondensed:
3279 m_value.valueID = CSSValueSemiCondensed;
3280 return;
3281 case FontStretchNormal:
3282 m_value.valueID = CSSValueNormal;
3283 return;
3284 case FontStretchSemiExpanded:
3285 m_value.valueID = CSSValueSemiExpanded;
3286 return;
3287 case FontStretchExpanded:
3288 m_value.valueID = CSSValueExpanded;
3289 return;
3290 case FontStretchExtraExpanded:
3291 m_value.valueID = CSSValueExtraExpanded;
3292 return;
3293 case FontStretchUltraExpanded:
3294 m_value.valueID = CSSValueUltraExpanded;
3295 return;
3298 ASSERT_NOT_REACHED();
3299 m_value.valueID = CSSValueNormal;
3302 template<> inline CSSPrimitiveValue::operator FontStretch() const
3304 ASSERT(isValueID());
3305 switch (m_value.valueID) {
3306 case CSSValueUltraCondensed:
3307 return FontStretchUltraCondensed;
3308 case CSSValueExtraCondensed:
3309 return FontStretchExtraCondensed;
3310 case CSSValueCondensed:
3311 return FontStretchCondensed;
3312 case CSSValueSemiCondensed:
3313 return FontStretchSemiCondensed;
3314 case CSSValueNormal:
3315 return FontStretchNormal;
3316 case CSSValueSemiExpanded:
3317 return FontStretchSemiExpanded;
3318 case CSSValueExpanded:
3319 return FontStretchExpanded;
3320 case CSSValueExtraExpanded:
3321 return FontStretchExtraExpanded;
3322 case CSSValueUltraExpanded:
3323 return FontStretchUltraExpanded;
3324 default:
3325 break;
3328 ASSERT_NOT_REACHED();
3329 return FontStretchNormal;
3332 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontVariant smallCaps)
3333 : CSSValue(PrimitiveClass)
3335 init(UnitType::ValueID);
3336 switch (smallCaps) {
3337 case FontVariantNormal:
3338 m_value.valueID = CSSValueNormal;
3339 return;
3340 case FontVariantSmallCaps:
3341 m_value.valueID = CSSValueSmallCaps;
3342 return;
3345 ASSERT_NOT_REACHED();
3346 m_value.valueID = CSSValueNormal;
3349 template<> inline CSSPrimitiveValue::operator FontVariant() const
3351 ASSERT(isValueID());
3352 switch (m_value.valueID) {
3353 case CSSValueSmallCaps:
3354 return FontVariantSmallCaps;
3355 case CSSValueNormal:
3356 return FontVariantNormal;
3357 default:
3358 break;
3360 ASSERT_NOT_REACHED();
3361 return FontVariantNormal;
3364 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
3365 : CSSValue(PrimitiveClass)
3367 init(UnitType::ValueID);
3368 switch (e) {
3369 case AutoTextRendering:
3370 m_value.valueID = CSSValueAuto;
3371 break;
3372 case OptimizeSpeed:
3373 m_value.valueID = CSSValueOptimizeSpeed;
3374 break;
3375 case OptimizeLegibility:
3376 m_value.valueID = CSSValueOptimizeLegibility;
3377 break;
3378 case GeometricPrecision:
3379 m_value.valueID = CSSValueGeometricPrecision;
3380 break;
3384 template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
3386 ASSERT(isValueID());
3387 switch (m_value.valueID) {
3388 case CSSValueAuto:
3389 return AutoTextRendering;
3390 case CSSValueOptimizeSpeed:
3391 return OptimizeSpeed;
3392 case CSSValueOptimizeLegibility:
3393 return OptimizeLegibility;
3394 case CSSValueGeometricPrecision:
3395 return GeometricPrecision;
3396 default:
3397 break;
3400 ASSERT_NOT_REACHED();
3401 return AutoTextRendering;
3404 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e)
3405 : CSSValue(PrimitiveClass)
3407 init(UnitType::ValueID);
3408 switch (e) {
3409 case SpeakNone:
3410 m_value.valueID = CSSValueNone;
3411 break;
3412 case SpeakNormal:
3413 m_value.valueID = CSSValueNormal;
3414 break;
3415 case SpeakSpellOut:
3416 m_value.valueID = CSSValueSpellOut;
3417 break;
3418 case SpeakDigits:
3419 m_value.valueID = CSSValueDigits;
3420 break;
3421 case SpeakLiteralPunctuation:
3422 m_value.valueID = CSSValueLiteralPunctuation;
3423 break;
3424 case SpeakNoPunctuation:
3425 m_value.valueID = CSSValueNoPunctuation;
3426 break;
3430 template<> inline CSSPrimitiveValue::operator Order() const
3432 ASSERT(isValueID());
3433 switch (m_value.valueID) {
3434 case CSSValueLogical:
3435 return LogicalOrder;
3436 case CSSValueVisual:
3437 return VisualOrder;
3438 default:
3439 break;
3442 ASSERT_NOT_REACHED();
3443 return LogicalOrder;
3446 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e)
3447 : CSSValue(PrimitiveClass)
3449 init(UnitType::ValueID);
3450 switch (e) {
3451 case LogicalOrder:
3452 m_value.valueID = CSSValueLogical;
3453 break;
3454 case VisualOrder:
3455 m_value.valueID = CSSValueVisual;
3456 break;
3460 template<> inline CSSPrimitiveValue::operator ESpeak() const
3462 ASSERT(isValueID());
3463 switch (m_value.valueID) {
3464 case CSSValueNone:
3465 return SpeakNone;
3466 case CSSValueNormal:
3467 return SpeakNormal;
3468 case CSSValueSpellOut:
3469 return SpeakSpellOut;
3470 case CSSValueDigits:
3471 return SpeakDigits;
3472 case CSSValueLiteralPunctuation:
3473 return SpeakLiteralPunctuation;
3474 case CSSValueNoPunctuation:
3475 return SpeakNoPunctuation;
3476 default:
3477 break;
3480 ASSERT_NOT_REACHED();
3481 return SpeakNormal;
3484 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WebBlendMode blendMode)
3485 : CSSValue(PrimitiveClass)
3487 init(UnitType::ValueID);
3488 switch (blendMode) {
3489 case WebBlendModeNormal:
3490 m_value.valueID = CSSValueNormal;
3491 break;
3492 case WebBlendModeMultiply:
3493 m_value.valueID = CSSValueMultiply;
3494 break;
3495 case WebBlendModeScreen:
3496 m_value.valueID = CSSValueScreen;
3497 break;
3498 case WebBlendModeOverlay:
3499 m_value.valueID = CSSValueOverlay;
3500 break;
3501 case WebBlendModeDarken:
3502 m_value.valueID = CSSValueDarken;
3503 break;
3504 case WebBlendModeLighten:
3505 m_value.valueID = CSSValueLighten;
3506 break;
3507 case WebBlendModeColorDodge:
3508 m_value.valueID = CSSValueColorDodge;
3509 break;
3510 case WebBlendModeColorBurn:
3511 m_value.valueID = CSSValueColorBurn;
3512 break;
3513 case WebBlendModeHardLight:
3514 m_value.valueID = CSSValueHardLight;
3515 break;
3516 case WebBlendModeSoftLight:
3517 m_value.valueID = CSSValueSoftLight;
3518 break;
3519 case WebBlendModeDifference:
3520 m_value.valueID = CSSValueDifference;
3521 break;
3522 case WebBlendModeExclusion:
3523 m_value.valueID = CSSValueExclusion;
3524 break;
3525 case WebBlendModeHue:
3526 m_value.valueID = CSSValueHue;
3527 break;
3528 case WebBlendModeSaturation:
3529 m_value.valueID = CSSValueSaturation;
3530 break;
3531 case WebBlendModeColor:
3532 m_value.valueID = CSSValueColor;
3533 break;
3534 case WebBlendModeLuminosity:
3535 m_value.valueID = CSSValueLuminosity;
3536 break;
3540 template<> inline CSSPrimitiveValue::operator WebBlendMode() const
3542 ASSERT(isValueID());
3543 switch (m_value.valueID) {
3544 case CSSValueNormal:
3545 return WebBlendModeNormal;
3546 case CSSValueMultiply:
3547 return WebBlendModeMultiply;
3548 case CSSValueScreen:
3549 return WebBlendModeScreen;
3550 case CSSValueOverlay:
3551 return WebBlendModeOverlay;
3552 case CSSValueDarken:
3553 return WebBlendModeDarken;
3554 case CSSValueLighten:
3555 return WebBlendModeLighten;
3556 case CSSValueColorDodge:
3557 return WebBlendModeColorDodge;
3558 case CSSValueColorBurn:
3559 return WebBlendModeColorBurn;
3560 case CSSValueHardLight:
3561 return WebBlendModeHardLight;
3562 case CSSValueSoftLight:
3563 return WebBlendModeSoftLight;
3564 case CSSValueDifference:
3565 return WebBlendModeDifference;
3566 case CSSValueExclusion:
3567 return WebBlendModeExclusion;
3568 case CSSValueHue:
3569 return WebBlendModeHue;
3570 case CSSValueSaturation:
3571 return WebBlendModeSaturation;
3572 case CSSValueColor:
3573 return WebBlendModeColor;
3574 case CSSValueLuminosity:
3575 return WebBlendModeLuminosity;
3576 default:
3577 break;
3580 ASSERT_NOT_REACHED();
3581 return WebBlendModeNormal;
3584 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
3585 : CSSValue(PrimitiveClass)
3587 init(UnitType::ValueID);
3588 switch (e) {
3589 case ButtCap:
3590 m_value.valueID = CSSValueButt;
3591 break;
3592 case RoundCap:
3593 m_value.valueID = CSSValueRound;
3594 break;
3595 case SquareCap:
3596 m_value.valueID = CSSValueSquare;
3597 break;
3601 template<> inline CSSPrimitiveValue::operator LineCap() const
3603 ASSERT(isValueID());
3604 switch (m_value.valueID) {
3605 case CSSValueButt:
3606 return ButtCap;
3607 case CSSValueRound:
3608 return RoundCap;
3609 case CSSValueSquare:
3610 return SquareCap;
3611 default:
3612 break;
3615 ASSERT_NOT_REACHED();
3616 return ButtCap;
3619 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
3620 : CSSValue(PrimitiveClass)
3622 init(UnitType::ValueID);
3623 switch (e) {
3624 case MiterJoin:
3625 m_value.valueID = CSSValueMiter;
3626 break;
3627 case RoundJoin:
3628 m_value.valueID = CSSValueRound;
3629 break;
3630 case BevelJoin:
3631 m_value.valueID = CSSValueBevel;
3632 break;
3636 template<> inline CSSPrimitiveValue::operator LineJoin() const
3638 ASSERT(isValueID());
3639 switch (m_value.valueID) {
3640 case CSSValueMiter:
3641 return MiterJoin;
3642 case CSSValueRound:
3643 return RoundJoin;
3644 case CSSValueBevel:
3645 return BevelJoin;
3646 default:
3647 break;
3650 ASSERT_NOT_REACHED();
3651 return MiterJoin;
3654 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
3655 : CSSValue(PrimitiveClass)
3657 init(UnitType::ValueID);
3658 switch (e) {
3659 case RULE_NONZERO:
3660 m_value.valueID = CSSValueNonzero;
3661 break;
3662 case RULE_EVENODD:
3663 m_value.valueID = CSSValueEvenodd;
3664 break;
3668 template<> inline CSSPrimitiveValue::operator WindRule() const
3670 ASSERT(isValueID());
3671 switch (m_value.valueID) {
3672 case CSSValueNonzero:
3673 return RULE_NONZERO;
3674 case CSSValueEvenodd:
3675 return RULE_EVENODD;
3676 default:
3677 break;
3680 ASSERT_NOT_REACHED();
3681 return RULE_NONZERO;
3685 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e)
3686 : CSSValue(PrimitiveClass)
3688 init(UnitType::ValueID);
3689 switch (e) {
3690 case AB_AUTO:
3691 m_value.valueID = CSSValueAuto;
3692 break;
3693 case AB_BASELINE:
3694 m_value.valueID = CSSValueBaseline;
3695 break;
3696 case AB_BEFORE_EDGE:
3697 m_value.valueID = CSSValueBeforeEdge;
3698 break;
3699 case AB_TEXT_BEFORE_EDGE:
3700 m_value.valueID = CSSValueTextBeforeEdge;
3701 break;
3702 case AB_MIDDLE:
3703 m_value.valueID = CSSValueMiddle;
3704 break;
3705 case AB_CENTRAL:
3706 m_value.valueID = CSSValueCentral;
3707 break;
3708 case AB_AFTER_EDGE:
3709 m_value.valueID = CSSValueAfterEdge;
3710 break;
3711 case AB_TEXT_AFTER_EDGE:
3712 m_value.valueID = CSSValueTextAfterEdge;
3713 break;
3714 case AB_IDEOGRAPHIC:
3715 m_value.valueID = CSSValueIdeographic;
3716 break;
3717 case AB_ALPHABETIC:
3718 m_value.valueID = CSSValueAlphabetic;
3719 break;
3720 case AB_HANGING:
3721 m_value.valueID = CSSValueHanging;
3722 break;
3723 case AB_MATHEMATICAL:
3724 m_value.valueID = CSSValueMathematical;
3725 break;
3729 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
3731 ASSERT(isValueID());
3732 switch (m_value.valueID) {
3733 case CSSValueAuto:
3734 return AB_AUTO;
3735 case CSSValueBaseline:
3736 return AB_BASELINE;
3737 case CSSValueBeforeEdge:
3738 return AB_BEFORE_EDGE;
3739 case CSSValueTextBeforeEdge:
3740 return AB_TEXT_BEFORE_EDGE;
3741 case CSSValueMiddle:
3742 return AB_MIDDLE;
3743 case CSSValueCentral:
3744 return AB_CENTRAL;
3745 case CSSValueAfterEdge:
3746 return AB_AFTER_EDGE;
3747 case CSSValueTextAfterEdge:
3748 return AB_TEXT_AFTER_EDGE;
3749 case CSSValueIdeographic:
3750 return AB_IDEOGRAPHIC;
3751 case CSSValueAlphabetic:
3752 return AB_ALPHABETIC;
3753 case CSSValueHanging:
3754 return AB_HANGING;
3755 case CSSValueMathematical:
3756 return AB_MATHEMATICAL;
3757 default:
3758 break;
3761 ASSERT_NOT_REACHED();
3762 return AB_AUTO;
3765 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderCollapse e)
3766 : CSSValue(PrimitiveClass)
3768 init(UnitType::ValueID);
3769 switch (e) {
3770 case BSEPARATE:
3771 m_value.valueID = CSSValueSeparate;
3772 break;
3773 case BCOLLAPSE:
3774 m_value.valueID = CSSValueCollapse;
3775 break;
3779 template<> inline CSSPrimitiveValue::operator EBorderCollapse() const
3781 ASSERT(isValueID());
3782 switch (m_value.valueID) {
3783 case CSSValueSeparate:
3784 return BSEPARATE;
3785 case CSSValueCollapse:
3786 return BCOLLAPSE;
3787 default:
3788 break;
3791 ASSERT_NOT_REACHED();
3792 return BSEPARATE;
3795 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
3796 : CSSValue(PrimitiveClass)
3798 init(UnitType::ValueID);
3799 switch (e) {
3800 case ImageRenderingAuto:
3801 m_value.valueID = CSSValueAuto;
3802 break;
3803 case ImageRenderingOptimizeSpeed:
3804 m_value.valueID = CSSValueOptimizeSpeed;
3805 break;
3806 case ImageRenderingOptimizeQuality:
3807 m_value.valueID = CSSValueOptimizeQuality;
3808 break;
3809 case ImageRenderingPixelated:
3810 m_value.valueID = CSSValuePixelated;
3811 break;
3812 case ImageRenderingOptimizeContrast:
3813 m_value.valueID = CSSValueWebkitOptimizeContrast;
3814 break;
3818 template<> inline CSSPrimitiveValue::operator EImageRendering() const
3820 ASSERT(isValueID());
3821 switch (m_value.valueID) {
3822 case CSSValueAuto:
3823 return ImageRenderingAuto;
3824 case CSSValueOptimizeSpeed:
3825 return ImageRenderingOptimizeSpeed;
3826 case CSSValueOptimizeQuality:
3827 return ImageRenderingOptimizeQuality;
3828 case CSSValuePixelated:
3829 return ImageRenderingPixelated;
3830 case CSSValueWebkitOptimizeContrast:
3831 return ImageRenderingOptimizeContrast;
3832 default:
3833 break;
3836 ASSERT_NOT_REACHED();
3837 return ImageRenderingAuto;
3840 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETransformStyle3D e)
3841 : CSSValue(PrimitiveClass)
3843 init(UnitType::ValueID);
3844 switch (e) {
3845 case TransformStyle3DFlat:
3846 m_value.valueID = CSSValueFlat;
3847 break;
3848 case TransformStyle3DPreserve3D:
3849 m_value.valueID = CSSValuePreserve3d;
3850 break;
3854 template<> inline CSSPrimitiveValue::operator ETransformStyle3D() const
3856 ASSERT(isValueID());
3857 switch (m_value.valueID) {
3858 case CSSValueFlat:
3859 return TransformStyle3DFlat;
3860 case CSSValuePreserve3d:
3861 return TransformStyle3DPreserve3D;
3862 default:
3863 break;
3866 ASSERT_NOT_REACHED();
3867 return TransformStyle3DFlat;
3870 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e)
3871 : CSSValue(PrimitiveClass)
3873 init(UnitType::ValueID);
3874 switch (e) {
3875 case BR_AUTO:
3876 m_value.valueID = CSSValueAuto;
3877 break;
3878 case BR_DYNAMIC:
3879 m_value.valueID = CSSValueDynamic;
3880 break;
3881 case BR_STATIC:
3882 m_value.valueID = CSSValueStatic;
3883 break;
3887 template<> inline CSSPrimitiveValue::operator EBufferedRendering() const
3889 ASSERT(isValueID());
3890 switch (m_value.valueID) {
3891 case CSSValueAuto:
3892 return BR_AUTO;
3893 case CSSValueDynamic:
3894 return BR_DYNAMIC;
3895 case CSSValueStatic:
3896 return BR_STATIC;
3897 default:
3898 break;
3901 ASSERT_NOT_REACHED();
3902 return BR_AUTO;
3905 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
3906 : CSSValue(PrimitiveClass)
3908 init(UnitType::ValueID);
3909 switch (e) {
3910 case CI_AUTO:
3911 m_value.valueID = CSSValueAuto;
3912 break;
3913 case CI_SRGB:
3914 m_value.valueID = CSSValueSRGB;
3915 break;
3916 case CI_LINEARRGB:
3917 m_value.valueID = CSSValueLinearRGB;
3918 break;
3922 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
3924 ASSERT(isValueID());
3925 switch (m_value.valueID) {
3926 case CSSValueSRGB:
3927 return CI_SRGB;
3928 case CSSValueLinearRGB:
3929 return CI_LINEARRGB;
3930 case CSSValueAuto:
3931 return CI_AUTO;
3932 default:
3933 break;
3936 ASSERT_NOT_REACHED();
3937 return CI_AUTO;
3940 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e)
3941 : CSSValue(PrimitiveClass)
3943 init(UnitType::ValueID);
3944 switch (e) {
3945 case CR_AUTO:
3946 m_value.valueID = CSSValueAuto;
3947 break;
3948 case CR_OPTIMIZESPEED:
3949 m_value.valueID = CSSValueOptimizeSpeed;
3950 break;
3951 case CR_OPTIMIZEQUALITY:
3952 m_value.valueID = CSSValueOptimizeQuality;
3953 break;
3957 template<> inline CSSPrimitiveValue::operator EColorRendering() const
3959 ASSERT(isValueID());
3960 switch (m_value.valueID) {
3961 case CSSValueOptimizeSpeed:
3962 return CR_OPTIMIZESPEED;
3963 case CSSValueOptimizeQuality:
3964 return CR_OPTIMIZEQUALITY;
3965 case CSSValueAuto:
3966 return CR_AUTO;
3967 default:
3968 break;
3971 ASSERT_NOT_REACHED();
3972 return CR_AUTO;
3975 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e)
3976 : CSSValue(PrimitiveClass)
3978 init(UnitType::ValueID);
3979 switch (e) {
3980 case DB_AUTO:
3981 m_value.valueID = CSSValueAuto;
3982 break;
3983 case DB_USE_SCRIPT:
3984 m_value.valueID = CSSValueUseScript;
3985 break;
3986 case DB_NO_CHANGE:
3987 m_value.valueID = CSSValueNoChange;
3988 break;
3989 case DB_RESET_SIZE:
3990 m_value.valueID = CSSValueResetSize;
3991 break;
3992 case DB_CENTRAL:
3993 m_value.valueID = CSSValueCentral;
3994 break;
3995 case DB_MIDDLE:
3996 m_value.valueID = CSSValueMiddle;
3997 break;
3998 case DB_TEXT_BEFORE_EDGE:
3999 m_value.valueID = CSSValueTextBeforeEdge;
4000 break;
4001 case DB_TEXT_AFTER_EDGE:
4002 m_value.valueID = CSSValueTextAfterEdge;
4003 break;
4004 case DB_IDEOGRAPHIC:
4005 m_value.valueID = CSSValueIdeographic;
4006 break;
4007 case DB_ALPHABETIC:
4008 m_value.valueID = CSSValueAlphabetic;
4009 break;
4010 case DB_HANGING:
4011 m_value.valueID = CSSValueHanging;
4012 break;
4013 case DB_MATHEMATICAL:
4014 m_value.valueID = CSSValueMathematical;
4015 break;
4019 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
4021 ASSERT(isValueID());
4022 switch (m_value.valueID) {
4023 case CSSValueAuto:
4024 return DB_AUTO;
4025 case CSSValueUseScript:
4026 return DB_USE_SCRIPT;
4027 case CSSValueNoChange:
4028 return DB_NO_CHANGE;
4029 case CSSValueResetSize:
4030 return DB_RESET_SIZE;
4031 case CSSValueIdeographic:
4032 return DB_IDEOGRAPHIC;
4033 case CSSValueAlphabetic:
4034 return DB_ALPHABETIC;
4035 case CSSValueHanging:
4036 return DB_HANGING;
4037 case CSSValueMathematical:
4038 return DB_MATHEMATICAL;
4039 case CSSValueCentral:
4040 return DB_CENTRAL;
4041 case CSSValueMiddle:
4042 return DB_MIDDLE;
4043 case CSSValueTextAfterEdge:
4044 return DB_TEXT_AFTER_EDGE;
4045 case CSSValueTextBeforeEdge:
4046 return DB_TEXT_BEFORE_EDGE;
4047 default:
4048 break;
4051 ASSERT_NOT_REACHED();
4052 return DB_AUTO;
4055 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e)
4056 : CSSValue(PrimitiveClass)
4058 init(UnitType::ValueID);
4059 switch (e) {
4060 case SR_AUTO:
4061 m_value.valueID = CSSValueAuto;
4062 break;
4063 case SR_OPTIMIZESPEED:
4064 m_value.valueID = CSSValueOptimizeSpeed;
4065 break;
4066 case SR_CRISPEDGES:
4067 m_value.valueID = CSSValueCrispEdges;
4068 break;
4069 case SR_GEOMETRICPRECISION:
4070 m_value.valueID = CSSValueGeometricPrecision;
4071 break;
4075 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
4077 ASSERT(isValueID());
4078 switch (m_value.valueID) {
4079 case CSSValueAuto:
4080 return SR_AUTO;
4081 case CSSValueOptimizeSpeed:
4082 return SR_OPTIMIZESPEED;
4083 case CSSValueCrispEdges:
4084 return SR_CRISPEDGES;
4085 case CSSValueGeometricPrecision:
4086 return SR_GEOMETRICPRECISION;
4087 default:
4088 break;
4091 ASSERT_NOT_REACHED();
4092 return SR_AUTO;
4095 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e)
4096 : CSSValue(PrimitiveClass)
4098 init(UnitType::ValueID);
4099 switch (e) {
4100 case TA_START:
4101 m_value.valueID = CSSValueStart;
4102 break;
4103 case TA_MIDDLE:
4104 m_value.valueID = CSSValueMiddle;
4105 break;
4106 case TA_END:
4107 m_value.valueID = CSSValueEnd;
4108 break;
4112 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
4114 ASSERT(isValueID());
4115 switch (m_value.valueID) {
4116 case CSSValueStart:
4117 return TA_START;
4118 case CSSValueMiddle:
4119 return TA_MIDDLE;
4120 case CSSValueEnd:
4121 return TA_END;
4122 default:
4123 break;
4126 ASSERT_NOT_REACHED();
4127 return TA_START;
4130 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SVGWritingMode e)
4131 : CSSValue(PrimitiveClass)
4133 init(UnitType::ValueID);
4134 switch (e) {
4135 case WM_LRTB:
4136 m_value.valueID = CSSValueLrTb;
4137 break;
4138 case WM_LR:
4139 m_value.valueID = CSSValueLr;
4140 break;
4141 case WM_RLTB:
4142 m_value.valueID = CSSValueRlTb;
4143 break;
4144 case WM_RL:
4145 m_value.valueID = CSSValueRl;
4146 break;
4147 case WM_TBRL:
4148 m_value.valueID = CSSValueTbRl;
4149 break;
4150 case WM_TB:
4151 m_value.valueID = CSSValueTb;
4152 break;
4156 template<> inline CSSPrimitiveValue::operator SVGWritingMode() const
4158 ASSERT(isValueID());
4159 switch (m_value.valueID) {
4160 case CSSValueLrTb:
4161 return WM_LRTB;
4162 case CSSValueLr:
4163 return WM_LR;
4164 case CSSValueRlTb:
4165 return WM_RLTB;
4166 case CSSValueRl:
4167 return WM_RL;
4168 case CSSValueTbRl:
4169 return WM_TBRL;
4170 case CSSValueTb:
4171 return WM_TB;
4172 default:
4173 break;
4176 ASSERT_NOT_REACHED();
4177 return WM_LRTB;
4180 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e)
4181 : CSSValue(PrimitiveClass)
4183 init(UnitType::ValueID);
4184 switch (e) {
4185 case VE_NONE:
4186 m_value.valueID = CSSValueNone;
4187 break;
4188 case VE_NON_SCALING_STROKE:
4189 m_value.valueID = CSSValueNonScalingStroke;
4190 break;
4194 template<> inline CSSPrimitiveValue::operator EVectorEffect() const
4196 ASSERT(isValueID());
4197 switch (m_value.valueID) {
4198 case CSSValueNone:
4199 return VE_NONE;
4200 case CSSValueNonScalingStroke:
4201 return VE_NON_SCALING_STROKE;
4202 default:
4203 break;
4206 ASSERT_NOT_REACHED();
4207 return VE_NONE;
4210 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPaintOrderType e)
4211 : CSSValue(PrimitiveClass)
4213 init(UnitType::ValueID);
4214 switch (e) {
4215 case PT_FILL:
4216 m_value.valueID = CSSValueFill;
4217 break;
4218 case PT_STROKE:
4219 m_value.valueID = CSSValueStroke;
4220 break;
4221 case PT_MARKERS:
4222 m_value.valueID = CSSValueMarkers;
4223 break;
4224 default:
4225 ASSERT_NOT_REACHED();
4226 m_value.valueID = CSSValueFill;
4227 break;
4231 template<> inline CSSPrimitiveValue::operator EPaintOrderType() const
4233 ASSERT(isValueID());
4234 switch (m_value.valueID) {
4235 case CSSValueFill:
4236 return PT_FILL;
4237 case CSSValueStroke:
4238 return PT_STROKE;
4239 case CSSValueMarkers:
4240 return PT_MARKERS;
4241 default:
4242 break;
4245 ASSERT_NOT_REACHED();
4246 return PT_NONE;
4249 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMaskType e)
4250 : CSSValue(PrimitiveClass)
4252 init(UnitType::ValueID);
4253 switch (e) {
4254 case MT_LUMINANCE:
4255 m_value.valueID = CSSValueLuminance;
4256 break;
4257 case MT_ALPHA:
4258 m_value.valueID = CSSValueAlpha;
4259 break;
4263 template<> inline CSSPrimitiveValue::operator EMaskType() const
4265 ASSERT(isValueID());
4266 switch (m_value.valueID) {
4267 case CSSValueLuminance:
4268 return MT_LUMINANCE;
4269 case CSSValueAlpha:
4270 return MT_ALPHA;
4271 default:
4272 break;
4275 ASSERT_NOT_REACHED();
4276 return MT_LUMINANCE;
4279 template<> inline CSSPrimitiveValue::operator TouchAction() const
4281 ASSERT(isValueID());
4282 switch (m_value.valueID) {
4283 case CSSValueNone:
4284 return TouchActionNone;
4285 case CSSValueAuto:
4286 return TouchActionAuto;
4287 case CSSValuePanLeft:
4288 return TouchActionPanLeft;
4289 case CSSValuePanRight:
4290 return TouchActionPanRight;
4291 case CSSValuePanX:
4292 return TouchActionPanX;
4293 case CSSValuePanUp:
4294 return TouchActionPanUp;
4295 case CSSValuePanDown:
4296 return TouchActionPanDown;
4297 case CSSValuePanY:
4298 return TouchActionPanY;
4299 case CSSValueManipulation:
4300 return TouchActionPanX | TouchActionPanY | TouchActionPinchZoom;
4301 default:
4302 break;
4305 ASSERT_NOT_REACHED();
4306 return TouchActionNone;
4309 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EIsolation i)
4310 : CSSValue(PrimitiveClass)
4312 init(UnitType::ValueID);
4313 switch (i) {
4314 case IsolationAuto:
4315 m_value.valueID = CSSValueAuto;
4316 break;
4317 case IsolationIsolate:
4318 m_value.valueID = CSSValueIsolate;
4319 break;
4323 template<> inline CSSPrimitiveValue::operator EIsolation() const
4325 ASSERT(isValueID());
4326 switch (m_value.valueID) {
4327 case CSSValueAuto:
4328 return IsolationAuto;
4329 case CSSValueIsolate:
4330 return IsolationIsolate;
4331 default:
4332 break;
4335 ASSERT_NOT_REACHED();
4336 return IsolationAuto;
4339 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSBoxType cssBox)
4340 : CSSValue(PrimitiveClass)
4342 init(UnitType::ValueID);
4343 switch (cssBox) {
4344 case MarginBox:
4345 m_value.valueID = CSSValueMarginBox;
4346 break;
4347 case BorderBox:
4348 m_value.valueID = CSSValueBorderBox;
4349 break;
4350 case PaddingBox:
4351 m_value.valueID = CSSValuePaddingBox;
4352 break;
4353 case ContentBox:
4354 m_value.valueID = CSSValueContentBox;
4355 break;
4356 case BoxMissing:
4357 // The missing box should convert to a null primitive value.
4358 ASSERT_NOT_REACHED();
4362 template<> inline CSSPrimitiveValue::operator CSSBoxType() const
4364 switch (getValueID()) {
4365 case CSSValueMarginBox:
4366 return MarginBox;
4367 case CSSValueBorderBox:
4368 return BorderBox;
4369 case CSSValuePaddingBox:
4370 return PaddingBox;
4371 case CSSValueContentBox:
4372 return ContentBox;
4373 default:
4374 break;
4376 ASSERT_NOT_REACHED();
4377 return ContentBox;
4380 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ItemPosition itemPosition)
4381 : CSSValue(PrimitiveClass)
4383 init(UnitType::ValueID);
4384 switch (itemPosition) {
4385 case ItemPositionAuto:
4386 m_value.valueID = CSSValueAuto;
4387 break;
4388 case ItemPositionStretch:
4389 m_value.valueID = CSSValueStretch;
4390 break;
4391 case ItemPositionBaseline:
4392 m_value.valueID = CSSValueBaseline;
4393 break;
4394 case ItemPositionLastBaseline:
4395 m_value.valueID = CSSValueLastBaseline;
4396 break;
4397 case ItemPositionCenter:
4398 m_value.valueID = CSSValueCenter;
4399 break;
4400 case ItemPositionStart:
4401 m_value.valueID = CSSValueStart;
4402 break;
4403 case ItemPositionEnd:
4404 m_value.valueID = CSSValueEnd;
4405 break;
4406 case ItemPositionSelfStart:
4407 m_value.valueID = CSSValueSelfStart;
4408 break;
4409 case ItemPositionSelfEnd:
4410 m_value.valueID = CSSValueSelfEnd;
4411 break;
4412 case ItemPositionFlexStart:
4413 m_value.valueID = CSSValueFlexStart;
4414 break;
4415 case ItemPositionFlexEnd:
4416 m_value.valueID = CSSValueFlexEnd;
4417 break;
4418 case ItemPositionLeft:
4419 m_value.valueID = CSSValueLeft;
4420 break;
4421 case ItemPositionRight:
4422 m_value.valueID = CSSValueRight;
4423 break;
4427 template<> inline CSSPrimitiveValue::operator ItemPosition() const
4429 switch (m_value.valueID) {
4430 case CSSValueAuto:
4431 return ItemPositionAuto;
4432 case CSSValueStretch:
4433 return ItemPositionStretch;
4434 case CSSValueBaseline:
4435 return ItemPositionBaseline;
4436 case CSSValueLastBaseline:
4437 return ItemPositionLastBaseline;
4438 case CSSValueCenter:
4439 return ItemPositionCenter;
4440 case CSSValueStart:
4441 return ItemPositionStart;
4442 case CSSValueEnd:
4443 return ItemPositionEnd;
4444 case CSSValueSelfStart:
4445 return ItemPositionSelfStart;
4446 case CSSValueSelfEnd:
4447 return ItemPositionSelfEnd;
4448 case CSSValueFlexStart:
4449 return ItemPositionFlexStart;
4450 case CSSValueFlexEnd:
4451 return ItemPositionFlexEnd;
4452 case CSSValueLeft:
4453 return ItemPositionLeft;
4454 case CSSValueRight:
4455 return ItemPositionRight;
4456 default:
4457 break;
4459 ASSERT_NOT_REACHED();
4460 return ItemPositionAuto;
4463 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentPosition contentPosition)
4464 : CSSValue(PrimitiveClass)
4466 init(UnitType::ValueID);
4467 switch (contentPosition) {
4468 case ContentPositionAuto:
4469 m_value.valueID = CSSValueAuto;
4470 break;
4471 case ContentPositionBaseline:
4472 m_value.valueID = CSSValueBaseline;
4473 break;
4474 case ContentPositionLastBaseline:
4475 m_value.valueID = CSSValueLastBaseline;
4476 break;
4477 case ContentPositionCenter:
4478 m_value.valueID = CSSValueCenter;
4479 break;
4480 case ContentPositionStart:
4481 m_value.valueID = CSSValueStart;
4482 break;
4483 case ContentPositionEnd:
4484 m_value.valueID = CSSValueEnd;
4485 break;
4486 case ContentPositionFlexStart:
4487 m_value.valueID = CSSValueFlexStart;
4488 break;
4489 case ContentPositionFlexEnd:
4490 m_value.valueID = CSSValueFlexEnd;
4491 break;
4492 case ContentPositionLeft:
4493 m_value.valueID = CSSValueLeft;
4494 break;
4495 case ContentPositionRight:
4496 m_value.valueID = CSSValueRight;
4497 break;
4501 template<> inline CSSPrimitiveValue::operator ContentPosition() const
4503 switch (m_value.valueID) {
4504 case CSSValueAuto:
4505 return ContentPositionAuto;
4506 case CSSValueBaseline:
4507 return ContentPositionBaseline;
4508 case CSSValueLastBaseline:
4509 return ContentPositionLastBaseline;
4510 case CSSValueCenter:
4511 return ContentPositionCenter;
4512 case CSSValueStart:
4513 return ContentPositionStart;
4514 case CSSValueEnd:
4515 return ContentPositionEnd;
4516 case CSSValueFlexStart:
4517 return ContentPositionFlexStart;
4518 case CSSValueFlexEnd:
4519 return ContentPositionFlexEnd;
4520 case CSSValueLeft:
4521 return ContentPositionLeft;
4522 case CSSValueRight:
4523 return ContentPositionRight;
4524 default:
4525 break;
4527 ASSERT_NOT_REACHED();
4528 return ContentPositionAuto;
4531 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContentDistributionType contentDistribution)
4532 : CSSValue(PrimitiveClass)
4534 init(UnitType::ValueID);
4535 switch (contentDistribution) {
4536 case ContentDistributionDefault:
4537 m_value.valueID = CSSValueDefault;
4538 break;
4539 case ContentDistributionSpaceBetween:
4540 m_value.valueID = CSSValueSpaceBetween;
4541 break;
4542 case ContentDistributionSpaceAround:
4543 m_value.valueID = CSSValueSpaceAround;
4544 break;
4545 case ContentDistributionSpaceEvenly:
4546 m_value.valueID = CSSValueSpaceEvenly;
4547 break;
4548 case ContentDistributionStretch:
4549 m_value.valueID = CSSValueStretch;
4550 break;
4554 template<> inline CSSPrimitiveValue::operator ContentDistributionType() const
4556 switch (m_value.valueID) {
4557 case CSSValueSpaceBetween:
4558 return ContentDistributionSpaceBetween;
4559 case CSSValueSpaceAround:
4560 return ContentDistributionSpaceAround;
4561 case CSSValueSpaceEvenly:
4562 return ContentDistributionSpaceEvenly;
4563 case CSSValueStretch:
4564 return ContentDistributionStretch;
4565 default:
4566 break;
4568 ASSERT_NOT_REACHED();
4569 return ContentDistributionStretch;
4572 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverflowAlignment overflowAlignment)
4573 : CSSValue(PrimitiveClass)
4575 init(UnitType::ValueID);
4576 switch (overflowAlignment) {
4577 case OverflowAlignmentDefault:
4578 m_value.valueID = CSSValueDefault;
4579 break;
4580 case OverflowAlignmentTrue:
4581 m_value.valueID = CSSValueTrue;
4582 break;
4583 case OverflowAlignmentSafe:
4584 m_value.valueID = CSSValueSafe;
4585 break;
4589 template<> inline CSSPrimitiveValue::operator OverflowAlignment() const
4591 switch (m_value.valueID) {
4592 case CSSValueTrue:
4593 return OverflowAlignmentTrue;
4594 case CSSValueSafe:
4595 return OverflowAlignmentSafe;
4596 default:
4597 break;
4599 ASSERT_NOT_REACHED();
4600 return OverflowAlignmentTrue;
4603 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollBehavior behavior)
4604 : CSSValue(PrimitiveClass)
4606 init(UnitType::ValueID);
4607 switch (behavior) {
4608 case ScrollBehaviorAuto:
4609 m_value.valueID = CSSValueAuto;
4610 break;
4611 case ScrollBehaviorSmooth:
4612 m_value.valueID = CSSValueSmooth;
4613 break;
4614 case ScrollBehaviorInstant:
4615 // Behavior 'instant' is only allowed in ScrollOptions arguments passed to
4616 // CSSOM scroll APIs.
4617 ASSERT_NOT_REACHED();
4621 template<> inline CSSPrimitiveValue::operator ScrollBehavior() const
4623 switch (getValueID()) {
4624 case CSSValueAuto:
4625 return ScrollBehaviorAuto;
4626 case CSSValueSmooth:
4627 return ScrollBehaviorSmooth;
4628 default:
4629 break;
4631 ASSERT_NOT_REACHED();
4632 return ScrollBehaviorAuto;
4635 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapType snapType)
4636 : CSSValue(PrimitiveClass)
4638 init(UnitType::ValueID);
4639 switch (snapType) {
4640 case ScrollSnapTypeNone:
4641 m_value.valueID = CSSValueNone;
4642 break;
4643 case ScrollSnapTypeMandatory:
4644 m_value.valueID = CSSValueMandatory;
4645 break;
4646 case ScrollSnapTypeProximity:
4647 m_value.valueID = CSSValueProximity;
4648 break;
4652 template<> inline CSSPrimitiveValue::operator ScrollSnapType() const
4654 switch (getValueID()) {
4655 case CSSValueNone:
4656 return ScrollSnapTypeNone;
4657 case CSSValueMandatory:
4658 return ScrollSnapTypeMandatory;
4659 case CSSValueProximity:
4660 return ScrollSnapTypeProximity;
4661 default:
4662 break;
4664 ASSERT_NOT_REACHED();
4665 return ScrollSnapTypeNone;
4668 } // namespace blink
4670 #endif