css: matcher draft

This commit is contained in:
Pierre Tachoire
2024-03-15 16:09:16 +01:00
parent a131e96ed5
commit b59fd9b1fb
4 changed files with 121 additions and 0 deletions

22
src/css/libdom.zig Normal file
View File

@@ -0,0 +1,22 @@
const std = @import("std");
const parser = @import("../netsurf.zig");
// Node implementation with Netsurf Libdom C lib.
pub const Node = struct {
node: *parser.Node,
pub fn firstChild(n: Node) !?Node {
const c = try parser.nodeFirstChild(n.node);
if (c) |cc| return .{ .node = cc };
return null;
}
pub fn nextSibling(n: Node) ?Node {
const c = try parser.nodeNextSibling(n.node);
if (c) |cc| return .{ .node = cc };
return null;
}
};