LibWeb: Parse the border-image-slice property

This commit is contained in:
Tim Ledbetter 2025-06-10 16:58:54 +01:00 committed by Sam Atkins
commit 245905b833
Notes: github-actions[bot] 2025-07-03 09:21:11 +00:00
27 changed files with 1132 additions and 765 deletions

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "BorderImageSliceStyleValue.h"
#include <LibWeb/CSS/Serialize.h>
namespace Web::CSS {
String BorderImageSliceStyleValue::to_string(SerializationMode mode) const
{
StringBuilder builder;
if (first_is_equal_to_all_of(top(), right(), bottom(), left())) {
builder.append(top()->to_string(mode));
} else if (top() == bottom() && right() == left()) {
builder.appendff("{} {}", top()->to_string(mode), right()->to_string(mode));
} else if (left() == right()) {
builder.appendff("{} {} {}", top()->to_string(mode), right()->to_string(mode), bottom()->to_string(mode));
} else {
builder.appendff("{} {} {} {}", top()->to_string(mode), right()->to_string(mode), bottom()->to_string(mode), left()->to_string(mode));
}
if (fill())
builder.append(" fill"sv);
return MUST(builder.to_string());
}
}