diff --git a/LibHTML/CSS/Selector.cpp b/LibHTML/CSS/Selector.cpp new file mode 100644 index 00000000000..de7a87d1d42 --- /dev/null +++ b/LibHTML/CSS/Selector.cpp @@ -0,0 +1,9 @@ +#include + +Selector::Selector() +{ +} + +Selector::~Selector() +{ +} diff --git a/LibHTML/CSS/Selector.h b/LibHTML/CSS/Selector.h new file mode 100644 index 00000000000..cc87e346539 --- /dev/null +++ b/LibHTML/CSS/Selector.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +class Selector { +public: + Selector(); + ~Selector(); + + struct Component { + enum class Type { Invalid, TagName, Id, Class }; + Type type { Type::Invalid }; + String value; + }; + + const Vector& components() const { return m_components; } + +private: + Vector m_components; +}; diff --git a/LibHTML/CSS/StyleDeclaration.cpp b/LibHTML/CSS/StyleDeclaration.cpp new file mode 100644 index 00000000000..187c6ab7669 --- /dev/null +++ b/LibHTML/CSS/StyleDeclaration.cpp @@ -0,0 +1,9 @@ +#include + +StyleDeclaration::StyleDeclaration() +{ +} + +StyleDeclaration::~StyleDeclaration() +{ +} diff --git a/LibHTML/CSS/StyleDeclaration.h b/LibHTML/CSS/StyleDeclaration.h new file mode 100644 index 00000000000..558e0849258 --- /dev/null +++ b/LibHTML/CSS/StyleDeclaration.h @@ -0,0 +1,17 @@ +#pragma once + +#include +#include + +class StyleDeclaration { +public: + StyleDeclaration(); + ~StyleDeclaration(); + + const String& property_name() const { return m_property_name; } + const StyleValue& value() const { return *m_value; } + +public: + String m_property_name; + RetainPtr m_value; +}; diff --git a/LibHTML/CSS/StyleRule.cpp b/LibHTML/CSS/StyleRule.cpp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/LibHTML/CSS/StyleRule.h b/LibHTML/CSS/StyleRule.h new file mode 100644 index 00000000000..657d851d951 --- /dev/null +++ b/LibHTML/CSS/StyleRule.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include +#include + +class StyleRule { +public: + StyleRule(); + ~StyleRule(); + +private: + Vector m_selectors; + Vector m_declarations; +}; diff --git a/LibHTML/CSS/StyleSheet.cpp b/LibHTML/CSS/StyleSheet.cpp new file mode 100644 index 00000000000..840b46835b5 --- /dev/null +++ b/LibHTML/CSS/StyleSheet.cpp @@ -0,0 +1,9 @@ +#include + +StyleSheet::StyleSheet() +{ +} + +StyleSheet::~StyleSheet() +{ +} diff --git a/LibHTML/CSS/StyleSheet.h b/LibHTML/CSS/StyleSheet.h new file mode 100644 index 00000000000..7089b59e671 --- /dev/null +++ b/LibHTML/CSS/StyleSheet.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +class StyleSheet { +public: + StyleSheet(); + ~StyleSheet(); + + const Vector& rules() const { return m_rules; } + +private: + Vector m_rules; +}; diff --git a/LibHTML/CSS/StyleValue.cpp b/LibHTML/CSS/StyleValue.cpp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/LibHTML/CSS/StyleValue.h b/LibHTML/CSS/StyleValue.h new file mode 100644 index 00000000000..1796f86b0bc --- /dev/null +++ b/LibHTML/CSS/StyleValue.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +class StyleValue : public Retainable { +public: + virtual ~StyleValue(); + + enum Type { + Invalid, + Inherit, + Initial, + Primitive, + }; + + Type type() const { return m_type; } + +protected: + explicit StyleValue(Type); + +private: + Type m_type { Type::Invalid }; +}; diff --git a/LibHTML/Makefile b/LibHTML/Makefile index 1b068adc31e..1e3039fb72e 100644 --- a/LibHTML/Makefile +++ b/LibHTML/Makefile @@ -6,6 +6,11 @@ LIBHTML_OBJS = \ DOM/Element.o \ DOM/Document.o \ DOM/Text.o \ + CSS/Selector.o \ + CSS/StyleSheet.o \ + CSS/StyleRule.o \ + CSS/StyleDeclaration.o \ + CSS/StyleValue.o \ Parser/Parser.o \ Layout/LayoutNode.o \ Layout/LayoutText.o \