mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
move window from nav to html
This commit is contained in:
@@ -2,10 +2,12 @@ const generate = @import("../generate.zig");
|
||||
|
||||
const HTMLDocument = @import("document.zig").HTMLDocument;
|
||||
const HTMLElem = @import("elements.zig");
|
||||
const Window = @import("window.zig").Window;
|
||||
|
||||
pub const Interfaces = generate.Tuple(.{
|
||||
HTMLDocument,
|
||||
HTMLElem.HTMLElement,
|
||||
HTMLElem.HTMLMediaElement,
|
||||
HTMLElem.Interfaces,
|
||||
Window,
|
||||
});
|
||||
|
||||
44
src/html/window.zig
Normal file
44
src/html/window.zig
Normal file
@@ -0,0 +1,44 @@
|
||||
const std = @import("std");
|
||||
|
||||
const parser = @import("../netsurf.zig");
|
||||
|
||||
// https://dom.spec.whatwg.org/#interface-window-extensions
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window
|
||||
pub const Window = struct {
|
||||
pub const mem_guarantied = true;
|
||||
|
||||
document: *parser.Document = undefined,
|
||||
target: []const u8,
|
||||
|
||||
pub fn create(target: ?[]const u8) Window {
|
||||
return Window{
|
||||
.target = target orelse "",
|
||||
};
|
||||
}
|
||||
|
||||
pub fn replaceDocument(self: *Window, doc: *parser.Document) void {
|
||||
self.document = doc;
|
||||
}
|
||||
|
||||
pub fn get_window(self: *Window) *Window {
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn get_self(self: *Window) *Window {
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn get_parent(self: *Window) *Window {
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn get_document(self: *Window) *parser.Document {
|
||||
return self.document;
|
||||
}
|
||||
|
||||
pub fn get_name(self: *Window) []const u8 {
|
||||
return self.target;
|
||||
}
|
||||
|
||||
// TODO we need to re-implement EventTarget interface.
|
||||
};
|
||||
Reference in New Issue
Block a user