diff --git a/dom/html/HTMLSourceElement.h b/dom/html/HTMLSourceElement.h
index 5d7a6c0fb002..4572b862cdac 100644
--- a/dom/html/HTMLSourceElement.h
+++ b/dom/html/HTMLSourceElement.h
@@ -89,12 +89,16 @@ class HTMLSourceElement final : public nsGenericHTMLElement {
SetHTMLAttr(nsGkAtoms::media, aMedia, rv);
}
- uint32_t Width() const { return GetUnsignedIntAttr(nsGkAtoms::width, 0); }
+ uint32_t Width() const {
+ return GetDimensionAttrAsUnsignedInt(nsGkAtoms::width, 0);
+ }
void SetWidth(uint32_t aWidth, ErrorResult& aRv) {
SetUnsignedIntAttr(nsGkAtoms::width, aWidth, 0, aRv);
}
- uint32_t Height() const { return GetUnsignedIntAttr(nsGkAtoms::height, 0); }
+ uint32_t Height() const {
+ return GetDimensionAttrAsUnsignedInt(nsGkAtoms::height, 0);
+ }
void SetHeight(uint32_t aHeight, ErrorResult& aRv) {
SetUnsignedIntAttr(nsGkAtoms::height, aHeight, 0, aRv);
}
diff --git a/testing/web-platform/meta/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html.ini b/testing/web-platform/meta/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html.ini
index 5eb5cdce31ed..83a7fd89b364 100644
--- a/testing/web-platform/meta/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html.ini
+++ b/testing/web-platform/meta/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/picture-aspect-ratio.html.ini
@@ -1,4 +1,2 @@
[picture-aspect-ratio.html]
prefs: [dom.picture_source_dimension_attributes.enabled:true]
- [Percentages on source should be ignored for aspect-ratio but used for width/height.]
- expected: FAIL