1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibWeb: Create "empty" line box fragments for inline elements

In order for inline elements (e.g <span>) to contribute padding etc.
to line boxes, we now create special "leading" and "trailing" fragments
for Layout::InlineNode and size them according to the horizontal
padding values.

The height of these fragments is taken from the tallest fragment on the
line. (Perhaps we should stop having per-fragment heights and just keep
a single height per line box, but that's a separate issue.)

In order to make things look nice, we now also adjust the height of all
fragments on a line so that nobody is shorter than the CSS line-height.
This commit is contained in:
Andreas Kling 2020-12-03 19:21:33 +01:00
parent 311e1039b5
commit d59ec3ab85
7 changed files with 56 additions and 4 deletions

View file

@ -36,6 +36,10 @@ public:
virtual ~InlineNode() override;
virtual const char* class_name() const override { return "InlineNode"; }
void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const;
virtual void split_into_lines(BlockBox& containing_block, LayoutMode) override;
private:
virtual bool is_inline_node() const final { return true; }
};