1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00

LibWeb: Add a JavaScript wrapper for HTMLImageElement :^)

This commit is contained in:
Andreas Kling 2020-04-14 20:37:01 +02:00
parent 22de1e47ec
commit 370befbf52
6 changed files with 114 additions and 0 deletions

View file

@ -29,9 +29,11 @@
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/DocumentWrapper.h>
#include <LibWeb/Bindings/HTMLCanvasElementWrapper.h>
#include <LibWeb/Bindings/HTMLImageElementWrapper.h>
#include <LibWeb/Bindings/NodeWrapper.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/HTMLCanvasElement.h>
#include <LibWeb/DOM/HTMLImageElement.h>
#include <LibWeb/DOM/Node.h>
namespace Web {
@ -43,6 +45,8 @@ NodeWrapper* wrap(JS::Heap& heap, Node& node)
return static_cast<NodeWrapper*>(wrap_impl(heap, to<Document>(node)));
if (is<HTMLCanvasElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(heap, to<HTMLCanvasElement>(node)));
if (is<HTMLImageElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(heap, to<HTMLImageElement>(node)));
if (is<Element>(node))
return static_cast<NodeWrapper*>(wrap_impl(heap, to<Element>(node)));
return static_cast<NodeWrapper*>(wrap_impl(heap, node));