mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibHTML: Implement enough of the CSS parser to parse the default stylesheet.
This commit is contained in:
parent
7e1cb86da7
commit
4573eb226e
3 changed files with 71 additions and 5 deletions
|
@ -0,0 +1,15 @@
|
|||
#include "StyleValue.h"
|
||||
|
||||
StyleValue::StyleValue(Type type)
|
||||
: m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
StyleValue::~StyleValue()
|
||||
{
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleValue> StyleValue::parse(const StringView& str)
|
||||
{
|
||||
return adopt(*new PrimitiveStyleValue(str));
|
||||
}
|
|
@ -1,9 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
class StyleValue : public RefCounted<StyleValue> {
|
||||
public:
|
||||
static NonnullRefPtr<StyleValue> parse(const StringView&);
|
||||
|
||||
virtual ~StyleValue();
|
||||
|
||||
enum Type {
|
||||
|
@ -21,3 +26,18 @@ protected:
|
|||
private:
|
||||
Type m_type { Type::Invalid };
|
||||
};
|
||||
|
||||
class PrimitiveStyleValue : public StyleValue {
|
||||
public:
|
||||
virtual ~PrimitiveStyleValue() override {}
|
||||
PrimitiveStyleValue(const String& string)
|
||||
: StyleValue(Type::Primitive)
|
||||
, m_string(string)
|
||||
{
|
||||
}
|
||||
|
||||
String to_string() const { return m_string; }
|
||||
|
||||
private:
|
||||
String m_string;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue