mirror of
https://github.com/RGBCube/serenity
synced 2025-05-17 21:55:07 +00:00

In order for this to work nicely, I made the line box classes use float instead of int for its geometry information. Justification works by distributing all of the whitespace on the line (including the trailing whitespace before the line break) evenly across the spaces in-between words. We should probably use floating point (or maybe fixed point?) for all the layout metrics stuff. But one thing at a time. :^)
20 lines
491 B
C++
20 lines
491 B
C++
#pragma once
|
|
|
|
#include <AK/Vector.h>
|
|
#include <LibHTML/Layout/LineBoxFragment.h>
|
|
|
|
class LineBox {
|
|
public:
|
|
LineBox() {}
|
|
|
|
float width() const { return m_width; }
|
|
|
|
void add_fragment(const LayoutNode& layout_node, int start, int length, int width, int height);
|
|
|
|
const Vector<LineBoxFragment>& fragments() const { return m_fragments; }
|
|
Vector<LineBoxFragment>& fragments() { return m_fragments; }
|
|
|
|
private:
|
|
Vector<LineBoxFragment> m_fragments;
|
|
float m_width { 0 };
|
|
};
|