Implement CSS `display: flow-root` (modern clearfix)
[WebKit-https.git] / Source / WebCore / css / CSSPrimitiveValueMappings.h
index 54b4e56..9d120ca 100644 (file)
@@ -42,6 +42,7 @@
 #include "SVGRenderStyleDefs.h"
 #include "TextFlags.h"
 #include "ThemeTypes.h"
+#include "TouchAction.h"
 #include "UnicodeBidi.h"
 #include "WritingMode.h"
 #include <wtf/MathExtras.h>
@@ -621,6 +622,16 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
         m_value.valueID = CSSValueApplePayButton;
         break;
 #endif
+#if ENABLE(INPUT_TYPE_COLOR)
+    case ColorWellPart:
+        m_value.valueID = CSSValueColorWell;
+        break;
+#endif
+#if ENABLE(DATALIST_ELEMENT)
+    case ListButtonPart:
+        m_value.valueID = CSSValueListButton;
+        break;
+#endif
     }
 }
 
@@ -1398,6 +1409,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(DisplayType e)
     case DisplayType::Contents:
         m_value.valueID = CSSValueContents;
         break;
+    case DisplayType::FlowRoot:
+        m_value.valueID = CSSValueFlowRoot;
+        break;
     }
 }
 
@@ -1633,6 +1647,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineBreak e)
     case LineBreak::AfterWhiteSpace:
         m_value.valueID = CSSValueAfterWhiteSpace;
         break;
+    case LineBreak::Anywhere:
+        m_value.valueID = CSSValueAnywhere;
+        break;
     }
 }
 
@@ -1674,6 +1691,8 @@ template<> inline CSSPrimitiveValue::operator LineBreak() const
         return LineBreak::Strict;
     case CSSValueAfterWhiteSpace:
         return LineBreak::AfterWhiteSpace;
+    case CSSValueAnywhere:
+        return LineBreak::Anywhere;
     default:
         break;
     }
@@ -2159,9 +2178,6 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Overflow e)
     case Overflow::Auto:
         m_value.valueID = CSSValueAuto;
         break;
-    case Overflow::Overlay:
-        m_value.valueID = CSSValueOverlay;
-        break;
     case Overflow::PagedX:
         m_value.valueID = CSSValueWebkitPagedX;
         break;
@@ -2182,10 +2198,9 @@ template<> inline CSSPrimitiveValue::operator Overflow() const
         return Overflow::Hidden;
     case CSSValueScroll:
         return Overflow::Scroll;
+    case CSSValueOverlay:
     case CSSValueAuto:
         return Overflow::Auto;
-    case CSSValueOverlay:
-        return Overflow::Overlay;
     case CSSValueWebkitPagedX:
         return Overflow::PagedX;
     case CSSValueWebkitPagedY:
@@ -2328,7 +2343,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(PositionType e)
         m_value.valueID = CSSValueFixed;
         break;
     case PositionType::Sticky:
-        m_value.valueID = CSSValueWebkitSticky;
+        m_value.valueID = CSSValueSticky;
         break;
     }
 }
@@ -2346,6 +2361,7 @@ template<> inline CSSPrimitiveValue::operator PositionType() const
         return PositionType::Absolute;
     case CSSValueFixed:
         return PositionType::Fixed;
+    case CSSValueSticky:
     case CSSValueWebkitSticky:
         return PositionType::Sticky;
     default:
@@ -2630,42 +2646,41 @@ template<> inline CSSPrimitiveValue::operator TextDecorationStyle() const
     return TextDecorationStyle::Solid;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OptionSet<TextUnderlinePosition> e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextUnderlinePosition position)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
-    switch (static_cast<TextUnderlinePosition>(e.toRaw())) {
+    switch (position) {
     case TextUnderlinePosition::Auto:
         m_value.valueID = CSSValueAuto;
         break;
-    case TextUnderlinePosition::Alphabetic:
-        m_value.valueID = CSSValueAlphabetic;
-        break;
     case TextUnderlinePosition::Under:
         m_value.valueID = CSSValueUnder;
         break;
+    case TextUnderlinePosition::FromFont:
+        m_value.valueID = CSSValueFromFont;
+        break;
     }
 
     // FIXME: Implement support for 'under left' and 'under right' values.
 }
 
-template<> inline CSSPrimitiveValue::operator OptionSet<TextUnderlinePosition>() const
+template<> inline CSSPrimitiveValue::operator TextUnderlinePosition() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
     case CSSValueAuto:
         return TextUnderlinePosition::Auto;
