ComputedStyle.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <LibHTML/CSS/LengthBox.h>
  3. #include <LibDraw/Color.h>
  4. #include <LibDraw/Size.h>
  5. enum FontStyle {
  6. Normal,
  7. Bold,
  8. };
  9. class ComputedStyle {
  10. public:
  11. ComputedStyle();
  12. ~ComputedStyle();
  13. Color text_color() const { return m_text_color; }
  14. Color background_color() const { return m_background_color; }
  15. LengthBox& offset() { return m_offset; }
  16. LengthBox& margin() { return m_margin; }
  17. LengthBox& padding() { return m_padding; }
  18. LengthBox& border() { return m_border; }
  19. const LengthBox& offset() const { return m_offset; }
  20. const LengthBox& margin() const { return m_margin; }
  21. const LengthBox& padding() const { return m_padding; }
  22. const LengthBox& border() const { return m_border; }
  23. FontStyle font_style() const { return m_font_style; }
  24. const Size& size() const { return m_size; }
  25. Size& size() { return m_size; }
  26. private:
  27. Color m_text_color;
  28. Color m_background_color;
  29. LengthBox m_offset;
  30. LengthBox m_margin;
  31. LengthBox m_padding;
  32. LengthBox m_border;
  33. Size m_size;
  34. FontStyle m_font_style { FontStyle::Normal };
  35. };