mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38: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:
parent
311e1039b5
commit
d59ec3ab85
7 changed files with 56 additions and 4 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <LibWeb/Layout/InitialContainingBlockBox.h>
|
||||
#include <LibWeb/Layout/LineBoxFragment.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
#include <LibWeb/Layout/InlineNode.h>
|
||||
#include <LibWeb/Painting/PaintContext.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -41,6 +42,9 @@ void LineBoxFragment::paint(PaintContext& context, PaintPhase phase)
|
|||
return;
|
||||
}
|
||||
|
||||
if (is<InlineNode>(layout_node()))
|
||||
downcast<InlineNode>(layout_node()).paint_fragment(context, *this, phase);
|
||||
|
||||
if (is<TextNode>(layout_node()))
|
||||
downcast<TextNode>(layout_node()).paint_fragment(context, *this, phase);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue