about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-01 01:03:50 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-01 01:46:38 +0200
commit55cfd29e961488a8c1ed9eb7801d237d27bc86c7 (patch)
treec74569e15ca72d777eadcfd19a0203cbb76c3e3f /src/css
parente9466c4c436f964b53034e28356aa3f5c957a068 (diff)
downloadchawan-55cfd29e961488a8c1ed9eb7801d237d27bc86c7.tar.gz
canvas: move to separate CGI script
* stream: and passFd is now client-based, and accessible for buffers
* Bitmap's width & height is now int, not uint64
* no more non-network Bitmap special case in the pager for canvas

I just shoehorned it into the static image model, so it still doesn't
render changes after page load. But at least now it doesn't crash the
browser.
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cascade.nim16
-rw-r--r--src/css/cssvalues.nim2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index efa9227f..1cee3399 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -416,13 +416,15 @@ proc applyRulesFrameInvalid(frame: CascadeFrame; ua, user: CSSStylesheet;
       let styledText = styledParent.newStyledReplacement(content, pseudo)
       styledParent.children.add(styledText)
     of peCanvas:
-      let content = CSSContent(
-        t: ContentImage,
-        s: "canvas://",
-        bmp: HTMLCanvasElement(styledParent.node).bitmap
-      )
-      let styledText = styledParent.newStyledReplacement(content, pseudo)
-      styledParent.children.add(styledText)
+      let bmp = HTMLCanvasElement(styledParent.node).bitmap
+      if bmp.cacheId != 0:
+        let content = CSSContent(
+          t: ContentImage,
+          s: "canvas://",
+          bmp: bmp
+        )
+        let styledText = styledParent.newStyledReplacement(content, pseudo)
+        styledParent.children.add(styledText)
     of peVideo:
       let content = CSSContent(t: ContentVideo)
       let styledText = styledParent.newStyledReplacement(content, pseudo)
diff --git a/src/css/cssvalues.nim b/src/css/cssvalues.nim
index f0b3cbc8..f8a50723 100644
--- a/src/css/cssvalues.nim
+++ b/src/css/cssvalues.nim
@@ -318,7 +318,7 @@ type
   CSSContent* = object
     t*: CSSContentType
     s*: string
-    bmp*: Bitmap
+    bmp*: NetworkBitmap
 
   CSSQuotes* = object
     auto*: bool