1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibWeb: Make default CSS font settings match other browsers better

Let's make 16px the default font size instead of 10px. This makes our
layout results match those of other engines in many more cases.

Also make the h1-h6 element styles use relative (em) font sizes, also
matching other browsers.
This commit is contained in:
Andreas Kling 2022-09-08 12:41:42 +02:00
parent 3dc82d2fa5
commit 8f0a48ef23
3 changed files with 33 additions and 9 deletions

View file

@ -855,7 +855,7 @@ void StyleComputer::compute_defaulted_values(StyleProperties& style, DOM::Elemen
float StyleComputer::root_element_font_size() const
{
constexpr float default_root_element_font_size = 10;
constexpr float default_root_element_font_size = 16;
auto const* root_element = m_document.first_child_of_type<HTML::HTMLHtmlElement>();
if (!root_element)
@ -921,7 +921,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
bool bold = weight > Gfx::FontWeight::Regular;
float font_size_in_px = 10;
float font_size_in_px = 16;
if (font_size->is_identifier()) {
switch (static_cast<IdentifierStyleValue const&>(*font_size).id()) {
@ -930,7 +930,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
case CSS::ValueID::Small:
case CSS::ValueID::Medium:
// FIXME: Should be based on "user's default font size"
font_size_in_px = 10;
font_size_in_px = 16;
break;
case CSS::ValueID::Large:
case CSS::ValueID::XLarge: