mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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
Notes:
sideshowbarker
2024-07-16 22:34:39 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6cb9d755d9 Pull-request: https://github.com/SerenityOS/serenity/pull/18955
3 changed files with 10 additions and 1 deletions
|
@ -0,0 +1,3 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x16 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html><style>
|
||||
body { stroke-width: 5%; }
|
||||
</style>
|
|
@ -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…
Reference in a new issue