mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:38:12 +00:00
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.
This commit is contained in:
parent
e96b3315ad
commit
7df62c64b7
1 changed files with 2 additions and 2 deletions
|
@ -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 }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue