зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1738586 - Fix a11y test_general on dark mode. r=Jamie
Since this is a chrome page we start honoring dark mode colors by default, and after bug 1525107 that affects default background and text colors, which these tests were hardcoding to black/white. Differential Revision: https://phabricator.services.mozilla.com/D129983
This commit is contained in:
Родитель
14b0e9f677
Коммит
f3f1e06187
|
@ -342,6 +342,14 @@ function fontFamily(aComputedStyle) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a computed system color for this document.
|
||||
*/
|
||||
function getSystemColor(aColor) {
|
||||
let { r, g, b, a } = InspectorUtils.colorToRGBA(aColor, document);
|
||||
return a == 1 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${a})`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an object of default text attributes expected for the given accessible.
|
||||
*
|
||||
|
@ -355,7 +363,7 @@ function buildDefaultTextAttrs(aID, aFontSize, aFontWeight, aFontFamily) {
|
|||
var computedStyle = document.defaultView.getComputedStyle(elm);
|
||||
var bgColor =
|
||||
computedStyle.backgroundColor == "rgba(0, 0, 0, 0)"
|
||||
? "rgb(255, 255, 255)"
|
||||
? getSystemColor("Canvas")
|
||||
: computedStyle.backgroundColor;
|
||||
|
||||
var defAttrs = {
|
||||
|
|
|
@ -2,24 +2,21 @@
|
|||
|
||||
<head>
|
||||
<title>Text attributes tests</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<style type="text/css">
|
||||
<style>
|
||||
.gencontent:before { content: "*"; }
|
||||
.gencontent:after { content: "*"; }
|
||||
</style>
|
||||
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../attributes.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
<script src="../common.js"></script>
|
||||
<script src="../attributes.js"></script>
|
||||
<script src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
<script>
|
||||
var gComputedStyle = null;
|
||||
|
||||
function doTest() {
|
||||
|
@ -496,7 +493,7 @@
|
|||
|
||||
attrs = {
|
||||
"text-underline-style": "solid",
|
||||
"text-underline-color": "rgb(0, 0, 0)",
|
||||
"text-underline-color": getSystemColor("CanvasText"),
|
||||
};
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 10);
|
||||
|
||||
|
@ -508,13 +505,13 @@
|
|||
|
||||
attrs = {
|
||||
"text-underline-style": "dotted",
|
||||
"text-underline-color": "rgb(0, 0, 0)",
|
||||
"text-underline-color": getSystemColor("CanvasText"),
|
||||
};
|
||||
testTextAttrs(ID, 15, attrs, defAttrs, 15, 22);
|
||||
|
||||
attrs = {
|
||||
"text-line-through-style": "solid",
|
||||
"text-line-through-color": "rgb(0, 0, 0)",
|
||||
"text-line-through-color": getSystemColor("CanvasText"),
|
||||
};
|
||||
testTextAttrs(ID, 22, attrs, defAttrs, 22, 34);
|
||||
|
||||
|
@ -526,7 +523,7 @@
|
|||
|
||||
attrs = {
|
||||
"text-line-through-style": "wavy",
|
||||
"text-line-through-color": "rgb(0, 0, 0)",
|
||||
"text-line-through-color": getSystemColor("CanvasText"),
|
||||
};
|
||||
testTextAttrs(ID, 39, attrs, defAttrs, 39, 44);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче