1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibWeb: Properly serialize shadow colors

This commit is contained in:
Matthew Olsson 2024-03-03 09:19:45 -07:00 committed by Alexander Kalenik
parent da18957063
commit 8502b7ee9f
2 changed files with 5 additions and 3 deletions

View file

@ -1 +1 @@
0 calc(5px - 10px) 0 calc(2px + 3px) => #000000ff 0px -5px 0px 5px 0 calc(5px - 10px) 0 calc(2px + 3px) => rgb(0, 0, 0) 0px -5px 0px 5px

View file

@ -7,14 +7,16 @@
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include "ShadowStyleValue.h" #include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
namespace Web::CSS { namespace Web::CSS {
String ShadowStyleValue::to_string() const String ShadowStyleValue::to_string() const
{ {
StringBuilder builder; StringBuilder builder;
builder.appendff("{} {} {} {} {}", m_properties.color.to_string(), m_properties.offset_x->to_string(), m_properties.offset_y->to_string(), m_properties.blur_radius->to_string(), m_properties.spread_distance->to_string()); serialize_a_srgb_value(builder, m_properties.color);
builder.appendff(" {} {} {} {}", m_properties.offset_x->to_string(), m_properties.offset_y->to_string(), m_properties.blur_radius->to_string(), m_properties.spread_distance->to_string());
if (m_properties.placement == ShadowPlacement::Inner) if (m_properties.placement == ShadowPlacement::Inner)
builder.append(" inset"sv); builder.append(" inset"sv);
return MUST(builder.to_string()); return MUST(builder.to_string());