-    case CSSValueAlphabetic:
-        return TextUnderlinePosition::Alphabetic;
     case CSSValueUnder:
         return TextUnderlinePosition::Under;
+    case CSSValueFromFont:
+        return TextUnderlinePosition::FromFont;
     default:
         break;
     }
 
     // FIXME: Implement support for 'under left' and 'under right' values.
-
     ASSERT_NOT_REACHED();
     return TextUnderlinePosition::Auto;
 }
@@ -3045,6 +3060,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WhiteSpace e)
     case WhiteSpace::KHTMLNoWrap:
         m_value.valueID = CSSValueWebkitNowrap;
         break;
+    case WhiteSpace::BreakSpaces:
+        m_value.valueID = CSSValueBreakSpaces;
+        break;
     }
 }
 
@@ -3065,6 +3083,8 @@ template<> inline CSSPrimitiveValue::operator WhiteSpace() const
         return WhiteSpace::PreLine;
     case CSSValueNormal:
         return WhiteSpace::Normal;
+    case CSSValueBreakSpaces:
+        return WhiteSpace::BreakSpaces;
     default:
         break;
     }
@@ -3087,7 +3107,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WordBreak e)
     case WordBreak::KeepAll:
         m_value.valueID = CSSValueKeepAll;
         break;
-    case WordBreak::Break:
+    case WordBreak::BreakWord:
         m_value.valueID = CSSValueBreakWord;
         break;
     }
@@ -3103,7 +3123,7 @@ template<> inline CSSPrimitiveValue::operator WordBreak() const
     case CSSValueKeepAll:
         return WordBreak::KeepAll;
     case CSSValueBreakWord:
-        return WordBreak::Break;
+        return WordBreak::BreakWord;
     case CSSValueNormal:
         return WordBreak::Normal;
     default:
@@ -3150,10 +3170,10 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (e) {
-    case LTR:
+    case TextDirection::LTR:
         m_value.valueID = CSSValueLtr;
         break;
-    case RTL:
+    case TextDirection::RTL:
         m_value.valueID = CSSValueRtl;
         break;
     }
@@ -3165,15 +3185,15 @@ template<> inline CSSPrimitiveValue::operator TextDirection() const
 
     switch (m_value.valueID) {
     case CSSValueLtr:
-        return LTR;
+        return TextDirection::LTR;
     case CSSValueRtl:
-        return RTL;
+        return TextDirection::RTL;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return LTR;
+    return TextDirection::LTR;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e)
@@ -3605,16 +3625,16 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothi
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (smoothing) {
-    case AutoSmoothing:
+    case FontSmoothingMode::AutoSmoothing:
         m_value.valueID = CSSValueAuto;
         return;
-    case NoSmoothing:
+    case FontSmoothingMode::NoSmoothing:
         m_value.valueID = CSSValueNone;
         return;
-    case Antialiased:
+    case FontSmoothingMode::Antialiased:
         m_value.valueID = CSSValueAntialiased;
         return;
-    case SubpixelAntialiased:
+    case FontSmoothingMode::SubpixelAntialiased:
         m_value.valueID = CSSValueSubpixelAntialiased;
         return;
     }
