Sfoglia il codice sorgente

LibWeb: Set border width to zero if style is none

Egor Ananyin 4 anni fa
parent
commit
86290c0e4e
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      Userland/Libraries/LibWeb/Layout/Node.cpp

+ 4 - 1
Userland/Libraries/LibWeb/Layout/Node.cpp

@@ -307,9 +307,12 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
     computed_values.set_padding(specified_style.length_box(CSS::PropertyID::PaddingLeft, CSS::PropertyID::PaddingTop, CSS::PropertyID::PaddingRight, CSS::PropertyID::PaddingBottom, CSS::Length::make_px(0)));
 
     auto do_border_style = [&](CSS::BorderData& border, CSS::PropertyID width_property, CSS::PropertyID color_property, CSS::PropertyID style_property) {
-        border.width = specified_style.length_or_fallback(width_property, {}).resolved_or_zero(*this, 0).to_px(*this);
         border.color = specified_style.color_or_fallback(color_property, document(), Color::Transparent);
         border.line_style = specified_style.line_style(style_property).value_or(CSS::LineStyle::None);
+        if (border.line_style == CSS::LineStyle::None)
+            border.width = 0;
+        else
+            border.width = specified_style.length_or_fallback(width_property, {}).resolved_or_zero(*this, 0).to_px(*this);
     };
 
     do_border_style(computed_values.border_left(), CSS::PropertyID::BorderLeftWidth, CSS::PropertyID::BorderLeftColor, CSS::PropertyID::BorderLeftStyle);