Bug 1512597 - Resolve currentcolor in fill and stroke against visited-dependent color r=xidorn

Differential Revision: https://phabricator.services.mozilla.com/D14706

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Cameron McCormack 2018-12-18 09:39:07 +00:00
Родитель 7e1563241b
Коммит 59475d7fc5
5 изменённых файлов: 26 добавлений и 1 удалений

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

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg">
<style>
rect { fill: green; stroke: green; stroke-width: 20px; }
</style>
<rect x="10" y="10" width="80" height="80"/>
</svg>

После

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

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

@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
<link xmlns="http://www.w3.org/1999/xhtml" rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au"/>
<link xmlns="http://www.w3.org/1999/xhtml" rel="help" href="https://www.w3.org/TR/SVG2/pservers.html"/>
<link xmlns="http://www.w3.org/1999/xhtml" rel="match" href="currentcolor-visited-ref.svg"/>
<meta xmlns="http://www.w3.org/1999/xhtml" name="assert" content="currentcolor should resolve against the visited-dependent value of the color property."/>
</metadata>
<style>
a:link { color: red; }
a:visited { color: green; }
rect { fill: currentcolor; stroke: currentcolor; stroke-width: 20px; }
</style>
<a href=""><rect x="10" y="10" width="80" height="80"/></a>
</svg>

После

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

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

@ -114,6 +114,8 @@ TEST_HARNESS_FILES.testing.mochitest.tests.layout.style.test['css-visited'] += [
'/layout/reftests/css-visited/subject-of-selector-descendant-1.html',
'/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml',
'/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml',
'/layout/reftests/css-visited/svg-paint-currentcolor-visited-ref.svg',
'/layout/reftests/css-visited/svg-paint-currentcolor-visited.svg',
'/layout/reftests/css-visited/transition-on-visited-ref.html',
'/layout/reftests/css-visited/transition-on-visited.html',
'/layout/reftests/css-visited/visited-inherit-1-ref.html',

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

@ -95,6 +95,7 @@ var gTests = [
// TODO: test should equal the reference after implementing logical border shorthands.
"!= logical-box-border-color-visited-link-002.html logical-box-border-color-visited-link-ref.html",
"== logical-box-border-color-visited-link-003.html logical-box-border-color-visited-link-ref.html",
"== svg-paint-currentcolor-visited.svg svg-paint-currentcolor-visited-ref.svg",
];
// We record the maximum number of times we had to look at a test before

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

@ -1342,7 +1342,7 @@ static gfxRect PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
// another simple color.
if (paintIfVisited.Type() == eStyleSVGPaintType_Color &&
paint.Type() == eStyleSVGPaintType_Color) {
nscolor colors[2] = {color, paintIfVisited.GetColor(aComputedStyle)};
nscolor colors[2] = {color, paintIfVisited.GetColor(styleIfVisited)};
return ComputedStyle::CombineVisitedColors(
colors, aComputedStyle->RelevantLinkVisited());
}