/* * Copyright (c) 2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once // FIXME: Find a way to generate all of this #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ADD_WINDOW_OBJECT_CONSTRUCTOR_AND_PROTOTYPE(interface_name, constructor_name, prototype_name) \ { \ auto& constructor = ensure_web_constructor(#interface_name); \ constructor.define_direct_property(vm.names.name, js_string(vm, #interface_name), JS::Attribute::Configurable); \ auto& prototype = ensure_web_prototype(#interface_name); \ prototype.define_direct_property(vm.names.constructor, &constructor, JS::Attribute::Writable | JS::Attribute::Configurable); \ } #define ADD_WINDOW_OBJECT_INTERFACE(interface_name) \ ADD_WINDOW_OBJECT_CONSTRUCTOR_AND_PROTOTYPE(interface_name, interface_name##Constructor, interface_name##Prototype) #define ADD_WINDOW_OBJECT_INTERFACES \ auto& vm = this->vm(); \ ADD_WINDOW_OBJECT_INTERFACE(CanvasRenderingContext2D) \ ADD_WINDOW_OBJECT_INTERFACE(CharacterData) \ ADD_WINDOW_OBJECT_INTERFACE(CloseEvent) \ ADD_WINDOW_OBJECT_INTERFACE(Comment) \ ADD_WINDOW_OBJECT_INTERFACE(CSSStyleSheet) \ ADD_WINDOW_OBJECT_INTERFACE(DocumentFragment) \ ADD_WINDOW_OBJECT_INTERFACE(Document) \ ADD_WINDOW_OBJECT_INTERFACE(DocumentType) \ ADD_WINDOW_OBJECT_INTERFACE(DOMException) \ ADD_WINDOW_OBJECT_INTERFACE(DOMImplementation) \ ADD_WINDOW_OBJECT_INTERFACE(DOMParser) \ ADD_WINDOW_OBJECT_INTERFACE(Element) \ ADD_WINDOW_OBJECT_INTERFACE(Event) \ ADD_WINDOW_OBJECT_INTERFACE(EventTarget) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLAnchorElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLAreaElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLAudioElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLBaseElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLBodyElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLBRElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLButtonElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLCanvasElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDataElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDataListElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDetailsElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDialogElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDirectoryElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDivElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLDListElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLEmbedElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLFieldSetElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLFontElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLFormElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLFrameElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLFrameSetElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLHeadElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLHeadingElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLHRElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLHtmlElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLIFrameElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLImageElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLInputElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLLabelElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLLegendElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLLIElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLLinkElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLMapElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLMarqueeElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLMediaElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLMenuElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLMetaElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLMeterElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLModElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLObjectElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLOListElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLOptGroupElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLOptionElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLOutputElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLParagraphElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLParamElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLPictureElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLPreElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLProgressElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLQuoteElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLScriptElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLSelectElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLSlotElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLSourceElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLSpanElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLStyleElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTableCaptionElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTableCellElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTableColElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTableElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTableRowElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTableSectionElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTemplateElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTextAreaElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTimeElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTitleElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLTrackElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLUListElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLUnknownElement) \ ADD_WINDOW_OBJECT_INTERFACE(HTMLVideoElement) \ ADD_WINDOW_OBJECT_INTERFACE(ImageData) \ ADD_WINDOW_OBJECT_INTERFACE(MessageEvent) \ ADD_WINDOW_OBJECT_INTERFACE(MouseEvent) \ ADD_WINDOW_OBJECT_INTERFACE(Node) \ ADD_WINDOW_OBJECT_INTERFACE(Performance) \ ADD_WINDOW_OBJECT_INTERFACE(PerformanceTiming) \ ADD_WINDOW_OBJECT_INTERFACE(ProcessingInstruction) \ ADD_WINDOW_OBJECT_INTERFACE(ProgressEvent) \ ADD_WINDOW_OBJECT_INTERFACE(Screen) \ ADD_WINDOW_OBJECT_INTERFACE(ShadowRoot) \ ADD_WINDOW_OBJECT_INTERFACE(StyleSheet) \ ADD_WINDOW_OBJECT_INTERFACE(StyleSheetList) \ ADD_WINDOW_OBJECT_INTERFACE(SubmitEvent) \ ADD_WINDOW_OBJECT_INTERFACE(SVGElement) \ ADD_WINDOW_OBJECT_INTERFACE(SVGGeometryElement) \ ADD_WINDOW_OBJECT_INTERFACE(SVGGraphicsElement) \ ADD_WINDOW_OBJECT_INTERFACE(SVGPathElement) \ ADD_WINDOW_OBJECT_INTERFACE(SVGSVGElement) \ ADD_WINDOW_OBJECT_INTERFACE(Text) \ ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \ ADD_WINDOW_OBJECT_INTERFACE(WebSocket) \ ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequest) \ ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequestEventTarget) \ ADD_WINDOW_OBJECT_CONSTRUCTOR_AND_PROTOTYPE(Image, ImageConstructor, HTMLImageElementPrototype)