mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibWeb: Split StyleValueList out of StyleValue.{h,cpp}
This commit is contained in:
parent
3a2de67c7b
commit
4c54c5d3dd
Notes:
sideshowbarker
2024-07-17 06:51:10 +09:00
Author: https://github.com/AtkinsSJ
Commit: 4c54c5d3dd
Pull-request: https://github.com/SerenityOS/serenity/pull/18040
12 changed files with 102 additions and 63 deletions
|
@ -48,6 +48,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
||||
|
@ -1149,34 +1150,6 @@ ErrorOr<void> PositionValue::serialize(StringBuilder& builder) const
|
|||
return {};
|
||||
}
|
||||
|
||||
bool StyleValueList::Properties::operator==(Properties const& other) const
|
||||
{
|
||||
return separator == other.separator && values.span() == other.values.span();
|
||||
}
|
||||
|
||||
ErrorOr<String> StyleValueList::to_string() const
|
||||
{
|
||||
auto separator = ""sv;
|
||||
switch (m_properties.separator) {
|
||||
case Separator::Space:
|
||||
separator = " "sv;
|
||||
break;
|
||||
case Separator::Comma:
|
||||
separator = ", "sv;
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
StringBuilder builder;
|
||||
for (size_t i = 0; i < m_properties.values.size(); ++i) {
|
||||
TRY(builder.try_append(TRY(m_properties.values[i]->to_string())));
|
||||
if (i != m_properties.values.size() - 1)
|
||||
TRY(builder.try_append(separator));
|
||||
}
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
Optional<CSS::Length> absolutized_length(CSS::Length const& length, CSSPixelRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, CSSPixels font_size, CSSPixels root_font_size, CSSPixels line_height, CSSPixels root_line_height)
|
||||
{
|
||||
if (length.is_px())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue