diff options
-rw-r--r-- | Base/res/html/misc/fonts.html | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Base/res/html/misc/fonts.html b/Base/res/html/misc/fonts.html index 99f5a1387f..02381a9f7f 100644 --- a/Base/res/html/misc/fonts.html +++ b/Base/res/html/misc/fonts.html @@ -37,8 +37,8 @@ <section> <p style="font-family: 'Liberation Serif', cursive; font-size: calc(120% + 10px);">font-family: 'Liberation Serif', cursive; font-size: calc(120% + 10px);</p> <p style="font: calc(120% + 10px) 'Liberation Serif', cursive;">font: calc(120% + 10px) 'Liberation Serif', cursive;</p> - <p style="font-family: 'Liberation Serif', cursive; font-weight: calc(200 * 4);">font-family: 'Liberation Serif', cursive; font-weight: calc(200 * 4);</p> - <p style="font: calc(200*4) 20px 'Liberation Serif', cursive;">font: calc(200 * 4) 20px 'Liberation Serif', cursive;</p> + <p style="font-family: 'Liberation Serif', cursive; font-weight: calc((200 * 3) + 100);">font-family: 'Liberation Serif', cursive; font-weight: calc((200 * 3) + 100);</p> + <p style="font: calc((200 * 3) + 100) 20px 'Liberation Serif', cursive;">font: calc((200 * 3) + 100) 20px 'Liberation Serif', cursive;</p> </section> <h2>Fallback</h2> diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 41325d09ea..61617cdce0 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -714,8 +714,11 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele weight = Gfx::FontWeight::Bold; else weight = Gfx::FontWeight::Black; + } else if (font_weight->is_calculated()) { + auto maybe_weight = font_weight->as_calculated().resolve_integer(); + if (maybe_weight.has_value()) + weight = maybe_weight.value(); } - // FIXME: calc() for font-weight bool bold = weight > Gfx::FontWeight::Regular; @@ -777,6 +780,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele } if (maybe_length.has_value()) { // FIXME: Support font-size: calc(...) + // Theoretically we can do this now, but to resolve it we need a layout_node which we might not have. :^( if (!maybe_length->is_calculated()) { auto px = maybe_length.value().to_px(viewport_rect, font_metrics, root_font_size); if (px != 0) |