diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/layout/box.nim | 13 | ||||
-rw-r--r-- | src/layout/engine.nim | 14 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/layout/box.nim b/src/layout/box.nim index 82791103..7c764203 100644 --- a/src/layout/box.nim +++ b/src/layout/box.nim @@ -29,10 +29,6 @@ type t*: SizeConstraintType u*: LayoutUnit - Strut* = object - pos*: LayoutUnit - neg*: LayoutUnit - Viewport* = ref object window*: WindowAttributes positioned*: seq[BlockBox] @@ -204,15 +200,6 @@ type margin_top*: LayoutUnit margin_bottom*: LayoutUnit -proc append*(a: var Strut, b: LayoutUnit) = - if b < 0: - a.neg = min(b, a.neg) - else: - a.pos = max(b, a.pos) - -func sum*(a: Strut): LayoutUnit = - return a.pos + a.neg - func minContent*(): SizeConstraint = return SizeConstraint(t: MIN_CONTENT) diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 99d98455..9cf45515 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -1058,6 +1058,20 @@ proc positionRelative(parent, box: BlockBox) = elif not top.auto: box.offset.y -= parent.height - bottom.px(parent.viewport) - box.height + +type Strut = object + pos: LayoutUnit + neg: LayoutUnit + +proc append(a: var Strut, b: LayoutUnit) = + if b < 0: + a.neg = min(b, a.neg) + else: + a.pos = max(b, a.pos) + +func sum(a: Strut): LayoutUnit = + return a.pos + a.neg + proc applyChildPosition(parent, child: BlockBox, x, y: var LayoutUnit, margin_todo: var Strut, maxChildWidth, childHeight: var LayoutUnit) = if child.computed{"position"} == POSITION_ABSOLUTE: #TODO sticky, fixed |