diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index c65308a1b19..962c60b8e8c 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -4513,6 +4513,8 @@ void generate_constructor_implementation(IDL::Interface const& interface, String generator.set("prototype_class", interface.prototype_class); generator.set("constructor_class", interface.constructor_class); generator.set("fully_qualified_name", interface.fully_qualified_name); + generator.set("parent_name", interface.parent_name); + generator.set("prototype_base_class", interface.prototype_base_class); generator.append(R"~~~( #include @@ -4535,6 +4537,10 @@ void generate_constructor_implementation(IDL::Interface const& interface, String #include #include +#if __has_include() +# include +#endif + )~~~"); if (interface.constructors.size() == 1) { @@ -4586,6 +4592,15 @@ void @constructor_class@::initialize(JS::Realm& realm) [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable; Base::initialize(realm); +)~~~"); + + if (interface.prototype_base_class != "ObjectPrototype") { + generator.append(R"~~~( + set_prototype(&ensure_web_constructor<@prototype_base_class@>(realm, "@parent_name@"_fly_string)); +)~~~"); + } + + generator.append(R"~~~( define_direct_property(vm.names.prototype, &ensure_web_prototype<@prototype_class@>(realm, "@namespaced_name@"_fly_string), 0); define_direct_property(vm.names.length, JS::Value(@constructor.length@), JS::Attribute::Configurable); diff --git a/Tests/LibWeb/Text/expected/SVG/svg-element-proto.txt b/Tests/LibWeb/Text/expected/SVG/svg-element-proto.txt new file mode 100644 index 00000000000..e8eb1d35065 --- /dev/null +++ b/Tests/LibWeb/Text/expected/SVG/svg-element-proto.txt @@ -0,0 +1,5 @@ +function SVGElement() { [native code] } +function Element() { [native code] } +function Node() { [native code] } +function EventTarget() { [native code] } +function () { [native code] } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-nesting/cssom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-nesting/cssom.txt index 560f8485d1c..d624a39e2a4 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-nesting/cssom.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-nesting/cssom.txt @@ -6,10 +6,10 @@ Rerun Found 13 tests -11 Pass -2 Fail +12 Pass +1 Fail Details -Result Test Name MessageFail CSSStyleRule is a CSSGroupingRule +Result Test Name MessagePass CSSStyleRule is a CSSGroupingRule Pass Simple CSSOM manipulation of subrules Pass Simple CSSOM manipulation of subrules 1 Pass Simple CSSOM manipulation of subrules 2 @@ -21,4 +21,4 @@ Pass Simple CSSOM manipulation of subrules 7 Fail Simple CSSOM manipulation of subrules 8 Pass Simple CSSOM manipulation of subrules 9 Pass Simple CSSOM manipulation of subrules 10 -Pass Mutating the selectorText of outer rule invalidates inner rules \ No newline at end of file +Pass Mutating the selectorText of outer rule invalidates inner rules diff --git a/Tests/LibWeb/Text/input/SVG/svg-element-proto.html b/Tests/LibWeb/Text/input/SVG/svg-element-proto.html new file mode 100644 index 00000000000..f4680826e6f --- /dev/null +++ b/Tests/LibWeb/Text/input/SVG/svg-element-proto.html @@ -0,0 +1,10 @@ + +