canvas API

This commit is contained in:
Face
2025-08-31 14:17:34 +03:00
parent 322cb4072e
commit f973bb55f6
16 changed files with 3387 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ const TEXTAREA = preload("res://Scenes/Tags/textarea.tscn")
const DIV = preload("res://Scenes/Tags/div.tscn")
const AUDIO = preload("res://Scenes/Tags/audio.tscn")
const POSTPROCESS = preload("res://Scenes/Tags/postprocess.tscn")
const CANVAS = preload("res://Scenes/Tags/canvas.tscn")
const MIN_SIZE = Vector2i(750, 200)
@@ -324,7 +325,7 @@ func render_content(html_bytes: PackedByteArray) -> void:
if element_node:
# Input elements register their own DOM nodes in their init() function
if element.tag_name not in ["input", "textarea", "select", "button", "audio"]:
if element.tag_name not in ["input", "textarea", "select", "button", "audio", "canvas"]:
parser.register_dom_node(element, element_node)
# ul/ol handle their own adding
@@ -606,6 +607,9 @@ func create_element_node_internal(element: HTMLParser.HTMLElement, parser: HTMLP
"audio":
node = AUDIO.instantiate()
node.init(element, parser)
"canvas":
node = CANVAS.instantiate()
node.init(element, parser)
"div":
var styles = parser.get_element_styles_with_inheritance(element, "", [])
var hover_styles = parser.get_element_styles_with_inheritance(element, "hover", [])