diff --git a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html.ini b/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html.ini
index fd9bb4e6885b..0d8d3e2f2026 100644
--- a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html.ini
+++ b/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html.ini
@@ -2,3 +2,211 @@
# TODO(dholbert): Look into this crash in bug 1969597
expected:
if (processor == "x86") and (os == "linux"): CRASH
+
+ # These "when not rendered" expected-failures are all bug 1965560:
+ [SVG image, no natural dimensions (when not rendered)]
+ expected: FAIL
+
+ [SVG image with width attr, no natural dimensions (when not rendered)]
+ expected: FAIL
+
+ [SVG image with height attr, no natural dimensions (when not rendered)]
+ expected: FAIL
+
+ [SVG image, percengage natural dimensions (when not rendered)]
+ expected: FAIL
+
+ [SVG image, negative percengage natural dimensions (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width of 0 (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height of 0 (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width being negative (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height being negative (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, and aspect ratio from viewBox (when not rendered)]
+ expected: FAIL
+
+ [SVG image, percengage natural dimensions, and aspect ratio from viewBox (when not rendered)]
+ expected: FAIL
+
+ [SVG image, negative percengage natural dimensions, and aspect ratio from viewBox (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 width/height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 width (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 width/height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 width (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 width/height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 width (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 height (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image with width attr, no natural dimensions (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image with height attr, no natural dimensions (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, percengage natural dimensions (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, negative percengage natural dimensions (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width of 0 (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height of 0 (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width being negative (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height being negative (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, and aspect ratio from viewBox (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, percengage natural dimensions, and aspect ratio from viewBox (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, negative percengage natural dimensions, and aspect ratio from viewBox (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 width/height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 width (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 width/height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 width (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 width/height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 width (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 height (with srcset/1x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image with width attr, no natural dimensions (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image with height attr, no natural dimensions (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, percengage natural dimensions (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, negative percengage natural dimensions (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width of 0 (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height of 0 (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width being negative (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height being negative (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, and aspect ratio from viewBox (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, percengage natural dimensions, and aspect ratio from viewBox (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, negative percengage natural dimensions, and aspect ratio from viewBox (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 width/height (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 width (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, no natural dimensions, viewBox with 0 height (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 width/height (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 width (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural width, viewBox with 0 height (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 width/height (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 width (with srcset/2x) (when not rendered)]
+ expected: FAIL
+
+ [SVG image, with natural height, viewBox with 0 height (with srcset/2x) (when not rendered)]
+ expected: FAIL
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html
index 8a8fad13965d..c10a942069c7 100644
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/naturalWidth-naturalHeight-width-height.tentative.html
@@ -65,7 +65,8 @@ img {
+ data-width="10" data-height="10"
+ data-not-rendered-width="10" data-not-rendered-height="10">
@@ -76,7 +77,8 @@ img {
+ data-width="10" data-height="10"
+ data-not-rendered-width="10" data-not-rendered-height="10">
{
+ const expectedNaturalWidth = parseFloat(img.dataset.naturalWidth);
+ const expectedNaturalHeight = parseFloat(img.dataset.naturalHeight);
+
test(function() {
// We expect naturalWidth to match the provided data-natural-width
// (and similar for 'height').
- const expectedNaturalWidth = parseFloat(img.dataset.naturalWidth);
- const expectedNaturalHeight = parseFloat(img.dataset.naturalHeight);
assert_equals(img.naturalWidth, expectedNaturalWidth, 'naturalWidth');
assert_equals(img.naturalHeight, expectedNaturalHeight, 'naturalHeight');
@@ -303,6 +341,35 @@ onload = function() {
assert_equals(img.height, expectedHeight, 'height');
}
}, `${img.title}`);
+
+ test(function() {
+ // Now test what we get when the img is not rendered.
+ // * naturalWidth and naturalHeight shouldn't change.
+ // * width and height should generally match naturalWidth and
+ // naturalHeight. (Exceptions are indicated via the
+ // 'data-not-rendered-{width/height} attributes).
+ this.add_cleanup(function() {
+ img.style.display = "";
+ });
+
+ img.style.display = "none";
+ img.getBoundingClientRect(); // Flush layout.
+
+ assert_equals(img.naturalWidth, expectedNaturalWidth,
+ 'naturalWidth when not rendered');
+ assert_equals(img.naturalHeight, expectedNaturalHeight,
+ 'naturalHeight when not rendered');
+
+ const expectedNotRenderedWidth = 'notRenderedWidth' in img.dataset ?
+ parseFloat(img.dataset.notRenderedWidth) : expectedNaturalWidth;
+ const expectedNotRenderedHeight = 'notRenderedHeight' in img.dataset ?
+ parseFloat(img.dataset.notRenderedHeight) : expectedNaturalHeight;
+
+ assert_equals(img.width, expectedNotRenderedWidth,
+ 'width when not rendered');
+ assert_equals(img.height, expectedNotRenderedHeight,
+ 'height when not rendered');
+ }, `${img.title} (when not rendered)`);
});
done();
};