summaryrefslogtreecommitdiff
path: root/src/layout/line.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/line.rs')
-rw-r--r--src/layout/line.rs44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/layout/line.rs b/src/layout/line.rs
index 9de8348c..baef9fb0 100644
--- a/src/layout/line.rs
+++ b/src/layout/line.rs
@@ -12,7 +12,9 @@ use super::*;
/// Performs the line layouting.
pub struct LineLayouter {
+ /// The context used for line layouting.
ctx: LineContext,
+ /// The underlying layouter that stacks the finished lines.
stack: StackLayouter,
/// The in-progress line.
run: LineRun,
@@ -36,27 +38,6 @@ pub struct LineContext {
pub line_spacing: f64,
}
-/// A sequence of boxes with the same alignment. A real line can consist of
-/// multiple runs with different alignments.
-struct LineRun {
- /// The so-far accumulated items of the run.
- layouts: Vec<(f64, BoxLayout)>,
- /// The summed width and maximal height of the run.
- size: Size,
- /// The alignment of all layouts in the line.
- ///
- /// When a new run is created the alignment is yet to be determined and
- /// `None` as such. Once a layout is added, its alignment decides the
- /// alignment for the whole run.
- align: Option<LayoutAlign>,
- /// The amount of space left by another run on the same line or `None` if
- /// this is the only run so far.
- usable: Option<f64>,
- /// The spacing state. This influences how new spacing is handled, e.g. hard
- /// spacing may override soft spacing.
- last_spacing: LastSpacing,
-}
-
impl LineLayouter {
/// Create a new line layouter.
pub fn new(ctx: LineContext) -> Self {
@@ -259,6 +240,27 @@ impl LineLayouter {
}
}
+/// A sequence of boxes with the same alignment. A real line can consist of
+/// multiple runs with different alignments.
+struct LineRun {
+ /// The so-far accumulated items of the run.
+ layouts: Vec<(f64, BoxLayout)>,
+ /// The summed width and maximal height of the run.
+ size: Size,
+ /// The alignment of all layouts in the line.
+ ///
+ /// When a new run is created the alignment is yet to be determined and
+ /// `None` as such. Once a layout is added, its alignment decides the
+ /// alignment for the whole run.
+ align: Option<LayoutAlign>,
+ /// The amount of space left by another run on the same line or `None` if
+ /// this is the only run so far.
+ usable: Option<f64>,
+ /// The spacing state. This influences how new spacing is handled, e.g. hard
+ /// spacing may override soft spacing.
+ last_spacing: LastSpacing,
+}
+
impl LineRun {
fn new() -> Self {
Self {