mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-08-02 10:47:15 -04:00
Rather than having a generic SVG type (which gets us past parsing, but even the slightest JS usage is likely to fail), this adds concrete types for a number of known SVG types. A lot of these are empty (but even that's enough to pass something like `instanceof SVGAElement`), but a handful of the more important accessors and methods are implemented (e.g. I ran into a site that made extensive use of SVGSVGElement.getElementById).
45 lines
1.4 KiB
Zig
45 lines
1.4 KiB
Zig
// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
|
|
//
|
|
// Francis Bouvier <francis@lightpanda.io>
|
|
// Pierre Tachoire <pierre@lightpanda.io>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
// License, or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
const js = @import("../../../js/js.zig");
|
|
|
|
const Node = @import("../../Node.zig");
|
|
const Element = @import("../../Element.zig");
|
|
|
|
const Graphics = @import("Graphics.zig");
|
|
|
|
const Defs = @This();
|
|
_proto: *Graphics,
|
|
|
|
pub fn asElement(self: *Defs) *Element {
|
|
return self._proto.asElement();
|
|
}
|
|
pub fn asNode(self: *Defs) *Node {
|
|
return self.asElement().asNode();
|
|
}
|
|
|
|
pub const JsApi = struct {
|
|
pub const bridge = js.Bridge(Defs);
|
|
|
|
pub const Meta = struct {
|
|
pub const name = "SVGDefsElement";
|
|
pub const prototype_chain = bridge.prototypeChain();
|
|
pub var class_id: bridge.ClassId = undefined;
|
|
};
|
|
};
|