ladybird/Libraries/LibHTML/Layout/LayoutBlock.h
Andreas Kling 48f43a7429 LibHTML: Anonymous blocks *should* inherit some properties
Okay, I got that a bit wrong. Here's what CSS 2.1 says:

"The properties of anonymous boxes are inherited from the enclosing
non-anonymous box. Non-inherited properties have their initial value."

This patch implements a better behavior by only copying the inherited
properties from the parent style.
2019-10-05 23:47:06 +02:00

40 lines
1 KiB
C++

#pragma once
#include <LibHTML/Layout/LayoutNode.h>
#include <LibHTML/Layout/LineBox.h>
class Element;
class LayoutBlock : public LayoutNode {
public:
LayoutBlock(const Node*, NonnullRefPtr<StyleProperties>);
virtual ~LayoutBlock() override;
virtual const char* class_name() const override { return "LayoutBlock"; }
virtual void layout() override;
virtual void render(RenderingContext&) override;
virtual LayoutNode& inline_wrapper() override;
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;
private:
virtual bool is_block() const override { return true; }
NonnullRefPtr<StyleProperties> style_for_anonymous_block() const;
void layout_inline_children();
void layout_block_children();
void compute_width();
void compute_position();
void compute_height();
Vector<LineBox> m_line_boxes;
};