mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
LibGfx+LibWeb: Move "transparent" keyword into Color::from_string()
It seemed odd to have this one color handled separately, when `Color::from_string()` implements all other CSS colors.
This commit is contained in:
parent
2ab089fa21
commit
21b65de1ec
Notes:
sideshowbarker
2024-07-18 01:59:15 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/21b65de1ec4 Pull-request: https://github.com/SerenityOS/serenity/pull/10599 Reviewed-by: https://github.com/awesomekling
@ -245,6 +245,9 @@ Optional<Color> Color::from_string(const StringView& string)
|
||||
{ 0x000000, nullptr }
|
||||
};
|
||||
|
||||
if (string == "transparent")
|
||||
return Color::from_rgba(0x00000000);
|
||||
|
||||
for (size_t i = 0; !web_colors[i].name.is_null(); ++i) {
|
||||
if (string == web_colors[i].name)
|
||||
return Color::from_rgb(web_colors[i].color);
|
||||
|
@ -2087,8 +2087,6 @@ Optional<Color> Parser::parse_color(ParsingContext const&, StyleComponentValueRu
|
||||
// https://www.w3.org/TR/css-color-3/
|
||||
if (component_value.is(Token::Type::Ident)) {
|
||||
auto ident = component_value.token().ident();
|
||||
if (ident.equals_ignoring_case("transparent"))
|
||||
return Color::from_rgba(0x00000000);
|
||||
|
||||
auto color = Color::from_string(ident.to_string().to_lowercase());
|
||||
if (color.has_value())
|
||||
|
Loading…
Reference in New Issue
Block a user