mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
netsurf: first adaptations
Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const std = @import("std");
|
||||
|
||||
const parser = @import("../parser.zig");
|
||||
const parser = @import("../netsurf.zig");
|
||||
|
||||
const jsruntime = @import("jsruntime");
|
||||
const Case = jsruntime.test_utils.Case;
|
||||
@@ -22,12 +22,13 @@ pub const HTMLDocument = struct {
|
||||
return parser.documentHTMLBody(self);
|
||||
}
|
||||
|
||||
pub fn _getElementById(self: *parser.DocumentHTML, id: []u8) ?*parser.HTMLElement {
|
||||
const body_html = parser.documentHTMLBody(self);
|
||||
const body_dom = @as(*parser.Element, @ptrCast(body_html));
|
||||
const doc_dom = @as(*parser.Document, @ptrCast(self));
|
||||
const elem_dom = Document.getElementById(doc_dom, body_dom, id);
|
||||
return @as(*parser.HTMLElement, @ptrCast(elem_dom));
|
||||
pub fn _getElementById(self: *parser.DocumentHTML, id: []u8) ?*parser.ElementHTML {
|
||||
const doc = parser.documentHTMLToDocument(self);
|
||||
const elem = parser.documentGetElementById(doc, id);
|
||||
if (elem) |value| {
|
||||
return @as(*parser.ElementHTML, @ptrCast(value));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn _createElement(self: *parser.DocumentHTML, tag_name: []const u8) E.HTMLElements {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const parser = @import("../parser.zig");
|
||||
const parser = @import("../netsurf.zig");
|
||||
const generate = @import("../generate.zig");
|
||||
|
||||
const Element = @import("../dom/element.zig").Element;
|
||||
@@ -7,7 +7,7 @@ const Element = @import("../dom/element.zig").Element;
|
||||
// --------------
|
||||
|
||||
pub const HTMLElement = struct {
|
||||
pub const Self = parser.HTMLElement;
|
||||
pub const Self = parser.ElementHTML;
|
||||
pub const prototype = *Element;
|
||||
pub const mem_guarantied = true;
|
||||
};
|
||||
@@ -455,7 +455,7 @@ pub const HTMLVideoElement = struct {
|
||||
};
|
||||
|
||||
pub fn ElementToHTMLElementInterface(elem: *parser.Element) HTMLElements {
|
||||
const tag = parser.nodeTag(parser.elementNode(elem));
|
||||
const tag = parser.elementHTMLGetTagType(@as(*parser.ElementHTML, @ptrCast(elem)));
|
||||
return switch (tag) {
|
||||
.a => .{ .HTMLAnchorElement = @as(*parser.Anchor, @ptrCast(elem)) },
|
||||
.area => .{ .HTMLAreaElement = @as(*parser.Area, @ptrCast(elem)) },
|
||||
|
||||
Reference in New Issue
Block a user