Skip to content

Commit 6de55df

Browse files
Merge pull request #856 from lightpanda-io/resize_observer
add dummy ResizeObserver
2 parents 189fe26 + 95cbbc3 commit 6de55df

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/browser/dom/dom.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const NamedNodeMap = @import("namednodemap.zig").NamedNodeMap;
2323
const DOMTokenList = @import("token_list.zig");
2424
const NodeList = @import("nodelist.zig");
2525
const Node = @import("node.zig");
26+
const ResizeObserver = @import("resize_observer.zig");
2627
const MutationObserver = @import("mutation_observer.zig");
2728
const IntersectionObserver = @import("intersection_observer.zig");
2829
const DOMParser = @import("dom_parser.zig").DOMParser;
@@ -40,6 +41,7 @@ pub const Interfaces = .{
4041
NodeList.Interfaces,
4142
Node.Node,
4243
Node.Interfaces,
44+
ResizeObserver.Interfaces,
4345
MutationObserver.Interfaces,
4446
IntersectionObserver.Interfaces,
4547
DOMParser,
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
2+
//
3+
// Francis Bouvier <[email protected]>
4+
// Pierre Tachoire <[email protected]>
5+
//
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU Affero General Public License as
8+
// published by the Free Software Foundation, either version 3 of the
9+
// License, or (at your option) any later version.
10+
//
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU Affero General Public License for more details.
15+
//
16+
// You should have received a copy of the GNU Affero General Public License
17+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
19+
const Env = @import("../env.zig").Env;
20+
const parser = @import("../netsurf.zig");
21+
22+
pub const Interfaces = .{
23+
ResizeObserver,
24+
};
25+
26+
// WEB IDL https://drafts.csswg.org/resize-observer/#resize-observer-interface
27+
pub const ResizeObserver = struct {
28+
pub fn constructor(cbk: Env.Function) ResizeObserver {
29+
_ = cbk;
30+
return .{};
31+
}
32+
33+
pub fn _observe(self: *const ResizeObserver, element: *parser.Element, options_: ?Options) void {
34+
_ = self;
35+
_ = element;
36+
_ = options_;
37+
return;
38+
}
39+
40+
pub fn _unobserve(self: *const ResizeObserver, element: *parser.Element) void {
41+
_ = self;
42+
_ = element;
43+
return;
44+
}
45+
46+
// TODO
47+
pub fn _disconnect(self: *ResizeObserver) void {
48+
_ = self;
49+
}
50+
};
51+
52+
const Options = struct {
53+
box: []const u8,
54+
};

0 commit comments

Comments
 (0)