mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
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.
This commit is contained in:
parent
a190f67450
commit
33ac0de988
4 changed files with 49 additions and 18 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue