LineBoxFragment.h 899 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <LibDraw/FloatRect.h>
  3. class LayoutNode;
  4. class RenderingContext;
  5. class LineBoxFragment {
  6. friend class LineBox;
  7. public:
  8. LineBoxFragment(const LayoutNode& layout_node, int start, int length, const FloatRect& rect)
  9. : m_layout_node(layout_node)
  10. , m_start(start)
  11. , m_length(length)
  12. , m_rect(rect)
  13. {
  14. }
  15. const LayoutNode& layout_node() const { return m_layout_node; }
  16. int start() const { return m_start; }
  17. int length() const { return m_length; }
  18. const FloatRect& rect() const { return m_rect; }
  19. FloatRect& rect() { return m_rect; }
  20. float width() const { return m_rect.width(); }
  21. void render(RenderingContext&);
  22. bool is_justifiable_whitespace() const;
  23. StringView text() const;
  24. private:
  25. const LayoutNode& m_layout_node;
  26. int m_start { 0 };
  27. int m_length { 0 };
  28. FloatRect m_rect;
  29. };