From 55920614747021f79e61e69f2ac155a9aa63a554 Mon Sep 17 00:00:00 2001
From: leo030303 <59373587+leo030303@users.noreply.github.com>
Date: Thu, 24 Jul 2025 14:40:44 +0100
Subject: [PATCH] Add dimension source attribute to HTMLImageElement (#38152)
HTMLImageElement was missing the dimension source attribute, as step 9
from
[here](https://html.spec.whatwg.org/multipage/images.html#updating-the-source-set)
wasn't implemented. This meant that for an element like this:
```html
```
The `width` and `height` attributes of the source tag were being
ignored. This broke stuff like these icons on the main page of
Wikipedia.
**Original:**
**Fixed:**
Testing: If there isn't an existing test that covers this I'll make one,
waiting for the github runner to tell me whether this is covered and
then I'll amend the PR
---------
Signed-off-by: Leo Ring
Signed-off-by: Xiaocheng Hu
Signed-off-by: Xiaocheng Hu
Co-authored-by: Xiaocheng Hu
Co-authored-by: Xiaocheng Hu
---
components/script/dom/htmlimageelement.rs | 45 +++++++++++++++----
.../picture-aspect-ratio.html.ini | 6 ---
2 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 427c9ed9401..3a38c851bcf 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -162,6 +162,9 @@ pub(crate) struct HTMLImageElement {
form_owner: MutNullableDom,
generation: Cell,
source_set: DomRefCell,
+ ///
+ /// Always non-null after construction.
+ dimension_attribute_source: MutNullableDom,
last_selected_source: DomRefCell