From ea5be244dccd11458696bbbff3dd9fe8ccb656da Mon Sep 17 00:00:00 2001 From: Gustavo Toyota Date: Fri, 14 Jul 2023 11:12:38 -0400 Subject: [PATCH] fix: fix inline background color wrap rendering --- src/render/canvas/canvas-renderer.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/render/canvas/canvas-renderer.ts b/src/render/canvas/canvas-renderer.ts index 6efb648..42a7b64 100644 --- a/src/render/canvas/canvas-renderer.ts +++ b/src/render/canvas/canvas-renderer.ts @@ -714,7 +714,21 @@ export class CanvasRenderer extends Renderer { if (!isTransparent(styles.backgroundColor)) { this.ctx.fillStyle = asString(styles.backgroundColor); - this.ctx.fill(); + + if (styles.display === DISPLAY.INLINE) { + for (const textNode of paint.container.textNodes) { + for (const textBound of textNode.textBounds) { + this.ctx.fillRect( + textBound.bounds.left, + textBound.bounds.top, + textBound.bounds.width, + textBound.bounds.height + ); + } + } + } else { + this.ctx.fill(); + } } await this.renderBackgroundImage(paint.container);