@@ -1022,14 +1022,24 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
1022
1022
{ CSS::ValueID::XLarge, 1.5 },
1023
1023
{ CSS::ValueID::XxLarge, 2.0 },
1024
1024
{ CSS::ValueID::XxxLarge, 3.0 },
1025
+ { CSS::ValueID::Smaller, 0.8 },
1026
+ { CSS::ValueID::Larger, 1.25 },
1025
1027
};
1028
+
1026
1029
auto const identifier = static_cast <IdentifierStyleValue const &>(*font_size).id ();
1030
+
1031
+ // https://w3c.github.io/csswg-drafts/css-fonts/#valdef-font-size-relative-size
1032
+ // TODO: If the parent element has a keyword font size in the absolute size keyword mapping table,
1033
+ // larger may compute the font size to the next entry in the table,
1034
+ // and smaller may compute the font size to the previous entry in the table.
1027
1035
if (identifier == CSS::ValueID::Smaller || identifier == CSS::ValueID::Larger) {
1028
- // FIXME: Should be based on parent element
1029
- } else {
1030
- auto const multiplier = absolute_size_mapping.get (identifier).value_or (1.0 );
1031
- font_size_in_px *= multiplier;
1036
+ if (parent_element && parent_element->computed_css_values ()) {
1037
+ font_size_in_px = parent_element->computed_css_values ()->computed_font ().pixel_metrics ().size ;
1038
+ }
1032
1039
}
1040
+ auto const multiplier = absolute_size_mapping.get (identifier).value_or (1.0 );
1041
+ font_size_in_px *= multiplier;
1042
+
1033
1043
} else {
1034
1044
float root_font_size = root_element_font_size ();
1035
1045
0 commit comments