2019-06-15 22:49:44 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-06-15 23:41:15 +02:00
|
|
|
#include <LibHTML/Layout/LayoutNode.h>
|
2019-10-03 15:20:13 +02:00
|
|
|
#include <LibHTML/Layout/LineBox.h>
|
2019-06-15 22:49:44 +02:00
|
|
|
|
|
|
|
class Element;
|
|
|
|
|
2019-10-07 09:50:31 +02:00
|
|
|
class LayoutBlock : public LayoutNodeWithStyle {
|
2019-06-15 22:49:44 +02:00
|
|
|
public:
|
2019-10-04 12:12:39 +02:00
|
|
|
LayoutBlock(const Node*, NonnullRefPtr<StyleProperties>);
|
2019-06-15 22:49:44 +02:00
|
|
|
virtual ~LayoutBlock() override;
|
|
|
|
|
|
|
|
virtual const char* class_name() const override { return "LayoutBlock"; }
|
|
|
|
|
2019-06-20 23:00:26 +02:00
|
|
|
virtual void layout() override;
|
2019-09-25 12:40:37 +03:00
|
|
|
virtual void render(RenderingContext&) override;
|
2019-06-20 23:00:26 +02:00
|
|
|
|
2019-07-08 17:42:23 +02:00
|
|
|
virtual LayoutNode& inline_wrapper() override;
|
|
|
|
|
2019-10-03 15:20:13 +02:00
|
|
|
bool children_are_inline() const;
|
|
|
|
|
|
|
|
Vector<LineBox>& line_boxes() { return m_line_boxes; }
|
|
|
|
const Vector<LineBox>& line_boxes() const { return m_line_boxes; }
|
|
|
|
|
|
|
|
virtual HitTestResult hit_test(const Point&) const override;
|
|
|
|
|
2019-06-15 22:49:44 +02:00
|
|
|
private:
|
2019-07-01 07:28:37 +02:00
|
|
|
virtual bool is_block() const override { return true; }
|
|
|
|
|
2019-10-05 23:47:06 +02:00
|
|
|
NonnullRefPtr<StyleProperties> style_for_anonymous_block() const;
|
|
|
|
|
2019-10-03 15:20:13 +02:00
|
|
|
void layout_inline_children();
|
|
|
|
void layout_block_children();
|
|
|
|
|
2019-07-01 07:28:37 +02:00
|
|
|
void compute_width();
|
2019-08-18 08:37:53 +02:00
|
|
|
void compute_position();
|
2019-07-01 07:28:37 +02:00
|
|
|
void compute_height();
|
2019-10-03 15:20:13 +02:00
|
|
|
|
|
|
|
Vector<LineBox> m_line_boxes;
|
2019-06-15 22:49:44 +02:00
|
|
|
};
|