mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Deduplicate "ident is color" check
Reuse the check from IdentifierStyleValue in the CSS Parser, instead of duplicating it. This might not be the ideal place to put it, but it works for now.
This commit is contained in:
Notes:
sideshowbarker
2024-07-16 22:54:10 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/1dcd63be05 Pull-request: https://github.com/SerenityOS/serenity/pull/20743
@@ -19,9 +19,9 @@ String IdentifierStyleValue::to_string() const
|
||||
return MUST(String::from_utf8(CSS::string_from_value_id(m_id)));
|
||||
}
|
||||
|
||||
bool IdentifierStyleValue::has_color() const
|
||||
bool IdentifierStyleValue::is_color(ValueID value_id)
|
||||
{
|
||||
switch (m_id) {
|
||||
switch (value_id) {
|
||||
case ValueID::Currentcolor:
|
||||
case ValueID::LibwebLink:
|
||||
case ValueID::LibwebPaletteActiveLink:
|
||||
@@ -84,6 +84,11 @@ bool IdentifierStyleValue::has_color() const
|
||||
}
|
||||
}
|
||||
|
||||
bool IdentifierStyleValue::has_color() const
|
||||
{
|
||||
return is_color(m_id);
|
||||
}
|
||||
|
||||
Color IdentifierStyleValue::to_color(Optional<Layout::NodeWithStyle const&> node) const
|
||||
{
|
||||
if (id() == CSS::ValueID::Currentcolor) {
|
||||
|
||||
Reference in New Issue
Block a user