1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 06:15:07 +00:00

LibHTML: Move CSS value parsing to CSSParser.

This commit is contained in:
Andreas Kling 2019-07-04 15:49:16 +02:00
parent 55a5c46253
commit 63814ffebf
3 changed files with 34 additions and 26 deletions

View file

@ -8,18 +8,3 @@ StyleValue::StyleValue(Type type)
StyleValue::~StyleValue()
{
}
NonnullRefPtr<StyleValue> StyleValue::parse(const StringView& str)
{
String string(str);
bool ok;
int as_int = string.to_int(ok);
if (ok)
return adopt(*new LengthStyleValue(Length(as_int, Length::Type::Absolute)));
unsigned as_uint = string.to_uint(ok);
if (ok)
return adopt(*new LengthStyleValue(Length(as_uint, Length::Type::Absolute)));
if (string == "auto")
return adopt(*new LengthStyleValue(Length()));
return adopt(*new StringStyleValue(str));
}