about summary refs log tree commit diff stats
path: root/src/io/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-07-16 14:14:06 +0200
committerbptato <nincsnevem662@gmail.com>2022-07-16 14:15:52 +0200
commit8cd503c88693171f9887716440cdc110fdca2bb3 (patch)
tree7416b86ab677b8bf38c0bd89009991899e516660 /src/io/buffer.nim
parent368794ad19514deb7397d4eb2f0e5b72862d28e5 (diff)
downloadchawan-8cd503c88693171f9887716440cdc110fdca2bb3.tar.gz
Use StyledNodes instead of passing the entire DOM to the layout engine
This moves pseudo element generation to the cascading phase.
For now it also breaks style caching.
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r--src/io/buffer.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index e329b777..9fa23fe6 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -8,6 +8,7 @@ import unicode
 
 import css/cascade
 import css/sheet
+import css/stylednode
 import html/dom
 import html/tags
 import html/htmlparser
@@ -40,6 +41,7 @@ type
     attrs*: TermAttributes
     document*: Document
     viewport*: Viewport
+    prevstyled*: StyledNode
     redraw*: bool
     reshape*: bool
     nostatus*: bool
@@ -754,7 +756,9 @@ proc render*(buffer: Buffer) =
   of "text/html":
     if buffer.viewport == nil:
       buffer.viewport = Viewport(term: buffer.attrs)
-    buffer.lines = renderDocument(buffer.document, buffer.attrs, buffer.userstyle, buffer.viewport)
+    let ret = renderDocument(buffer.document, buffer.attrs, buffer.userstyle, buffer.viewport, buffer.prevstyled)
+    buffer.lines = ret[0]
+    buffer.prevstyled = ret[1]
   else: discard
   buffer.updateCursor()