LengthBox.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/CSS/Percentage.h>
  8. namespace Web::CSS {
  9. class LengthBox {
  10. public:
  11. LengthBox();
  12. LengthBox(LengthPercentage top, LengthPercentage right, LengthPercentage bottom, LengthPercentage left);
  13. ~LengthBox();
  14. // Length (and thus LengthPercentage) includes a RefPtr<CalculatedStyleValue> member, but we can't include the header StyleValue.h as it includes
  15. // this file already. To break the cyclic dependency, we must initialize these members in the constructor.
  16. LengthPercentage& top() { return m_top; }
  17. LengthPercentage& right() { return m_right; }
  18. LengthPercentage& bottom() { return m_bottom; }
  19. LengthPercentage& left() { return m_left; };
  20. LengthPercentage const& top() const { return m_top; }
  21. LengthPercentage const& right() const { return m_right; }
  22. LengthPercentage const& bottom() const { return m_bottom; }
  23. LengthPercentage const& left() const { return m_left; };
  24. private:
  25. LengthPercentage m_top;
  26. LengthPercentage m_right;
  27. LengthPercentage m_bottom;
  28. LengthPercentage m_left;
  29. };
  30. }