mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-16 07:11:52 +00:00
LibHTML: Respect the CSS "color" property for text
Also remove the color values from the ComputedStyle object and get them via StyleProperties instead. At the moment, we only handle colors that Color::from_string() parses.
This commit is contained in:
parent
b8cab2a934
commit
62cbaa74f3
Notes:
sideshowbarker
2024-07-19 11:54:23 +09:00
Author: https://github.com/awesomekling
Commit: 62cbaa74f3
7 changed files with 56 additions and 10 deletions
|
@ -28,3 +28,13 @@ String StyleProperties::string_or_fallback(const StringView& property_name, cons
|
|||
return fallback;
|
||||
return value.value()->to_string();
|
||||
}
|
||||
|
||||
Color StyleProperties::color_or_fallback(const StringView& property_name, Color fallback) const
|
||||
{
|
||||
auto value = property(property_name);
|
||||
if (!value.has_value())
|
||||
return fallback;
|
||||
if (value.value()->type() != StyleValue::Type::Color)
|
||||
return fallback;
|
||||
return static_cast<ColorStyleValue&>(*value.value()).color();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue