mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Don't serialize resolved CSS color values as named colors
With all the plumbing in place, we can handle this quirk at the serialization layer. This allows us to remove the pass where StyleComputer would loop over all computed values and replace any color values with new values stripped of their original name strings.
This commit is contained in:
parent
b3c4b4fd97
commit
6d7bb074fc
Notes:
github-actions[bot]
2024-12-07 08:31:53 +00:00
Author: https://github.com/awesomekling
Commit: 6d7bb074fc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2820
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 2 additions and 13 deletions
|
@ -70,10 +70,10 @@ bool CSSRGB::equals(CSSStyleValue const& other) const
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/css-color-4/#serializing-sRGB-values
|
||||
String CSSRGB::to_string(SerializationMode) const
|
||||
String CSSRGB::to_string(SerializationMode mode) const
|
||||
{
|
||||
// FIXME: Do this properly, taking unresolved calculated values into account.
|
||||
if (m_properties.name.has_value())
|
||||
if (mode != SerializationMode::ResolvedValue && m_properties.name.has_value())
|
||||
return m_properties.name.value().to_string().to_ascii_lowercase();
|
||||
return serialize_a_srgb_value(to_color({}));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue