Bug 1420526 part 1: Change svg-as-image :visited reftests to be more robust (and to run as part of test_visited_reftests.html). r=emilio

MozReview-Commit-ID: 46DGG1LBEFy

--HG--
rename : layout/reftests/svg/as-image/svg-image-visited-1-helper.svg => layout/reftests/svg/as-image/svg-image-visited-1a-helper.svg
rename : layout/reftests/svg/as-image/svg-image-visited-1.html => layout/reftests/svg/as-image/svg-image-visited-1a.html
rename : layout/reftests/svg/as-image/svg-image-visited-2-helper.svg => layout/reftests/svg/as-image/svg-image-visited-1b-helper.svg
rename : layout/reftests/svg/as-image/svg-image-visited-2.html => layout/reftests/svg/as-image/svg-image-visited-1b.html
This commit is contained in:
Daniel Holbert 2017-12-08 18:11:10 -08:00
Родитель 046a447d04
Коммит f69fd6f959
10 изменённых файлов: 101 добавлений и 64 удалений

Просмотреть файл

@ -189,17 +189,6 @@ HTTP == svg-stylesheet-datauri-1.html lime100x100.svg
== svg-stylesheet-external-1.html blue100x100.svg
HTTP == svg-stylesheet-external-1.html blue100x100.svg
# test that :visited status is ignored in image documents
# We load the images directly first, to be sure history is populated.
# It's also good to verify that the helper images don't match lime100x100.svg
# in non-image contexts, but for that to work, we have to reliably count on
# :visited styles loading (asynchronously), so we test that in
# layout/style/test/test_visited_reftests.html instead of the reftest harness.
!= svg-image-visited-1-helper.svg about:blank
== svg-image-visited-1.html lime100x100.svg
!= svg-image-visited-2-helper.svg about:blank
== svg-image-visited-2.html lime100x100.svg
# tests for SVG <image> that should have a synthetic viewBox
== svg-image-synthetic-viewBox-01.svg svg-image-synthetic-viewBox-01-ref.svg

Просмотреть файл

@ -0,0 +1,24 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Reference for bug 641731</title>
<style>
.imgRef, .embedRef {
height: 100px;
width: 100px;
border: 1px solid black;
display: inline-block;
}
.imgRef { background: lime }
.embedRef { background: purple }
</style>
</head>
<body>
<div class="imgRef"></div>
<div class="embedRef"></div>
</body>
</html>

Просмотреть файл

@ -1,23 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html class="reftest-wait">
<head>
<title>Test for bug 641731</title>
<script>
function snapshot() {
document.documentElement.removeAttribute("class");
}
function delay_snapshot() {
setTimeout(snapshot, 100); // delay snapshot to allow time for
// :visited style inside the image to
// resolve (which it hopefully won't)
}
document.addEventListener("MozReftestInvalidate", delay_snapshot);
</script>
</head>
<body style="margin: 0">
<img src="svg-image-visited-1-helper.svg">
</body>
</html>

Просмотреть файл

@ -10,7 +10,7 @@
<![CDATA[
a:link {/* Note: an a:link block was needed to trigger bug 641731. */ }
a:link > rect { fill: lime; }
a:visited > rect { fill: red; }
a:visited > rect { fill: purple; }
]]>
</style>
@ -20,4 +20,15 @@
<a xlink:href="" id="foo">
<rect x="0" y="0" width="100" height="100" fill="orange"/>
</a>
<!-- This trivial SMIL animation ensures that we *won't* get repainted via
imagelib's SurfaceCache optimization. Specifically, we want to bypass
the SurfaceCache so that we can ensure that repaints of this file (as an
image) will *actually repaint the SVG content*, rather than painting a
previously-rasterized snapshot (which may've been rasterized before we
had any chance to consider :visited styles). -->
<rect x="0" y="0" width="100" height="100" fill="teal">
<set attributeName="fill" to="transparent"
begin="0s" duration="indefinite"/>
</rect>
</svg>

До

Ширина:  |  Высота:  |  Размер: 778 B

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Test for bug 641731</title>
<style>
img, embed {
height: 100px;
width: 100px;
border: 1px solid black;
}
</style>
</head>
<body>
<!-- This shouldn't show visited link coloring: -->
<img src="svg-image-visited-1a-helper.svg">
<!-- This should show visited link coloring: -->
<embed src="svg-image-visited-1a-helper.svg">
</body>
</html>

Просмотреть файл

@ -9,7 +9,7 @@
<style>
<![CDATA[
a:link > rect { fill: lime; }
a:visited > rect { fill: red; }
a:visited > rect { fill: purple; }
]]>
</style>
@ -19,4 +19,15 @@
<a xlink:href="" id="foo">
<rect x="0" y="0" width="100" height="100" fill="orange"/>
</a>
<!-- This trivial SMIL animation ensures that we *won't* get repainted via
imagelib's SurfaceCache optimization. Specifically, we want to bypass
the SurfaceCache so that we can ensure that repaints of this file (as an
image) will *actually repaint the SVG content*, rather than painting a
previously-rasterized snapshot (which may've been rasterized before we
had any chance to consider :visited styles). -->
<rect x="0" y="0" width="100" height="100" fill="teal">
<set attributeName="fill" to="transparent"
begin="0s" duration="indefinite"/>
</rect>
</svg>

До

Ширина:  |  Высота:  |  Размер: 700 B

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Test for bug 641731</title>
<style>
img, embed {
height: 100px;
width: 100px;
border: 1px solid black;
}
</style>
</head>
<body>
<!-- This shouldn't show visited link coloring: -->
<img src="svg-image-visited-1b-helper.svg">
<!-- This should show visited link coloring: -->
<embed src="svg-image-visited-1b-helper.svg">
</body>
</html>

Просмотреть файл

@ -1,23 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html class="reftest-wait">
<head>
<title>Test for bug 641731</title>
<script>
function snapshot() {
document.documentElement.removeAttribute("class");
}
function delay_snapshot() {
setTimeout(snapshot, 100); // delay snapshot to allow time for
// :visited style inside the image to
// resolve (which it hopefully won't)
}
document.addEventListener("MozReftestInvalidate", delay_snapshot);
</script>
</head>
<body style="margin: 0">
<img src="svg-image-visited-2-helper.svg">
</body>
</html>

Просмотреть файл

@ -118,9 +118,11 @@ TEST_HARNESS_FILES.testing.mochitest.tests.layout.style.test['css-visited'] += [
'/layout/reftests/css-visited/width-on-link-1.html',
'/layout/reftests/css-visited/width-on-visited-1.html',
'/layout/reftests/fonts/Ahem.ttf',
'/layout/reftests/svg/as-image/lime100x100.svg',
'/layout/reftests/svg/as-image/svg-image-visited-1-helper.svg',
'/layout/reftests/svg/as-image/svg-image-visited-2-helper.svg',
'/layout/reftests/svg/as-image/svg-image-visited-1-ref.html',
'/layout/reftests/svg/as-image/svg-image-visited-1a-helper.svg',
'/layout/reftests/svg/as-image/svg-image-visited-1a.html',
'/layout/reftests/svg/as-image/svg-image-visited-1b-helper.svg',
'/layout/reftests/svg/as-image/svg-image-visited-1b.html',
'/layout/reftests/svg/pseudo-classes-02-ref.svg',
'/layout/reftests/svg/pseudo-classes-02.svg',
]

Просмотреть файл

@ -77,8 +77,8 @@ var gTests = [
"== subject-of-selector-adj-sibling-1.html subject-of-selector-1-ref.html",
"== subject-of-selector-any-sibling-1.html subject-of-selector-1-ref.html",
"== inherit-keyword-1.xhtml inherit-keyword-1-ref.html",
"!= svg-image-visited-1-helper.svg lime100x100.svg",
"!= svg-image-visited-2-helper.svg lime100x100.svg",
"== svg-image-visited-1a.html svg-image-visited-1-ref.html",
"== svg-image-visited-1b.html svg-image-visited-1-ref.html",
// FIXME: commented out because dynamic changes on the non-first-line
// part of the test don't work right when the link becomes visited.
//"== first-line-1.html first-line-1-ref.html",