diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-01 17:17:32 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-01 17:17:32 +0200 |
commit | 33ac0de988c4328c3ed292190cbc38210e5f8c5f (patch) | |
tree | 42eed226e023f491e1cbe5d3435e9f910fb64640 /LibHTML/Layout | |
parent | a190f674501a8eb71425d14c067a5dc0842cbbce (diff) | |
download | serenity-33ac0de988c4328c3ed292190cbc38210e5f8c5f.zip |
LibHTML: Add Length and LengthBox classes.
We need a way to represent values that are "auto", so adding a Length class
seems like the easiest way to achieve that.
Diffstat (limited to 'LibHTML/Layout')
-rw-r--r-- | LibHTML/Layout/LayoutBlock.cpp | 2 | ||||
-rw-r--r-- | LibHTML/Layout/LayoutStyle.h | 29 |
2 files changed, 13 insertions, 18 deletions
diff --git a/LibHTML/Layout/LayoutBlock.cpp b/LibHTML/Layout/LayoutBlock.cpp index ffcca02f15..95fc1e5bd7 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 99bb54fec4..ddee1736ad 100644 --- a/LibHTML/Layout/LayoutStyle.h +++ b/LibHTML/Layout/LayoutStyle.h @@ -1,15 +1,9 @@ #pragma once +#include <LibHTML/CSS/LengthBox.h> #include <SharedGraphics/Color.h> #include <SharedGraphics/Size.h> -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; |