about summary refs log tree commit diff stats
path: root/src/io/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-09-05 14:49:40 +0200
committerbptato <nincsnevem662@gmail.com>2022-09-05 14:49:40 +0200
commit3223a3364ae9f17dd2dc25bcbf2e644380db462f (patch)
tree330141bc4a6677e548fdb9b8f902ab737e43b44a /src/io/buffer.nim
parent252174bacfffd5b3eb21056f678a225b368dda10 (diff)
downloadchawan-3223a3364ae9f17dd2dc25bcbf2e644380db462f.tar.gz
Add a network stream wrapper, improve eprint
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r--src/io/buffer.nim13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index bcbaef2d..52a55819 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -15,7 +15,6 @@ import io/cell
 import io/lineedit
 import io/loader
 import io/request
-import io/serialize
 import io/term
 import js/regex
 import layout/box
@@ -847,16 +846,8 @@ proc loadResources(buffer: Buffer, document: Document) =
           let url = url.get
           if url.scheme == buffer.location.scheme:
             let fs = buffer.loader.doRequest(newRequest(url))
-            if fs.s != nil and fs.contenttype == "text/css":
-              var res = newStringStream()
-              while true:
-                var s: string
-                fs.s.sread(s)
-                if s == "": break
-                res.write(s)
-              res.setPosition(0)
-              let sheet = parseStylesheet(res)
-              elem.sheet = sheet
+            if fs.body != nil and fs.contenttype == "text/css":
+              elem.sheet = parseStylesheet(fs.body)
 
     for child in elem.children_rev:
       stack.add(child)