netsurf: move to public only API

And add some Node APIs:
- getters: firstChild, lastChild, nextSibling, previoussibling,
parentNode, parentElement, nodeName, nodeType, ownerDocument,
isConnected
- getters/setters: nodeValue, textContent
- methods: appendChild

And some test comptime optimizations on Document

Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
Francis Bouvier
2023-09-26 11:58:05 +02:00
parent 0bce7a5e37
commit fab03586a3
11 changed files with 536 additions and 137 deletions

View File

@@ -454,7 +454,8 @@ pub const HTMLVideoElement = struct {
pub const mem_guarantied = true;
};
pub fn toInterface(comptime T: type, elem: *parser.Element) T {
pub fn toInterface(comptime T: type, e: *parser.Element) T {
const elem: *align(@alignOf(*parser.Element)) parser.Element = @alignCast(e);
const tag = parser.elementHTMLGetTagType(@as(*parser.ElementHTML, @ptrCast(elem)));
return switch (tag) {
.a => .{ .HTMLAnchorElement = @as(*parser.Anchor, @ptrCast(elem)) },