mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
window.length dynamically
This commit is contained in:
@@ -110,7 +110,7 @@ pub const NodeList = struct {
|
|||||||
try self.nodes.append(alloc, node);
|
try self.nodes.append(alloc, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_length(self: *NodeList) u32 {
|
pub fn get_length(self: *const NodeList) u32 {
|
||||||
return @intCast(self.nodes.items.len);
|
return @intCast(self.nodes.items.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ const MediaQueryList = @import("media_query_list.zig").MediaQueryList;
|
|||||||
const Performance = @import("../dom/performance.zig").Performance;
|
const Performance = @import("../dom/performance.zig").Performance;
|
||||||
const CSSStyleDeclaration = @import("../cssom/CSSStyleDeclaration.zig");
|
const CSSStyleDeclaration = @import("../cssom/CSSStyleDeclaration.zig");
|
||||||
const Screen = @import("screen.zig").Screen;
|
const Screen = @import("screen.zig").Screen;
|
||||||
|
const domcss = @import("../dom/css.zig");
|
||||||
const Css = @import("../css/css.zig").Css;
|
const Css = @import("../css/css.zig").Css;
|
||||||
|
|
||||||
const Function = Env.Function;
|
const Function = Env.Function;
|
||||||
@@ -134,9 +135,16 @@ pub const Window = struct {
|
|||||||
pub fn get_frames(self: *Window) *Window {
|
pub fn get_frames(self: *Window) *Window {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
// TODO: frames
|
|
||||||
pub fn get_length(_: *Window) u32 {
|
// Retrieve the numbre of frames/iframes from the DOM dynamically.
|
||||||
return 0;
|
pub fn get_length(self: *const Window, page: *Page) !u32 {
|
||||||
|
const frames = try domcss.querySelectorAll(
|
||||||
|
page.call_arena,
|
||||||
|
parser.documentHTMLToNode(self.document),
|
||||||
|
"frame,iframe",
|
||||||
|
);
|
||||||
|
|
||||||
|
return frames.get_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_top(self: *Window) *Window {
|
pub fn get_top(self: *Window) *Window {
|
||||||
|
|||||||
Reference in New Issue
Block a user