mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-27 10:00:24 +00:00
LibGfx: Fix parsing of rgba values
Trim whitespace of the alpha component before calling parse_first_floating_point, which doesn't handle it.
This commit is contained in:
parent
1bbfe4630d
commit
0ad131e13d
Notes:
sideshowbarker
2024-07-17 02:29:45 +09:00
Author: https://github.com/axgallo Commit: https://github.com/SerenityOS/serenity/commit/0ad131e13d Pull-request: https://github.com/SerenityOS/serenity/pull/18994
1 changed files with 3 additions and 2 deletions
|
@ -64,8 +64,9 @@ static Optional<Color> parse_rgba_color(StringView string)
|
|||
auto b = parts[2].to_int().value_or(256);
|
||||
|
||||
double alpha = 0;
|
||||
char const* start = parts[3].characters_without_null_termination();
|
||||
auto alpha_result = parse_first_floating_point(start, start + parts[3].length());
|
||||
auto alpha_str = parts[3].trim_whitespace();
|
||||
char const* start = alpha_str.characters_without_null_termination();
|
||||
auto alpha_result = parse_first_floating_point(start, start + alpha_str.length());
|
||||
if (alpha_result.parsed_value())
|
||||
alpha = alpha_result.value;
|
||||
|
||||
|
|
Loading…
Reference in a new issue