LineBox.h 915 B

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 <AK/NonnullOwnPtrVector.h>
  8. #include <AK/Vector.h>
  9. #include <LibWeb/Layout/LineBoxFragment.h>
  10. namespace Web::Layout {
  11. class LineBox {
  12. public:
  13. LineBox() { }
  14. float width() const { return m_width; }
  15. void add_fragment(Node& layout_node, int start, int length, float width, float height, LineBoxFragment::Type = LineBoxFragment::Type::Normal);
  16. const NonnullOwnPtrVector<LineBoxFragment>& fragments() const { return m_fragments; }
  17. NonnullOwnPtrVector<LineBoxFragment>& fragments() { return m_fragments; }
  18. void trim_trailing_whitespace();
  19. bool is_empty_or_ends_in_whitespace() const;
  20. private:
  21. friend class BlockBox;
  22. friend class InlineFormattingContext;
  23. NonnullOwnPtrVector<LineBoxFragment> m_fragments;
  24. float m_width { 0 };
  25. };
  26. }