From 2a7cf1c588149fbd11ae4f4f77113130b7254347 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Tue, 21 May 2024 12:22:45 +0100 Subject: [PATCH] LibWeb: Implement the `width` and `height` attributes where missing This change adds the `width` and `height` properties to `HTMLVideoElement` and `HTMLSourceElement`. These properties reflect their respective content attribute values. --- .../expected/HTML/reflected-integer-attributes.txt | 12 ++++++++++++ .../input/HTML/reflected-integer-attributes.html | 6 ++++++ Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl | 4 ++-- Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl | 4 ++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Tests/LibWeb/Text/expected/HTML/reflected-integer-attributes.txt b/Tests/LibWeb/Text/expected/HTML/reflected-integer-attributes.txt index b51ac609989..a3364920ad9 100644 --- a/Tests/LibWeb/Text/expected/HTML/reflected-integer-attributes.txt +++ b/Tests/LibWeb/Text/expected/HTML/reflected-integer-attributes.txt @@ -16,3 +16,15 @@ object.hspace after setting to 2147483648: 0 object.vspace after setting to -1: 0 object.vspace after setting to 20: 20 object.vspace after setting to 2147483648: 0 +source.width after setting to -1: 0 +source.width after setting to 20: 20 +source.width after setting to 2147483648: 0 +source.height after setting to -1: 0 +source.height after setting to 20: 20 +source.height after setting to 2147483648: 0 +video.width after setting to -1: 0 +video.width after setting to 20: 20 +video.width after setting to 2147483648: 0 +video.height after setting to -1: 0 +video.height after setting to 20: 20 +video.height after setting to 2147483648: 0 diff --git a/Tests/LibWeb/Text/input/HTML/reflected-integer-attributes.html b/Tests/LibWeb/Text/input/HTML/reflected-integer-attributes.html index e894b0bebc2..c58b3cac9eb 100644 --- a/Tests/LibWeb/Text/input/HTML/reflected-integer-attributes.html +++ b/Tests/LibWeb/Text/input/HTML/reflected-integer-attributes.html @@ -19,5 +19,11 @@ testIntegerReflectedProperty(tagName, property); } } + + for (const tagName of ["source", "video"]) { + for (const property of ["width", "height"]) { + testIntegerReflectedProperty(tagName, property); + } + } }); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl index 19116eab585..4379af016cc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl @@ -11,7 +11,7 @@ interface HTMLSourceElement : HTMLElement { [CEReactions, Reflect] attribute DOMString srcset; [CEReactions, Reflect] attribute DOMString sizes; [CEReactions, Reflect] attribute DOMString media; - [FIXME, CEReactions, Reflect] attribute unsigned long width; - [FIXME, CEReactions, Reflect] attribute unsigned long height; + [CEReactions, Reflect] attribute unsigned long width; + [CEReactions, Reflect] attribute unsigned long height; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl index 3c8c99659dc..f19d18eb10b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl @@ -6,8 +6,8 @@ interface HTMLVideoElement : HTMLMediaElement { [HTMLConstructor] constructor(); - [FIXME, CEReactions] attribute unsigned long width; - [FIXME, CEReactions] attribute unsigned long height; + [CEReactions, Reflect] attribute unsigned long width; + [CEReactions, Reflect] attribute unsigned long height; readonly attribute unsigned long videoWidth; readonly attribute unsigned long videoHeight; [CEReactions, Reflect] attribute USVString poster;