mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
backport frames access from Window
This commit is contained in:
@@ -343,8 +343,23 @@ pub fn atob(_: *const Window, input: []const u8, page: *Page) ![]const u8 {
|
|||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getLength(_: *const Window) u32 {
|
pub fn getFrame(_: *Window, _: usize) !?*Window {
|
||||||
return 0;
|
// TODO return the iframe's window.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn getFramesLength(self: *const Window) u32 {
|
||||||
|
const TreeWalker = @import("TreeWalker.zig");
|
||||||
|
var walker = TreeWalker.Full.init(self._document.asNode(), .{});
|
||||||
|
|
||||||
|
var ln: u32 = 0;
|
||||||
|
while (walker.next()) |node| {
|
||||||
|
const other_element = node.is(Element) orelse continue;
|
||||||
|
_ = other_element.is(Element.Html.IFrame) orelse continue;
|
||||||
|
ln += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ln;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getInnerWidth(_: *const Window) u32 {
|
pub fn getInnerWidth(_: *const Window) u32 {
|
||||||
@@ -562,9 +577,10 @@ pub const JsApi = struct {
|
|||||||
pub const btoa = bridge.function(Window.btoa, .{});
|
pub const btoa = bridge.function(Window.btoa, .{});
|
||||||
pub const atob = bridge.function(Window.atob, .{});
|
pub const atob = bridge.function(Window.atob, .{});
|
||||||
pub const reportError = bridge.function(Window.reportError, .{});
|
pub const reportError = bridge.function(Window.reportError, .{});
|
||||||
pub const frames = bridge.accessor(Window.getWindow, null, .{ .cache = "frames" });
|
|
||||||
pub const getComputedStyle = bridge.function(Window.getComputedStyle, .{});
|
pub const getComputedStyle = bridge.function(Window.getComputedStyle, .{});
|
||||||
pub const length = bridge.accessor(Window.getLength, null, .{ .cache = "length" });
|
pub const frames = bridge.accessor(Window.getWindow, null, .{ .cache = "frames" });
|
||||||
|
pub const index = bridge.indexed(Window.getFrame, .{ .null_as_undefined = true });
|
||||||
|
pub const length = bridge.accessor(Window.getFramesLength, null, .{ .cache = "length" });
|
||||||
pub const innerWidth = bridge.accessor(Window.getInnerWidth, null, .{ .cache = "innerWidth" });
|
pub const innerWidth = bridge.accessor(Window.getInnerWidth, null, .{ .cache = "innerWidth" });
|
||||||
pub const innerHeight = bridge.accessor(Window.getInnerHeight, null, .{ .cache = "innerHeight" });
|
pub const innerHeight = bridge.accessor(Window.getInnerHeight, null, .{ .cache = "innerHeight" });
|
||||||
pub const scrollX = bridge.accessor(Window.getScrollX, null, .{ .cache = "scrollX" });
|
pub const scrollX = bridge.accessor(Window.getScrollX, null, .{ .cache = "scrollX" });
|
||||||
|
|||||||
Reference in New Issue
Block a user