diff --git a/LibHTML/CSS/Length.h b/LibHTML/CSS/Length.h
new file mode 100644
index 00000000000..d0483c6fdf1
--- /dev/null
+++ b/LibHTML/CSS/Length.h
@@ -0,0 +1,26 @@
+#pragma once
+
+class Length {
+public:
+ enum class Type {
+ Auto,
+ Absolute,
+ };
+
+ Length() {}
+ Length(int value, Type type)
+ : m_type(type)
+ , m_value(value)
+ {
+ }
+ ~Length() {}
+
+ bool is_auto() const { return m_type == Type::Auto; }
+ bool is_absolute() const { return m_type == Type::Absolute; }
+
+ int value() const { return m_value; }
+
+private:
+ Type m_type { Type::Auto };
+ int m_value { 0 };
+};
diff --git a/LibHTML/CSS/LengthBox.h b/LibHTML/CSS/LengthBox.h
new file mode 100644
index 00000000000..46fa6c5cc92
--- /dev/null
+++ b/LibHTML/CSS/LengthBox.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include
+
+struct LengthBox {
+ Length top;
+ Length right;
+ Length bottom;
+ Length left;
+};
diff --git a/LibHTML/Layout/LayoutBlock.cpp b/LibHTML/Layout/LayoutBlock.cpp
index ffcca02f157..95fc1e5bd7d 100644
--- a/LibHTML/Layout/LayoutBlock.cpp
+++ b/LibHTML/Layout/LayoutBlock.cpp
@@ -21,10 +21,8 @@ void LayoutBlock::layout()
void LayoutBlock::compute_width()
{
-
}
void LayoutBlock::compute_height()
{
-
}
diff --git a/LibHTML/Layout/LayoutStyle.h b/LibHTML/Layout/LayoutStyle.h
index 99bb54fec4d..ddee1736ad1 100644
--- a/LibHTML/Layout/LayoutStyle.h
+++ b/LibHTML/Layout/LayoutStyle.h
@@ -1,15 +1,9 @@
#pragma once
+#include
#include
#include
-struct Box {
- int top { 0 };
- int right { 0 };
- int bottom { 0 };
- int left { 0 };
-};
-
enum FontStyle {
Normal,
Bold,
@@ -23,13 +17,15 @@ public:
Color text_color() const { return m_text_color; }
Color background_color() const { return m_background_color; }
- Box& offset() { return m_offset; }
- Box& margin() { return m_margin; }
- Box& padding() { return m_padding; }
+ LengthBox& offset() { return m_offset; }
+ LengthBox& margin() { return m_margin; }
+ LengthBox& padding() { return m_padding; }
+ LengthBox& border() { return m_border; }
- const Box& offset() const { return m_offset; }
- const Box& margin() const { return m_margin; }
- const Box& padding() const { return m_padding; }
+ const LengthBox& offset() const { return m_offset; }
+ const LengthBox& margin() const { return m_margin; }
+ const LengthBox& padding() const { return m_padding; }
+ const LengthBox& border() const { return m_border; }
FontStyle font_style() const { return m_font_style; }
@@ -40,9 +36,10 @@ private:
Color m_text_color;
Color m_background_color;
- Box m_offset;
- Box m_margin;
- Box m_padding;
+ LengthBox m_offset;
+ LengthBox m_margin;
+ LengthBox m_padding;
+ LengthBox m_border;
Size m_size;