@@ -3629,19 +3649,19 @@ template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
 
     switch (m_value.valueID) {
     case CSSValueAuto:
-        return AutoSmoothing;
+        return FontSmoothingMode::AutoSmoothing;
     case CSSValueNone:
-        return NoSmoothing;
+        return FontSmoothingMode::NoSmoothing;
     case CSSValueAntialiased:
-        return Antialiased;
+        return FontSmoothingMode::Antialiased;
     case CSSValueSubpixelAntialiased:
-        return SubpixelAntialiased;
+        return FontSmoothingMode::SubpixelAntialiased;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return AutoSmoothing;
+    return FontSmoothingMode::AutoSmoothing;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
@@ -3649,10 +3669,10 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (smallCaps) {
-    case FontSmallCapsOff:
+    case FontSmallCaps::Off:
         m_value.valueID = CSSValueNormal;
         return;
-    case FontSmallCapsOn:
+    case FontSmallCaps::On:
         m_value.valueID = CSSValueSmallCaps;
         return;
     }
@@ -3667,14 +3687,14 @@ template<> inline CSSPrimitiveValue::operator FontSmallCaps() const
 
     switch (m_value.valueID) {
     case CSSValueSmallCaps:
-        return FontSmallCapsOn;
+        return FontSmallCaps::On;
     case CSSValueNormal:
-        return FontSmallCapsOff;
+        return FontSmallCaps::Off;
     default:
         break;
     }
     ASSERT_NOT_REACHED();
-    return FontSmallCapsOff;
+    return FontSmallCaps::Off;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
@@ -3682,16 +3702,16 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (e) {
-    case AutoTextRendering:
+    case TextRenderingMode::AutoTextRendering:
         m_value.valueID = CSSValueAuto;
         break;
-    case OptimizeSpeed:
+    case TextRenderingMode::OptimizeSpeed:
         m_value.valueID = CSSValueOptimizeSpeed;
         break;
-    case OptimizeLegibility:
+    case TextRenderingMode::OptimizeLegibility:
         m_value.valueID = CSSValueOptimizeLegibility;
         break;
-    case GeometricPrecision:
+    case TextRenderingMode::GeometricPrecision:
         m_value.valueID = CSSValueGeometricPrecision;
         break;
     }
@@ -3703,19 +3723,19 @@ template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
 
     switch (m_value.valueID) {
     case CSSValueAuto:
-        return AutoTextRendering;
+        return TextRenderingMode::AutoTextRendering;
     case CSSValueOptimizeSpeed:
-        return OptimizeSpeed;
+        return TextRenderingMode::OptimizeSpeed;
     case CSSValueOptimizeLegibility:
-        return OptimizeLegibility;
+        return TextRenderingMode::OptimizeLegibility;
     case CSSValueGeometricPrecision:
-        return GeometricPrecision;
+        return TextRenderingMode::GeometricPrecision;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return AutoTextRendering;
+    return TextRenderingMode::AutoTextRendering;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Hyphens hyphens)
@@ -3903,58 +3923,58 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BlendMode blendMode)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (blendMode) {
-    case BlendModeNormal:
+    case BlendMode::Normal:
         m_value.valueID = CSSValueNormal;
         break;
-    case BlendModeMultiply:
+    case BlendMode::Multiply:
         m_value.valueID = CSSValueMultiply;
         break;
-    case BlendModeScreen:
+    case BlendMode::Screen:
         m_value.valueID = CSSValueScreen;
         break;
-    case BlendModeOverlay:
+    case BlendMode::Overlay:
         m_value.valueID = CSSValueOverlay;
         break;
-    case BlendModeDarken:
+    case BlendMode::Darken:
         m_value.valueID = CSSValueDarken;
         break;
-    case BlendModeLighten:
+    case BlendMode::Lighten:
         m_value.valueID = CSSValueLighten;
         break;
-    case BlendModeColorDodge:
+    case BlendMode::ColorDodge:
         m_value.valueID = CSSValueColorDodge;
         break;
-    case BlendModeColorBurn:
+    case BlendMode::ColorBurn:
         m_value.valueID = CSSValueColorBurn;
         break;
-    case BlendModeHardLight:
+    case BlendMode::HardLight:
         m_value.valueID = CSSValueHardLight;
         break;
-    case BlendModeSoftLight:
+    case BlendMode::SoftLight:
         m_value.valueID = CSSValueSoftLight;
         break;
-    case BlendModeDifference:
+    case BlendMode::Difference:
         m_value.valueID = CSSValueDifference;
         break;
-    case BlendModeExclusion:
+    case BlendMode::Exclusion:
         m_value.valueID = CSSValueExclusion;
         break;
-    case BlendModeHue:
+    case BlendMode::Hue:
         m_value.valueID = CSSValueHue;
         break;
-    case BlendModeSaturation:
+    case BlendMode::Saturation:
         m_value.valueID = CSSValueSaturation;
         break;
-    case BlendModeColor:
+    case BlendMode::Color:
         m_value.valueID = CSSValueColor;
         break;
-    case BlendModeLuminosity:
+    case BlendMode::Luminosity:
         m_value.valueID = CSSValueLuminosity;
         break;
-    case BlendModePlusDarker:
+    case BlendMode::PlusDarker:
         m_value.valueID = CSSValuePlusDarker;
         break;
-    case BlendModePlusLighter:
+    case BlendMode::PlusLighter:
         m_value.valueID = CSSValuePlusLighter;
         break;
     }
