ladybird/Libraries/LibWeb/CSS/StyleValues/RatioStyleValue.cpp
Callum Law 9f8ffc3ad0 LibWeb: Move RatioStyleValue methods into implementation file
We will be expanding this class in a later commit so it makes sense to
have an implementation file
2026-03-24 14:00:01 +00:00

29 lines
827 B
C++

/*
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "RatioStyleValue.h"
#include <LibWeb/CSS/Parser/ComponentValue.h>
namespace Web::CSS {
void RatioStyleValue::serialize(StringBuilder& builder, SerializationMode) const
{
builder.append(m_ratio.to_string());
}
Vector<Parser::ComponentValue> RatioStyleValue::tokenize() const
{
return {
Parser::Token::create_number(Number { Number::Type::Number, m_ratio.numerator() }),
Parser::Token::create_whitespace(" "_string),
Parser::Token::create_delim('/'),
Parser::Token::create_whitespace(" "_string),
Parser::Token::create_number(Number { Number::Type::Number, m_ratio.denominator() }),
};
}
}