Selaa lähdekoodia

LibWeb: Treat width/height on <svg> element as HTML dimension values

This might not be entirely correct, but neither was using the completely
ad-hoc parse_html_length(), and this is the last user of that API so
let's move off of it.
Andreas Kling 3 vuotta sitten
vanhempi
commit
7df62c64b7
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp

+ 2 - 2
Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp

@@ -28,14 +28,14 @@ RefPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleP
 void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) const
 {
     // Width defaults to 100%
-    if (auto width_value = parse_html_length(document(), attribute("width"))) {
+    if (auto width_value = parse_dimension_value(attribute(SVG::AttributeNames::width))) {
         style.set_property(CSS::PropertyID::Width, width_value.release_nonnull());
     } else {
         style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }));
     }
 
     // Height defaults to 100%
-    if (auto height_value = parse_html_length(document(), attribute("height"))) {
+    if (auto height_value = parse_dimension_value(attribute(SVG::AttributeNames::width))) {
         style.set_property(CSS::PropertyID::Height, height_value.release_nonnull());
     } else {
         style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }));