mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 14:18:15 +00:00
LibHTML: Rewrite inline and text layout
Inline layout is now done by LayoutBlock. Blocks with inline children will split them into line boxes during layout. A LayoutBlock can have zero or more LineBox objects. Each LineBox represents one visual line. A LineBox can have any number of LineBoxFragment children. A fragment is an offset+length into a specific LayoutNode. To paint a LayoutBlock with inline children, we walk its line boxes, and walk their fragments, painting each fragment at a time by calling LineBoxFragment::render(), which in turn calls the LayoutNode via LayoutText::render_fragment(). Hit testing works similarly. This is very incomplete and has many bugs, but should make it easier for us to move forward with this code.
This commit is contained in:
12
Libraries/LibHTML/Layout/LineBoxFragment.cpp
Normal file
12
Libraries/LibHTML/Layout/LineBoxFragment.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibHTML/Layout/LayoutText.h>
|
||||
#include <LibHTML/Layout/LineBoxFragment.h>
|
||||
#include <LibHTML/RenderingContext.h>
|
||||
|
||||
void LineBoxFragment::render(RenderingContext& context)
|
||||
{
|
||||
if (layout_node().is_text()) {
|
||||
auto& layout_text = static_cast<const LayoutText&>(layout_node());
|
||||
layout_text.render_fragment(context, *this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user