From 330e124166be5ce2871050aa026677489ec1763a Mon Sep 17 00:00:00 2001 From: stasoid Date: Mon, 11 Sep 2023 22:36:59 +0600 Subject: [PATCH 1/3] discard invalid color declarations --- src/style.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/style.cpp b/src/style.cpp index 5f267bfae..5642d36c4 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -242,7 +242,7 @@ void style::add_property(string_id name, const string& val, const string& baseur add_parsed_property(_border_top_width_, width); add_parsed_property(_border_bottom_width_, width); } - else + else if (web_color::is_color(token, container)) { web_color _color = web_color::from_string(token, container); property_value color(_color, important); @@ -275,7 +275,7 @@ void style::add_property(string_id name, const string& val, const string& baseur property_value width(parse_border_width(token), important); add_parsed_property(_id(_s(name) + "-width"), width); } - else + else if (web_color::is_color(token, container)) { web_color color = web_color::from_string(token, container); add_parsed_property(_id(_s(name) + "-color"), property_value(color, important)); @@ -338,11 +338,12 @@ void style::add_property(string_id name, const string& val, const string& baseur case _border_bottom_color_: case _border_left_color_: case _border_right_color_: - { - web_color color = web_color::from_string(val, container); - add_parsed_property(name, property_value(color, important)); + if (web_color::is_color(val, container)) + { + web_color color = web_color::from_string(val, container); + add_parsed_property(name, property_value(color, important)); + } break; - } // Parse border radius shorthand properties case _border_bottom_left_radius_: From 01f186a1720217820e87427d1c3f425c19394ad1 Mon Sep 17 00:00:00 2001 From: stasoid Date: Mon, 11 Sep 2023 22:40:00 +0600 Subject: [PATCH 2/3] fix win32_container after commit 3b896be --- containers/win32/win32_container.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/containers/win32/win32_container.cpp b/containers/win32/win32_container.cpp index d48530071..520b1ed23 100644 --- a/containers/win32/win32_container.cpp +++ b/containers/win32/win32_container.cpp @@ -280,20 +280,7 @@ void win32_container::draw_background( uint_ptr _hdc, const std::vector Date: Mon, 11 Sep 2023 23:43:35 +0600 Subject: [PATCH 3/3] test for commit 330e1241 --- test/render/css-2-invalid-color.htm | 11 +++++++++++ test/render/css-2-invalid-color.htm.png | Bin 0 -> 151 bytes 2 files changed, 11 insertions(+) create mode 100644 test/render/css-2-invalid-color.htm create mode 100644 test/render/css-2-invalid-color.htm.png diff --git a/test/render/css-2-invalid-color.htm b/test/render/css-2-invalid-color.htm new file mode 100644 index 000000000..df396aafd --- /dev/null +++ b/test/render/css-2-invalid-color.htm @@ -0,0 +1,11 @@ + + + + +

text \ No newline at end of file diff --git a/test/render/css-2-invalid-color.htm.png b/test/render/css-2-invalid-color.htm.png new file mode 100644 index 0000000000000000000000000000000000000000..69dfe83c1665d53883b5dde516ac32617f903d05 GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0y~yU{(OK4H%h$5M4 zba4!+V0?RVBX5HNk4vE1N1iD>M>*uqUG+^>RI%D+vQO!k|I7V)b_@&$&i}Mk>bAQ2 y*<0ms`AajGd8Y+5k54kXqY`8&$H>57UB&1i#uvZO%cCD?E`z75pUXO@geCxH!!a=c literal 0 HcmV?d00001