mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
add an explicit HTMLSpanElement
This commit is contained in:
@@ -1542,10 +1542,10 @@ pub fn createElement(self: *Page, ns_: ?[]const u8, name: []const u8, attribute_
|
|||||||
},
|
},
|
||||||
4 => switch (@as(u32, @bitCast(name[0..4].*))) {
|
4 => switch (@as(u32, @bitCast(name[0..4].*))) {
|
||||||
asUint("span") => return self.createHtmlElementT(
|
asUint("span") => return self.createHtmlElementT(
|
||||||
Element.Html.Generic,
|
Element.Html.Span,
|
||||||
namespace,
|
namespace,
|
||||||
attribute_iterator,
|
attribute_iterator,
|
||||||
.{ ._proto = undefined, ._tag_name = String.init(undefined, "span", .{}) catch unreachable, ._tag = .span },
|
.{ ._proto = undefined },
|
||||||
),
|
),
|
||||||
asUint("meta") => return self.createHtmlElementT(
|
asUint("meta") => return self.createHtmlElementT(
|
||||||
Element.Html.Meta,
|
Element.Html.Meta,
|
||||||
|
|||||||
@@ -557,6 +557,7 @@ pub const JsApis = flattenTypes(&.{
|
|||||||
@import("../webapi/element/html/Script.zig"),
|
@import("../webapi/element/html/Script.zig"),
|
||||||
@import("../webapi/element/html/Select.zig"),
|
@import("../webapi/element/html/Select.zig"),
|
||||||
@import("../webapi/element/html/Slot.zig"),
|
@import("../webapi/element/html/Slot.zig"),
|
||||||
|
@import("../webapi/element/html/Span.zig"),
|
||||||
@import("../webapi/element/html/Style.zig"),
|
@import("../webapi/element/html/Style.zig"),
|
||||||
@import("../webapi/element/html/Template.zig"),
|
@import("../webapi/element/html/Template.zig"),
|
||||||
@import("../webapi/element/html/TextArea.zig"),
|
@import("../webapi/element/html/TextArea.zig"),
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ pub fn getTagNameLower(self: *const Element) []const u8 {
|
|||||||
.script => "script",
|
.script => "script",
|
||||||
.select => "select",
|
.select => "select",
|
||||||
.slot => "slot",
|
.slot => "slot",
|
||||||
|
.span => "span",
|
||||||
.style => "style",
|
.style => "style",
|
||||||
.template => "template",
|
.template => "template",
|
||||||
.textarea => "textarea",
|
.textarea => "textarea",
|
||||||
@@ -256,6 +257,7 @@ pub fn getTagNameSpec(self: *const Element, buf: []u8) []const u8 {
|
|||||||
.script => "SCRIPT",
|
.script => "SCRIPT",
|
||||||
.select => "SELECT",
|
.select => "SELECT",
|
||||||
.slot => "SLOT",
|
.slot => "SLOT",
|
||||||
|
.span => "SPAN",
|
||||||
.style => "STYLE",
|
.style => "STYLE",
|
||||||
.template => "TEMPLATE",
|
.template => "TEMPLATE",
|
||||||
.textarea => "TEXTAREA",
|
.textarea => "TEXTAREA",
|
||||||
@@ -1085,6 +1087,7 @@ pub fn getTag(self: *const Element) Tag {
|
|||||||
.script => .script,
|
.script => .script,
|
||||||
.select => .select,
|
.select => .select,
|
||||||
.slot => .slot,
|
.slot => .slot,
|
||||||
|
.span => .span,
|
||||||
.option => .option,
|
.option => .option,
|
||||||
.template => .template,
|
.template => .template,
|
||||||
.textarea => .textarea,
|
.textarea => .textarea,
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ fn getDefaultDisplay(element: *const Element) []const u8 {
|
|||||||
switch (element._type) {
|
switch (element._type) {
|
||||||
.html => |html| {
|
.html => |html| {
|
||||||
return switch (html._type) {
|
return switch (html._type) {
|
||||||
.anchor, .br => "inline",
|
.anchor, .br, .span => "inline",
|
||||||
.body, .div, .p, .heading, .form, .button, .canvas, .dialog, .embed, .head, .html, .hr, .iframe, .img, .input, .li, .link, .meta, .ol, .option, .script, .select, .slot, .style, .template, .textarea, .title, .ul, .media => "block",
|
.body, .div, .p, .heading, .form, .button, .canvas, .dialog, .embed, .head, .html, .hr, .iframe, .img, .input, .li, .link, .meta, .ol, .option, .script, .select, .slot, .style, .template, .textarea, .title, .ul, .media => "block",
|
||||||
.generic, .custom, .unknown, .data => blk: {
|
.generic, .custom, .unknown, .data => blk: {
|
||||||
const tag = element.getTagNameLower();
|
const tag = element.getTagNameLower();
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ pub const Paragraph = @import("html/Paragraph.zig");
|
|||||||
pub const Script = @import("html/Script.zig");
|
pub const Script = @import("html/Script.zig");
|
||||||
pub const Select = @import("html/Select.zig");
|
pub const Select = @import("html/Select.zig");
|
||||||
pub const Slot = @import("html/Slot.zig");
|
pub const Slot = @import("html/Slot.zig");
|
||||||
|
pub const Span = @import("html/Span.zig");
|
||||||
pub const Style = @import("html/Style.zig");
|
pub const Style = @import("html/Style.zig");
|
||||||
pub const Template = @import("html/Template.zig");
|
pub const Template = @import("html/Template.zig");
|
||||||
pub const TextArea = @import("html/TextArea.zig");
|
pub const TextArea = @import("html/TextArea.zig");
|
||||||
@@ -101,6 +102,7 @@ pub const Type = union(enum) {
|
|||||||
script: *Script,
|
script: *Script,
|
||||||
select: *Select,
|
select: *Select,
|
||||||
slot: *Slot,
|
slot: *Slot,
|
||||||
|
span: *Span,
|
||||||
style: *Style,
|
style: *Style,
|
||||||
template: *Template,
|
template: *Template,
|
||||||
textarea: *TextArea,
|
textarea: *TextArea,
|
||||||
@@ -158,6 +160,7 @@ pub fn className(self: *const HtmlElement) []const u8 {
|
|||||||
.script => "[object HTMLScriptElement]",
|
.script => "[object HTMLScriptElement]",
|
||||||
.select => "[object HTMLSelectElement]",
|
.select => "[object HTMLSelectElement]",
|
||||||
.slot => "[object HTMLSlotElement]",
|
.slot => "[object HTMLSlotElement]",
|
||||||
|
.span => "[object HTMLSpanElement]",
|
||||||
.style => "[object HTMLSyleElement]",
|
.style => "[object HTMLSyleElement]",
|
||||||
.template => "[object HTMLTemplateElement]",
|
.template => "[object HTMLTemplateElement]",
|
||||||
.textarea => "[object HTMLTextAreaElement]",
|
.textarea => "[object HTMLTextAreaElement]",
|
||||||
|
|||||||
25
src/browser/webapi/element/html/Span.zig
Normal file
25
src/browser/webapi/element/html/Span.zig
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
const js = @import("../../../js/js.zig");
|
||||||
|
const Node = @import("../../Node.zig");
|
||||||
|
const Element = @import("../../Element.zig");
|
||||||
|
const HtmlElement = @import("../Html.zig");
|
||||||
|
|
||||||
|
const Span = @This();
|
||||||
|
|
||||||
|
_proto: *HtmlElement,
|
||||||
|
|
||||||
|
pub fn asElement(self: *Span) *Element {
|
||||||
|
return self._proto._proto;
|
||||||
|
}
|
||||||
|
pub fn asNode(self: *Span) *Node {
|
||||||
|
return self.asElement().asNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const JsApi = struct {
|
||||||
|
pub const bridge = js.Bridge(Span);
|
||||||
|
|
||||||
|
pub const Meta = struct {
|
||||||
|
pub const name = "HTMLSpanElement";
|
||||||
|
pub const prototype_chain = bridge.prototypeChain();
|
||||||
|
pub var class_id: bridge.ClassId = undefined;
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user