Просмотр исходного кода

LibWeb: Don't override computed font-weight with value from used font

The CSS font-weight is king, even if we load a font that has another
weight value in its OpenType tables.
Andreas Kling 2 лет назад
Родитель
Сommit
10020ba182
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      Userland/Libraries/LibWeb/CSS/StyleComputer.cpp

+ 1 - 1
Userland/Libraries/LibWeb/CSS/StyleComputer.cpp

@@ -2321,7 +2321,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
     auto found_font = compute_font_for_style_values(element, pseudo_element, font_family, font_size, font_style, font_weight, font_stretch);
 
     style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(found_font->pixel_size())).release_value_but_fixme_should_propagate_errors(), nullptr);
-    style.set_property(CSS::PropertyID::FontWeight, NumberStyleValue::create(found_font->weight()).release_value_but_fixme_should_propagate_errors(), nullptr);
+    style.set_property(CSS::PropertyID::FontWeight, NumberStyleValue::create(font_weight->to_font_weight()).release_value_but_fixme_should_propagate_errors());
 
     style.set_computed_font(found_font.release_nonnull());