about summary refs log tree commit diff stats
path: root/src/server/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-14 03:53:54 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-14 03:53:54 +0200
commit15c722c013c209e72a277908276c3d851943ecdd (patch)
tree543ed8dbfeb7f9711d6ea9b558d42bd50d0fe0e8 /src/server/buffer.nim
parent1c494d3fd5fb746d5a5b6d582119cda261e1e7b5 (diff)
downloadchawan-15c722c013c209e72a277908276c3d851943ecdd.tar.gz
buffer: directly pass EncoderStream to parseStylesheet
No need for that extra copy into a StringStream.
Diffstat (limited to 'src/server/buffer.nim')
-rw-r--r--src/server/buffer.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim
index 6303fd65..5bdef808 100644
--- a/src/server/buffer.nim
+++ b/src/server/buffer.nim
@@ -607,9 +607,8 @@ proc loadResource(buffer: Buffer, elem: HTMLLinkElement): EmptyPromise =
           let ss = newStringStream(s.get)
           #TODO non-utf-8 css
           let ds = newDecoderStream(ss, cs = CHARSET_UTF_8)
-          let source = newEncoderStream(ds, cs = CHARSET_UTF_8).readAll()
-          let ss2 = newStringStream(source)
-          elem.sheet = parseStylesheet(ss2))
+          let source = newEncoderStream(ds, cs = CHARSET_UTF_8)
+          elem.sheet = parseStylesheet(source))
 
 proc loadResource(buffer: Buffer, elem: HTMLImageElement): EmptyPromise =
   let document = buffer.document