@@ -3966,47 +3986,47 @@ template<> inline CSSPrimitiveValue::operator BlendMode() const
 
     switch (m_value.valueID) {
     case CSSValueNormal:
-        return BlendModeNormal;
+        return BlendMode::Normal;
     case CSSValueMultiply:
-        return BlendModeMultiply;
+        return BlendMode::Multiply;
     case CSSValueScreen:
-        return BlendModeScreen;
+        return BlendMode::Screen;
     case CSSValueOverlay:
-        return BlendModeOverlay;
+        return BlendMode::Overlay;
     case CSSValueDarken:
-        return BlendModeDarken;
+        return BlendMode::Darken;
     case CSSValueLighten:
-        return BlendModeLighten;
+        return BlendMode::Lighten;
     case CSSValueColorDodge:
-        return BlendModeColorDodge;
+        return BlendMode::ColorDodge;
     case CSSValueColorBurn:
-        return BlendModeColorBurn;
+        return BlendMode::ColorBurn;
     case CSSValueHardLight:
-        return BlendModeHardLight;
+        return BlendMode::HardLight;
     case CSSValueSoftLight:
-        return BlendModeSoftLight;
+        return BlendMode::SoftLight;
     case CSSValueDifference:
-        return BlendModeDifference;
+        return BlendMode::Difference;
     case CSSValueExclusion:
-        return BlendModeExclusion;
+        return BlendMode::Exclusion;
     case CSSValueHue:
-        return BlendModeHue;
+        return BlendMode::Hue;
     case CSSValueSaturation:
-        return BlendModeSaturation;
+        return BlendMode::Saturation;
     case CSSValueColor:
-        return BlendModeColor;
+        return BlendMode::Color;
     case CSSValueLuminosity:
-        return BlendModeLuminosity;
+        return BlendMode::Luminosity;
     case CSSValuePlusDarker:
-        return BlendModePlusDarker;
+        return BlendMode::PlusDarker;
     case CSSValuePlusLighter:
-        return BlendModePlusLighter;
+        return BlendMode::PlusLighter;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return BlendModeNormal;
+    return BlendMode::Normal;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Isolation isolation)
@@ -5230,7 +5250,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextZoom textZoom)
     m_value.valueID = CSSValueNormal;
 }
 
-#if ENABLE(TOUCH_EVENTS)
+#if ENABLE(POINTER_EVENTS)
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchAction touchAction)
     : CSSValue(PrimitiveClass)
 {
@@ -5242,10 +5262,22 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TouchAction touchAction)
     case TouchAction::Manipulation:
         m_value.valueID = CSSValueManipulation;
         break;
+    case TouchAction::None:
+        m_value.valueID = CSSValueNone;
+        break;
+    case TouchAction::PanX:
+        m_value.valueID = CSSValuePanX;
+        break;
+    case TouchAction::PanY:
+        m_value.valueID = CSSValuePanY;
+        break;
+    case TouchAction::PinchZoom:
+        m_value.valueID = CSSValuePinchZoom;
+        break;
     }
 }
 
-template<> inline CSSPrimitiveValue::operator TouchAction() const
+template<> inline CSSPrimitiveValue::operator OptionSet<TouchAction>() const
 {
     ASSERT(isValueID());
     switch (m_value.valueID) {
@@ -5253,6 +5285,14 @@ template<> inline CSSPrimitiveValue::operator TouchAction() const
         return TouchAction::Auto;
     case CSSValueManipulation:
         return TouchAction::Manipulation;
+    case CSSValueNone:
+        return TouchAction::None;
+    case CSSValuePanX:
+        return TouchAction::PanX;
+    case CSSValuePanY:
+        return TouchAction::PanY;
+    case CSSValuePinchZoom:
+        return TouchAction::PinchZoom;
     default:
         break;
     }
@@ -5468,6 +5508,17 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ApplePayButtonType e)
     case ApplePayButtonType::Donate:
         m_value.valueID = CSSValueDonate;
         break;
+#if ENABLE(APPLE_PAY_SESSION_V4)
+    case ApplePayButtonType::CheckOut:
+        m_value.valueID = CSSValueCheckOut;
+        break;
+    case ApplePayButtonType::Book:
+        m_value.valueID = CSSValueBook;
+        break;
+    case ApplePayButtonType::Subscribe:
+        m_value.valueID = CSSValueSubscribe;
+        break;
+#endif
 
     default:
         ASSERT_NOT_REACHED();
@@ -5487,6 +5538,14 @@ template<> inline CSSPrimitiveValue::operator ApplePayButtonType() const
         return ApplePayButtonType::SetUp;
     case CSSValueDonate:
         return ApplePayButtonType::Donate;
+#if ENABLE(APPLE_PAY_SESSION_V4)
+    case CSSValueCheckOut:
+        return ApplePayButtonType::CheckOut;
+    case CSSValueBook:
+        return ApplePayButtonType::Book;
+    case CSSValueSubscribe:
+        return ApplePayButtonType::Subscribe;
+#endif
     default:
         break;
     }