diff --git a/Libraries/LibHTML/Layout/ComputedStyle.cpp b/Libraries/LibHTML/Layout/ComputedStyle.cpp index 2716ff6463a..e5948039ae6 100644 --- a/Libraries/LibHTML/Layout/ComputedStyle.cpp +++ b/Libraries/LibHTML/Layout/ComputedStyle.cpp @@ -7,3 +7,13 @@ ComputedStyle::ComputedStyle() ComputedStyle::~ComputedStyle() { } + +ComputedStyle::PixelBox ComputedStyle::full_margin() const +{ + return { + m_margin.top.to_px() + m_border.top.to_px() + m_padding.top.to_px(), + m_margin.right.to_px() + m_border.right.to_px() + m_padding.right.to_px(), + m_margin.bottom.to_px() + m_border.bottom.to_px() + m_padding.bottom.to_px(), + m_margin.left.to_px() + m_border.left.to_px() + m_padding.left.to_px(), + }; +} diff --git a/Libraries/LibHTML/Layout/ComputedStyle.h b/Libraries/LibHTML/Layout/ComputedStyle.h index c3569005361..2fba7f6275e 100644 --- a/Libraries/LibHTML/Layout/ComputedStyle.h +++ b/Libraries/LibHTML/Layout/ComputedStyle.h @@ -1,8 +1,8 @@ #pragma once -#include #include #include +#include enum FontStyle { Normal, @@ -30,6 +30,15 @@ public: const Size& size() const { return m_size; } Size& size() { return m_size; } + struct PixelBox { + int top; + int right; + int bottom; + int left; + }; + + PixelBox full_margin() const; + private: Color m_text_color; Color m_background_color;