diff options
author | Luke Wilde <lukew@serenityos.org> | 2022-02-26 10:34:08 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-26 12:18:56 +0100 |
commit | ed76b4238c311af04fae0da51200475f34b42eb3 (patch) | |
tree | 553f532d141104257e1f64e669e90956cfd9673b /Userland/Libraries | |
parent | 79ea30bc967f0ed1b28cb4aed4d6fdabb3f62408 (diff) | |
download | serenity-ed76b4238c311af04fae0da51200475f34b42eb3.zip |
LibWeb: Implement the legacy Audio factory function
This creates an Audio element with preload="auto" and the given src
attribute.
Required by Cookie Clicker.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp | 67 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/AudioConstructor.h | 27 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h | 304 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/AttributeNames.h | 1 |
5 files changed, 249 insertions, 151 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp new file mode 100644 index 0000000000..4a9d5d5c05 --- /dev/null +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibWeb/Bindings/AudioConstructor.h> +#include <LibWeb/Bindings/HTMLAudioElementPrototype.h> +#include <LibWeb/Bindings/HTMLAudioElementWrapper.h> +#include <LibWeb/Bindings/NodeWrapperFactory.h> +#include <LibWeb/DOM/ElementFactory.h> +#include <LibWeb/DOM/Window.h> +#include <LibWeb/Namespace.h> + +namespace Web::Bindings { + +AudioConstructor::AudioConstructor(JS::GlobalObject& global_object) + : NativeFunction(*global_object.function_prototype()) +{ +} + +void AudioConstructor::initialize(JS::GlobalObject& global_object) +{ + auto& vm = this->vm(); + auto& window = static_cast<WindowObject&>(global_object); + NativeFunction::initialize(global_object); + + define_direct_property(vm.names.prototype, &window.ensure_web_prototype<HTMLAudioElementPrototype>("HTMLAudioElement"), 0); + define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); +} + +AudioConstructor::~AudioConstructor() +{ +} + +JS::ThrowCompletionOr<JS::Value> AudioConstructor::call() +{ + return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Audio"); +} + +// https://html.spec.whatwg.org/multipage/media.html#dom-audio +JS::ThrowCompletionOr<JS::Object*> AudioConstructor::construct(FunctionObject&) +{ + // 1. Let document be the current global object's associated Document. + auto& window = static_cast<WindowObject&>(global_object()); + auto& document = window.impl().associated_document(); + + // 2. Let audio be the result of creating an element given document, audio, and the HTML namespace. + auto audio = DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML); + + // 3. Set an attribute value for audio using "preload" and "auto". + audio->set_attribute(HTML::AttributeNames::preload, "auto"sv); + + auto src_value = vm().argument(0); + + // 4. If src is given, then set an attribute value for audio using "src" and src. + // (This will cause the user agent to invoke the object's resource selection algorithm before returning.) + if (!src_value.is_undefined()) { + auto src = TRY(src_value.to_string(global_object())); + audio->set_attribute(HTML::AttributeNames::src, move(src)); + } + + // 5. Return audio. + return wrap(global_object(), audio); +} + +} diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h new file mode 100644 index 0000000000..3c913c67ae --- /dev/null +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <LibJS/Runtime/NativeFunction.h> + +namespace Web::Bindings { + +class AudioConstructor final : public JS::NativeFunction { +public: + explicit AudioConstructor(JS::GlobalObject&); + virtual void initialize(JS::GlobalObject&) override; + virtual ~AudioConstructor() override; + + virtual JS::ThrowCompletionOr<JS::Value> call() override; + virtual JS::ThrowCompletionOr<JS::Object*> construct(JS::FunctionObject& new_target) override; + +private: + virtual bool has_constructor() const override { return true; } + virtual const char* class_name() const override { return "AudioConstructor"; } +}; + +} diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h b/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h index d7bd9c1f76..6a606e39ac 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h @@ -12,6 +12,7 @@ #include <LibWeb/Bindings/AbortControllerPrototype.h> #include <LibWeb/Bindings/AbortSignalConstructor.h> #include <LibWeb/Bindings/AbortSignalPrototype.h> +#include <LibWeb/Bindings/AudioConstructor.h> #include <LibWeb/Bindings/CSSRuleConstructor.h> #include <LibWeb/Bindings/CSSRuleListConstructor.h> #include <LibWeb/Bindings/CSSRuleListPrototype.h> @@ -321,155 +322,156 @@ #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(AbortController) \ - ADD_WINDOW_OBJECT_INTERFACE(AbortSignal) \ - ADD_WINDOW_OBJECT_INTERFACE(Crypto) \ - ADD_WINDOW_OBJECT_INTERFACE(CSSRule) \ - ADD_WINDOW_OBJECT_INTERFACE(CSSRuleList) \ - ADD_WINDOW_OBJECT_INTERFACE(CSSStyleDeclaration) \ - ADD_WINDOW_OBJECT_INTERFACE(CSSStyleRule) \ - ADD_WINDOW_OBJECT_INTERFACE(CSSStyleSheet) \ - ADD_WINDOW_OBJECT_INTERFACE(CanvasGradient) \ - ADD_WINDOW_OBJECT_INTERFACE(CanvasRenderingContext2D) \ - ADD_WINDOW_OBJECT_INTERFACE(CharacterData) \ - ADD_WINDOW_OBJECT_INTERFACE(CloseEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(Comment) \ - ADD_WINDOW_OBJECT_INTERFACE(CustomEvent) \ - 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(DOMRect) \ - ADD_WINDOW_OBJECT_INTERFACE(DOMRectList) \ - ADD_WINDOW_OBJECT_INTERFACE(DOMRectReadOnly) \ - ADD_WINDOW_OBJECT_INTERFACE(DOMStringMap) \ - ADD_WINDOW_OBJECT_INTERFACE(Element) \ - ADD_WINDOW_OBJECT_INTERFACE(ErrorEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(Event) \ - ADD_WINDOW_OBJECT_INTERFACE(EventTarget) \ - ADD_WINDOW_OBJECT_INTERFACE(History) \ - 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(HTMLCollection) \ - 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(IntersectionObserver) \ - ADD_WINDOW_OBJECT_INTERFACE(KeyboardEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(MediaQueryList) \ - ADD_WINDOW_OBJECT_INTERFACE(MediaQueryListEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(MessageChannel) \ - ADD_WINDOW_OBJECT_INTERFACE(MessageEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(MouseEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(Node) \ - ADD_WINDOW_OBJECT_INTERFACE(NodeList) \ - ADD_WINDOW_OBJECT_INTERFACE(PageTransitionEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(Performance) \ - ADD_WINDOW_OBJECT_INTERFACE(PerformanceTiming) \ - ADD_WINDOW_OBJECT_INTERFACE(ProcessingInstruction) \ - ADD_WINDOW_OBJECT_INTERFACE(ProgressEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(PromiseRejectionEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(Range) \ - ADD_WINDOW_OBJECT_INTERFACE(ResizeObserver) \ - ADD_WINDOW_OBJECT_INTERFACE(Screen) \ - ADD_WINDOW_OBJECT_INTERFACE(Selection) \ - ADD_WINDOW_OBJECT_INTERFACE(ShadowRoot) \ - ADD_WINDOW_OBJECT_INTERFACE(Storage) \ - ADD_WINDOW_OBJECT_INTERFACE(StyleSheet) \ - ADD_WINDOW_OBJECT_INTERFACE(StyleSheetList) \ - ADD_WINDOW_OBJECT_INTERFACE(SubmitEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(SubtleCrypto) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGCircleElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGEllipseElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGGeometryElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGGraphicsElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGLineElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGPathElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGPolygonElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGPolylineElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGRectElement) \ - ADD_WINDOW_OBJECT_INTERFACE(SVGSVGElement) \ - ADD_WINDOW_OBJECT_INTERFACE(Text) \ - ADD_WINDOW_OBJECT_INTERFACE(TextDecoder) \ - ADD_WINDOW_OBJECT_INTERFACE(TextEncoder) \ - ADD_WINDOW_OBJECT_INTERFACE(TextMetrics) \ - ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \ - ADD_WINDOW_OBJECT_INTERFACE(URLSearchParams) \ - ADD_WINDOW_OBJECT_INTERFACE(URL) \ - ADD_WINDOW_OBJECT_INTERFACE(WebSocket) \ - ADD_WINDOW_OBJECT_INTERFACE(Worker) \ - ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequest) \ - ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequestEventTarget) \ +#define ADD_WINDOW_OBJECT_INTERFACES \ + auto& vm = this->vm(); \ + ADD_WINDOW_OBJECT_INTERFACE(AbortController) \ + ADD_WINDOW_OBJECT_INTERFACE(AbortSignal) \ + ADD_WINDOW_OBJECT_INTERFACE(Crypto) \ + ADD_WINDOW_OBJECT_INTERFACE(CSSRule) \ + ADD_WINDOW_OBJECT_INTERFACE(CSSRuleList) \ + ADD_WINDOW_OBJECT_INTERFACE(CSSStyleDeclaration) \ + ADD_WINDOW_OBJECT_INTERFACE(CSSStyleRule) \ + ADD_WINDOW_OBJECT_INTERFACE(CSSStyleSheet) \ + ADD_WINDOW_OBJECT_INTERFACE(CanvasGradient) \ + ADD_WINDOW_OBJECT_INTERFACE(CanvasRenderingContext2D) \ + ADD_WINDOW_OBJECT_INTERFACE(CharacterData) \ + ADD_WINDOW_OBJECT_INTERFACE(CloseEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(Comment) \ + ADD_WINDOW_OBJECT_INTERFACE(CustomEvent) \ + 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(DOMRect) \ + ADD_WINDOW_OBJECT_INTERFACE(DOMRectList) \ + ADD_WINDOW_OBJECT_INTERFACE(DOMRectReadOnly) \ + ADD_WINDOW_OBJECT_INTERFACE(DOMStringMap) \ + ADD_WINDOW_OBJECT_INTERFACE(Element) \ + ADD_WINDOW_OBJECT_INTERFACE(ErrorEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(Event) \ + ADD_WINDOW_OBJECT_INTERFACE(EventTarget) \ + ADD_WINDOW_OBJECT_INTERFACE(History) \ + 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(HTMLCollection) \ + 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(IntersectionObserver) \ + ADD_WINDOW_OBJECT_INTERFACE(KeyboardEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(MediaQueryList) \ + ADD_WINDOW_OBJECT_INTERFACE(MediaQueryListEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(MessageChannel) \ + ADD_WINDOW_OBJECT_INTERFACE(MessageEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(MouseEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(Node) \ + ADD_WINDOW_OBJECT_INTERFACE(NodeList) \ + ADD_WINDOW_OBJECT_INTERFACE(PageTransitionEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(Performance) \ + ADD_WINDOW_OBJECT_INTERFACE(PerformanceTiming) \ + ADD_WINDOW_OBJECT_INTERFACE(ProcessingInstruction) \ + ADD_WINDOW_OBJECT_INTERFACE(ProgressEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(PromiseRejectionEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(Range) \ + ADD_WINDOW_OBJECT_INTERFACE(ResizeObserver) \ + ADD_WINDOW_OBJECT_INTERFACE(Screen) \ + ADD_WINDOW_OBJECT_INTERFACE(Selection) \ + ADD_WINDOW_OBJECT_INTERFACE(ShadowRoot) \ + ADD_WINDOW_OBJECT_INTERFACE(Storage) \ + ADD_WINDOW_OBJECT_INTERFACE(StyleSheet) \ + ADD_WINDOW_OBJECT_INTERFACE(StyleSheetList) \ + ADD_WINDOW_OBJECT_INTERFACE(SubmitEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(SubtleCrypto) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGCircleElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGEllipseElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGGeometryElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGGraphicsElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGLineElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGPathElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGPolygonElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGPolylineElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGRectElement) \ + ADD_WINDOW_OBJECT_INTERFACE(SVGSVGElement) \ + ADD_WINDOW_OBJECT_INTERFACE(Text) \ + ADD_WINDOW_OBJECT_INTERFACE(TextDecoder) \ + ADD_WINDOW_OBJECT_INTERFACE(TextEncoder) \ + ADD_WINDOW_OBJECT_INTERFACE(TextMetrics) \ + ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \ + ADD_WINDOW_OBJECT_INTERFACE(URLSearchParams) \ + ADD_WINDOW_OBJECT_INTERFACE(URL) \ + ADD_WINDOW_OBJECT_INTERFACE(WebSocket) \ + ADD_WINDOW_OBJECT_INTERFACE(Worker) \ + ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequest) \ + ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequestEventTarget) \ + ADD_WINDOW_OBJECT_CONSTRUCTOR_AND_PROTOTYPE(Audio, AudioConstructor, HTMLAudioElementPrototype) \ ADD_WINDOW_OBJECT_CONSTRUCTOR_AND_PROTOTYPE(Image, ImageConstructor, HTMLImageElementPrototype) diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 056bbf3eef..e1317f8f67 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -1,4 +1,5 @@ set(SOURCES + Bindings/AudioConstructor.cpp Bindings/CSSNamespace.cpp Bindings/CSSRuleWrapperFactory.cpp Bindings/CSSStyleDeclarationWrapperCustom.cpp diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.h b/Userland/Libraries/LibWeb/HTML/AttributeNames.h index e966ac89da..f43a144daa 100644 --- a/Userland/Libraries/LibWeb/HTML/AttributeNames.h +++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.h @@ -167,6 +167,7 @@ namespace AttributeNames { __ENUMERATE_HTML_ATTRIBUTE(placeholder) \ __ENUMERATE_HTML_ATTRIBUTE(playsinline) \ __ENUMERATE_HTML_ATTRIBUTE(poster) \ + __ENUMERATE_HTML_ATTRIBUTE(preload) \ __ENUMERATE_HTML_ATTRIBUTE(readonly) \ __ENUMERATE_HTML_ATTRIBUTE(rel) \ __ENUMERATE_HTML_ATTRIBUTE(required) \ |