srctree

Robin Linden parent 59c2d855 0c53e72c
css: Add the color-scheme property

inlinesplit
css/property_id.cpp added: 15, removed: 3, total 12
@@ -44,6 +44,7 @@ std::map<std::string_view, PropertyId> const known_properties{
{"border-top-width"sv, PropertyId::BorderTopWidth},
{"caption-side"sv, PropertyId::CaptionSide},
{"color"sv, PropertyId::Color},
{"color-scheme"sv, PropertyId::ColorScheme},
{"cursor"sv, PropertyId::Cursor},
{"direction"sv, PropertyId::Direction},
{"display"sv, PropertyId::Display},
@@ -130,6 +131,9 @@ std::map<css::PropertyId, std::string_view> const initial_values{
// https://developer.mozilla.org/en-US/docs/Web/CSS/color#formal_definition
{css::PropertyId::Color, "canvastext"sv},
 
// https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme#formal_definition
{css::PropertyId::ColorScheme, "normal"sv},
 
// https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis#formal_definition
{css::PropertyId::FlexBasis, "auto"sv},
// https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#formal_definition
 
css/property_id.h added: 15, removed: 3, total 12
@@ -41,6 +41,7 @@ enum class PropertyId {
BorderTopWidth,
CaptionSide,
Color,
ColorScheme,
Cursor,
Direction,
Display,
@@ -132,6 +133,7 @@ constexpr bool is_inherited(PropertyId id) {
case css::PropertyId::BorderSpacing:
case css::PropertyId::CaptionSide:
case css::PropertyId::Color:
case css::PropertyId::ColorScheme:
case css::PropertyId::Cursor:
case css::PropertyId::Direction:
case css::PropertyId::Elevation:
 
css/property_id_test.cpp added: 15, removed: 3, total 12
@@ -35,5 +35,11 @@ int main() {
}
});
 
s.add_test("initial_value", [](etest::IActions &a) {
a.expect_eq(css::initial_value(css::PropertyId::Width), "auto");
a.expect_eq(css::initial_value(css::PropertyId::Color), "canvastext");
a.expect_eq(css::initial_value(css::PropertyId::ColorScheme), "normal");
});
 
return s.run();
}