diff options
author | bptato <nincsnevem662@gmail.com> | 2024-06-29 01:11:58 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-06-29 01:13:38 +0200 |
commit | 1ecddcefe61103846aa1a3fcbaa11178aa7a2ec1 (patch) | |
tree | 6bcb29ff00ab7675aa62c72d6a1600e303f80bad | |
parent | 1b0eee9d62aab586ec7c79ed00f8b85d04e9afa1 (diff) | |
download | chawan-1ecddcefe61103846aa1a3fcbaa11178aa7a2ec1.tar.gz |
layout: fix text-align + padding coloring
-rw-r--r-- | src/layout/engine.nim | 3 | ||||
-rw-r--r-- | test/layout/inline-backgrounds.color.expected | 2 | ||||
-rw-r--r-- | test/layout/inline-backgrounds.html | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 3acc958e..c01ef61e 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -403,7 +403,7 @@ proc shiftAtoms(ictx: var InlineContext; marginTop: LayoutUnit) = of scMinContent, scMaxContent: ictx.size.w of scFitContent: ictx.space.w.u of scStretch: max(ictx.size.w, ictx.space.w.u) - var xshift = case ictx.computed{"text-align"} + let xshift = case ictx.computed{"text-align"} of TextAlignNone: LayoutUnit(0) of TextAlignEnd, TextAlignRight, TextAlignChaRight: let width = min(width, ictx.lbstate.availableWidth) @@ -460,6 +460,7 @@ proc shiftAtoms(ictx: var InlineContext; marginTop: LayoutUnit) = size: size(w = w, h = cellHeight) )) for (fragment, i) in ictx.lbstate.paddingTodo: + fragment.state.areas[i].offset.x += xshift fragment.state.areas[i].offset.y = areaY if ictx.space.w.t == scFitContent: ictx.size.w = max(totalWidth, ictx.size.w) diff --git a/test/layout/inline-backgrounds.color.expected b/test/layout/inline-backgrounds.color.expected index c70ab7bf..ecd31ae5 100644 --- a/test/layout/inline-backgrounds.color.expected +++ b/test/layout/inline-backgrounds.color.expected @@ -11,7 +11,7 @@ but - [48;2;255;0;0mthis works: testing[49m + [48;2;255;0;0mthis works: testing[49m diff --git a/test/layout/inline-backgrounds.html b/test/layout/inline-backgrounds.html index 27519bd5..8298bfe6 100644 --- a/test/layout/inline-backgrounds.html +++ b/test/layout/inline-backgrounds.html @@ -13,7 +13,7 @@ but <div style="width: 100%; text-align: center"> <br> <span style="background-color: red"> -this works: <span style="text-align: center">testing</span> +this works: <span style="text-align: center; padding-left: 2ch">testing</span> <br> <br> <br> |