diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-17 01:20:17 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-17 01:23:29 +0100 |
commit | a5ed422c2ceab87b174bae276bd10095bd6bed2e (patch) | |
tree | f2f60cbf28bc5978703769ee3f5c03a1c97ed51b /src/render/renderdocument.nim | |
parent | 6ec8abb19214835348bb96575455b0a65079741e (diff) | |
download | chawan-a5ed422c2ceab87b174bae276bd10095bd6bed2e.tar.gz |
More bgcolor fixes
* fix accidental dependency on previously chosen bgcolor (ouch) * also draw empty background boxes for bgcolor-is-canvas boxes * remove unused variable
Diffstat (limited to 'src/render/renderdocument.nim')
-rw-r--r-- | src/render/renderdocument.nim | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim index 625984df..ed0bc809 100644 --- a/src/render/renderdocument.nim +++ b/src/render/renderdocument.nim @@ -284,7 +284,6 @@ type RenderState = object # https://drafts.csswg.org/css-position/#absolute-positioning-containing-block absolutePos: seq[Offset] bgcolor: CellColor - root: bool proc renderBlockBox(grid: var FlexibleGrid; state: var RenderState; box: BlockBox; offset: Offset; attrs: WindowAttributes) @@ -380,12 +379,12 @@ proc renderBlockBox(grid: var FlexibleGrid; state: var RenderState; state.absolutePos.add(offset) stack.add((nil, Offset(x: -1, y: -1))) - if box.computed{"-cha-bgcolor-is-canvas"} and - state.bgcolor == defaultColor: - #TODO bgimage - if box.computed{"background-color"}.a != 0: #TODO color blending - state.bgcolor = box.computed{"background-color"}.cellColor() - elif box.computed{"visibility"} == VISIBILITY_VISIBLE: + if box.computed{"visibility"} == VISIBILITY_VISIBLE: + if box.computed{"-cha-bgcolor-is-canvas"} and + state.bgcolor == defaultColor: + #TODO bgimage + if box.computed{"background-color"}.a != 0: #TODO color blending + state.bgcolor = box.computed{"background-color"}.cellColor() if box.computed{"background-color"}.a != 0: #TODO color blending let ix = toInt(offset.x) let iy = toInt(offset.y) @@ -429,9 +428,7 @@ proc renderDocument*(grid: var FlexibleGrid; bgcolor: var CellColor; styledRoot: StyledNode; attrs: WindowAttributes) = grid.setLen(0) var state = RenderState( - absolutePos: @[Offset(x: 0, y: 0)], - root: true, - bgcolor: bgcolor + absolutePos: @[Offset(x: 0, y: 0)] ) let rootBox = renderLayout(styledRoot, attrs) grid.renderBlockBox(state, rootBox, Offset(x: 0, y: 0), attrs) |