1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:25:08 +00:00

LibWeb: Add Comment and DocumentFragment bindings, move querySelector...

...{All} to ParentNode. Exposes createDocumentFragment and
createComment on Document. Stubs out the document.body setter. 

Also adds ParentNode back :^).
This commit is contained in:
Luke 2020-08-17 19:14:30 +01:00 committed by Andreas Kling
parent 7b755e6a58
commit 8b807e65d7
17 changed files with 223 additions and 54 deletions

View file

@ -486,11 +486,15 @@ void generate_implementation(const IDL::Interface& interface)
out() << "#include <LibWeb/DOM/Element.h>";
out() << "#include <LibWeb/HTML/HTMLElement.h>";
out() << "#include <LibWeb/DOM/EventListener.h>";
out() << "#include <LibWeb/Bindings/CommentWrapper.h>";
out() << "#include <LibWeb/Bindings/DocumentWrapper.h>";
out() << "#include <LibWeb/Bindings/DocumentFragmentWrapper.h>";
out() << "#include <LibWeb/Bindings/DocumentTypeWrapper.h>";
out() << "#include <LibWeb/Bindings/HTMLCanvasElementWrapper.h>";
out() << "#include <LibWeb/Bindings/HTMLHeadElementWrapper.h>";
out() << "#include <LibWeb/Bindings/HTMLImageElementWrapper.h>";
out() << "#include <LibWeb/Bindings/ImageDataWrapper.h>";
out() << "#include <LibWeb/Bindings/TextWrapper.h>";
out() << "#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>";
// FIXME: This is a total hack until we can figure out the namespace for a given type somehow.
@ -681,7 +685,11 @@ void generate_implementation(const IDL::Interface& interface)
out() << " return {};";
if (function.length() > 0) {
out() << " if (interpreter.argument_count() < " << function.length() << ")";
out() << " return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::BadArgCountMany, \"" << function.name << "\", \"" << function.length() << "\");";
if (function.length() == 1)
out() << " return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::BadArgCountOne, \"" << function.name << "\");";
else
out() << " return interpreter.throw_exception<JS::TypeError>(JS::ErrorType::BadArgCountMany, \"" << function.name << "\", \"" << function.length() << "\");";
}
StringBuilder arguments_builder;