mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibWeb: Don't crash on percentage values for CSS stroke-width
Fixes a crash when loading https://vercel.com/
This commit is contained in:
parent
beb55f726f
commit
6cb9d755d9
3 changed files with 10 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/EdgeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
#include <LibWeb/CSS/StyleValues/URLStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -665,8 +666,10 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
// https://svgwg.org/svg2-draft/coords.html#TermUserUnits
|
||||
if (stroke_width->is_numeric())
|
||||
computed_values.set_stroke_width(CSS::Length::make_px(stroke_width->to_number()));
|
||||
else
|
||||
else if (stroke_width->is_length())
|
||||
computed_values.set_stroke_width(stroke_width->to_length());
|
||||
else if (stroke_width->is_percentage())
|
||||
computed_values.set_stroke_width(CSS::LengthPercentage { stroke_width->as_percentage().percentage() });
|
||||
|
||||
computed_values.set_fill_opacity(computed_style.fill_opacity());
|
||||
computed_values.set_stroke_opacity(computed_style.stroke_opacity());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue