Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also update tests in size-auto to match spec update: whatwg/html#9493 Spec: https://html.spec.whatwg.org/#parsing-a-sizes-attribute https://whatpr.org/html/9493/images.html#parsing-a-sizes-attribute R=pdr Bug: 1359051 Change-Id: I77ecbfef3a5a63101929f67025699550cc7f6413
- Loading branch information
1 parent
ded643e
commit 404b772
Showing
6 changed files
with
142 additions
and
9 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
.../semantics/embedded-content/the-img-element/sizes/reference/sizes-auto-rendering-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!doctype html> | ||
<title>Auto sizes rendering</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#sizes-attributes"> | ||
<meta name="assert" content="auto sizes rendering"> | ||
<img | ||
src="/images/green.png" | ||
width="33" | ||
height="13" | ||
> |
26 changes: 26 additions & 0 deletions
26
html/semantics/embedded-content/the-img-element/sizes/sizes-auto-rendering-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!doctype html> | ||
<html class="reftest-wait"> | ||
<title>Auto sizes rendering</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#sizes-attributes"> | ||
<link rel="match" href="reference/sizes-auto-rendering-ref.html"> | ||
<script src="/common/rendering-utils.js"></script> | ||
<script src="/common/reftest-wait.js"></script> | ||
<meta name="assert" content="auto sizes rendering"> | ||
<img | ||
id="testImg" | ||
loading="lazy" | ||
sizes="auto" | ||
width="33" | ||
height="13" | ||
> | ||
<script> | ||
function imageLoaded() { | ||
waitForAtLeastOneFrame().then(takeScreenshot); | ||
} | ||
|
||
testImg.addEventListener('load', imageLoaded); | ||
testImg.setAttribute('srcset', ` | ||
/images/red.png 10w, | ||
/images/green.png 100w | ||
`); | ||
</script> |
26 changes: 26 additions & 0 deletions
26
html/semantics/embedded-content/the-img-element/sizes/sizes-auto-rendering-3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!doctype html> | ||
<html class="reftest-wait"> | ||
<title>Auto sizes rendering</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#sizes-attributes"> | ||
<link rel="match" href="reference/sizes-auto-rendering-ref.html"> | ||
<script src="/common/rendering-utils.js"></script> | ||
<script src="/common/reftest-wait.js"></script> | ||
<meta name="assert" content="auto sizes rendering"> | ||
<img | ||
id="testImg" | ||
loading="lazy" | ||
sizes="auto" | ||
width="33" | ||
height="13" | ||
> | ||
<script> | ||
function imageLoaded() { | ||
waitForAtLeastOneFrame().then(takeScreenshot); | ||
} | ||
|
||
testImg.addEventListener('load', imageLoaded); | ||
testImg.setAttribute('srcset', ` | ||
/images/green.png 100w, | ||
/images/red.png 1000w | ||
`); | ||
</script> |
39 changes: 39 additions & 0 deletions
39
html/semantics/embedded-content/the-img-element/sizes/sizes-auto-rendering-dynamic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!doctype html> | ||
<html class="reftest-wait"> | ||
<title>Auto sizes dynamic rendering</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#sizes-attributes"> | ||
<link rel="match" href="reference/sizes-auto-rendering-ref.html"> | ||
<script src="/common/rendering-utils.js"></script> | ||
<script src="/common/reftest-wait.js"></script> | ||
<meta name="assert" content="auto sizes dynamic rendering"> | ||
<img | ||
id="testImg" | ||
loading="lazy" | ||
sizes="auto" | ||
width="1" | ||
height="13" | ||
> | ||
<script> | ||
function secondImageLoaded() { | ||
waitForAtLeastOneFrame().then(takeScreenshot); | ||
} | ||
|
||
function firstImageLoaded() { | ||
const expected = 'red.png'; | ||
if (!testImg.currentSrc.endsWith('red.png')) { | ||
const fail_msg = `FAIL: currentSrc is ${testImg.currentSrc}, expected ${expected}.`; | ||
(document.body || document.documentElement).textContent = fail_msg; | ||
takeScreenshot(); | ||
} | ||
|
||
testImg.addEventListener('load', secondImageLoaded); | ||
testImg.style.width = '33px'; | ||
} | ||
|
||
testImg.addEventListener('load', firstImageLoaded, {once: true}); | ||
testImg.setAttribute('srcset', ` | ||
/images/fail.gif 1000w, | ||
/images/green.png 100w, | ||
/images/red.png 10w | ||
`); | ||
</script> |
27 changes: 27 additions & 0 deletions
27
html/semantics/embedded-content/the-img-element/sizes/sizes-auto-rendering.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!doctype html> | ||
<html class="reftest-wait"> | ||
<title>Auto sizes rendering</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#sizes-attributes"> | ||
<link rel="match" href="reference/sizes-auto-rendering-ref.html"> | ||
<script src="/common/rendering-utils.js"></script> | ||
<script src="/common/reftest-wait.js"></script> | ||
<meta name="assert" content="auto sizes rendering"> | ||
<img | ||
id="testImg" | ||
loading="lazy" | ||
sizes="auto" | ||
width="33" | ||
height="13" | ||
> | ||
<script> | ||
function imageLoaded() { | ||
waitForAtLeastOneFrame().then(takeScreenshot); | ||
} | ||
|
||
testImg.addEventListener('load', imageLoaded); | ||
testImg.setAttribute('srcset', ` | ||
/images/fail.gif 10w, | ||
/images/green.png 100w, | ||
/images/red.png 1000w | ||
`); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters