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:
parent
55a5c46253
commit
63814ffebf
3 changed files with 34 additions and 26 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue