diff --git a/style/styled_node.cpp b/style/styled_node.cpp index 42d63086..27adb8c4 100644 --- a/style/styled_node.cpp +++ b/style/styled_node.cpp @@ -437,7 +437,7 @@ int StyledNode::get_font_size_property() const { auto it = std::ranges::find_if(rbegin(n->properties), rend(n->properties), [](auto const &v) { return v.first == css::PropertyId::FontSize; }); - if (it != rend(n->properties)) { + if (it != rend(n->properties) && it->second != "inherit" && it->second != "unset") { return {{it->second, n}}; } } diff --git a/style/styled_node_test.cpp b/style/styled_node_test.cpp index 34faacec..86e65d28 100644 --- a/style/styled_node_test.cpp +++ b/style/styled_node_test.cpp @@ -190,6 +190,12 @@ int main() { expect_eq(child.get_property(), 10); expect_eq(root.get_property(), 50); + // inherit, unset + child.properties[0] = {css::PropertyId::FontSize, "unset"}; + expect_eq(child.get_property(), 50); + child.properties[0] = {css::PropertyId::FontSize, "inherit"}; + expect_eq(child.get_property(), 50); + // % child.properties[0] = {css::PropertyId::FontSize, "100%"}; expect_eq(child.get_property(), 50);