srctree

Robin Linden parent e718bfaa 5a36f394
css: Fix border shorthand not allowing dot as the first char of width

inlinesplit
css/parser.h added: 15, removed: 3, total 12
@@ -295,7 +295,7 @@ private:
return BorderPropertyType::Style;
}
 
if (v.find_first_of("0123456789") == 0 || is_in_array<border_width_keywords>(v)) {
if (v.find_first_of(dot_and_digits) == 0 || is_in_array<border_width_keywords>(v)) {
return BorderPropertyType::Width;
}
 
 
css/parser_test.cpp added: 15, removed: 3, total 12
@@ -942,6 +942,18 @@ int main() {
});
});
 
etest::test("parser: border shorthand, width, first character a dot", [] {
auto rules = css::parse("p { border-right: .3em; }");
require(rules.size() == 1);
auto const &p = rules[0];
expect_eq(p.declarations,
std::map<css::PropertyId, std::string>{
{css::PropertyId::BorderRightColor, "currentcolor"s},
{css::PropertyId::BorderRightStyle, "none"s},
{css::PropertyId::BorderRightWidth, ".3em"s},
});
});
 
etest::test("parser: border shorthand, too many values", [] {
auto rules = css::parse("p { border-top: outset #123 none solid; }");
require(rules.size() == 1);