about summary refs log tree commit diff stats
path: root/src/render
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-25 18:42:27 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-25 18:42:27 +0100
commit7ab7f28fdefe503fdde53ba9e253e308cb06b44f (patch)
treecd4cc561061c673999f9e8ecf1063a0664ba4dae /src/render
parentd205ef228866cad35891ca96cacae547c02fd4ae (diff)
downloadchawan-7ab7f28fdefe503fdde53ba9e253e308cb06b44f.tar.gz
Add some quirks mode rules + presentational hints
Only as a POC for now.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/renderdocument.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim
index e1342dbb..a039cc71 100644
--- a/src/render/renderdocument.nim
+++ b/src/render/renderdocument.nim
@@ -270,7 +270,7 @@ proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockBox, x, y: int, window
     x += ctx.offset.x
     y += ctx.offset.y
 
-    if ctx.computed{"background-color"}.rgba.a != 0: #TODO color blending
+    if ctx.computed{"background-color"}.a != 0: #TODO color blending
       grid.paintBackground(ctx.computed{"background-color"}, x, y, x + ctx.width, y + ctx.height, window)
 
     if ctx of ListItemBox:
@@ -287,7 +287,12 @@ proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockBox, x, y: int, window
 
 const css = staticRead"res/ua.css"
 let uastyle = css.parseStylesheet()
+const quirk = css & staticRead"res/quirk.css"
+let quirkstyle = quirk.parseStylesheet()
 proc renderDocument*(document: Document, window: WindowAttributes, userstyle: CSSStylesheet, layout: var Viewport, previousStyled: StyledNode): (FlexibleGrid, StyledNode) =
+  var uastyle = uastyle
+  if document.mode == QUIRKS:
+    uastyle = quirkstyle
   let styledNode = document.applyStylesheets(uastyle, userstyle, previousStyled)
   result[1] = styledNode
   layout.renderLayout(document, styledNode)