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
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"
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
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
81 return clampTo
<unsigned short>(getDoubleValue());
84 template<> inline CSSPrimitiveValue::operator int() const
87 return clampTo
<int>(getDoubleValue());
90 template<> inline CSSPrimitiveValue::operator unsigned() const
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
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
);
134 case ReflectionAbove
:
135 m_value
.valueID
= CSSValueAbove
;
137 case ReflectionBelow
:
138 m_value
.valueID
= CSSValueBelow
;
141 m_value
.valueID
= CSSValueLeft
;
143 case ReflectionRight
:
144 m_value
.valueID
= CSSValueRight
;
148 template<> inline CSSPrimitiveValue::operator CSSReflectionDirection() const
151 switch (m_value
.valueID
) {
153 return ReflectionAbove
;
155 return ReflectionBelow
;
157 return ReflectionLeft
;
159 return ReflectionRight
;
164 ASSERT_NOT_REACHED();
165 return ReflectionBelow
;
168 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill
)
169 : CSSValue(PrimitiveClass
)
171 init(UnitType::ValueID
);
172 switch (columnFill
) {
174 m_value
.valueID
= CSSValueAuto
;
176 case ColumnFillBalance
:
177 m_value
.valueID
= CSSValueBalance
;
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
) {
200 m_value
.valueID
= CSSValueAll
;
203 m_value
.valueID
= CSSValueNone
;
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
;
215 switch (m_value
.valueID
) {
217 return ColumnSpanAll
;
219 return ColumnSpanNone
;
224 ASSERT_NOT_REACHED();
225 return ColumnSpanNone
;
229 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PrintColorAdjust value
)
230 : CSSValue(PrimitiveClass
)
232 init(UnitType::ValueID
);
234 case PrintColorAdjustExact
:
235 m_value
.valueID
= CSSValueExact
;
237 case PrintColorAdjustEconomy
:
238 m_value
.valueID
= CSSValueEconomy
;
243 template<> inline CSSPrimitiveValue::operator PrintColorAdjust() const
246 switch (m_value
.valueID
) {
247 case CSSValueEconomy
:
248 return PrintColorAdjustEconomy
;
250 return PrintColorAdjustExact
;
255 ASSERT_NOT_REACHED();
256 return PrintColorAdjustEconomy
;
260 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e
)
261 : CSSValue(PrimitiveClass
)
263 init(UnitType::ValueID
);
266 m_value
.valueID
= CSSValueNone
;
269 m_value
.valueID
= CSSValueHidden
;
272 m_value
.valueID
= CSSValueInset
;
275 m_value
.valueID
= CSSValueGroove
;
278 m_value
.valueID
= CSSValueRidge
;
281 m_value
.valueID
= CSSValueOutset
;
284 m_value
.valueID
= CSSValueDotted
;
287 m_value
.valueID
= CSSValueDashed
;
290 m_value
.valueID
= CSSValueSolid
;
293 m_value
.valueID
= CSSValueDouble
;
298 template<> inline CSSPrimitiveValue::operator EBorderStyle() const
301 if (m_value
.valueID
== CSSValueAuto
) // Valid for CSS outline-style
303 return (EBorderStyle
)(m_value
.valueID
- CSSValueNone
);
306 template<> inline CSSPrimitiveValue::operator OutlineIsAuto() const
308 if (m_value
.valueID
== CSSValueAuto
)
313 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e
)
314 : CSSValue(PrimitiveClass
)
316 init(UnitType::ValueID
);
319 m_value
.valueID
= CSSValueClear
;
322 m_value
.valueID
= CSSValueCopy
;
324 case CompositeSourceOver
:
325 m_value
.valueID
= CSSValueSourceOver
;
327 case CompositeSourceIn
:
328 m_value
.valueID
= CSSValueSourceIn
;
330 case CompositeSourceOut
:
331 m_value
.valueID
= CSSValueSourceOut
;
333 case CompositeSourceAtop
:
334 m_value
.valueID
= CSSValueSourceAtop
;
336 case CompositeDestinationOver
:
337 m_value
.valueID
= CSSValueDestinationOver
;
339 case CompositeDestinationIn
:
340 m_value
.valueID
= CSSValueDestinationIn
;
342 case CompositeDestinationOut
:
343 m_value
.valueID
= CSSValueDestinationOut
;
345 case CompositeDestinationAtop
:
346 m_value
.valueID
= CSSValueDestinationAtop
;
349 m_value
.valueID
= CSSValueXor
;
351 case CompositePlusLighter
:
352 m_value
.valueID
= CSSValuePlusLighter
;
355 ASSERT_NOT_REACHED();
360 template<> inline CSSPrimitiveValue::operator CompositeOperator() const
363 switch (m_value
.valueID
) {
365 return CompositeClear
;
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
;
386 case CSSValuePlusLighter
:
387 return CompositePlusLighter
;
392 ASSERT_NOT_REACHED();
393 return CompositeClear
;
396 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e
)
397 : CSSValue(PrimitiveClass
)
399 init(UnitType::ValueID
);
402 m_value
.valueID
= CSSValueNone
;
405 m_value
.valueID
= CSSValueCheckbox
;
408 m_value
.valueID
= CSSValueRadio
;
411 m_value
.valueID
= CSSValuePushButton
;
413 case SquareButtonPart
:
414 m_value
.valueID
= CSSValueSquareButton
;
417 m_value
.valueID
= CSSValueButton
;
419 case ButtonBevelPart
:
420 m_value
.valueID
= CSSValueButtonBevel
;
422 case InnerSpinButtonPart
:
423 m_value
.valueID
= CSSValueInnerSpinButton
;
426 m_value
.valueID
= CSSValueListbox
;
429 m_value
.valueID
= CSSValueListitem
;
431 case MediaEnterFullscreenButtonPart
:
432 m_value
.valueID
= CSSValueMediaEnterFullscreenButton
;
434 case MediaExitFullscreenButtonPart
:
435 m_value
.valueID
= CSSValueMediaExitFullscreenButton
;
437 case MediaPlayButtonPart
:
438 m_value
.valueID
= CSSValueMediaPlayButton
;
440 case MediaOverlayPlayButtonPart
:
441 m_value
.valueID
= CSSValueMediaOverlayPlayButton
;
443 case MediaMuteButtonPart
:
444 m_value
.valueID
= CSSValueMediaMuteButton
;
446 case MediaToggleClosedCaptionsButtonPart
:
447 m_value
.valueID
= CSSValueMediaToggleClosedCaptionsButton
;
449 case MediaCastOffButtonPart
:
450 m_value
.valueID
= CSSValueInternalMediaCastOffButton
;
452 case MediaOverlayCastOffButtonPart
:
453 m_value
.valueID
= CSSValueInternalMediaOverlayCastOffButton
;
455 case MediaSliderPart
:
456 m_value
.valueID
= CSSValueMediaSlider
;
458 case MediaSliderThumbPart
:
459 m_value
.valueID
= CSSValueMediaSliderthumb
;
461 case MediaVolumeSliderContainerPart
:
462 m_value
.valueID
= CSSValueMediaVolumeSliderContainer
;
464 case MediaVolumeSliderPart
:
465 m_value
.valueID
= CSSValueMediaVolumeSlider
;
467 case MediaVolumeSliderThumbPart
:
468 m_value
.valueID
= CSSValueMediaVolumeSliderthumb
;
470 case MediaControlsBackgroundPart
:
471 m_value
.valueID
= CSSValueMediaControlsBackground
;
473 case MediaControlsFullscreenBackgroundPart
:
474 m_value
.valueID
= CSSValueMediaControlsFullscreenBackground
;
476 case MediaFullScreenVolumeSliderPart
:
477 m_value
.valueID
= CSSValueMediaFullscreenVolumeSlider
;
479 case MediaFullScreenVolumeSliderThumbPart
:
480 m_value
.valueID
= CSSValueMediaFullscreenVolumeSliderThumb
;
482 case MediaCurrentTimePart
:
483 m_value
.valueID
= CSSValueMediaCurrentTimeDisplay
;
485 case MediaTimeRemainingPart
:
486 m_value
.valueID
= CSSValueMediaTimeRemainingDisplay
;
489 m_value
.valueID
= CSSValueMenulist
;
491 case MenulistButtonPart
:
492 m_value
.valueID
= CSSValueMenulistButton
;
494 case MenulistTextPart
:
495 m_value
.valueID
= CSSValueMenulistText
;
497 case MenulistTextFieldPart
:
498 m_value
.valueID
= CSSValueMenulistTextfield
;
501 m_value
.valueID
= CSSValueMeter
;
503 case RelevancyLevelIndicatorPart
:
504 m_value
.valueID
= CSSValueRelevancyLevelIndicator
;
506 case ContinuousCapacityLevelIndicatorPart
:
507 m_value
.valueID
= CSSValueContinuousCapacityLevelIndicator
;
509 case DiscreteCapacityLevelIndicatorPart
:
510 m_value
.valueID
= CSSValueDiscreteCapacityLevelIndicator
;
512 case RatingLevelIndicatorPart
:
513 m_value
.valueID
= CSSValueRatingLevelIndicator
;
515 case ProgressBarPart
:
516 m_value
.valueID
= CSSValueProgressBar
;
518 case ProgressBarValuePart
:
519 m_value
.valueID
= CSSValueProgressBarValue
;
521 case SliderHorizontalPart
:
522 m_value
.valueID
= CSSValueSliderHorizontal
;
524 case SliderVerticalPart
:
525 m_value
.valueID
= CSSValueSliderVertical
;
527 case SliderThumbHorizontalPart
:
528 m_value
.valueID
= CSSValueSliderthumbHorizontal
;
530 case SliderThumbVerticalPart
:
531 m_value
.valueID
= CSSValueSliderthumbVertical
;
534 m_value
.valueID
= CSSValueCaret
;
536 case SearchFieldPart
:
537 m_value
.valueID
= CSSValueSearchfield
;
539 case SearchFieldDecorationPart
:
540 m_value
.valueID
= CSSValueSearchfieldDecoration
;
542 case SearchFieldResultsDecorationPart
:
543 m_value
.valueID
= CSSValueSearchfieldResultsDecoration
;
545 case SearchFieldCancelButtonPart
:
546 m_value
.valueID
= CSSValueSearchfieldCancelButton
;
549 m_value
.valueID
= CSSValueTextfield
;
552 m_value
.valueID
= CSSValueTextarea
;
554 case CapsLockIndicatorPart
:
555 m_value
.valueID
= CSSValueCapsLockIndicator
;
560 template<> inline CSSPrimitiveValue::operator ControlPart() const
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
);
573 case BackfaceVisibilityVisible
:
574 m_value
.valueID
= CSSValueVisible
;
576 case BackfaceVisibilityHidden
:
577 m_value
.valueID
= CSSValueHidden
;
582 template<> inline CSSPrimitiveValue::operator EBackfaceVisibility() const
585 switch (m_value
.valueID
) {
586 case CSSValueVisible
:
587 return BackfaceVisibilityVisible
;
589 return BackfaceVisibilityHidden
;
594 ASSERT_NOT_REACHED();
595 return BackfaceVisibilityHidden
;
599 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e
)
600 : CSSValue(PrimitiveClass
)
602 init(UnitType::ValueID
);
604 case ScrollBackgroundAttachment
:
605 m_value
.valueID
= CSSValueScroll
;
607 case LocalBackgroundAttachment
:
608 m_value
.valueID
= CSSValueLocal
;
610 case FixedBackgroundAttachment
:
611 m_value
.valueID
= CSSValueFixed
;
616 template<> inline CSSPrimitiveValue::operator EFillAttachment() const
619 switch (m_value
.valueID
) {
621 return ScrollBackgroundAttachment
;
623 return LocalBackgroundAttachment
;
625 return FixedBackgroundAttachment
;
630 ASSERT_NOT_REACHED();
631 return ScrollBackgroundAttachment
;
634 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e
)
635 : CSSValue(PrimitiveClass
)
637 init(UnitType::ValueID
);
640 m_value
.valueID
= CSSValueBorderBox
;
643 m_value
.valueID
= CSSValuePaddingBox
;
646 m_value
.valueID
= CSSValueContentBox
;
649 m_value
.valueID
= CSSValueText
;
654 template<> inline CSSPrimitiveValue::operator EFillBox() const
657 switch (m_value
.valueID
) {
659 case CSSValueBorderBox
:
660 return BorderFillBox
;
661 case CSSValuePadding
:
662 case CSSValuePaddingBox
:
663 return PaddingFillBox
;
664 case CSSValueContent
:
665 case CSSValueContentBox
:
666 return ContentFillBox
;
668 case CSSValueWebkitText
:
674 ASSERT_NOT_REACHED();
675 return BorderFillBox
;
678 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e
)
679 : CSSValue(PrimitiveClass
)
681 init(UnitType::ValueID
);
684 m_value
.valueID
= CSSValueRepeat
;
687 m_value
.valueID
= CSSValueNoRepeat
;
690 m_value
.valueID
= CSSValueRound
;
693 m_value
.valueID
= CSSValueSpace
;
698 template<> inline CSSPrimitiveValue::operator EFillRepeat() const
701 switch (m_value
.valueID
) {
704 case CSSValueNoRepeat
:
714 ASSERT_NOT_REACHED();
718 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxPack e
)
719 : CSSValue(PrimitiveClass
)
721 init(UnitType::ValueID
);
724 m_value
.valueID
= CSSValueStart
;
727 m_value
.valueID
= CSSValueCenter
;
730 m_value
.valueID
= CSSValueEnd
;
733 m_value
.valueID
= CSSValueJustify
;
738 template<> inline CSSPrimitiveValue::operator EBoxPack() const
741 switch (m_value
.valueID
) {
748 case CSSValueJustify
:
754 ASSERT_NOT_REACHED();
758 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e
)
759 : CSSValue(PrimitiveClass
)
761 init(UnitType::ValueID
);
764 m_value
.valueID
= CSSValueStretch
;
767 m_value
.valueID
= CSSValueStart
;
770 m_value
.valueID
= CSSValueCenter
;
773 m_value
.valueID
= CSSValueEnd
;
776 m_value
.valueID
= CSSValueBaseline
;
781 template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
784 switch (m_value
.valueID
) {
785 case CSSValueStretch
:
793 case CSSValueBaseline
:
799 ASSERT_NOT_REACHED();
803 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDecorationBreak e
)
804 : CSSValue(PrimitiveClass
)
806 init(UnitType::ValueID
);
809 m_value
.valueID
= CSSValueSlice
;
812 m_value
.valueID
= CSSValueClone
;
817 template<> inline CSSPrimitiveValue::operator EBoxDecorationBreak() const
820 switch (m_value
.valueID
) {
829 ASSERT_NOT_REACHED();
833 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BackgroundEdgeOrigin e
)
834 : CSSValue(PrimitiveClass
)
836 init(UnitType::ValueID
);
839 m_value
.valueID
= CSSValueTop
;
842 m_value
.valueID
= CSSValueRight
;
845 m_value
.valueID
= CSSValueBottom
;
848 m_value
.valueID
= CSSValueLeft
;
853 template<> inline CSSPrimitiveValue::operator BackgroundEdgeOrigin() const
856 switch (m_value
.valueID
) {
869 ASSERT_NOT_REACHED();
873 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxSizing e
)
874 : CSSValue(PrimitiveClass
)
876 init(UnitType::ValueID
);
879 m_value
.valueID
= CSSValueBorderBox
;
882 m_value
.valueID
= CSSValueContentBox
;
887 template<> inline CSSPrimitiveValue::operator EBoxSizing() const
890 switch (m_value
.valueID
) {
891 case CSSValueBorderBox
:
893 case CSSValueContentBox
:
899 ASSERT_NOT_REACHED();
903 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e
)
904 : CSSValue(PrimitiveClass
)
906 init(UnitType::ValueID
);
909 m_value
.valueID
= CSSValueNormal
;
912 m_value
.valueID
= CSSValueReverse
;
917 template<> inline CSSPrimitiveValue::operator EBoxDirection() const
920 switch (m_value
.valueID
) {
923 case CSSValueReverse
:
929 ASSERT_NOT_REACHED();
933 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e
)
934 : CSSValue(PrimitiveClass
)
936 init(UnitType::ValueID
);
939 m_value
.valueID
= CSSValueSingle
;
942 m_value
.valueID
= CSSValueMultiple
;
947 template<> inline CSSPrimitiveValue::operator EBoxLines() const
950 switch (m_value
.valueID
) {
953 case CSSValueMultiple
:
959 ASSERT_NOT_REACHED();
963 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e
)
964 : CSSValue(PrimitiveClass
)
966 init(UnitType::ValueID
);
969 m_value
.valueID
= CSSValueHorizontal
;
972 m_value
.valueID
= CSSValueVertical
;
977 template<> inline CSSPrimitiveValue::operator EBoxOrient() const
980 switch (m_value
.valueID
) {
981 case CSSValueHorizontal
:
982 case CSSValueInlineAxis
:
984 case CSSValueVertical
:
985 case CSSValueBlockAxis
:
991 ASSERT_NOT_REACHED();
995 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e
)
996 : CSSValue(PrimitiveClass
)
998 init(UnitType::ValueID
);
1001 m_value
.valueID
= CSSValueLeft
;
1004 m_value
.valueID
= CSSValueRight
;
1007 m_value
.valueID
= CSSValueTop
;
1010 m_value
.valueID
= CSSValueBottom
;
1015 template<> inline CSSPrimitiveValue::operator ECaptionSide() const
1017 ASSERT(isValueID());
1018 switch (m_value
.valueID
) {
1025 case CSSValueBottom
:
1031 ASSERT_NOT_REACHED();
1035 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e
)
1036 : CSSValue(PrimitiveClass
)
1038 init(UnitType::ValueID
);
1041 m_value
.valueID
= CSSValueNone
;
1044 m_value
.valueID
= CSSValueLeft
;
1047 m_value
.valueID
= CSSValueRight
;
1050 m_value
.valueID
= CSSValueBoth
;
1055 template<> inline CSSPrimitiveValue::operator EClear() const
1057 ASSERT(isValueID());
1058 switch (m_value
.valueID
) {
1071 ASSERT_NOT_REACHED();
1075 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e
)
1076 : CSSValue(PrimitiveClass
)
1078 init(UnitType::ValueID
);
1081 m_value
.valueID
= CSSValueAuto
;
1084 m_value
.valueID
= CSSValueCrosshair
;
1086 case CURSOR_DEFAULT
:
1087 m_value
.valueID
= CSSValueDefault
;
1089 case CURSOR_POINTER
:
1090 m_value
.valueID
= CSSValuePointer
;
1093 m_value
.valueID
= CSSValueMove
;
1096 m_value
.valueID
= CSSValueCell
;
1098 case CURSOR_VERTICAL_TEXT
:
1099 m_value
.valueID
= CSSValueVerticalText
;
1101 case CURSOR_CONTEXT_MENU
:
1102 m_value
.valueID
= CSSValueContextMenu
;
1105 m_value
.valueID
= CSSValueAlias
;
1108 m_value
.valueID
= CSSValueCopy
;
1111 m_value
.valueID
= CSSValueNone
;
1113 case CURSOR_PROGRESS
:
1114 m_value
.valueID
= CSSValueProgress
;
1116 case CURSOR_NO_DROP
:
1117 m_value
.valueID
= CSSValueNoDrop
;
1119 case CURSOR_NOT_ALLOWED
:
1120 m_value
.valueID
= CSSValueNotAllowed
;
1122 case CURSOR_ZOOM_IN
:
1123 m_value
.valueID
= CSSValueZoomIn
;
1125 case CURSOR_ZOOM_OUT
:
1126 m_value
.valueID
= CSSValueZoomOut
;
1128 case CURSOR_E_RESIZE
:
1129 m_value
.valueID
= CSSValueEResize
;
1131 case CURSOR_NE_RESIZE
:
1132 m_value
.valueID
= CSSValueNeResize
;
1134 case CURSOR_NW_RESIZE
:
1135 m_value
.valueID
= CSSValueNwResize
;
1137 case CURSOR_N_RESIZE
:
1138 m_value
.valueID
= CSSValueNResize
;
1140 case CURSOR_SE_RESIZE
:
1141 m_value
.valueID
= CSSValueSeResize
;
1143 case CURSOR_SW_RESIZE
:
1144 m_value
.valueID
= CSSValueSwResize
;
1146 case CURSOR_S_RESIZE
:
1147 m_value
.valueID
= CSSValueSResize
;
1149 case CURSOR_W_RESIZE
:
1150 m_value
.valueID
= CSSValueWResize
;
1152 case CURSOR_EW_RESIZE
:
1153 m_value
.valueID
= CSSValueEwResize
;
1155 case CURSOR_NS_RESIZE
:
1156 m_value
.valueID
= CSSValueNsResize
;
1158 case CURSOR_NESW_RESIZE
:
1159 m_value
.valueID
= CSSValueNeswResize
;
1161 case CURSOR_NWSE_RESIZE
:
1162 m_value
.valueID
= CSSValueNwseResize
;
1164 case CURSOR_COL_RESIZE
:
1165 m_value
.valueID
= CSSValueColResize
;
1167 case CURSOR_ROW_RESIZE
:
1168 m_value
.valueID
= CSSValueRowResize
;
1171 m_value
.valueID
= CSSValueText
;
1174 m_value
.valueID
= CSSValueWait
;
1177 m_value
.valueID
= CSSValueHelp
;
1179 case CURSOR_ALL_SCROLL
:
1180 m_value
.valueID
= CSSValueAllScroll
;
1182 case CURSOR_WEBKIT_GRAB
:
1183 m_value
.valueID
= CSSValueWebkitGrab
;
1185 case CURSOR_WEBKIT_GRABBING
:
1186 m_value
.valueID
= CSSValueWebkitGrabbing
;
1191 template<> inline CSSPrimitiveValue::operator ECursor() const
1193 ASSERT(isValueID());
1194 switch (m_value
.valueID
) {
1197 case CSSValueWebkitZoomIn
:
1198 return CURSOR_ZOOM_IN
;
1199 case CSSValueWebkitZoomOut
:
1200 return CURSOR_ZOOM_OUT
;
1204 return static_cast<ECursor
>(m_value
.valueID
- CSSValueAuto
);
1208 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e
)
1209 : CSSValue(PrimitiveClass
)
1211 init(UnitType::ValueID
);
1214 m_value
.valueID
= CSSValueInline
;
1217 m_value
.valueID
= CSSValueBlock
;
1220 m_value
.valueID
= CSSValueListItem
;
1223 m_value
.valueID
= CSSValueInlineBlock
;
1226 m_value
.valueID
= CSSValueTable
;
1229 m_value
.valueID
= CSSValueInlineTable
;
1231 case TABLE_ROW_GROUP
:
1232 m_value
.valueID
= CSSValueTableRowGroup
;
1234 case TABLE_HEADER_GROUP
:
1235 m_value
.valueID
= CSSValueTableHeaderGroup
;
1237 case TABLE_FOOTER_GROUP
:
1238 m_value
.valueID
= CSSValueTableFooterGroup
;
1241 m_value
.valueID
= CSSValueTableRow
;
1243 case TABLE_COLUMN_GROUP
:
1244 m_value
.valueID
= CSSValueTableColumnGroup
;
1247 m_value
.valueID
= CSSValueTableColumn
;
1250 m_value
.valueID
= CSSValueTableCell
;
1253 m_value
.valueID
= CSSValueTableCaption
;
1256 m_value
.valueID
= CSSValueWebkitBox
;
1259 m_value
.valueID
= CSSValueWebkitInlineBox
;
1262 m_value
.valueID
= CSSValueFlex
;
1265 m_value
.valueID
= CSSValueInlineFlex
;
1268 m_value
.valueID
= CSSValueGrid
;
1271 m_value
.valueID
= CSSValueInlineGrid
;
1274 m_value
.valueID
= CSSValueNone
;
1279 template<> inline CSSPrimitiveValue::operator EDisplay() const
1281 ASSERT(isValueID());
1282 if (m_value
.valueID
== CSSValueNone
)
1285 if (m_value
.valueID
== CSSValueWebkitFlex
)
1287 if (m_value
.valueID
== CSSValueWebkitInlineFlex
)
1290 EDisplay display
= static_cast<EDisplay
>(m_value
.valueID
- CSSValueInline
);
1291 ASSERT(display
>= INLINE
&& display
<= NONE
);
1295 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e
)
1296 : CSSValue(PrimitiveClass
)
1298 init(UnitType::ValueID
);
1301 m_value
.valueID
= CSSValueShow
;
1304 m_value
.valueID
= CSSValueHide
;
1309 template<> inline CSSPrimitiveValue::operator EEmptyCell() const
1311 ASSERT(isValueID());
1312 switch (m_value
.valueID
) {
1321 ASSERT_NOT_REACHED();
1325 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexDirection e
)
1326 : CSSValue(PrimitiveClass
)
1328 init(UnitType::ValueID
);
1331 m_value
.valueID
= CSSValueRow
;
1333 case FlowRowReverse
:
1334 m_value
.valueID
= CSSValueRowReverse
;
1337 m_value
.valueID
= CSSValueColumn
;
1339 case FlowColumnReverse
:
1340 m_value
.valueID
= CSSValueColumnReverse
;
1345 template<> inline CSSPrimitiveValue::operator EFlexDirection() const
1347 ASSERT(isValueID());
1348 switch (m_value
.valueID
) {
1351 case CSSValueRowReverse
:
1352 return FlowRowReverse
;
1353 case CSSValueColumn
:
1355 case CSSValueColumnReverse
:
1356 return FlowColumnReverse
;
1361 ASSERT_NOT_REACHED();
1365 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexWrap e
)
1366 : CSSValue(PrimitiveClass
)
1368 init(UnitType::ValueID
);
1371 m_value
.valueID
= CSSValueNowrap
;
1374 m_value
.valueID
= CSSValueWrap
;
1376 case FlexWrapReverse
:
1377 m_value
.valueID
= CSSValueWrapReverse
;
1382 template<> inline CSSPrimitiveValue::operator EFlexWrap() const
1384 ASSERT(isValueID());
1385 switch (m_value
.valueID
) {
1386 case CSSValueNowrap
:
1390 case CSSValueWrapReverse
:
1391 return FlexWrapReverse
;
1396 ASSERT_NOT_REACHED();
1400 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e
)
1401 : CSSValue(PrimitiveClass
)
1403 init(UnitType::ValueID
);
1406 m_value
.valueID
= CSSValueNone
;
1409 m_value
.valueID
= CSSValueLeft
;
1412 m_value
.valueID
= CSSValueRight
;
1417 template<> inline CSSPrimitiveValue::operator EFloat() const
1419 ASSERT(isValueID());
1420 switch (m_value
.valueID
) {
1431 ASSERT_NOT_REACHED();
1435 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineBreak e
)
1436 : CSSValue(PrimitiveClass
)
1438 init(UnitType::ValueID
);
1441 m_value
.valueID
= CSSValueAuto
;
1443 case LineBreakLoose
:
1444 m_value
.valueID
= CSSValueLoose
;
1446 case LineBreakNormal
:
1447 m_value
.valueID
= CSSValueNormal
;
1449 case LineBreakStrict
:
1450 m_value
.valueID
= CSSValueStrict
;
1452 case LineBreakAfterWhiteSpace
:
1453 m_value
.valueID
= CSSValueAfterWhiteSpace
;
1458 template<> inline CSSPrimitiveValue::operator LineBreak() const
1460 ASSERT(isValueID());
1461 switch (m_value
.valueID
) {
1463 return LineBreakAuto
;
1465 return LineBreakLoose
;
1466 case CSSValueNormal
:
1467 return LineBreakNormal
;
1468 case CSSValueStrict
:
1469 return LineBreakStrict
;
1470 case CSSValueAfterWhiteSpace
:
1471 return LineBreakAfterWhiteSpace
;
1476 ASSERT_NOT_REACHED();
1477 return LineBreakAuto
;
1480 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e
)
1481 : CSSValue(PrimitiveClass
)
1483 init(UnitType::ValueID
);
1486 m_value
.valueID
= CSSValueOutside
;
1489 m_value
.valueID
= CSSValueInside
;
1494 template<> inline CSSPrimitiveValue::operator EListStylePosition() const
1496 ASSERT(isValueID());
1497 switch (m_value
.valueID
) {
1498 case CSSValueOutside
:
1500 case CSSValueInside
:
1506 ASSERT_NOT_REACHED();
1510 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e
)
1511 : CSSValue(PrimitiveClass
)
1513 init(UnitType::ValueID
);
1516 m_value
.valueID
= CSSValueArabicIndic
;
1519 m_value
.valueID
= CSSValueArmenian
;
1522 m_value
.valueID
= CSSValueBengali
;
1525 m_value
.valueID
= CSSValueCambodian
;
1528 m_value
.valueID
= CSSValueCircle
;
1530 case CjkEarthlyBranch
:
1531 m_value
.valueID
= CSSValueCjkEarthlyBranch
;
1533 case CjkHeavenlyStem
:
1534 m_value
.valueID
= CSSValueCjkHeavenlyStem
;
1536 case CJKIdeographic
:
1537 m_value
.valueID
= CSSValueCjkIdeographic
;
1539 case DecimalLeadingZero
:
1540 m_value
.valueID
= CSSValueDecimalLeadingZero
;
1542 case DecimalListStyle
:
1543 m_value
.valueID
= CSSValueDecimal
;
1546 m_value
.valueID
= CSSValueDevanagari
;
1549 m_value
.valueID
= CSSValueDisc
;
1551 case EthiopicHalehame
:
1552 m_value
.valueID
= CSSValueEthiopicHalehame
;
1554 case EthiopicHalehameAm
:
1555 m_value
.valueID
= CSSValueEthiopicHalehameAm
;
1557 case EthiopicHalehameTiEt
:
1558 m_value
.valueID
= CSSValueEthiopicHalehameTiEt
;
1560 case EthiopicHalehameTiEr
:
1561 m_value
.valueID
= CSSValueEthiopicHalehameTiEr
;
1564 m_value
.valueID
= CSSValueGeorgian
;
1567 m_value
.valueID
= CSSValueGujarati
;
1570 m_value
.valueID
= CSSValueGurmukhi
;
1573 m_value
.valueID
= CSSValueHangul
;
1575 case HangulConsonant
:
1576 m_value
.valueID
= CSSValueHangulConsonant
;
1578 case KoreanHangulFormal
:
1579 m_value
.valueID
= CSSValueKoreanHangulFormal
;
1581 case KoreanHanjaFormal
:
1582 m_value
.valueID
= CSSValueKoreanHanjaFormal
;
1584 case KoreanHanjaInformal
:
1585 m_value
.valueID
= CSSValueKoreanHanjaInformal
;
1588 m_value
.valueID
= CSSValueHebrew
;
1591 m_value
.valueID
= CSSValueHiragana
;
1594 m_value
.valueID
= CSSValueHiraganaIroha
;
1597 m_value
.valueID
= CSSValueKannada
;
1600 m_value
.valueID
= CSSValueKatakana
;
1603 m_value
.valueID
= CSSValueKatakanaIroha
;
1606 m_value
.valueID
= CSSValueKhmer
;
1609 m_value
.valueID
= CSSValueLao
;
1612 m_value
.valueID
= CSSValueLowerAlpha
;
1615 m_value
.valueID
= CSSValueLowerArmenian
;
1618 m_value
.valueID
= CSSValueLowerGreek
;
1621 m_value
.valueID
= CSSValueLowerLatin
;
1624 m_value
.valueID
= CSSValueLowerRoman
;
1627 m_value
.valueID
= CSSValueMalayalam
;
1630 m_value
.valueID
= CSSValueMongolian
;
1633 m_value
.valueID
= CSSValueMyanmar
;
1636 m_value
.valueID
= CSSValueNone
;
1639 m_value
.valueID
= CSSValueOriya
;
1642 m_value
.valueID
= CSSValuePersian
;
1644 case SimpChineseFormal
:
1645 m_value
.valueID
= CSSValueSimpChineseFormal
;
1647 case SimpChineseInformal
:
1648 m_value
.valueID
= CSSValueSimpChineseInformal
;
1651 m_value
.valueID
= CSSValueSquare
;
1654 m_value
.valueID
= CSSValueTelugu
;
1657 m_value
.valueID
= CSSValueThai
;
1660 m_value
.valueID
= CSSValueTibetan
;
1662 case TradChineseFormal
:
1663 m_value
.valueID
= CSSValueTradChineseFormal
;
1665 case TradChineseInformal
:
1666 m_value
.valueID
= CSSValueTradChineseInformal
;
1669 m_value
.valueID
= CSSValueUpperAlpha
;
1672 m_value
.valueID
= CSSValueUpperArmenian
;
1675 m_value
.valueID
= CSSValueUpperLatin
;
1678 m_value
.valueID
= CSSValueUpperRoman
;
1681 m_value
.valueID
= CSSValueUrdu
;
1686 template<> inline CSSPrimitiveValue::operator EListStyleType() const
1688 ASSERT(isValueID());
1689 switch (m_value
.valueID
) {
1691 return NoneListStyle
;
1693 return static_cast<EListStyleType
>(m_value
.valueID
- CSSValueDisc
);
1697 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e
)
1698 : CSSValue(PrimitiveClass
)
1700 init(UnitType::ValueID
);
1703 m_value
.valueID
= CSSValueCollapse
;
1706 m_value
.valueID
= CSSValueSeparate
;
1709 m_value
.valueID
= CSSValueDiscard
;
1714 template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
1716 ASSERT(isValueID());
1717 switch (m_value
.valueID
) {
1718 case CSSValueCollapse
:
1720 case CSSValueSeparate
:
1722 case CSSValueDiscard
:
1728 ASSERT_NOT_REACHED();
1732 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e
)
1733 : CSSValue(PrimitiveClass
)
1735 init(UnitType::ValueID
);
1738 m_value
.valueID
= CSSValueVisible
;
1741 m_value
.valueID
= CSSValueHidden
;
1744 m_value
.valueID
= CSSValueScroll
;
1747 m_value
.valueID
= CSSValueAuto
;
1750 m_value
.valueID
= CSSValueOverlay
;
1753 m_value
.valueID
= CSSValueWebkitPagedX
;
1756 m_value
.valueID
= CSSValueWebkitPagedY
;
1761 template<> inline CSSPrimitiveValue::operator EOverflow() const
1763 ASSERT(isValueID());
1764 switch (m_value
.valueID
) {
1765 case CSSValueVisible
:
1767 case CSSValueHidden
:
1769 case CSSValueScroll
:
1773 case CSSValueOverlay
:
1775 case CSSValueWebkitPagedX
:
1777 case CSSValueWebkitPagedY
:
1783 ASSERT_NOT_REACHED();
1787 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e
)
1788 : CSSValue(PrimitiveClass
)
1790 init(UnitType::ValueID
);
1793 m_value
.valueID
= CSSValueAuto
;
1796 m_value
.valueID
= CSSValueAlways
;
1799 m_value
.valueID
= CSSValueAvoid
;
1804 template<> inline CSSPrimitiveValue::operator EPageBreak() const
1806 ASSERT(isValueID());
1807 switch (m_value
.valueID
) {
1812 case CSSValueAlways
:
1813 return PBALWAYS
; // CSS2.1: "Conforming user agents may map left/right to always."
1820 ASSERT_NOT_REACHED();
1824 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e
)
1825 : CSSValue(PrimitiveClass
)
1827 init(UnitType::ValueID
);
1829 case StaticPosition
:
1830 m_value
.valueID
= CSSValueStatic
;
1832 case RelativePosition
:
1833 m_value
.valueID
= CSSValueRelative
;
1835 case AbsolutePosition
:
1836 m_value
.valueID
= CSSValueAbsolute
;
1839 m_value
.valueID
= CSSValueFixed
;
1841 case StickyPosition
:
1842 m_value
.valueID
= CSSValueSticky
;
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
;
1858 return FixedPosition
;
1859 case CSSValueSticky
:
1860 return StickyPosition
;
1865 ASSERT_NOT_REACHED();
1866 return StaticPosition
;
1869 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e
)
1870 : CSSValue(PrimitiveClass
)
1872 init(UnitType::ValueID
);
1875 m_value
.valueID
= CSSValueBoth
;
1877 case RESIZE_HORIZONTAL
:
1878 m_value
.valueID
= CSSValueHorizontal
;
1880 case RESIZE_VERTICAL
:
1881 m_value
.valueID
= CSSValueVertical
;
1884 m_value
.valueID
= CSSValueNone
;
1889 template<> inline CSSPrimitiveValue::operator EResize() const
1891 ASSERT(isValueID());
1892 switch (m_value
.valueID
) {
1895 case CSSValueHorizontal
:
1896 return RESIZE_HORIZONTAL
;
1897 case CSSValueVertical
:
1898 return RESIZE_VERTICAL
;
1900 ASSERT_NOT_REACHED(); // Depends on settings, thus should be handled by the caller.
1908 ASSERT_NOT_REACHED();
1912 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e
)
1913 : CSSValue(PrimitiveClass
)
1915 init(UnitType::ValueID
);
1918 m_value
.valueID
= CSSValueAuto
;
1921 m_value
.valueID
= CSSValueFixed
;
1926 template<> inline CSSPrimitiveValue::operator ETableLayout() const
1928 ASSERT(isValueID());
1929 switch (m_value
.valueID
) {
1938 ASSERT_NOT_REACHED();
1942 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e
)
1943 : CSSValue(PrimitiveClass
)
1945 init(UnitType::ValueID
);
1948 m_value
.valueID
= CSSValueStart
;
1951 m_value
.valueID
= CSSValueEnd
;
1954 m_value
.valueID
= CSSValueLeft
;
1957 m_value
.valueID
= CSSValueRight
;
1960 m_value
.valueID
= CSSValueCenter
;
1963 m_value
.valueID
= CSSValueJustify
;
1966 m_value
.valueID
= CSSValueWebkitLeft
;
1969 m_value
.valueID
= CSSValueWebkitRight
;
1972 m_value
.valueID
= CSSValueWebkitCenter
;
1977 template<> inline CSSPrimitiveValue::operator ETextAlign() const
1979 ASSERT(isValueID());
1980 switch (m_value
.valueID
) {
1981 case CSSValueWebkitAuto
: // Legacy -webkit-auto. Eqiuvalent to start.
1987 return static_cast<ETextAlign
>(m_value
.valueID
- CSSValueLeft
);
1991 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextAlignLast e
)
1992 : CSSValue(PrimitiveClass
)
1994 init(UnitType::ValueID
);
1996 case TextAlignLastStart
:
1997 m_value
.valueID
= CSSValueStart
;
1999 case TextAlignLastEnd
:
2000 m_value
.valueID
= CSSValueEnd
;
2002 case TextAlignLastLeft
:
2003 m_value
.valueID
= CSSValueLeft
;
2005 case TextAlignLastRight
:
2006 m_value
.valueID
= CSSValueRight
;
2008 case TextAlignLastCenter
:
2009 m_value
.valueID
= CSSValueCenter
;
2011 case TextAlignLastJustify
:
2012 m_value
.valueID
= CSSValueJustify
;
2014 case TextAlignLastAuto
:
2015 m_value
.valueID
= CSSValueAuto
;
2020 template<> inline CSSPrimitiveValue::operator TextAlignLast() const
2022 ASSERT(isValueID());
2023 switch (m_value
.valueID
) {
2025 return TextAlignLastAuto
;
2027 return TextAlignLastStart
;
2029 return TextAlignLastEnd
;
2031 return TextAlignLastLeft
;
2033 return TextAlignLastRight
;
2034 case CSSValueCenter
:
2035 return TextAlignLastCenter
;
2036 case CSSValueJustify
:
2037 return TextAlignLastJustify
;
2042 ASSERT_NOT_REACHED();
2043 return TextAlignLastAuto
;
2046 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e
)
2047 : CSSValue(PrimitiveClass
)
2049 init(UnitType::ValueID
);
2051 case TextJustifyAuto
:
2052 m_value
.valueID
= CSSValueAuto
;
2054 case TextJustifyNone
:
2055 m_value
.valueID
= CSSValueNone
;
2057 case TextJustifyInterWord
:
2058 m_value
.valueID
= CSSValueInterWord
;
2060 case TextJustifyDistribute
:
2061 m_value
.valueID
= CSSValueDistribute
;
2066 template<> inline CSSPrimitiveValue::operator TextJustify() const
2068 switch (m_value
.valueID
) {
2070 return TextJustifyAuto
;
2072 return TextJustifyNone
;
2073 case CSSValueInterWord
:
2074 return TextJustifyInterWord
;
2075 case CSSValueDistribute
:
2076 return TextJustifyDistribute
;
2081 ASSERT_NOT_REACHED();
2082 return TextJustifyAuto
;
2085 template<> inline CSSPrimitiveValue::operator TextDecoration() const
2087 ASSERT(isValueID());
2088 switch (m_value
.valueID
) {
2090 return TextDecorationNone
;
2091 case CSSValueUnderline
:
2092 return TextDecorationUnderline
;
2093 case CSSValueOverline
:
2094 return TextDecorationOverline
;
2095 case CSSValueLineThrough
:
2096 return TextDecorationLineThrough
;
2098 return TextDecorationBlink
;
2103 ASSERT_NOT_REACHED();
2104 return TextDecorationNone
;
2107 template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const
2109 ASSERT(isValueID());
2110 switch (m_value
.valueID
) {
2112 return TextDecorationStyleSolid
;
2113 case CSSValueDouble
:
2114 return TextDecorationStyleDouble
;
2115 case CSSValueDotted
:
2116 return TextDecorationStyleDotted
;
2117 case CSSValueDashed
:
2118 return TextDecorationStyleDashed
;
2120 return TextDecorationStyleWavy
;
2125 ASSERT_NOT_REACHED();
2126 return TextDecorationStyleSolid
;
2129 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextUnderlinePosition e
)
2130 : CSSValue(PrimitiveClass
)
2132 init(UnitType::ValueID
);
2134 case TextUnderlinePositionAuto
:
2135 m_value
.valueID
= CSSValueAuto
;
2137 case TextUnderlinePositionUnder
:
2138 m_value
.valueID
= CSSValueUnder
;
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
) {
2150 return TextUnderlinePositionAuto
;
2152 return TextUnderlinePositionUnder
;
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
);
2169 m_value
.valueID
= CSSValueNone
;
2172 m_value
.valueID
= CSSValueDisc
;
2175 m_value
.valueID
= CSSValueCircle
;
2178 m_value
.valueID
= CSSValueSquare
;
2183 template<> inline CSSPrimitiveValue::operator ETextSecurity() const
2185 ASSERT(isValueID());
2186 switch (m_value
.valueID
) {
2191 case CSSValueCircle
:
2193 case CSSValueSquare
:
2199 ASSERT_NOT_REACHED();
2203 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e
)
2204 : CSSValue(PrimitiveClass
)
2206 init(UnitType::ValueID
);
2209 m_value
.valueID
= CSSValueCapitalize
;
2212 m_value
.valueID
= CSSValueUppercase
;
2215 m_value
.valueID
= CSSValueLowercase
;
2218 m_value
.valueID
= CSSValueNone
;
2223 template<> inline CSSPrimitiveValue::operator ETextTransform() const
2225 ASSERT(isValueID());
2226 switch (m_value
.valueID
) {
2227 case CSSValueCapitalize
:
2229 case CSSValueUppercase
:
2231 case CSSValueLowercase
:
2239 ASSERT_NOT_REACHED();
2243 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e
)
2244 : CSSValue(PrimitiveClass
)
2246 init(UnitType::ValueID
);
2249 m_value
.valueID
= CSSValueNormal
;
2252 m_value
.valueID
= CSSValueEmbed
;
2255 m_value
.valueID
= CSSValueBidiOverride
;
2258 m_value
.valueID
= CSSValueWebkitIsolate
;
2260 case IsolateOverride
:
2261 m_value
.valueID
= CSSValueWebkitIsolateOverride
;
2264 m_value
.valueID
= CSSValueWebkitPlaintext
;
2269 template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
2271 ASSERT(isValueID());
2272 switch (m_value
.valueID
) {
2273 case CSSValueNormal
:
2277 case CSSValueBidiOverride
:
2279 case CSSValueWebkitIsolate
:
2281 case CSSValueWebkitIsolateOverride
:
2282 return IsolateOverride
;
2283 case CSSValueWebkitPlaintext
:
2289 ASSERT_NOT_REACHED();
2293 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e
)
2294 : CSSValue(PrimitiveClass
)
2296 init(UnitType::ValueID
);
2299 m_value
.valueID
= CSSValueAuto
;
2302 m_value
.valueID
= CSSValueNone
;
2305 m_value
.valueID
= CSSValueElement
;
2312 template<> inline CSSPrimitiveValue::operator EUserDrag() const
2314 ASSERT(isValueID());
2315 switch (m_value
.valueID
) {
2320 case CSSValueElement
:
2321 return DRAG_ELEMENT
;
2326 ASSERT_NOT_REACHED();
2330 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e
)
2331 : CSSValue(PrimitiveClass
)
2333 init(UnitType::ValueID
);
2336 m_value
.valueID
= CSSValueReadOnly
;
2339 m_value
.valueID
= CSSValueReadWrite
;
2341 case READ_WRITE_PLAINTEXT_ONLY
:
2342 m_value
.valueID
= CSSValueReadWritePlaintextOnly
;
2347 template<> inline CSSPrimitiveValue::operator EUserModify() const
2349 ASSERT(isValueID());
2350 switch (m_value
.valueID
) {
2351 case CSSValueReadOnly
:
2353 case CSSValueReadWrite
:
2355 case CSSValueReadWritePlaintextOnly
:
2356 return READ_WRITE_PLAINTEXT_ONLY
;
2361 ASSERT_NOT_REACHED();
2365 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e
)
2366 : CSSValue(PrimitiveClass
)
2368 init(UnitType::ValueID
);
2371 m_value
.valueID
= CSSValueNone
;
2374 m_value
.valueID
= CSSValueText
;
2377 m_value
.valueID
= CSSValueAll
;
2382 template<> inline CSSPrimitiveValue::operator EUserSelect() const
2384 ASSERT(isValueID());
2385 switch (m_value
.valueID
) {
2398 ASSERT_NOT_REACHED();
2402 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVerticalAlign a
)
2403 : CSSValue(PrimitiveClass
)
2405 init(UnitType::ValueID
);
2408 m_value
.valueID
= CSSValueTop
;
2411 m_value
.valueID
= CSSValueBottom
;
2414 m_value
.valueID
= CSSValueMiddle
;
2417 m_value
.valueID
= CSSValueBaseline
;
2420 m_value
.valueID
= CSSValueTextBottom
;
2423 m_value
.valueID
= CSSValueTextTop
;
2426 m_value
.valueID
= CSSValueSub
;
2429 m_value
.valueID
= CSSValueSuper
;
2431 case BASELINE_MIDDLE
:
2432 m_value
.valueID
= CSSValueWebkitBaselineMiddle
;
2435 m_value
.valueID
= CSSValueInvalid
;
2439 template<> inline CSSPrimitiveValue::operator EVerticalAlign() const
2441 ASSERT(isValueID());
2442 switch (m_value
.valueID
) {
2445 case CSSValueBottom
:
2447 case CSSValueMiddle
:
2449 case CSSValueBaseline
:
2451 case CSSValueTextBottom
:
2453 case CSSValueTextTop
:
2459 case CSSValueWebkitBaselineMiddle
:
2460 return BASELINE_MIDDLE
;
2465 ASSERT_NOT_REACHED();
2469 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e
)
2470 : CSSValue(PrimitiveClass
)
2472 init(UnitType::ValueID
);
2475 m_value
.valueID
= CSSValueVisible
;
2478 m_value
.valueID
= CSSValueHidden
;
2481 m_value
.valueID
= CSSValueCollapse
;
2486 template<> inline CSSPrimitiveValue::operator EVisibility() const
2488 ASSERT(isValueID());
2489 switch (m_value
.valueID
) {
2490 case CSSValueHidden
:
2492 case CSSValueVisible
:
2494 case CSSValueCollapse
:
2500 ASSERT_NOT_REACHED();
2504 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e
)
2505 : CSSValue(PrimitiveClass
)
2507 init(UnitType::ValueID
);
2510 m_value
.valueID
= CSSValueNormal
;
2513 m_value
.valueID
= CSSValuePre
;
2516 m_value
.valueID
= CSSValuePreWrap
;
2519 m_value
.valueID
= CSSValuePreLine
;
2522 m_value
.valueID
= CSSValueNowrap
;
2525 m_value
.valueID
= CSSValueWebkitNowrap
;
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
:
2540 case CSSValuePreWrap
:
2542 case CSSValuePreLine
:
2544 case CSSValueNormal
:
2550 ASSERT_NOT_REACHED();
2554 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e
)
2555 : CSSValue(PrimitiveClass
)
2557 init(UnitType::ValueID
);
2559 case NormalWordBreak
:
2560 m_value
.valueID
= CSSValueNormal
;
2562 case BreakAllWordBreak
:
2563 m_value
.valueID
= CSSValueBreakAll
;
2565 case BreakWordBreak
:
2566 m_value
.valueID
= CSSValueBreakWord
;
2568 case KeepAllWordBreak
:
2569 m_value
.valueID
= CSSValueKeepAll
;
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
;
2590 ASSERT_NOT_REACHED();
2591 return NormalWordBreak
;
2594 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflowWrap e
)
2595 : CSSValue(PrimitiveClass
)
2597 init(UnitType::ValueID
);
2599 case NormalOverflowWrap
:
2600 m_value
.valueID
= CSSValueNormal
;
2602 case BreakOverflowWrap
:
2603 m_value
.valueID
= CSSValueBreakWord
;
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
;
2620 ASSERT_NOT_REACHED();
2621 return NormalOverflowWrap
;
2624 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e
)
2625 : CSSValue(PrimitiveClass
)
2627 init(UnitType::ValueID
);
2630 m_value
.valueID
= CSSValueLtr
;
2633 m_value
.valueID
= CSSValueRtl
;
2638 template<> inline CSSPrimitiveValue::operator TextDirection() const
2640 ASSERT(isValueID());
2641 switch (m_value
.valueID
) {
2650 ASSERT_NOT_REACHED();
2654 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e
)
2655 : CSSValue(PrimitiveClass
)
2657 init(UnitType::ValueID
);
2659 case TopToBottomWritingMode
:
2660 m_value
.valueID
= CSSValueHorizontalTb
;
2662 case RightToLeftWritingMode
:
2663 m_value
.valueID
= CSSValueVerticalRl
;
2665 case LeftToRightWritingMode
:
2666 m_value
.valueID
= CSSValueVerticalLr
;
2668 case BottomToTopWritingMode
:
2669 m_value
.valueID
= CSSValueHorizontalBt
;
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
;
2690 ASSERT_NOT_REACHED();
2691 return TopToBottomWritingMode
;
2694 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextCombine e
)
2695 : CSSValue(PrimitiveClass
)
2697 init(UnitType::ValueID
);
2699 case TextCombineNone
:
2700 m_value
.valueID
= CSSValueNone
;
2702 case TextCombineHorizontal
:
2703 m_value
.valueID
= CSSValueHorizontal
;
2708 template<> inline CSSPrimitiveValue::operator TextCombine() const
2710 ASSERT(isValueID());
2711 switch (m_value
.valueID
) {
2713 return TextCombineNone
;
2714 case CSSValueHorizontal
:
2715 return TextCombineHorizontal
;
2720 ASSERT_NOT_REACHED();
2721 return TextCombineNone
;
2724 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position
)
2725 : CSSValue(PrimitiveClass
)
2727 init(UnitType::ValueID
);
2729 case RubyPositionBefore
:
2730 m_value
.valueID
= CSSValueBefore
;
2732 case RubyPositionAfter
:
2733 m_value
.valueID
= CSSValueAfter
;
2738 template<> inline CSSPrimitiveValue::operator RubyPosition() const
2740 ASSERT(isValueID());
2741 switch (m_value
.valueID
) {
2742 case CSSValueBefore
:
2743 return RubyPositionBefore
;
2745 return RubyPositionAfter
;
2750 ASSERT_NOT_REACHED();
2751 return RubyPositionBefore
;
2754 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position
)
2755 : CSSValue(PrimitiveClass
)
2757 init(UnitType::ValueID
);
2759 case TextEmphasisPositionOver
:
2760 m_value
.valueID
= CSSValueOver
;
2762 case TextEmphasisPositionUnder
:
2763 m_value
.valueID
= CSSValueUnder
;
2768 template<> inline CSSPrimitiveValue::operator TextEmphasisPosition() const
2770 ASSERT(isValueID());
2771 switch (m_value
.valueID
) {
2773 return TextEmphasisPositionOver
;
2775 return TextEmphasisPositionUnder
;
2780 ASSERT_NOT_REACHED();
2781 return TextEmphasisPositionOver
;
2784 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOverflow overflow
)
2785 : CSSValue(PrimitiveClass
)
2787 init(UnitType::ValueID
);
2789 case TextOverflowClip
:
2790 m_value
.valueID
= CSSValueClip
;
2792 case TextOverflowEllipsis
:
2793 m_value
.valueID
= CSSValueEllipsis
;
2798 template<> inline CSSPrimitiveValue::operator TextOverflow() const
2800 ASSERT(isValueID());
2801 switch (m_value
.valueID
) {
2803 return TextOverflowClip
;
2804 case CSSValueEllipsis
:
2805 return TextOverflowEllipsis
;
2810 ASSERT_NOT_REACHED();
2811 return TextOverflowClip
;
2814 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisFill fill
)
2815 : CSSValue(PrimitiveClass
)
2817 init(UnitType::ValueID
);
2819 case TextEmphasisFillFilled
:
2820 m_value
.valueID
= CSSValueFilled
;
2822 case TextEmphasisFillOpen
:
2823 m_value
.valueID
= CSSValueOpen
;
2828 template<> inline CSSPrimitiveValue::operator TextEmphasisFill() const
2830 ASSERT(isValueID());
2831 switch (m_value
.valueID
) {
2832 case CSSValueFilled
:
2833 return TextEmphasisFillFilled
;
2835 return TextEmphasisFillOpen
;
2840 ASSERT_NOT_REACHED();
2841 return TextEmphasisFillFilled
;
2844 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisMark mark
)
2845 : CSSValue(PrimitiveClass
)
2847 init(UnitType::ValueID
);
2849 case TextEmphasisMarkDot
:
2850 m_value
.valueID
= CSSValueDot
;
2852 case TextEmphasisMarkCircle
:
2853 m_value
.valueID
= CSSValueCircle
;
2855 case TextEmphasisMarkDoubleCircle
:
2856 m_value
.valueID
= CSSValueDoubleCircle
;
2858 case TextEmphasisMarkTriangle
:
2859 m_value
.valueID
= CSSValueTriangle
;
2861 case TextEmphasisMarkSesame
:
2862 m_value
.valueID
= CSSValueSesame
;
2864 case TextEmphasisMarkNone
:
2865 case TextEmphasisMarkAuto
:
2866 case TextEmphasisMarkCustom
:
2867 ASSERT_NOT_REACHED();
2868 m_value
.valueID
= CSSValueNone
;
2873 template<> inline CSSPrimitiveValue::operator TextEmphasisMark() const
2875 ASSERT(isValueID());
2876 switch (m_value
.valueID
) {
2878 return TextEmphasisMarkNone
;
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
;
2893 ASSERT_NOT_REACHED();
2894 return TextEmphasisMarkNone
;
2897 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextOrientation e
)
2898 : CSSValue(PrimitiveClass
)
2900 init(UnitType::ValueID
);
2902 case TextOrientationSideways
:
2903 m_value
.valueID
= CSSValueSideways
;
2905 case TextOrientationSidewaysRight
:
2906 m_value
.valueID
= CSSValueSidewaysRight
;
2908 case TextOrientationVerticalRight
:
2909 m_value
.valueID
= CSSValueVerticalRight
;
2911 case TextOrientationUpright
:
2912 m_value
.valueID
= CSSValueUpright
;
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
;
2933 ASSERT_NOT_REACHED();
2934 return TextOrientationVerticalRight
;
2937 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e
)
2938 : CSSValue(PrimitiveClass
)
2940 init(UnitType::ValueID
);
2943 m_value
.valueID
= CSSValueNone
;
2946 m_value
.valueID
= CSSValueStroke
;
2949 m_value
.valueID
= CSSValueFill
;
2952 m_value
.valueID
= CSSValuePainted
;
2955 m_value
.valueID
= CSSValueVisible
;
2957 case PE_VISIBLE_STROKE
:
2958 m_value
.valueID
= CSSValueVisibleStroke
;
2960 case PE_VISIBLE_FILL
:
2961 m_value
.valueID
= CSSValueVisibleFill
;
2963 case PE_VISIBLE_PAINTED
:
2964 m_value
.valueID
= CSSValueVisiblePainted
;
2967 m_value
.valueID
= CSSValueAuto
;
2970 m_value
.valueID
= CSSValueAll
;
2972 case PE_BOUNDINGBOX
:
2973 m_value
.valueID
= CSSValueBoundingBox
;
2978 template<> inline CSSPrimitiveValue::operator EPointerEvents() const
2980 ASSERT(isValueID());
2981 switch (m_value
.valueID
) {
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
:
2996 case CSSValuePainted
:
3000 case CSSValueStroke
:
3002 case CSSValueBoundingBox
:
3003 return PE_BOUNDINGBOX
;
3008 ASSERT_NOT_REACHED();
3012 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontDescription::Kerning kerning
)
3013 : CSSValue(PrimitiveClass
)
3015 init(UnitType::ValueID
);
3017 case FontDescription::AutoKerning
:
3018 m_value
.valueID
= CSSValueAuto
;
3020 case FontDescription::NormalKerning
:
3021 m_value
.valueID
= CSSValueNormal
;
3023 case FontDescription::NoneKerning
:
3024 m_value
.valueID
= CSSValueNone
;
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
) {
3037 return FontDescription::AutoKerning
;
3038 case CSSValueNormal
:
3039 return FontDescription::NormalKerning
;
3041 return FontDescription::NoneKerning
;
3046 ASSERT_NOT_REACHED();
3047 return FontDescription::AutoKerning
;
3050 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ObjectFit fit
)
3051 : CSSValue(PrimitiveClass
)
3053 init(UnitType::ValueID
);
3056 m_value
.valueID
= CSSValueFill
;
3058 case ObjectFitContain
:
3059 m_value
.valueID
= CSSValueContain
;
3061 case ObjectFitCover
:
3062 m_value
.valueID
= CSSValueCover
;
3065 m_value
.valueID
= CSSValueNone
;
3067 case ObjectFitScaleDown
:
3068 m_value
.valueID
= CSSValueScaleDown
;
3073 template<> inline CSSPrimitiveValue::operator ObjectFit() const
3075 switch (m_value
.valueID
) {
3077 return ObjectFitFill
;
3078 case CSSValueContain
:
3079 return ObjectFitContain
;
3081 return ObjectFitCover
;
3083 return ObjectFitNone
;
3084 case CSSValueScaleDown
:
3085 return ObjectFitScaleDown
;
3087 ASSERT_NOT_REACHED();
3088 return ObjectFitFill
;
3092 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillSizeType fillSize
)
3093 : CSSValue(PrimitiveClass
)
3095 init(UnitType::ValueID
);
3098 m_value
.valueID
= CSSValueContain
;
3101 m_value
.valueID
= CSSValueCover
;
3104 m_value
.valueID
= CSSValueNone
;
3108 ASSERT_NOT_REACHED();
3112 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing
)
3113 : CSSValue(PrimitiveClass
)
3115 init(UnitType::ValueID
);
3116 switch (smoothing
) {
3118 m_value
.valueID
= CSSValueAuto
;
3121 m_value
.valueID
= CSSValueNone
;
3124 m_value
.valueID
= CSSValueAntialiased
;
3126 case SubpixelAntialiased
:
3127 m_value
.valueID
= CSSValueSubpixelAntialiased
;
3131 ASSERT_NOT_REACHED();
3132 m_value
.valueID
= CSSValueAuto
;
3135 template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
3137 ASSERT(isValueID());
3138 switch (m_value
.valueID
) {
3140 return AutoSmoothing
;
3143 case CSSValueAntialiased
:
3145 case CSSValueSubpixelAntialiased
:
3146 return SubpixelAntialiased
;
3151 ASSERT_NOT_REACHED();
3152 return AutoSmoothing
;
3155 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontWeight weight
)
3156 : CSSValue(PrimitiveClass
)
3158 init(UnitType::ValueID
);
3161 m_value
.valueID
= CSSValue900
;
3164 m_value
.valueID
= CSSValue800
;
3167 m_value
.valueID
= CSSValueBold
;
3170 m_value
.valueID
= CSSValue600
;
3173 m_value
.valueID
= CSSValue500
;
3176 m_value
.valueID
= CSSValueNormal
;
3179 m_value
.valueID
= CSSValue300
;
3182 m_value
.valueID
= CSSValue200
;
3185 m_value
.valueID
= CSSValue100
;
3189 ASSERT_NOT_REACHED();
3190 m_value
.valueID
= CSSValueNormal
;
3193 template<> inline CSSPrimitiveValue::operator FontWeight() const
3195 ASSERT(isValueID());
3196 switch (m_value
.valueID
) {
3198 return FontWeightBold
;
3199 case CSSValueNormal
:
3200 return FontWeightNormal
;
3202 return FontWeight900
;
3204 return FontWeight800
;
3206 return FontWeight700
;
3208 return FontWeight600
;
3210 return FontWeight500
;
3212 return FontWeight400
;
3214 return FontWeight300
;
3216 return FontWeight200
;
3218 return FontWeight100
;
3223 ASSERT_NOT_REACHED();
3224 return FontWeightNormal
;
3227 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontStyle italic
)
3228 : CSSValue(PrimitiveClass
)
3230 init(UnitType::ValueID
);
3232 case FontStyleNormal
:
3233 m_value
.valueID
= CSSValueNormal
;
3235 case FontStyleOblique
:
3236 m_value
.valueID
= CSSValueOblique
;
3238 case FontStyleItalic
:
3239 m_value
.valueID
= CSSValueItalic
;
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
;
3260 ASSERT_NOT_REACHED();
3261 return FontStyleNormal
;
3264 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontStretch stretch
)
3265 : CSSValue(PrimitiveClass
)
3267 init(UnitType::ValueID
);
3269 case FontStretchUltraCondensed
:
3270 m_value
.valueID
= CSSValueUltraCondensed
;
3272 case FontStretchExtraCondensed
:
3273 m_value
.valueID
= CSSValueExtraCondensed
;
3275 case FontStretchCondensed
:
3276 m_value
.valueID
= CSSValueCondensed
;
3278 case FontStretchSemiCondensed
:
3279 m_value
.valueID
= CSSValueSemiCondensed
;
3281 case FontStretchNormal
:
3282 m_value
.valueID
= CSSValueNormal
;
3284 case FontStretchSemiExpanded
:
3285 m_value
.valueID
= CSSValueSemiExpanded
;
3287 case FontStretchExpanded
:
3288 m_value
.valueID
= CSSValueExpanded
;
3290 case FontStretchExtraExpanded
:
3291 m_value
.valueID
= CSSValueExtraExpanded
;
3293 case FontStretchUltraExpanded
:
3294 m_value
.valueID
= CSSValueUltraExpanded
;
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
;
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
;
3340 case FontVariantSmallCaps
:
3341 m_value
.valueID
= CSSValueSmallCaps
;
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
;
3360 ASSERT_NOT_REACHED();
3361 return FontVariantNormal
;
3364 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e
)
3365 : CSSValue(PrimitiveClass
)
3367 init(UnitType::ValueID
);
3369 case AutoTextRendering
:
3370 m_value
.valueID
= CSSValueAuto
;
3373 m_value
.valueID
= CSSValueOptimizeSpeed
;
3375 case OptimizeLegibility
:
3376 m_value
.valueID
= CSSValueOptimizeLegibility
;
3378 case GeometricPrecision
:
3379 m_value
.valueID
= CSSValueGeometricPrecision
;
3384 template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
3386 ASSERT(isValueID());
3387 switch (m_value
.valueID
) {
3389 return AutoTextRendering
;
3390 case CSSValueOptimizeSpeed
:
3391 return OptimizeSpeed
;
3392 case CSSValueOptimizeLegibility
:
3393 return OptimizeLegibility
;
3394 case CSSValueGeometricPrecision
:
3395 return GeometricPrecision
;
3400 ASSERT_NOT_REACHED();
3401 return AutoTextRendering
;
3404 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e
)
3405 : CSSValue(PrimitiveClass
)
3407 init(UnitType::ValueID
);
3410 m_value
.valueID
= CSSValueNone
;
3413 m_value
.valueID
= CSSValueNormal
;
3416 m_value
.valueID
= CSSValueSpellOut
;
3419 m_value
.valueID
= CSSValueDigits
;
3421 case SpeakLiteralPunctuation
:
3422 m_value
.valueID
= CSSValueLiteralPunctuation
;
3424 case SpeakNoPunctuation
:
3425 m_value
.valueID
= CSSValueNoPunctuation
;
3430 template<> inline CSSPrimitiveValue::operator Order() const
3432 ASSERT(isValueID());
3433 switch (m_value
.valueID
) {
3434 case CSSValueLogical
:
3435 return LogicalOrder
;
3436 case CSSValueVisual
:
3442 ASSERT_NOT_REACHED();
3443 return LogicalOrder
;
3446 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e
)
3447 : CSSValue(PrimitiveClass
)
3449 init(UnitType::ValueID
);
3452 m_value
.valueID
= CSSValueLogical
;
3455 m_value
.valueID
= CSSValueVisual
;
3460 template<> inline CSSPrimitiveValue::operator ESpeak() const
3462 ASSERT(isValueID());
3463 switch (m_value
.valueID
) {
3466 case CSSValueNormal
:
3468 case CSSValueSpellOut
:
3469 return SpeakSpellOut
;
3470 case CSSValueDigits
:
3472 case CSSValueLiteralPunctuation
:
3473 return SpeakLiteralPunctuation
;
3474 case CSSValueNoPunctuation
:
3475 return SpeakNoPunctuation
;
3480 ASSERT_NOT_REACHED();
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
;
3492 case WebBlendModeMultiply
:
3493 m_value
.valueID
= CSSValueMultiply
;
3495 case WebBlendModeScreen
:
3496 m_value
.valueID
= CSSValueScreen
;
3498 case WebBlendModeOverlay
:
3499 m_value
.valueID
= CSSValueOverlay
;
3501 case WebBlendModeDarken
:
3502 m_value
.valueID
= CSSValueDarken
;
3504 case WebBlendModeLighten
:
3505 m_value
.valueID
= CSSValueLighten
;
3507 case WebBlendModeColorDodge
:
3508 m_value
.valueID
= CSSValueColorDodge
;
3510 case WebBlendModeColorBurn
:
3511 m_value
.valueID
= CSSValueColorBurn
;
3513 case WebBlendModeHardLight
:
3514 m_value
.valueID
= CSSValueHardLight
;
3516 case WebBlendModeSoftLight
:
3517 m_value
.valueID
= CSSValueSoftLight
;
3519 case WebBlendModeDifference
:
3520 m_value
.valueID
= CSSValueDifference
;
3522 case WebBlendModeExclusion
:
3523 m_value
.valueID
= CSSValueExclusion
;
3525 case WebBlendModeHue
:
3526 m_value
.valueID
= CSSValueHue
;
3528 case WebBlendModeSaturation
:
3529 m_value
.valueID
= CSSValueSaturation
;
3531 case WebBlendModeColor
:
3532 m_value
.valueID
= CSSValueColor
;
3534 case WebBlendModeLuminosity
:
3535 m_value
.valueID
= CSSValueLuminosity
;
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
;
3569 return WebBlendModeHue
;
3570 case CSSValueSaturation
:
3571 return WebBlendModeSaturation
;
3573 return WebBlendModeColor
;
3574 case CSSValueLuminosity
:
3575 return WebBlendModeLuminosity
;
3580 ASSERT_NOT_REACHED();
3581 return WebBlendModeNormal
;
3584 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e
)
3585 : CSSValue(PrimitiveClass
)
3587 init(UnitType::ValueID
);
3590 m_value
.valueID
= CSSValueButt
;
3593 m_value
.valueID
= CSSValueRound
;
3596 m_value
.valueID
= CSSValueSquare
;
3601 template<> inline CSSPrimitiveValue::operator LineCap() const
3603 ASSERT(isValueID());
3604 switch (m_value
.valueID
) {
3609 case CSSValueSquare
:
3615 ASSERT_NOT_REACHED();
3619 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e
)
3620 : CSSValue(PrimitiveClass
)
3622 init(UnitType::ValueID
);
3625 m_value
.valueID
= CSSValueMiter
;
3628 m_value
.valueID
= CSSValueRound
;
3631 m_value
.valueID
= CSSValueBevel
;
3636 template<> inline CSSPrimitiveValue::operator LineJoin() const
3638 ASSERT(isValueID());
3639 switch (m_value
.valueID
) {
3650 ASSERT_NOT_REACHED();
3654 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e
)
3655 : CSSValue(PrimitiveClass
)
3657 init(UnitType::ValueID
);
3660 m_value
.valueID
= CSSValueNonzero
;
3663 m_value
.valueID
= CSSValueEvenodd
;
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
;
3680 ASSERT_NOT_REACHED();
3681 return RULE_NONZERO
;
3685 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e
)
3686 : CSSValue(PrimitiveClass
)
3688 init(UnitType::ValueID
);
3691 m_value
.valueID
= CSSValueAuto
;
3694 m_value
.valueID
= CSSValueBaseline
;
3696 case AB_BEFORE_EDGE
:
3697 m_value
.valueID
= CSSValueBeforeEdge
;
3699 case AB_TEXT_BEFORE_EDGE
:
3700 m_value
.valueID
= CSSValueTextBeforeEdge
;
3703 m_value
.valueID
= CSSValueMiddle
;
3706 m_value
.valueID
= CSSValueCentral
;
3709 m_value
.valueID
= CSSValueAfterEdge
;
3711 case AB_TEXT_AFTER_EDGE
:
3712 m_value
.valueID
= CSSValueTextAfterEdge
;
3714 case AB_IDEOGRAPHIC
:
3715 m_value
.valueID
= CSSValueIdeographic
;
3718 m_value
.valueID
= CSSValueAlphabetic
;
3721 m_value
.valueID
= CSSValueHanging
;
3723 case AB_MATHEMATICAL
:
3724 m_value
.valueID
= CSSValueMathematical
;
3729 template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
3731 ASSERT(isValueID());
3732 switch (m_value
.valueID
) {
3735 case CSSValueBaseline
:
3737 case CSSValueBeforeEdge
:
3738 return AB_BEFORE_EDGE
;
3739 case CSSValueTextBeforeEdge
:
3740 return AB_TEXT_BEFORE_EDGE
;
3741 case CSSValueMiddle
:
3743 case CSSValueCentral
:
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
:
3755 case CSSValueMathematical
:
3756 return AB_MATHEMATICAL
;
3761 ASSERT_NOT_REACHED();
3765 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderCollapse e
)
3766 : CSSValue(PrimitiveClass
)
3768 init(UnitType::ValueID
);
3771 m_value
.valueID
= CSSValueSeparate
;
3774 m_value
.valueID
= CSSValueCollapse
;
3779 template<> inline CSSPrimitiveValue::operator EBorderCollapse() const
3781 ASSERT(isValueID());
3782 switch (m_value
.valueID
) {
3783 case CSSValueSeparate
:
3785 case CSSValueCollapse
:
3791 ASSERT_NOT_REACHED();
3795 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e
)
3796 : CSSValue(PrimitiveClass
)
3798 init(UnitType::ValueID
);
3800 case ImageRenderingAuto
:
3801 m_value
.valueID
= CSSValueAuto
;
3803 case ImageRenderingOptimizeSpeed
:
3804 m_value
.valueID
= CSSValueOptimizeSpeed
;
3806 case ImageRenderingOptimizeQuality
:
3807 m_value
.valueID
= CSSValueOptimizeQuality
;
3809 case ImageRenderingPixelated
:
3810 m_value
.valueID
= CSSValuePixelated
;
3812 case ImageRenderingOptimizeContrast
:
3813 m_value
.valueID
= CSSValueWebkitOptimizeContrast
;
3818 template<> inline CSSPrimitiveValue::operator EImageRendering() const
3820 ASSERT(isValueID());
3821 switch (m_value
.valueID
) {
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
;
3836 ASSERT_NOT_REACHED();
3837 return ImageRenderingAuto
;
3840 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETransformStyle3D e
)
3841 : CSSValue(PrimitiveClass
)
3843 init(UnitType::ValueID
);
3845 case TransformStyle3DFlat
:
3846 m_value
.valueID
= CSSValueFlat
;
3848 case TransformStyle3DPreserve3D
:
3849 m_value
.valueID
= CSSValuePreserve3d
;
3854 template<> inline CSSPrimitiveValue::operator ETransformStyle3D() const
3856 ASSERT(isValueID());
3857 switch (m_value
.valueID
) {
3859 return TransformStyle3DFlat
;
3860 case CSSValuePreserve3d
:
3861 return TransformStyle3DPreserve3D
;
3866 ASSERT_NOT_REACHED();
3867 return TransformStyle3DFlat
;
3870 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBufferedRendering e
)
3871 : CSSValue(PrimitiveClass
)
3873 init(UnitType::ValueID
);
3876 m_value
.valueID
= CSSValueAuto
;
3879 m_value
.valueID
= CSSValueDynamic
;
3882 m_value
.valueID
= CSSValueStatic
;
3887 template<> inline CSSPrimitiveValue::operator EBufferedRendering() const
3889 ASSERT(isValueID());
3890 switch (m_value
.valueID
) {
3893 case CSSValueDynamic
:
3895 case CSSValueStatic
:
3901 ASSERT_NOT_REACHED();
3905 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e
)
3906 : CSSValue(PrimitiveClass
)
3908 init(UnitType::ValueID
);
3911 m_value
.valueID
= CSSValueAuto
;
3914 m_value
.valueID
= CSSValueSRGB
;
3917 m_value
.valueID
= CSSValueLinearRGB
;
3922 template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
3924 ASSERT(isValueID());
3925 switch (m_value
.valueID
) {
3928 case CSSValueLinearRGB
:
3929 return CI_LINEARRGB
;
3936 ASSERT_NOT_REACHED();
3940 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e
)
3941 : CSSValue(PrimitiveClass
)
3943 init(UnitType::ValueID
);
3946 m_value
.valueID
= CSSValueAuto
;
3948 case CR_OPTIMIZESPEED
:
3949 m_value
.valueID
= CSSValueOptimizeSpeed
;
3951 case CR_OPTIMIZEQUALITY
:
3952 m_value
.valueID
= CSSValueOptimizeQuality
;
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
;
3971 ASSERT_NOT_REACHED();
3975 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e
)
3976 : CSSValue(PrimitiveClass
)
3978 init(UnitType::ValueID
);
3981 m_value
.valueID
= CSSValueAuto
;
3984 m_value
.valueID
= CSSValueUseScript
;
3987 m_value
.valueID
= CSSValueNoChange
;
3990 m_value
.valueID
= CSSValueResetSize
;
3993 m_value
.valueID
= CSSValueCentral
;
3996 m_value
.valueID
= CSSValueMiddle
;
3998 case DB_TEXT_BEFORE_EDGE
:
3999 m_value
.valueID
= CSSValueTextBeforeEdge
;
4001 case DB_TEXT_AFTER_EDGE
:
4002 m_value
.valueID
= CSSValueTextAfterEdge
;
4004 case DB_IDEOGRAPHIC
:
4005 m_value
.valueID
= CSSValueIdeographic
;
4008 m_value
.valueID
= CSSValueAlphabetic
;
4011 m_value
.valueID
= CSSValueHanging
;
4013 case DB_MATHEMATICAL
:
4014 m_value
.valueID
= CSSValueMathematical
;
4019 template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
4021 ASSERT(isValueID());
4022 switch (m_value
.valueID
) {
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
:
4037 case CSSValueMathematical
:
4038 return DB_MATHEMATICAL
;
4039 case CSSValueCentral
:
4041 case CSSValueMiddle
:
4043 case CSSValueTextAfterEdge
:
4044 return DB_TEXT_AFTER_EDGE
;
4045 case CSSValueTextBeforeEdge
:
4046 return DB_TEXT_BEFORE_EDGE
;
4051 ASSERT_NOT_REACHED();
4055 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e
)
4056 : CSSValue(PrimitiveClass
)
4058 init(UnitType::ValueID
);
4061 m_value
.valueID
= CSSValueAuto
;
4063 case SR_OPTIMIZESPEED
:
4064 m_value
.valueID
= CSSValueOptimizeSpeed
;
4067 m_value
.valueID
= CSSValueCrispEdges
;
4069 case SR_GEOMETRICPRECISION
:
4070 m_value
.valueID
= CSSValueGeometricPrecision
;
4075 template<> inline CSSPrimitiveValue::operator EShapeRendering() const
4077 ASSERT(isValueID());
4078 switch (m_value
.valueID
) {
4081 case CSSValueOptimizeSpeed
:
4082 return SR_OPTIMIZESPEED
;
4083 case CSSValueCrispEdges
:
4084 return SR_CRISPEDGES
;
4085 case CSSValueGeometricPrecision
:
4086 return SR_GEOMETRICPRECISION
;
4091 ASSERT_NOT_REACHED();
4095 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e
)
4096 : CSSValue(PrimitiveClass
)
4098 init(UnitType::ValueID
);
4101 m_value
.valueID
= CSSValueStart
;
4104 m_value
.valueID
= CSSValueMiddle
;
4107 m_value
.valueID
= CSSValueEnd
;
4112 template<> inline CSSPrimitiveValue::operator ETextAnchor() const
4114 ASSERT(isValueID());
4115 switch (m_value
.valueID
) {
4118 case CSSValueMiddle
:
4126 ASSERT_NOT_REACHED();
4130 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(SVGWritingMode e
)
4131 : CSSValue(PrimitiveClass
)
4133 init(UnitType::ValueID
);
4136 m_value
.valueID
= CSSValueLrTb
;
4139 m_value
.valueID
= CSSValueLr
;
4142 m_value
.valueID
= CSSValueRlTb
;
4145 m_value
.valueID
= CSSValueRl
;
4148 m_value
.valueID
= CSSValueTbRl
;
4151 m_value
.valueID
= CSSValueTb
;
4156 template<> inline CSSPrimitiveValue::operator SVGWritingMode() const
4158 ASSERT(isValueID());
4159 switch (m_value
.valueID
) {
4176 ASSERT_NOT_REACHED();
4180 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVectorEffect e
)
4181 : CSSValue(PrimitiveClass
)
4183 init(UnitType::ValueID
);
4186 m_value
.valueID
= CSSValueNone
;
4188 case VE_NON_SCALING_STROKE
:
4189 m_value
.valueID
= CSSValueNonScalingStroke
;
4194 template<> inline CSSPrimitiveValue::operator EVectorEffect() const
4196 ASSERT(isValueID());
4197 switch (m_value
.valueID
) {
4200 case CSSValueNonScalingStroke
:
4201 return VE_NON_SCALING_STROKE
;
4206 ASSERT_NOT_REACHED();
4210 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPaintOrderType e
)
4211 : CSSValue(PrimitiveClass
)
4213 init(UnitType::ValueID
);
4216 m_value
.valueID
= CSSValueFill
;
4219 m_value
.valueID
= CSSValueStroke
;
4222 m_value
.valueID
= CSSValueMarkers
;
4225 ASSERT_NOT_REACHED();
4226 m_value
.valueID
= CSSValueFill
;
4231 template<> inline CSSPrimitiveValue::operator EPaintOrderType() const
4233 ASSERT(isValueID());
4234 switch (m_value
.valueID
) {
4237 case CSSValueStroke
:
4239 case CSSValueMarkers
:
4245 ASSERT_NOT_REACHED();
4249 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMaskType e
)
4250 : CSSValue(PrimitiveClass
)
4252 init(UnitType::ValueID
);
4255 m_value
.valueID
= CSSValueLuminance
;
4258 m_value
.valueID
= CSSValueAlpha
;
4263 template<> inline CSSPrimitiveValue::operator EMaskType() const
4265 ASSERT(isValueID());
4266 switch (m_value
.valueID
) {
4267 case CSSValueLuminance
:
4268 return MT_LUMINANCE
;
4275 ASSERT_NOT_REACHED();
4276 return MT_LUMINANCE
;
4279 template<> inline CSSPrimitiveValue::operator TouchAction() const
4281 ASSERT(isValueID());
4282 switch (m_value
.valueID
) {
4284 return TouchActionNone
;
4286 return TouchActionAuto
;
4287 case CSSValuePanLeft
:
4288 return TouchActionPanLeft
;
4289 case CSSValuePanRight
:
4290 return TouchActionPanRight
;
4292 return TouchActionPanX
;
4294 return TouchActionPanUp
;
4295 case CSSValuePanDown
:
4296 return TouchActionPanDown
;
4298 return TouchActionPanY
;
4299 case CSSValueManipulation
:
4300 return TouchActionPanX
| TouchActionPanY
| TouchActionPinchZoom
;
4305 ASSERT_NOT_REACHED();
4306 return TouchActionNone
;
4309 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EIsolation i
)
4310 : CSSValue(PrimitiveClass
)
4312 init(UnitType::ValueID
);
4315 m_value
.valueID
= CSSValueAuto
;
4317 case IsolationIsolate
:
4318 m_value
.valueID
= CSSValueIsolate
;
4323 template<> inline CSSPrimitiveValue::operator EIsolation() const
4325 ASSERT(isValueID());
4326 switch (m_value
.valueID
) {
4328 return IsolationAuto
;
4329 case CSSValueIsolate
:
4330 return IsolationIsolate
;
4335 ASSERT_NOT_REACHED();
4336 return IsolationAuto
;
4339 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CSSBoxType cssBox
)
4340 : CSSValue(PrimitiveClass
)
4342 init(UnitType::ValueID
);
4345 m_value
.valueID
= CSSValueMarginBox
;
4348 m_value
.valueID
= CSSValueBorderBox
;
4351 m_value
.valueID
= CSSValuePaddingBox
;
4354 m_value
.valueID
= CSSValueContentBox
;
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
:
4367 case CSSValueBorderBox
:
4369 case CSSValuePaddingBox
:
4371 case CSSValueContentBox
:
4376 ASSERT_NOT_REACHED();
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
;
4388 case ItemPositionStretch
:
4389 m_value
.valueID
= CSSValueStretch
;
4391 case ItemPositionBaseline
:
4392 m_value
.valueID
= CSSValueBaseline
;
4394 case ItemPositionLastBaseline
:
4395 m_value
.valueID
= CSSValueLastBaseline
;
4397 case ItemPositionCenter
:
4398 m_value
.valueID
= CSSValueCenter
;
4400 case ItemPositionStart
:
4401 m_value
.valueID
= CSSValueStart
;
4403 case ItemPositionEnd
:
4404 m_value
.valueID
= CSSValueEnd
;
4406 case ItemPositionSelfStart
:
4407 m_value
.valueID
= CSSValueSelfStart
;
4409 case ItemPositionSelfEnd
:
4410 m_value
.valueID
= CSSValueSelfEnd
;
4412 case ItemPositionFlexStart
:
4413 m_value
.valueID
= CSSValueFlexStart
;
4415 case ItemPositionFlexEnd
:
4416 m_value
.valueID
= CSSValueFlexEnd
;
4418 case ItemPositionLeft
:
4419 m_value
.valueID
= CSSValueLeft
;
4421 case ItemPositionRight
:
4422 m_value
.valueID
= CSSValueRight
;
4427 template<> inline CSSPrimitiveValue::operator ItemPosition() const
4429 switch (m_value
.valueID
) {
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
;
4441 return ItemPositionStart
;
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
;
4453 return ItemPositionLeft
;
4455 return ItemPositionRight
;
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
;
4471 case ContentPositionBaseline
:
4472 m_value
.valueID
= CSSValueBaseline
;
4474 case ContentPositionLastBaseline
:
4475 m_value
.valueID
= CSSValueLastBaseline
;
4477 case ContentPositionCenter
:
4478 m_value
.valueID
= CSSValueCenter
;
4480 case ContentPositionStart
:
4481 m_value
.valueID
= CSSValueStart
;
4483 case ContentPositionEnd
:
4484 m_value
.valueID
= CSSValueEnd
;
4486 case ContentPositionFlexStart
:
4487 m_value
.valueID
= CSSValueFlexStart
;
4489 case ContentPositionFlexEnd
:
4490 m_value
.valueID
= CSSValueFlexEnd
;
4492 case ContentPositionLeft
:
4493 m_value
.valueID
= CSSValueLeft
;
4495 case ContentPositionRight
:
4496 m_value
.valueID
= CSSValueRight
;
4501 template<> inline CSSPrimitiveValue::operator ContentPosition() const
4503 switch (m_value
.valueID
) {
4505 return ContentPositionAuto
;
4506 case CSSValueBaseline
:
4507 return ContentPositionBaseline
;
4508 case CSSValueLastBaseline
:
4509 return ContentPositionLastBaseline
;
4510 case CSSValueCenter
:
4511 return ContentPositionCenter
;
4513 return ContentPositionStart
;
4515 return ContentPositionEnd
;
4516 case CSSValueFlexStart
:
4517 return ContentPositionFlexStart
;
4518 case CSSValueFlexEnd
:
4519 return ContentPositionFlexEnd
;
4521 return ContentPositionLeft
;
4523 return ContentPositionRight
;
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
;
4539 case ContentDistributionSpaceBetween
:
4540 m_value
.valueID
= CSSValueSpaceBetween
;
4542 case ContentDistributionSpaceAround
:
4543 m_value
.valueID
= CSSValueSpaceAround
;
4545 case ContentDistributionSpaceEvenly
:
4546 m_value
.valueID
= CSSValueSpaceEvenly
;
4548 case ContentDistributionStretch
:
4549 m_value
.valueID
= CSSValueStretch
;
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
;
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
;
4580 case OverflowAlignmentTrue
:
4581 m_value
.valueID
= CSSValueTrue
;
4583 case OverflowAlignmentSafe
:
4584 m_value
.valueID
= CSSValueSafe
;
4589 template<> inline CSSPrimitiveValue::operator OverflowAlignment() const
4591 switch (m_value
.valueID
) {
4593 return OverflowAlignmentTrue
;
4595 return OverflowAlignmentSafe
;
4599 ASSERT_NOT_REACHED();
4600 return OverflowAlignmentTrue
;
4603 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollBehavior behavior
)
4604 : CSSValue(PrimitiveClass
)
4606 init(UnitType::ValueID
);
4608 case ScrollBehaviorAuto
:
4609 m_value
.valueID
= CSSValueAuto
;
4611 case ScrollBehaviorSmooth
:
4612 m_value
.valueID
= CSSValueSmooth
;
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()) {
4625 return ScrollBehaviorAuto
;
4626 case CSSValueSmooth
:
4627 return ScrollBehaviorSmooth
;
4631 ASSERT_NOT_REACHED();
4632 return ScrollBehaviorAuto
;
4635 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapType snapType
)
4636 : CSSValue(PrimitiveClass
)
4638 init(UnitType::ValueID
);
4640 case ScrollSnapTypeNone
:
4641 m_value
.valueID
= CSSValueNone
;
4643 case ScrollSnapTypeMandatory
:
4644 m_value
.valueID
= CSSValueMandatory
;
4646 case ScrollSnapTypeProximity
:
4647 m_value
.valueID
= CSSValueProximity
;
4652 template<> inline CSSPrimitiveValue::operator ScrollSnapType() const
4654 switch (getValueID()) {
4656 return ScrollSnapTypeNone
;
4657 case CSSValueMandatory
:
4658 return ScrollSnapTypeMandatory
;
4659 case CSSValueProximity
:
4660 return ScrollSnapTypeProximity
;
4664 ASSERT_NOT_REACHED();
4665 return ScrollSnapTypeNone
;
4668 } // namespace blink