-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
0caf8c7
commit ee6bcea
Showing
6 changed files
with
137 additions
and
9 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
.../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,8 @@ | ||
<!doctype html> | ||
<title>Auto sizes rendering</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/images.html#sizes-attributes"> | ||
<img | ||
src="/images/green.png" | ||
width="33" | ||
height="13" | ||
> |
25 changes: 25 additions & 0 deletions
25
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,25 @@ | ||
<!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> | ||
<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> |
25 changes: 25 additions & 0 deletions
25
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,25 @@ | ||
<!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> | ||
<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> |
38 changes: 38 additions & 0 deletions
38
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,38 @@ | ||
<!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> | ||
<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.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> |
26 changes: 26 additions & 0 deletions
26
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,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> | ||
<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